本文整理汇总了Java中org.jboss.arquillian.core.api.Injector类的典型用法代码示例。如果您正苦于以下问题:Java Injector类的具体用法?Java Injector怎么用?Java Injector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Injector类属于org.jboss.arquillian.core.api包,在下文中一共展示了Injector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
public void register(@Observes DockerClientExecutor executor, CubeDockerConfiguration configuration,
Injector injector, CubeRegistry registry) {
//TODO, add key here generation here
DockerCompositions containerConfigurations = configuration.getDockerContainersContent();
for (Map.Entry<String, CubeContainer> containerConfiguration : containerConfigurations.getContainers()
.entrySet()) {
registry.addCube(
injector.inject(
new DockerCube(
containerConfiguration.getKey(),
containerConfiguration.getValue(),
executor)));
}
}
示例2: create
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
public static AutoStartParser create(String expression, DockerCompositions containersDefinition, Injector injector) {
if (isNone(expression)) {
return new NoneAutoStartParser();
} else {
if (isRegularExpressionBased(expression)) {
return new RegularExpressionAutoStartParser(expression, containersDefinition);
} else {
if (isCustomImplementation(expression)) {
return new CustomAutoStartParser(injector,
expression.substring(
expression.indexOf(CustomAutoStartParser.CUSTOM_PREFIX)
+ CustomAutoStartParser.CUSTOM_PREFIX.length()).trim()
);
} else {
if (isCommaSeparated(expression)) {
return new CommaSeparatedAutoStartParser(expression, containersDefinition);
} else {
return null;
}
}
}
}
}
示例3: should_start_a_network
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
@Test
public void should_start_a_network() {
ContainerNetworkObjectDslTestEnricher containerNetworkObjectDslTestEnricher = new ContainerNetworkObjectDslTestEnricher();
Injector injector = mock(Injector.class);
containerNetworkObjectDslTestEnricher.injectorInstance = () -> injector;
containerNetworkObjectDslTestEnricher.networkRegistryInstance = () -> networkRegistry;
containerNetworkObjectDslTestEnricher.dockerClientExecutorInstance = () -> dockerClientExecutor;
when(injector.inject(any(Network.class))).then(invocation -> invocation.getArgumentAt(0, Network.class));
when(dockerClientExecutor.createNetwork(eq("default"), any(org.arquillian.cube.docker.impl.client.config.Network.class))).thenReturn("default");
containerNetworkObjectDslTestEnricher.enrich(new NetworkTest());
verify(dockerClientExecutor).createNetwork(eq("default"), any(org.arquillian.cube.docker.impl.client.config.Network.class));
assertThat(networkRegistry.getNetwork("default")).isNotNull();
}
示例4: should_start_a_container
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
@Test
public void should_start_a_container() {
Injector injector = new Injector() {
@Override
public <T> T inject(T target) {
return target;
}
};
ContainerNetworkObjectDslTestEnricher containerNetworkObjectDslTestEnricher = new ContainerNetworkObjectDslTestEnricher();
containerNetworkObjectDslTestEnricher.injectorInstance = () -> injector;
containerNetworkObjectDslTestEnricher.cubeRegistryInstance = () -> cubeRegistry;
containerNetworkObjectDslTestEnricher.cubeControllerInstance = () -> cubeController;
containerNetworkObjectDslTestEnricher.dockerClientExecutorInstance = () -> dockerClientExecutor;
containerNetworkObjectDslTestEnricher.enrich(new SimpleContainerTest());
verify(cubeController).create("mytomcat");
verify(cubeController).start("mytomcat");
assertThat(cubeRegistry.getCube("mytomcat")).isNotNull();
}
示例5: should_start_multiple_containers_in_order
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
@Test
public void should_start_multiple_containers_in_order() {
Injector injector = new Injector() {
@Override
public <T> T inject(T target) {
return target;
}
};
ContainerNetworkObjectDslTestEnricher containerNetworkObjectDslTestEnricher = new ContainerNetworkObjectDslTestEnricher();
containerNetworkObjectDslTestEnricher.injectorInstance = () -> injector;
containerNetworkObjectDslTestEnricher.cubeRegistryInstance = () -> cubeRegistry;
containerNetworkObjectDslTestEnricher.cubeControllerInstance = () -> cubeController;
containerNetworkObjectDslTestEnricher.dockerClientExecutorInstance = () -> dockerClientExecutor;
containerNetworkObjectDslTestEnricher.enrich(new MultipleContainerTest());
InOrder inOrder = Mockito.inOrder(cubeController);
inOrder.verify(cubeController).create("mytomcat3");
inOrder.verify(cubeController).create("mytomcat1");
inOrder.verify(cubeController).create("mytomcat2");
}
示例6: init
import org.jboss.arquillian.core.api.Injector; //导入依赖的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();
}
示例7: initialize
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
public static DockerClientExecutor initialize() {
Injector injector = new Injector() {
@Override
public <T> T inject(T t) {
return t;
}
};
CubeDockerConfigurationResolver resolver = new CubeDockerConfigurationResolver(new Top(),
new DockerMachine(new CommandLineExecutor()),
new Boot2Docker(new CommandLineExecutor()),
new OperatingSystemResolver().currentOperatingSystem().getFamily());
final Map<String, String> config = resolver.resolve(new HashMap<>());
final CubeDockerConfiguration cubeDockerConfiguration = CubeDockerConfiguration.fromMap(config, injector);
return new DockerClientExecutor(cubeDockerConfiguration);
}
示例8: register
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
public void register(@Observes final OpenShiftClient client, final CubeRegistry registry, final Configuration conf,
final Injector injector) {
if (!(conf instanceof CubeOpenShiftConfiguration)) {
return;
}
CubeOpenShiftConfiguration configuration = (CubeOpenShiftConfiguration) conf;
if (!hasDefinitionStream(configuration)) {
return;
}
for (HasMetadata item : client.getClientExt().load(getDefinitionStream(configuration)).get()) {
if (item instanceof Pod) {
registry.addCube(injector.inject(new BuildablePodCube((Pod) item, client, configuration)));
} else if (item instanceof Service) {
registry.addCube(injector.inject(new ServiceCube((Service) item, client, configuration)));
}
}
}
示例9: TargetController
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public TargetController(ContainerAdapter adapter, Injector injector, File resolverCacheFolder) throws Exception {
// init
this.classloader = resolveClasspathDependencies(adapter, resolverCacheFolder);
final Class<?> delegateClass = classloader.loadClass(adapter.adapterClass());
this.delegate = injector.inject((DeployableContainer) delegateClass.newInstance());
this.adapter = adapter;
}
示例10: shouldInstantiateACustomAutoStartParser
import org.jboss.arquillian.core.api.Injector; //导入依赖的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"));
}
示例11: setInjector
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
@Override
public void setInjector(Injector injector) {
this.injector = injector;
}
示例12: ToxiProxyScenario
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
public ToxiProxyScenario(ToxiProxyClient client, Injector injector) {
this.client = client;
this.proxies = new HashMap<>();
this.injector = injector;
}
示例13: CustomAutoStartParser
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
public CustomAutoStartParser(Injector injector, String clazz) {
this.injector = injector;
this.clazz = clazz;
}
示例14: register
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
public void register(@Observes(precedence = 100) CubeConfiguration configuration, Injector injector) {
NetworkRegistry registry = new LocalDockerNetworkRegistry();
networkRegistryProducer.set(registry);
}
示例15: register
import org.jboss.arquillian.core.api.Injector; //导入依赖的package包/类
public void register(@Observes(precedence = 100) CubeConfiguration configuration, Injector injector) {
CubeRegistry registry = new LocalCubeRegistry();
registryProducer.set(registry);
}