當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。