本文整理汇总了Java中org.jboss.arquillian.core.spi.ServiceLoader类的典型用法代码示例。如果您正苦于以下问题:Java ServiceLoader类的具体用法?Java ServiceLoader怎么用?Java ServiceLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceLoader类属于org.jboss.arquillian.core.spi包,在下文中一共展示了ServiceLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
@Before
public void setup() throws Exception {
serviceProducer.set(serviceLoader);
final List<GovernorProvider> governorProviders = new ArrayList<GovernorProvider>();
governorProviders.add(governorProvider);
Mockito.when(serviceLoader.all(GovernorProvider.class)).thenReturn(governorProviders);
manager = Mockito.spy(getManager());
Mockito.when(manager.resolve(ServiceLoader.class)).thenReturn(serviceLoader);
governorConfiguration = new GovernorConfiguration();
bind(ApplicationScoped.class, GovernorConfiguration.class, governorConfiguration);
jiraGovernorConfiguration = new JiraGovernorConfiguration();
jiraGovernorConfiguration.setServer(JIRA_SERVER_ADDRESS);
jiraGovernorConfiguration.setUsername(USERNAME);
jiraGovernorConfiguration.setPassword(PASSWORD);
bind(ApplicationScoped.class, JiraGovernorConfiguration.class, jiraGovernorConfiguration);
final JiraGovernorClient jiraGovernorClient = new JiraGovernorClientFactory().build(jiraGovernorConfiguration);
bind(ApplicationScoped.class, JiraGovernorClient.class, jiraGovernorClient);
}
示例2: loadAuxiliaryArchives
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
private List<Archive<?>> loadAuxiliaryArchives() {
List<Archive<?>> archives = new ArrayList<>();
// load based on the Containers ClassLoader
ServiceLoader serviceLoader = _serviceLoaderInstance.get();
Collection<AuxiliaryArchiveAppender> archiveAppenders =
serviceLoader.all(AuxiliaryArchiveAppender.class);
for (AuxiliaryArchiveAppender archiveAppender : archiveAppenders) {
Archive<?> auxiliaryArchive =
archiveAppender.createAuxiliaryArchive();
if (auxiliaryArchive != null) {
archives.add(auxiliaryArchive);
}
}
return archives;
}
示例3: init
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
@Before
public void init() throws Exception {
bind(ApplicationScoped.class, ServiceLoader.class, serviceLoader);
bind(ApplicationScoped.class, ScreenshooterConfiguration.class, configuration);
bind(ApplicationScoped.class, Screenshooter.class, screenshooter);
bind(ApplicationScoped.class, RecorderStrategyRegister.class, recorderStrategyRegister);
Mockito.when(screenshooter.getScreenshotType()).thenReturn(ScreenshotType.PNG);
Mockito.doNothing().when(cleaner).clean(configuration);
Mockito.when(serviceLoader.onlyOne(ScreenshooterEnvironmentCleaner.class, DefaultScreenshooterEnvironmentCleaner.class))
.thenReturn(cleaner);
screenshotFile = folder.newFile("screenshot.png");
URL resource = BlurLevelTestCase.class.getResource("/arquillian_ui_success_256px.png");
FileUtils.copyURLToFile(resource, screenshotFile);
originalSize = (int) screenshotFile.length();
OUTPUT_FILE = screenshotFile.getAbsoluteFile();
}
示例4: init
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
@Before
public void init() {
cubeRegistry = new LocalCubeRegistry();
dockerContainerObjectFactory = new DockerContainerObjectFactory();
cubeController = mock(CubeController.class);
dockerClientExecutor = mock(DockerClientExecutor.class);
injector = mock(Injector.class);
serviceLoader = mock(ServiceLoader.class);
when(serviceLoader.all(any(Class.class))).thenReturn(Collections.emptyList());
dockerContainerObjectFactory.serviceLoaderInstance = () -> serviceLoader;
dockerContainerObjectFactory.dockerClientExecutorInstance = () -> dockerClientExecutor;
dockerContainerObjectFactory.cubeRegistryInstance = () -> cubeRegistry;
dockerContainerObjectFactory.cubeControllerInstance = () -> cubeController;
dockerContainerObjectFactory.injectorInstance = () -> injector;
//We asure that there is no previous executions there.
deleteTestDirectory();
}
示例5: initializeReporterAndRegisterServices
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
@Before
public final void initializeReporterAndRegisterServices() {
initMocks(this);
initiateStringKeys();
bind(ApplicationScoped.class, ServiceLoader.class, serviceLoader);
fire(new InitiateReporterEvent(lifecycleManager));
registerBuilders();
}
示例6: getCommandService
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
private CommandService getCommandService() {
ServiceLoader loader = serviceLoader.get();
if (loader == null) {
throw new IllegalStateException("No " + ServiceLoader.class.getName() + " found in context");
}
CommandService service = loader.onlyOne(CommandService.class);
if (service == null) {
throw new IllegalStateException("No " + CommandService.class.getName() + " found in context");
}
return service;
}
示例7: registerInstance
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
/**
* Method which observes {@link ContainerRegistry}. Gets called by Arquillian at startup time.
*
* @param registry
* contains containers defined in arquillian.xml
* @param serviceLoader
*/
public void registerInstance(@Observes ContainerRegistry registry, ServiceLoader serviceLoader) {
GenericContainer dockerContainer = new GenericContainer(DOCKER_IMAGE)
.withExposedPorts(WILDFLY_MANAGEMENT_PORT);
dockerContainer.start();
configureArquillianForRemoteWildfly(dockerContainer, registry);
setupDb(dockerContainer);
}
示例8: setup
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
@Before
public void setup() {
t = new ToxicProxyHandler();
t.networkChaosConfigurationInstance = () -> {
Mockito.when(networkChaosConfiguration.isToxifyPortBinding()).thenReturn(false);
return networkChaosConfiguration;
};
Mockito.when(loader.onlyOne(ProxyManager.class)).thenReturn(t);
bind(ApplicationScoped.class, ServiceLoader.class, loader);
}
示例9: setup
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
@Before
public void setup() {
Proxy p = new Proxy.Builder().build();
bind(ApplicationScoped.class, ArquillianDescriptor.class, descriptor);
bind(ApplicationScoped.class, ServiceLoader.class, serviceLoader);
Mockito.when(serviceLoader.onlyOne(ProxyManager.class)).thenReturn(proxyManager);
Mockito.when(proxyManager.install(Mockito.any(DockerCompositions.class))).thenReturn(p);
}
示例10: setup
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
@Before
public void setup() throws Exception {
serviceProducer.set(serviceLoader);
final List<GovernorProvider> governorProviders = new ArrayList<GovernorProvider>();
governorProviders.add(governorProvider);
Mockito.when(serviceLoader.all(GovernorProvider.class)).thenReturn(governorProviders);
manager = Mockito.spy(getManager());
Mockito.when(manager.resolve(ServiceLoader.class)).thenReturn(serviceLoader);
governorConfiguration = new GovernorConfiguration();
bind(ApplicationScoped.class, GovernorConfiguration.class, governorConfiguration);
redminebGovernorConfiguration = new RedmineGovernorConfiguration();
redminebGovernorConfiguration.setApiKey("apikey");
redminebGovernorConfiguration.setServer("http://localhost");
redminebGovernorConfiguration.setForce(true);
redminebGovernorConfiguration.setClosePassed(true);
bind(ApplicationScoped.class, RedmineGovernorConfiguration.class, redminebGovernorConfiguration);
final RedmineGovernorClient redmineGovernorClient = new RedmineGovernorClientFactory().build(redminebGovernorConfiguration);
bind(ApplicationScoped.class, RedmineGovernorClient.class, redmineGovernorClient);
}
示例11: setup
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
@Before
public void setup() throws Exception {
serviceProducer.set(serviceLoader);
final List<GovernorProvider> governorProviders = new ArrayList<GovernorProvider>();
governorProviders.add(governorProvider);
Mockito.when(serviceLoader.all(GovernorProvider.class)).thenReturn(governorProviders);
manager = Mockito.spy(getManager());
Mockito.when(manager.resolve(ServiceLoader.class)).thenReturn(serviceLoader);
governorConfiguration = new GovernorConfiguration();
bind(ApplicationScoped.class, GovernorConfiguration.class, governorConfiguration);
gitHubGovernorConfiguration = new GitHubGovernorConfiguration();
gitHubGovernorConfiguration.setRepository(REPOSITORY_NAME);
gitHubGovernorConfiguration.setRepositoryUser(REPOSITORY_USERNAME);
gitHubGovernorConfiguration.setForce(true);
gitHubGovernorConfiguration.setClosePassed(true);
if (!TOKEN.equals(EMPTY_STRING)) {
gitHubGovernorConfiguration.setToken(TOKEN);
}
gitHubGovernorConfiguration.setUsername(USERNAME);
gitHubGovernorConfiguration.setPassword(PASSWORD);
bind(ApplicationScoped.class, GitHubGovernorConfiguration.class, gitHubGovernorConfiguration);
final GitHubGovernorClient gitHubGovernorClient = new GitHubGovernorClientFactory().build(gitHubGovernorConfiguration);
bind(ApplicationScoped.class, GitHubGovernorClient.class, gitHubGovernorClient);
}
示例12: setup
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
@Before
public void setup() {
serviceProducer.set(serviceLoader);
final List<GovernorProvider> governorProviders = new ArrayList<GovernorProvider>();
governorProviders.add(governorProvider);
Mockito.when(serviceLoader.all(GovernorProvider.class)).thenReturn(governorProviders);
manager = Mockito.spy(getManager());
Mockito.when(manager.resolve(ServiceLoader.class)).thenReturn(serviceLoader);
governorConfiguration = new GovernorConfiguration();
bind(ApplicationScoped.class, GovernorConfiguration.class, governorConfiguration);
}
示例13: createInstanceProducer
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
public void createInstanceProducer(
@Observes ArquillianDescriptor arquillianDescriptor) {
ServiceLoader serviceLoader = _serviceLoaderInstance.get();
_importPackageManagerInstanceProducer.set(
serviceLoader.onlyOne(ImportPackageManager.class));
_manifestManagerInstanceProducer.set(
serviceLoader.onlyOne(ManifestManager.class));
_bundleActivatorsManagerInstanceProducer.set(
serviceLoader.onlyOne(BundleActivatorsManager.class));
}
开发者ID:arquillian,项目名称:arquillian-extension-liferay,代码行数:15,代码来源:OSGiAllInBundleInstanceProducer.java
示例14: setMocks
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
@org.junit.Before
public void setMocks() throws Exception {
bind(ApplicationScoped.class, ServiceLoader.class, serviceLoader);
bind(ApplicationScoped.class, ScreenshooterConfiguration.class, configuration);
bind(ApplicationScoped.class, Screenshooter.class, screenshooter);
bind(ApplicationScoped.class, RecorderStrategyRegister.class, recorderStrategyRegister);
Mockito.when(screenshooter.getScreenshotType()).thenReturn(ScreenshotType.PNG);
Mockito.doNothing().when(cleaner).clean(configuration);
Mockito.when(serviceLoader.onlyOne(ScreenshooterEnvironmentCleaner.class, DefaultScreenshooterEnvironmentCleaner.class))
.thenReturn(cleaner);
}
示例15: setup
import org.jboss.arquillian.core.spi.ServiceLoader; //导入依赖的package包/类
@org.junit.Before
public void setup() throws Exception {
bind(ApplicationScoped.class, ServiceLoader.class, serviceLoader);
bind(ApplicationScoped.class, VideoConfiguration.class, configuration);
bind(ApplicationScoped.class, Recorder.class, recorder);
bind(ApplicationScoped.class, TakenResourceRegister.class, takenResourceRegister);
strategy.setConfiguration(configuration);
bind(ApplicationScoped.class, VideoStrategy.class, strategy);
Mockito.when(recorder.getVideoType()).thenReturn(VideoType.MP4);
Mockito.doNothing().when(cleaner).clean(configuration);
Mockito.when(serviceLoader.onlyOne(VideoRecorderEnvironmentCleaner.class, DefaultVideoRecorderEnvironmentCleaner.class))
.thenReturn(cleaner);
// Mockito.when(serviceLoader.onlyOne(VideoStrategy.class, DefaultVideoStrategy.class))
// .thenReturn(strategy);
videoFile = File.createTempFile("fakeVideo", recorder.getVideoType().toString().toLowerCase());
Mockito.when(configuration.getVideoName()).thenReturn("record");
Mockito.when(video.getResource()).thenReturn(videoFile);
Mockito.when(video.getResourceType()).thenReturn(VideoType.MP4);
Mockito.when(video.getWidth()).thenReturn(100);
Mockito.when(video.getHeight()).thenReturn(100);
Mockito.when(recorder.stopRecording()).thenReturn(video);
}