本文整理汇总了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();
}