ClientProvider createClientProvider(TestContext testContext, Application application) { //create client supplier instance Class<? extends ClientProvider> clientProviderType = application.clientProvider(); ClientProvider clientProvider; if (clientProviderType.equals(ClientProvider.class)) { clientProvider = serviceLocatorUtil.getOne(clientProviderType); } else { clientProvider = reflectionUtil.newInstance(clientProviderType); } testContext.addProperty(TestContextProperties.CLIENT_PROVIDER, clientProvider); return clientProvider; }
} else { testRunner = ServiceLocatorUtil.INSTANCE .getOne(TestRunner.class, testSettings.getTestRunnerClass());
ServerProvider createServerProvider(TestContext testContext, Application application) { Class<? extends ServerProvider> serverProviderType = application.serverProvider(); ServerProvider serverProvider; if (ServerProvider.class.equals(serverProviderType)) { String start = application.start(); String stop = application.stop(); if (!start.isEmpty() && !stop.isEmpty()) { serverProvider = new DefaultServerProvider(); } else { serverProvider = serviceLocatorUtil.getOne(serverProviderType); } } else { serverProvider = reflectionUtil.newInstance(serverProviderType); } testContext.addProperty(TestContextProperties.SERVER_PROVIDER, serverProvider); return serverProvider; }
public void refresh(@SuperCall Callable<Void> zuper, @Argument(0) ApplicationContext applicationContext) throws Exception { ConfigurableApplicationContext configurableApplicationContext = (ConfigurableApplicationContext) applicationContext; TestContextHolder.INSTANCE.command(testContext -> { testContext.computeIfAbsent(SERVICE_INSTANCE, key -> { ServiceProvider<ConfigurableApplicationContext> serviceProvider = ServiceLocatorUtil.INSTANCE.getOne(ServiceProvider.class, SpringServiceProvider.class); return serviceProvider.configure(testContext, configurableApplicationContext); }); }); zuper.call(); }
public void initialize(@SuperCall Callable<Void> zuper, @Argument(0) Object applicationConfigurator, @Argument(1) InjectionManager injectionManager, @Argument(2) Binder customBinder) throws Exception { zuper.call(); TestContextHolder.INSTANCE.command(testContext -> { if (SystemCategory.class.equals(testContext.getTestCategory())) { testContext.computeIfAbsent(SERVICE_INSTANCE, key -> { ServiceProvider<InjectionManager> serviceProvider = ServiceLocatorUtil.INSTANCE.getOne(ServiceProvider.class, JerseyServiceProvider.class); return serviceProvider.configure(testContext, injectionManager); }); } }); }
@Override public DeploymentInfo configure(TestContext testContext) { applicationProvider = ServiceLocatorUtil.INSTANCE .getOne(ApplicationProvider.class); ApplicationInstance applicationInstance = applicationProvider.start(testContext); testContext.addProperty(APPLICATION_INSTANCE, applicationInstance);
resourceController = serviceLocatorUtil.getOne(ResourceController.class); resourceController.start(testContext);
testContext.verify(); resourceController = serviceLocatorUtil.getOne(ResourceController.class); resourceController.start(testContext);
Collection<Class<? extends Annotation>> guidelines = testDescriptor.getGuidelines(); resourceController = serviceLocatorUtil.getOne(ResourceController.class); resourceController.start(testContext);
ServiceLocatorUtil.INSTANCE.getOne(ServiceProvider.class, SpringServiceProvider.class);
.getOne(ServiceProvider.class, HK2ServiceProvider.class);
ServiceLocatorUtil.INSTANCE.getOne(ServiceProvider.class, SpringServiceProvider.class);