DockerUtils { public static String findDefaultImageVersion( String rawVersion ) { String rbcfVersion = rawVersion; if( rbcfVersion == null || rbcfVersion.toLowerCase().endsWith( "snapshot" )) rbcfVersion = LATEST; return rbcfVersion; } private  DockerUtils(); static DockerClient createDockerClient( Map<String,String> targetProperties ); static void deleteImageIfItExists( String imageId, DockerClient dockerClient ); static Image findImageByIdOrByTag( String name, DockerClient dockerClient ); static Image findImageById( String imageId, List<Image> images ); static Image findImageByTag( String imageTag, List<Image> images ); static Container findContainerByIdOrByName( String name, DockerClient dockerClient ); static ContainerState getContainerState( String containerId, DockerClient dockerClient ); static void configureOptions( Map<String,String> options, CreateContainerCmd cmd ); static Object prepareParameter( String rawValue, Class<?> clazz ); static boolean extractBoolean( Boolean bool ); static String findDefaultImageVersion( String rawVersion ); static String buildContainerNameFrom( String scopedInstancePath, String applicationName ); static final String LATEST; }
@Test public void testFindDefaultImageVersion() { Assert.assertEquals( DockerUtils.LATEST, DockerUtils.findDefaultImageVersion( null )); Assert.assertEquals( DockerUtils.LATEST, DockerUtils.findDefaultImageVersion( "0.1-snapshot" )); Assert.assertEquals( DockerUtils.LATEST, DockerUtils.findDefaultImageVersion( "1-SNAPshot" )); Assert.assertEquals( "0.8", DockerUtils.findDefaultImageVersion( "0.8" )); Assert.assertEquals( "0.8.1", DockerUtils.findDefaultImageVersion( "0.8.1" )); }