OperatingSystemInterface getCurrentOperatingSystem() { return new OperatingSystemResolver().currentOperatingSystem(); }
OperatingSystemInterface getCurrentOperatingSystem() { return new OperatingSystemResolver().currentOperatingSystem(); }
public static String resolveDistro() { OperatingSystemFamilyInterface currentOSFamily = new OperatingSystemResolver().currentOperatingSystem().getFamily(); for (DockerMachineDistro distro : values()) { for (OperatingSystemFamily osFamily : distro.osFamily) { if (osFamily == currentOSFamily) { return distro.distro; } } } return null; }
public static String resolveDistro() { OperatingSystemFamilyInterface currentOSFamily = new OperatingSystemResolver().currentOperatingSystem().getFamily(); for (DockerMachineDistro distro : values()) { for (OperatingSystemFamily osFamily : distro.osFamily) { if (osFamily == currentOSFamily) { return distro.distro; } } } return null; }
private static String convertToBind(Path hostPath, String containterPath, String mode) { boolean isWindows = new OperatingSystemResolver().currentOperatingSystem().getFamily() == OperatingSystemFamily.WINDOWS; Path absoluteHostPath = hostPath.toAbsolutePath(); if(isWindows) {
private static String convertToBind(Path hostPath, String containterPath, String mode) { boolean isWindows = new OperatingSystemResolver().currentOperatingSystem().getFamily() == OperatingSystemFamily.WINDOWS; Path absoluteHostPath = hostPath.toAbsolutePath(); if(isWindows) {
public DockerRequirement() { this.commandLineExecutor = new CommandLineExecutor(); this.resolver = new CubeDockerConfigurationResolver(new Top(), new DockerMachine(commandLineExecutor), new Boot2Docker(commandLineExecutor), new DefaultDocker(), new OperatingSystemResolver().currentOperatingSystem() ); }
public DockerRequirement() { this.commandLineExecutor = new CommandLineExecutor(); this.resolver = new CubeDockerConfigurationResolver(new Top(), new DockerMachine(commandLineExecutor), new Boot2Docker(commandLineExecutor), new DefaultDocker(), new OperatingSystemResolver().currentOperatingSystem() ); }
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 DefaultDocker(), new OperatingSystemResolver().currentOperatingSystem()); final Map<String, String> config = resolver.resolve(new HashMap<>()); final CubeDockerConfiguration cubeDockerConfiguration = CubeDockerConfiguration.fromMap(config, injector); return new DockerClientExecutor(cubeDockerConfiguration); }
@Test public void shouldUseBoot2DockerIfDockerHostIsSetOnServerURIByDefault() { assumeThat(new OperatingSystemResolver().currentOperatingSystem().getFamily(), is(not(OperatingSystemFamily.LINUX))); Map<String, String> config = new HashMap<>(); config.put(CubeDockerConfiguration.DOCKER_URI, "tcp://dockerHost:22222"); when(extensionDef.getExtensionProperties()).thenReturn(config); when(arquillianDescriptor.extension("docker")).thenReturn(extensionDef); when(commandLineExecutor.execCommand("boot2docker", "ip")).thenReturn("192.168.0.1"); when(commandLineExecutor.execCommand("docker-machine")).thenThrow(new RuntimeException()); fire(new CubeConfiguration()); assertThat(config, hasEntry(CubeDockerConfiguration.DOCKER_URI, "tcp://192.168.0.1:22222")); assertThat(config, hasEntry(is(CubeDockerConfiguration.CERT_PATH), defaultBootToDockerCertPath())); }
@Test public void tlsVerifyShouldBeTrueInCaseOfNotSetAndDockerHostTagPresent() { assumeThat(new OperatingSystemResolver().currentOperatingSystem().getFamily(), is(not(OperatingSystemFamily.LINUX))); Map<String, String> config = new HashMap<>(); config.put(CubeDockerConfiguration.DOCKER_URI, "tcp://dockerHost:22222"); when(extensionDef.getExtensionProperties()).thenReturn(config); when(arquillianDescriptor.extension("docker")).thenReturn(extensionDef); when(commandLineExecutor.execCommand("boot2docker", "ip")).thenReturn("192.168.0.2"); when(commandLineExecutor.execCommand("docker-machine")).thenThrow(new RuntimeException()); fire(new CubeConfiguration()); assertThat(config, hasEntry(CubeDockerConfiguration.DOCKER_URI, "tcp://192.168.0.2:22222")); assertThat(config, hasEntry(CubeDockerConfiguration.TLS_VERIFY, "true")); assertThat(config, hasEntry(is(CubeDockerConfiguration.CERT_PATH), defaultBootToDockerCertPath())); }
@Test public void dockerUriConfigurationParameterShouldTakePrecedenceOverSystemEnv() { assumeThat(new OperatingSystemResolver().currentOperatingSystem().getFamily(), is(not(OperatingSystemFamily.LINUX))); String originalVar = System.getProperty(CubeDockerConfigurator.DOCKER_HOST); try { System.setProperty(CubeDockerConfigurator.DOCKER_HOST, "tcp://127.0.0.1:22222"); Map<String, String> config = new HashMap<>(); config.put(CubeDockerConfiguration.DOCKER_URI, "tcp://dockerHost:22222"); when(extensionDef.getExtensionProperties()).thenReturn(config); when(arquillianDescriptor.extension("docker")).thenReturn(extensionDef); when(extensionDef.getExtensionProperties()).thenReturn(config); when(arquillianDescriptor.extension("docker")).thenReturn(extensionDef); when(commandLineExecutor.execCommand("boot2docker", "ip")).thenReturn("192.168.0.1"); when(commandLineExecutor.execCommand("docker-machine")).thenThrow(new RuntimeException()); fire(new CubeConfiguration()); assertThat(config, hasEntry(CubeDockerConfiguration.DOCKER_URI, "tcp://192.168.0.1:22222")); assertThat(config, hasEntry(CubeDockerConfiguration.DOCKER_SERVER_IP, "192.168.0.1")); } finally { if (originalVar != null) { System.setProperty(CubeDockerConfigurator.DOCKER_HOST, originalVar); } else { System.clearProperty(CubeDockerConfigurator.DOCKER_HOST); } } }