@SuppressWarnings("unchecked") public static DockerCompositions load(InputStream inputStream) { // TODO: Figure out how to map root Map<String, Type> objects. Workaround by mapping it to Map structure then dumping it into individual objects //Apply Docker compose substitutions to cube format as well final String content = DockerComposeEnvironmentVarResolver.replaceParameters(inputStream); Yaml yaml = new Yaml(new CubeConstructor()); Map<String, Object> rawLoad = (Map<String, Object>) yaml.load(content); DockerCompositions containers = new DockerCompositions(); for (Map.Entry<String, Object> rawLoadEntry : rawLoad.entrySet()) { if (NETWORKS.equals(rawLoadEntry.getKey())) { Map<String, Object> rawNetworks = (Map<String, Object>) rawLoadEntry.getValue(); for (Map.Entry<String, Object> rawNetworkEntry : rawNetworks.entrySet()) { Network network = yaml.loadAs(yaml.dump(rawNetworkEntry.getValue()), Network.class); containers.add(rawNetworkEntry.getKey(), network); } } else if (CONTAINERS.equals(rawLoadEntry.getKey())) { Map<String, Object> rawContainers = (Map<String, Object>) rawLoadEntry.getValue(); for (Map.Entry<String, Object> rawContainerEntry : rawContainers.entrySet()) { CubeContainer cubeContainer = yaml.loadAs(yaml.dump(rawContainerEntry.getValue()), CubeContainer.class); containers.add(rawContainerEntry.getKey(), cubeContainer); } } else { CubeContainer container = yaml.loadAs(yaml.dump(rawLoadEntry.getValue()), CubeContainer.class); containers.add(rawLoadEntry.getKey(), container); } } return applyExtendsRules(containers); }
@SuppressWarnings("unchecked") public static DockerCompositions load(InputStream inputStream) { // TODO: Figure out how to map root Map<String, Type> objects. Workaround by mapping it to Map structure then dumping it into individual objects //Apply Docker compose substitutions to cube format as well final String content = DockerComposeEnvironmentVarResolver.replaceParameters(inputStream); Yaml yaml = new Yaml(new CubeConstructor()); Map<String, Object> rawLoad = (Map<String, Object>) yaml.load(content); DockerCompositions containers = new DockerCompositions(); for (Map.Entry<String, Object> rawLoadEntry : rawLoad.entrySet()) { if (NETWORKS.equals(rawLoadEntry.getKey())) { Map<String, Object> rawNetworks = (Map<String, Object>) rawLoadEntry.getValue(); for (Map.Entry<String, Object> rawNetworkEntry : rawNetworks.entrySet()) { Network network = yaml.loadAs(yaml.dump(rawNetworkEntry.getValue()), Network.class); containers.add(rawNetworkEntry.getKey(), network); } } else if (CONTAINERS.equals(rawLoadEntry.getKey())) { Map<String, Object> rawContainers = (Map<String, Object>) rawLoadEntry.getValue(); for (Map.Entry<String, Object> rawContainerEntry : rawContainers.entrySet()) { CubeContainer cubeContainer = yaml.loadAs(yaml.dump(rawContainerEntry.getValue()), CubeContainer.class); containers.add(rawContainerEntry.getKey(), cubeContainer); } } else { CubeContainer container = yaml.loadAs(yaml.dump(rawLoadEntry.getValue()), CubeContainer.class); containers.add(rawLoadEntry.getKey(), container); } } return applyExtendsRules(containers); }
public DockerCompositions convert() { DockerCompositions dockerCompositions = new DockerCompositions(); Set<String> names = dockerComposeDefinitionMap.keySet(); boolean isV2OrGreater = names.contains(DOCKER_COMPOSE_VERSION_KEY) && Integer.parseInt((String) dockerComposeDefinitionMap.get(DOCKER_COMPOSE_VERSION_KEY)) > 1; if (isV2OrGreater) { dockerCompositions = convertCompose(dockerComposeDefinitionMap); } else { for(String name : names) { CubeContainer cubeContainer = convertContainer(asMap(dockerComposeDefinitionMap, name)); if (cubeContainer.getContainerName() != null) { dockerCompositions.add(cubeContainer.getContainerName(), cubeContainer); } else { dockerCompositions.add(name, cubeContainer); } } } return dockerCompositions; }
public DockerCompositions convert() { DockerCompositions dockerCompositions = new DockerCompositions(); Set<String> names = dockerComposeDefinitionMap.keySet(); boolean isV2OrGreater = names.contains(DOCKER_COMPOSE_VERSION_KEY) && Integer.parseInt((String) dockerComposeDefinitionMap.get(DOCKER_COMPOSE_VERSION_KEY)) > 1; if (isV2OrGreater) { dockerCompositions = convertCompose(dockerComposeDefinitionMap); } else { for(String name : names) { CubeContainer cubeContainer = convertContainer(asMap(dockerComposeDefinitionMap, name)); if (cubeContainer.getContainerName() != null) { dockerCompositions.add(cubeContainer.getContainerName(), cubeContainer); } else { dockerCompositions.add(name, cubeContainer); } } } return dockerCompositions; }
public void install(@Observes(precedence = 90) CubeDockerConfiguration configuration, ArquillianDescriptor arquillianDescriptor) { DockerCompositions cubes = configuration.getDockerContainersContent(); final SeleniumContainers seleniumContainers = SeleniumContainers.create(getBrowser(arquillianDescriptor), cubeDroneConfigurationInstance.get()); cubes.add(seleniumContainers.getSeleniumContainerName(), seleniumContainers.getSeleniumContainer()); final boolean recording = cubeDroneConfigurationInstance.get().isRecording(); if (recording) { cubes.add(seleniumContainers.getVncContainerName(), seleniumContainers.getVncContainer()); cubes.add(seleniumContainers.getVideoConverterContainerName(), seleniumContainers.getVideoConverterContainer()); } seleniumContainersInstanceProducer.set(seleniumContainers); System.out.println("SELENIUM INSTALLED"); System.out.println(ConfigUtil.dump(cubes)); }
public void install(@Observes(precedence = 90) CubeDockerConfiguration configuration, ArquillianDescriptor arquillianDescriptor) { DockerCompositions cubes = configuration.getDockerContainersContent(); final SeleniumContainers seleniumContainers = SeleniumContainers.create(getBrowser(arquillianDescriptor), cubeDroneConfigurationInstance.get()); cubes.add(seleniumContainers.getSeleniumContainerName(), seleniumContainers.getSeleniumContainer()); final boolean recording = cubeDroneConfigurationInstance.get().isRecording(); if (recording) { cubes.add(seleniumContainers.getVncContainerName(), seleniumContainers.getVncContainer()); cubes.add(seleniumContainers.getVideoConverterContainerName(), seleniumContainers.getVideoConverterContainer()); } seleniumContainersInstanceProducer.set(seleniumContainers); System.out.println("SELENIUM INSTALLED"); System.out.println(ConfigUtil.dump(cubes)); }
public void install(@Observes(precedence = 100) CubeDockerConfiguration configuration) { StandaloneManager installer = serviceLoaderInst.get().onlyOne(StandaloneManager.class); if (installer != null) { DockerCompositions cubes = configuration.getDockerContainersContent(); final StandaloneContainer install = installer.install(); final CubeContainer cube = install.getCube(); cubes.add(install.getName(), cube); standaloneContainerInst.set(install); System.out.println("STANDALONE CONTAINER INSTALLED"); System.out.println(ConfigUtil.dump(cubes)); } }
public void install(@Observes(precedence = 100) CubeDockerConfiguration configuration) { DockerCompositions cubes = configuration.getDockerContainersContent(); ProxyManager installer = serviceLoaderInst.get().onlyOne(ProxyManager.class); if (installer != null) { Proxy proxy = installer.install(cubes); proxyInst.set(proxy); final CubeContainer cube = proxy.getCube(); cubes.add(proxy.getName(), cube); System.out.println("PROXY INSTALLED"); System.out.println(ConfigUtil.dump(cubes)); } } }
NetworkBuilder networkBuilder = new NetworkBuilder(); Network network = networkBuilder.withDefaultDriver().build(); this.configuration.add(networkName, network); this.configuration.add(key, cubeContainer); NetworkBuilder networks = new NetworkBuilder(); Network network = networks.build(asMap(networksDefinition, key)); this.configuration.add(key, network); NetworkBuilder networkBuilder = new NetworkBuilder(); Network network = networkBuilder.withDefaultDriver().build(); this.configuration.add(networkName, network);
NetworkBuilder networkBuilder = new NetworkBuilder(); Network network = networkBuilder.withDefaultDriver().build(); this.configuration.add(networkName, network); this.configuration.add(key, cubeContainer); NetworkBuilder networks = new NetworkBuilder(); Network network = networks.build(asMap(networksDefinition, key)); this.configuration.add(key, network); NetworkBuilder networkBuilder = new NetworkBuilder(); Network network = networkBuilder.withDefaultDriver().build(); this.configuration.add(networkName, network);