本文整理匯總了Java中org.springframework.test.util.ReflectionTestUtils.invokeMethod方法的典型用法代碼示例。如果您正苦於以下問題:Java ReflectionTestUtils.invokeMethod方法的具體用法?Java ReflectionTestUtils.invokeMethod怎麽用?Java ReflectionTestUtils.invokeMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.test.util.ReflectionTestUtils
的用法示例。
在下文中一共展示了ReflectionTestUtils.invokeMethod方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: optimizedDbReset
import org.springframework.test.util.ReflectionTestUtils; //導入方法依賴的package包/類
private void optimizedDbReset(TestContext testContext, FlywayTest annotation) throws Exception {
if (annotation != null && annotation.invokeCleanDB() && annotation.invokeMigrateDB() && !annotation.invokeBaselineDB()) {
ApplicationContext applicationContext = testContext.getApplicationContext();
FlywayDataSourceContext dataSourceContext = getDataSourceContext(applicationContext, annotation.flywayName());
Flyway flywayBean = ReflectionTestUtils.invokeMethod(this, "getBean", applicationContext, Flyway.class, annotation.flywayName());
if (dataSourceContext != null && flywayBean != null) {
prepareDataSourceContext(dataSourceContext, flywayBean, annotation);
FlywayTest adjustedAnnotation = copyAnnotation(annotation, false, false, true);
ReflectionTestUtils.invokeMethod(this, "dbResetWithAnnotation", testContext, adjustedAnnotation);
return;
}
}
ReflectionTestUtils.invokeMethod(this, "dbResetWithAnnotation", testContext, annotation);
}
開發者ID:zonkyio,項目名稱:embedded-database-spring-test,代碼行數:21,代碼來源:OptimizedFlywayTestExecutionListener.java
示例2: setUp
import org.springframework.test.util.ReflectionTestUtils; //導入方法依賴的package包/類
@BeforeClass
public static void setUp() throws Exception {
layoutMapper = new LayoutMapper();
YamlMapFactoryBean yamlMapFactoryBean = new YamlMapFactoryBean();
yamlMapFactoryBean.setResources(new FileSystemResource(LayoutMapperTest.class.getResource("layout.yml").getPath()));
// String layout = "" +
// "category:\n" +
// " _default_: \"category/_layout\"\n" +
// "food:\n" +
// " detail: \"food/_layout\"\n" +
// "boo:\n" +
// " _default_: \"boo/_layout\"\n" +
// " index: \"_boo\"\n" +
// " foo:\n" +
// " detail: \"boo/_detail\"" +
// "";
// yamlMapFactoryBean.setResources(new ByteArrayResource(layout.getBytes("UTF-8")));
yamlMapFactoryBean.afterPropertiesSet();
ReflectionTestUtils.setField(layoutMapper, "layout", yamlMapFactoryBean.getObject());
ReflectionTestUtils.invokeMethod(layoutMapper, "init");
}
示例3: setUp
import org.springframework.test.util.ReflectionTestUtils; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
modelMetadataHolder = (ICachedModelHolder<ModelMetadata>)mock(ICachedModelHolder.class);
initModelChain = mock(TaskChain.class);
refreshModelChain = mock(TaskChain.class);
syncModelChain = mock(TaskChain.class);
testee = new RedirectorEngineProvider();
ReflectionTestUtils.setField(testee, "appName", APP_NAME);
ReflectionTestUtils.setField(testee, "modelFacade", mock(IAppModelFacade.class));
ReflectionTestUtils.setField(testee, "xmlSerializer", mock(Serializer.class));
ReflectionTestUtils.setField(testee, "backupManagerFactory", mock(IBackupManagerFactory.class));
ReflectionTestUtils.setField(testee, "globalBackupManagerFactory", mock(IBackupManagerFactory.class));
ReflectionTestUtils.setField(testee, "isStaticDiscoveryNeededForApp", mock(Predicate.class));
ReflectionTestUtils.invokeMethod(testee, "init");
ReflectionTestUtils.setField(testee, "modelMetadataHolder", modelMetadataHolder);
ReflectionTestUtils.setField(testee, "initModelChain", initModelChain);
ReflectionTestUtils.setField(testee, "refreshModelChain", refreshModelChain);
ReflectionTestUtils.setField(testee, "syncModelChain", syncModelChain);
}
示例4: tearDown
import org.springframework.test.util.ReflectionTestUtils; //導入方法依賴的package包/類
@Override
@After
public void tearDown() throws Exception {
ReflectionTestUtils.invokeMethod(remoteConfigLongPollService, "stopLongPollingRefresh");
recursiveDelete(configDir);
super.tearDown();
}
示例5: setUp
import org.springframework.test.util.ReflectionTestUtils; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
ReflectionTestUtils.invokeMethod(appNamespaceServiceWithCache, "reset");
someAppId = "someAppId";
someCluster = "someCluster";
someNamespace = "someNamespace";
somePublicAppId = "somePublicAppId";
somePublicNamespace = "somePublicNamespace";
someDC = "someDC";
someDefaultCluster = ConfigConsts.CLUSTER_NAME_DEFAULT;
someClientIp = "1.1.1.1";
executorService = Executors.newSingleThreadExecutor();
}
示例6: setUp
import org.springframework.test.util.ReflectionTestUtils; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
ReflectionTestUtils.invokeMethod(releaseMessageServiceWithCache, "reset");
ReflectionTestUtils.invokeMethod(appNamespaceServiceWithCache, "reset");
someAppId = "someAppId";
someCluster = ConfigConsts.CLUSTER_NAME_DEFAULT;
defaultNamespace = ConfigConsts.NAMESPACE_APPLICATION;
somePublicNamespace = "somePublicNamespace";
executorService = Executors.newSingleThreadExecutor();
}
示例7: setUp
import org.springframework.test.util.ReflectionTestUtils; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
ReflectionTestUtils.invokeMethod(releaseMessageServiceWithCache, "reset");
someAppId = "someAppId";
someCluster = ConfigConsts.CLUSTER_NAME_DEFAULT;
defaultNamespace = ConfigConsts.NAMESPACE_APPLICATION;
somePublicNamespace = "somePublicNamespace";
executorService = Executors.newSingleThreadExecutor();
typeReference = new ParameterizedTypeReference<List<ApolloConfigNotification>>() {
};
}
示例8: setUp
import org.springframework.test.util.ReflectionTestUtils; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
ReflectionTestUtils.invokeMethod(appNamespaceServiceWithCache, "reset");
someDefaultCluster = ConfigConsts.CLUSTER_NAME_DEFAULT;
someAppId = "someAppId";
somePublicAppId = "somePublicAppId";
someCluster = "someCluster";
someNamespace = "someNamespace";
somePublicNamespace = "somePublicNamespace";
someDC = "someDC";
grayClientIp = "1.1.1.1";
nonGrayClientIp = "2.2.2.2";
executorService = Executors.newSingleThreadExecutor();
}