本文整理汇总了Java中org.jboss.arquillian.core.api.Instance类的典型用法代码示例。如果您正苦于以下问题:Java Instance类的具体用法?Java Instance怎么用?Java Instance使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Instance类属于org.jboss.arquillian.core.api包,在下文中一共展示了Instance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: should_start_vnc_by_default
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
@Test
public void should_start_vnc_by_default() {
when(seleniumContainers.getVncContainerName()).thenReturn("vnc");
when(cubeRegistry.getCube("vnc")).thenReturn(cube);
VncRecorderLifecycleManager vncRecorderLifecycleManager = new VncRecorderLifecycleManager();
vncRecorderLifecycleManager.seleniumContainersInstance = new Instance<SeleniumContainers>() {
@Override
public SeleniumContainers get() {
return seleniumContainers;
}
};
vncRecorderLifecycleManager.startRecording(null,
CubeDroneConfiguration.fromMap(new HashMap<String, String>()),
cubeRegistry);
verify(cube).create();
verify(cube).start();
}
示例2: getKubernetesResourceLocator
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
private Instance<KubernetesResourceLocator> getKubernetesResourceLocator() {
return () -> new KubernetesResourceLocator() {
@Override
public URL locate() {
return getClass().getResource("/kubernetes.json");
}
@Override
public Collection<URL> locateAdditionalResources() {
return Collections.emptyList();
}
@Override
public KubernetesResourceLocator toImmutable() {
return this;
}
};
}
示例3: shouldEnrichTest
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
@Test
public void shouldEnrichTest() {
HostPortTestEnricher hostPortTestEnricher = new HostPortTestEnricher();
hostPortTestEnricher.cubeRegistryInstance = new Instance<CubeRegistry>() {
@Override
public CubeRegistry get() {
final CubeRegistry cubeRegistry = Mockito.mock(CubeRegistry.class);
Mockito.when(cubeRegistry.getCube("test")).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
final HasPortBindings hasPortBindings = Mockito.mock(HasPortBindings.class);
Mockito.when(hasPortBindings.getMappedAddress(99))
.thenReturn(new HasPortBindings.PortAddressImpl("192.168.99.100", 9999));
final Cube<?> cube = Mockito.mock(Cube.class);
Mockito.when(cube.getMetadata(HasPortBindings.class)).thenReturn(hasPortBindings);
return cube;
}
});
return cubeRegistry;
}
};
final MyTest testCase = new MyTest();
hostPortTestEnricher.enrich(testCase);
Assert.assertThat(testCase.port, CoreMatchers.is(9999));
}
示例4: shouldEnrichTestMethod
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
@Test
public void shouldEnrichTestMethod() throws NoSuchMethodException {
HostPortTestEnricher hostPortTestEnricher = new HostPortTestEnricher();
hostPortTestEnricher.cubeRegistryInstance = new Instance<CubeRegistry>() {
@Override
public CubeRegistry get() {
final CubeRegistry cubeRegistry = Mockito.mock(CubeRegistry.class);
Mockito.when(cubeRegistry.getCube("test")).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
final HasPortBindings hasPortBindings = Mockito.mock(HasPortBindings.class);
Mockito.when(hasPortBindings.getMappedAddress(99))
.thenReturn(new HasPortBindings.PortAddressImpl("192.168.99.100", 9999));
final Cube<?> cube = Mockito.mock(Cube.class);
Mockito.when(cube.getMetadata(HasPortBindings.class)).thenReturn(hasPortBindings);
return cube;
}
});
return cubeRegistry;
}
};
MyTest test = new MyTest();
Object[] myMethods = hostPortTestEnricher.resolve(test.getClass().getMethod("myMethod", String.class, int.class));
assertThat((int) myMethods[1], is(9999));
}
示例5: shouldNotEnrichUnknownContainers
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
@Test
public void shouldNotEnrichUnknownContainers() throws NoSuchMethodException {
HostPortTestEnricher hostPortTestEnricher = new HostPortTestEnricher();
hostPortTestEnricher.cubeRegistryInstance = new Instance<CubeRegistry>() {
@Override
public CubeRegistry get() {
final CubeRegistry cubeRegistry = Mockito.mock(CubeRegistry.class);
Mockito.when(cubeRegistry.getCube("test2")).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
final HasPortBindings hasPortBindings = Mockito.mock(HasPortBindings.class);
Mockito.when(hasPortBindings.getMappedAddress(99))
.thenReturn(new HasPortBindings.PortAddressImpl("192.168.99.100", 9999));
final Cube<?> cube = Mockito.mock(Cube.class);
Mockito.when(cube.getMetadata(HasPortBindings.class)).thenReturn(hasPortBindings);
return cube;
}
});
return cubeRegistry;
}
};
final MyTest testCase = new MyTest();
hostPortTestEnricher.enrich(testCase);
Assert.assertThat(testCase.port, CoreMatchers.is(0));
}
示例6: shouldInstantiateACustomAutoStartParser
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
@Test
public void shouldInstantiateACustomAutoStartParser() {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("serverVersion", "1.13");
parameters.put("serverUri", "http://localhost:25123");
parameters.put("dockerContainers", CONTENT);
parameters.put("definitionFormat", DefinitionFormat.CUBE.name());
final CubeDockerConfiguration cubeDockerConfiguration = CubeDockerConfiguration.fromMap(parameters, null);
Injector injector = new Injector() {
@Override
public <T> T inject(T target) {
final ChangeNameAutoStartParser orderByNameAutoStartParser = (ChangeNameAutoStartParser) target;
orderByNameAutoStartParser.cubeDockerConfigurationInstance = new Instance<CubeDockerConfiguration>() {
@Override
public CubeDockerConfiguration get() {
return cubeDockerConfiguration;
}
};
return target;
}
};
final AutoStartParser autoStartParser =
AutoStartParserFactory.create("custom:org.arquillian.cube.docker.impl.client.ChangeNameAutoStartParser", null,
injector);
assertThat(autoStartParser, instanceOf(CustomAutoStartParser.class));
final Set<String> names = autoStartParser.parse().keySet();
assertThat(names, hasItem("og"));
assertThat(names, hasItem("tacmot"));
}
示例7: prepareCubeDockerConfiguration
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
@Before
public void prepareCubeDockerConfiguration() {
when(cubeDockerConfiguration.getDockerServerIp()).thenReturn(DOCKER_HOST);
when(hasPortBindings.getInternalIP()).thenReturn("192.168.99.100");
when(cube.hasMetadata(HasPortBindings.class)).thenReturn(true);
when(cube.getMetadata(HasPortBindings.class)).thenReturn(hasPortBindings);
when(cubeRegistry.getCube("helloworld")).thenReturn(cube);
dockerCubeCustomizableURLResourceProvider = new DockerCubeCustomizableURLResourceProvider();
dockerCubeCustomizableURLResourceProvider.cubeDockerConfigurationInstance =
new Instance<CubeDockerConfiguration>() {
@Override
public CubeDockerConfiguration get() {
return cubeDockerConfiguration;
}
};
dockerCubeCustomizableURLResourceProvider.grapheneConfiguration = new Instance<GrapheneConfiguration>() {
@Override
public GrapheneConfiguration get() {
return grapheneConfiguration;
}
};
dockerCubeCustomizableURLResourceProvider.cubeRegistryInstance = new Instance<CubeRegistry>() {
@Override
public CubeRegistry get() {
return cubeRegistry;
}
};
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:31,代码来源:CubeDockerCustomizableURLResourceProviderTest.java
示例8: shouldEnrichTest
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
@Test
public void shouldEnrichTest() {
HostIpTestEnricher hostIpTestEnricher = new HostIpTestEnricher();
hostIpTestEnricher.hostUriContext = new Instance<HostIpContext>() {
@Override
public HostIpContext get() {
return new HostIpContext("192.168.99.100");
}
};
MyTest test = new MyTest();
hostIpTestEnricher.enrich(test);
assertThat(test.hostIp, is("192.168.99.100"));
}
示例9: shouldEnrichTestMethod
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
@Test
public void shouldEnrichTestMethod() throws NoSuchMethodException {
HostIpTestEnricher hostIpTestEnricher = new HostIpTestEnricher();
hostIpTestEnricher.hostUriContext = new Instance<HostIpContext>() {
@Override
public HostIpContext get() {
return new HostIpContext("192.168.99.100");
}
};
MyTest test = new MyTest();
Object[] myMethods =
hostIpTestEnricher.resolve(test.getClass().getMethod("myMethod", String.class, String.class));
assertThat((String) myMethods[1], is("192.168.99.100"));
}
示例10: should_enrich_test_with_container_ip
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
@Test
public void should_enrich_test_with_container_ip() {
CubeIpTestEnricher cubeIpTestEnricher = new CubeIpTestEnricher();
cubeIpTestEnricher.cubeRegistryInstance = new Instance<CubeRegistry>() {
@Override
public CubeRegistry get() {
final CubeRegistry cubeRegistry = Mockito.mock(CubeRegistry.class);
Mockito.when(cubeRegistry.getCube("test")).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
final HasPortBindings hasPortBindings = Mockito.mock(HasPortBindings.class);
Mockito.when(hasPortBindings.getInternalIP()).thenReturn("192.168.99.100");
Mockito.when(hasPortBindings.getContainerIP()).thenReturn("192.168.99.101");
final Cube<?> cube = Mockito.mock(Cube.class);
Mockito.when(cube.hasMetadata(HasPortBindings.class)).thenReturn(true);
Mockito.when(cube.getMetadata(HasPortBindings.class)).thenReturn(hasPortBindings);
return cube;
}
});
return cubeRegistry;
}
};
final CubeIpTestEnricherTest.MyTestExternal testCase = new CubeIpTestEnricherTest.MyTestExternal();
cubeIpTestEnricher.enrich(testCase);
assertThat(testCase.ip, is("192.168.99.101"));
}
示例11: should_enrich_test_with_internal_ip
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
@Test
public void should_enrich_test_with_internal_ip() {
CubeIpTestEnricher cubeIpTestEnricher = new CubeIpTestEnricher();
cubeIpTestEnricher.cubeRegistryInstance = new Instance<CubeRegistry>() {
@Override
public CubeRegistry get() {
final CubeRegistry cubeRegistry = Mockito.mock(CubeRegistry.class);
Mockito.when(cubeRegistry.getCube("test")).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
final HasPortBindings hasPortBindings = Mockito.mock(HasPortBindings.class);
Mockito.when(hasPortBindings.getInternalIP()).thenReturn("192.168.99.100");
final Cube<?> cube = Mockito.mock(Cube.class);
Mockito.when(cube.hasMetadata(HasPortBindings.class)).thenReturn(true);
Mockito.when(cube.getMetadata(HasPortBindings.class)).thenReturn(hasPortBindings);
return cube;
}
});
return cubeRegistry;
}
};
final CubeIpTestEnricherTest.MyTest testCase = new CubeIpTestEnricherTest.MyTest();
cubeIpTestEnricher.enrich(testCase);
assertThat(testCase.ip, is("192.168.99.100"));
}
示例12: should_enrich_test_method_with_internal
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
@Test
public void should_enrich_test_method_with_internal() throws NoSuchMethodException {
CubeIpTestEnricher cubeIpTestEnricher = new CubeIpTestEnricher();
cubeIpTestEnricher.cubeRegistryInstance = new Instance<CubeRegistry>() {
@Override
public CubeRegistry get() {
final CubeRegistry cubeRegistry = Mockito.mock(CubeRegistry.class);
Mockito.when(cubeRegistry.getCube("test")).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
final HasPortBindings hasPortBindings = Mockito.mock(HasPortBindings.class);
Mockito.when(hasPortBindings.getInternalIP()).thenReturn("192.168.99.100");
final Cube<?> cube = Mockito.mock(Cube.class);
Mockito.when(cube.hasMetadata(HasPortBindings.class)).thenReturn(true);
Mockito.when(cube.getMetadata(HasPortBindings.class)).thenReturn(hasPortBindings);
return cube;
}
});
return cubeRegistry;
}
};
final CubeIpTestEnricherTest.MyTest testCase = new CubeIpTestEnricherTest.MyTest();
final Object[] myMethods =
cubeIpTestEnricher.resolve(testCase.getClass().getMethod("myMethod", String.class, String.class));
assertThat((String) myMethods[1], Is.is("192.168.99.100"));
}
示例13: setProtocolMetaData
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
public void setProtocolMetaData(Instance<ProtocolMetaData> pmd) {
this.pmdInstance = pmd;
}
示例14: setRedmineGovernorConfigurationInstance
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
public void setRedmineGovernorConfigurationInstance(Instance<RedmineGovernorConfiguration> redmineGovernorConfigurationInstance) {
this.redmineGovernorConfigurationInstance = redmineGovernorConfigurationInstance;
}
示例15: setJiraGovernorConfigurationInstance
import org.jboss.arquillian.core.api.Instance; //导入依赖的package包/类
public void setJiraGovernorConfigurationInstance(Instance<JiraGovernorConfiguration> jiraGovernorConfigurationInstance) {
this.jiraGovernorConfigurationInstance = jiraGovernorConfigurationInstance;
}