当前位置: 首页>>代码示例>>Java>>正文


Java ReflectionTestUtils.invokeMethod方法代码示例

本文整理汇总了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");
    }
 
开发者ID:adaikiss,项目名称:mustache-showcase,代码行数:22,代码来源:LayoutMapperTest.java

示例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);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:23,代码来源:ModelProviderTest.java

示例4: tearDown

import org.springframework.test.util.ReflectionTestUtils; //导入方法依赖的package包/类
@Override
@After
public void tearDown() throws Exception {
  ReflectionTestUtils.invokeMethod(remoteConfigLongPollService, "stopLongPollingRefresh");
  recursiveDelete(configDir);
  super.tearDown();
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:8,代码来源:ConfigIntegrationTest.java

示例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();
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:15,代码来源:ConfigControllerIntegrationTest.java

示例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();
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:11,代码来源:NotificationControllerIntegrationTest.java

示例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>>() {
  };
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:12,代码来源:NotificationControllerV2IntegrationTest.java

示例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();
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:15,代码来源:ConfigFileControllerIntegrationTest.java


注:本文中的org.springframework.test.util.ReflectionTestUtils.invokeMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。