@Test(expected = UnsatisfiedRequirementException.class) public void testDockerRequirementCheckWhenDockerURLIsEmpty() throws UnsatisfiedRequirementException { Map<String, String> configMap = new HashMap<>(); configMap.put(CubeDockerConfiguration.DOCKER_URI, ""); when(configResolver.resolve(anyMap())).thenReturn(configMap); DockerRequirement requirement = new DockerRequirement(commandLineExecutor, configResolver); requirement.check(null); }
@Override public void check(RequiresDocker context) throws UnsatisfiedRequirementException { try { Map<String, String> config = resolver.resolve(new HashMap<String, String>()); String serverUrl = config.get(CubeDockerConfiguration.DOCKER_URI); if (Strings.isNullOrEmpty(serverUrl)) { throw new UnsatisfiedRequirementException("Could not resolve the docker server url."); } else if (!isDockerRunning(serverUrl)) { throw new UnsatisfiedRequirementException("No server is running on url:[" + serverUrl + "]."); } } catch (ExecutionException e) { throw new UnsatisfiedRequirementException("Cannot execute docker command."); } }
DockerRequirement implements Constraint<RequiresDocker> { @Override public void check(RequiresDocker context) throws UnsatisfiedRequirementException { try { Map<String, String> config = resolver.resolve(new HashMap<String, String>()); String serverUrl = config.get(CubeDockerConfiguration.DOCKER_URI); if (Strings.isNullOrEmpty(serverUrl)) { throw new UnsatisfiedRequirementException("Could not resolve the docker server url."); } else if (!isDockerRunning(serverUrl)) { throw new UnsatisfiedRequirementException("No server is running on url:[" + serverUrl + "]."); } } catch (ExecutionException e) { throw new UnsatisfiedRequirementException("Cannot execute docker command."); } } }
DockerRequirement implements Constraint<RequiresDocker> { @Override public void check(RequiresDocker context) throws UnsatisfiedRequirementException { try { Map<String, String> config = resolver.resolve(new HashMap<String, String>()); String serverUrl = config.get(CubeDockerConfiguration.DOCKER_URI); if (Strings.isNullOrEmpty(serverUrl)) { throw new UnsatisfiedRequirementException("Could not resolve the docker server url."); } else if (!isDockerRunning(serverUrl)) { throw new UnsatisfiedRequirementException("No server is running on url:[" + serverUrl + "]."); } } catch (ExecutionException e) { throw new UnsatisfiedRequirementException("Cannot execute docker command."); } } DockerRequirement();  DockerRequirement(CommandLineExecutor commandLineExecutor, CubeDockerConfigurationResolver resolver); }
DockerRequirement implements Constraint<RequiresDocker> { @Override public void check(RequiresDocker context) throws UnsatisfiedRequirementException { try { Map<String, String> config = resolver.resolve(new HashMap<String, String>()); String serverUrl = config.get(CubeDockerConfiguration.DOCKER_URI); if (Strings.isNullOrEmpty(serverUrl)) { throw new UnsatisfiedRequirementException("Could not resolve the docker server url."); } else if (!isDockerRunning(serverUrl)) { throw new UnsatisfiedRequirementException("No server is running on url:[" + serverUrl + "]."); } } catch (ExecutionException e) { throw new UnsatisfiedRequirementException("Cannot execute docker command."); } } DockerRequirement();  DockerRequirement(CommandLineExecutor commandLineExecutor, CubeDockerConfigurationResolver resolver); @Override void check(RequiresDocker context); }
DockerRequirement implements Constraint<RequiresDocker> { @Override public void check(RequiresDocker context) throws UnsatisfiedRequirementException { try { Map<String, String> config = resolver.resolve(new HashMap<String, String>()); String serverUrl = config.get(CubeDockerConfiguration.DOCKER_URI); if (Strings.isNullOrEmpty(serverUrl)) { throw new UnsatisfiedRequirementException("Could not resolve the docker server url."); } else if (!isDockerRunning(serverUrl)) { throw new UnsatisfiedRequirementException("No server is running on url:[" + serverUrl + "]."); } } catch (ExecutionException e) { throw new UnsatisfiedRequirementException("Cannot execute docker command."); } } DockerRequirement();  DockerRequirement(CommandLineExecutor commandLineExecutor, CubeDockerConfigurationResolver resolver); @Override void check(RequiresDocker context);  }