Tabnine Logo
Image.toImageRef
Code IndexAdd Tabnine to your IDE (free)

How to use
toImageRef
method
in
org.arquillian.cube.docker.impl.client.config.Image

Best Java code snippets using org.arquillian.cube.docker.impl.client.config.Image.toImageRef (Showing top 15 results out of 315)

origin: org.arquillian.cube/arquillian-cube-docker

private String getImageName(CubeContainer containerConfiguration, String name) {
  String image;
  if (containerConfiguration.getImage() != null) {
    image = containerConfiguration.getImage().toImageRef();
  } else {
    if (containerConfiguration.getBuildImage() != null) {
      BuildImage buildImage = containerConfiguration.getBuildImage();
      if (buildImage.getDockerfileLocation() != null) {
        Map<String, Object> params = new HashMap<String, Object>(); //(containerConfiguration, BUILD_IMAGE);
        params.put("noCache", buildImage.isNoCache());
        params.put("remove", buildImage.isRemove());
        params.put("dockerFileLocation", buildImage.getDockerfileLocation());
        params.put("dockerFileName", buildImage.getDockerfileName());
        image = this.buildImage(buildImage.getDockerfileLocation(), name, params);
      } else {
        throw new IllegalArgumentException(
          "A tar file with Dockerfile on root or a directory with a Dockerfile should be provided.");
      }
    } else {
      throw new IllegalArgumentException(
        String.format(
          "Current configuration file does not contain %s nor %s parameter and one of both should be provided.",
          IMAGE, BUILD_IMAGE));
    }
  }
  return image;
}
origin: arquillian/arquillian-cube

private String getImageName(CubeContainer containerConfiguration, String name) {
  String image;
  if (containerConfiguration.getImage() != null) {
    image = containerConfiguration.getImage().toImageRef();
  } else {
    if (containerConfiguration.getBuildImage() != null) {
      BuildImage buildImage = containerConfiguration.getBuildImage();
      if (buildImage.getDockerfileLocation() != null) {
        Map<String, Object> params = new HashMap<String, Object>(); //(containerConfiguration, BUILD_IMAGE);
        params.put("noCache", buildImage.isNoCache());
        params.put("remove", buildImage.isRemove());
        params.put("dockerFileLocation", buildImage.getDockerfileLocation());
        params.put("dockerFileName", buildImage.getDockerfileName());
        image = this.buildImage(buildImage.getDockerfileLocation(), name, params);
      } else {
        throw new IllegalArgumentException(
          "A tar file with Dockerfile on root or a directory with a Dockerfile should be provided.");
      }
    } else {
      throw new IllegalArgumentException(
        String.format(
          "Current configuration file does not contain %s nor %s parameter and one of both should be provided.",
          IMAGE, BUILD_IMAGE));
    }
  }
  return image;
}
origin: arquillian/arquillian-cube

private void testResolvePlaceholders(String dockerComposeFile, String expectedImageName) throws URISyntaxException, IOException {
 URI readEnvsDockerCompose = DockerComposeConverterTest.class.getResource(dockerComposeFile).toURI();
 DockerComposeConverter dockerComposeConverter = DockerComposeConverter.create(Paths.get(readEnvsDockerCompose));
 DockerCompositions convert = dockerComposeConverter.convert();
 CubeContainer webapp = convert.get("webapp2");
 assertThat(webapp.getImage(), is(notNullValue()));
 final String image = webapp.getImage().toImageRef();
 assertThat(image, is(expectedImageName));
}
origin: arquillian/arquillian-cube

@Test
public void should_load_cube_configuration_from_cube_file_if_no_file_is_provided() {
  Map<String, String> parameters = new HashMap<String, String>();
  parameters.put("serverVersion", "1.13");
  parameters.put("serverUri", "http://localhost:25123");
  parameters.put("definitionFormat", DefinitionFormat.CUBE.name());
  CubeDockerConfiguration cubeConfiguration = CubeDockerConfiguration.fromMap(parameters, null);
  DockerCompositions dockerContainersContent = cubeConfiguration.getDockerContainersContent();
  CubeContainer actualTomcat = dockerContainersContent.get("tomcat");
  assertThat(actualTomcat, is(notNullValue()));
  String image = actualTomcat.getImage().toImageRef();
  assertThat(image, is("tomcat:7.0"));
}
origin: arquillian/arquillian-cube

@Test
public void should_parse_and_load_configuration_file_from_container_configuration_file() throws IOException {
  File newFile = testFolder.newFile("config.yaml");
  Files.write(Paths.get(newFile.toURI()), CONTENT.getBytes());
  Map<String, String> parameters = new HashMap<String, String>();
  parameters.put("serverVersion", "1.13");
  parameters.put("serverUri", "http://localhost:25123");
  parameters.put("definitionFormat", DefinitionFormat.CUBE.name());
  parameters.put("dockerContainersFile", newFile.toURI().toString());
  CubeDockerConfiguration cubeConfiguration = CubeDockerConfiguration.fromMap(parameters, null);
  assertThat(cubeConfiguration.getDockerServerUri(), is("http://localhost:25123"));
  assertThat(cubeConfiguration.getDockerServerVersion(), is("1.13"));
  DockerCompositions dockerContainersContent = cubeConfiguration.getDockerContainersContent();
  CubeContainer actualTomcat = dockerContainersContent.get("tomcat");
  assertThat(actualTomcat, is(notNullValue()));
  String image = actualTomcat.getImage().toImageRef();
  assertThat(image, is("tutum/tomcat:7.0"));
}
origin: arquillian/arquillian-cube

@Test
public void should_parse_and_load_configuration_file_from_container_configuration_file_and_property_set_file()
  throws IOException {
  File newFile = testFolder.newFile("config.yml");
  Files.write(Paths.get(newFile.toURI()), CONTENT.getBytes());
  File newFile2 = testFolder.newFile("config.demo.yml");
  Files.write(Paths.get(newFile2.toURI()), CONTENT2.getBytes());
  System.setProperty("cube.environment", "demo");
  Map<String, String> parameters = new HashMap<String, String>();
  parameters.put("serverVersion", "1.13");
  parameters.put("serverUri", "http://localhost:25123");
  parameters.put("definitionFormat", DefinitionFormat.CUBE.name());
  parameters.put("dockerContainersFile", newFile.toURI().toString());
  CubeDockerConfiguration cubeConfiguration = CubeDockerConfiguration.fromMap(parameters, null);
  assertThat(cubeConfiguration.getDockerServerUri(), is("http://localhost:25123"));
  assertThat(cubeConfiguration.getDockerServerVersion(), is("1.13"));
  DockerCompositions dockerContainersContent = cubeConfiguration.getDockerContainersContent();
  CubeContainer actualTomcat = dockerContainersContent.get("tomcat");
  assertThat(actualTomcat, is(notNullValue()));
  String image = actualTomcat.getImage().toImageRef();
  assertThat(image, is("tutum/tomcat:7.0"));
  assertThat(dockerContainersContent.get("tomcat2"), is(notNullValue()));
}
origin: arquillian/arquillian-cube

@Test
public void should_parse_and_load_configuration_file() {
  Map<String, String> parameters = new HashMap<String, String>();
  parameters.put("serverVersion", "1.13");
  parameters.put("serverUri", "http://localhost:25123");
  parameters.put("definitionFormat", DefinitionFormat.CUBE.name());
  parameters.put("dockerContainers", CONTENT);
  CubeDockerConfiguration cubeConfiguration = CubeDockerConfiguration.fromMap(parameters, null);
  assertThat(cubeConfiguration.getDockerServerUri(), is("http://localhost:25123"));
  assertThat(cubeConfiguration.getDockerServerVersion(), is("1.13"));
  DockerCompositions dockerContainersContent = cubeConfiguration.getDockerContainersContent();
  CubeContainer actualTomcat = dockerContainersContent.get("tomcat");
  assertThat(actualTomcat, is(notNullValue()));
  String image = actualTomcat.getImage().toImageRef();
  assertThat(image, is("tutum/tomcat:7.0"));
}
origin: arquillian/arquillian-cube

@Test
public void should_parse_and_load_configuration_from_container_configuration_resource() throws IOException {
  Map<String, String> parameters = new HashMap<String, String>();
  parameters.put("serverVersion", "1.13");
  parameters.put("serverUri", "http://localhost:25123");
  parameters.put("definitionFormat", DefinitionFormat.CUBE.name());
  parameters.put("dockerContainersResource", "test-topologies/topology1.yaml");
  CubeDockerConfiguration cubeConfiguration = CubeDockerConfiguration.fromMap(parameters, null);
  assertThat(cubeConfiguration.getDockerServerUri(), is("http://localhost:25123"));
  assertThat(cubeConfiguration.getDockerServerVersion(), is("1.13"));
  DockerCompositions dockerContainersContent = cubeConfiguration.getDockerContainersContent();
  CubeContainer actualTomcat = dockerContainersContent.get("tomcat");
  assertThat(actualTomcat, is(notNullValue()));
  String image = actualTomcat.getImage().toImageRef();
  assertThat(image, is("tutum/tomcat:7.0"));
}
origin: arquillian/arquillian-cube

@Test
public void shouldStartAContainerObjectDefinedAsImage() {
  CubeContainerObjectTestEnricher cubeContainerObjectTestEnricher = new CubeContainerObjectTestEnricher();
  cubeContainerObjectTestEnricher.containerObjectFactoryInstance = () -> dockerContainerObjectFactory;
  when(serviceLoader.all(TestEnricher.class)).thenReturn(Arrays.asList(cubeContainerObjectTestEnricher));
  FourthInjectableTest injectableTest = new FourthInjectableTest();
  cubeContainerObjectTestEnricher.enrich(injectableTest);
  final org.arquillian.cube.spi.Cube<?> image = cubeRegistry.getCube("image");
  assertThat(image, is(notNullValue()));
  assertThat(image.hasMetadata(IsContainerObject.class), is(true));
  assertThat(image.getMetadata(IsContainerObject.class).getTestClass().getName(), is(FourthInjectableTest.class.getName()));
  verify(cubeController, times(1)).start("image");
  verify(cubeController, times(1)).create("image");
  DockerCube dockerCube = (DockerCube) image;
  assertThat(dockerCube.configuration().getImage().toImageRef(), is("tomee:8-jre-1.7.2-webprofile"));
}
origin: arquillian/arquillian-cube

@Test
public void shouldStartAContainerObjectDefinedUsingImage() {
  final AtomicReference<DockerCube> cubeRef = new AtomicReference<>();
  try {
    TestContainerObjectDefinedUsingImage containerObject = new DockerContainerObjectBuilder<TestContainerObjectDefinedUsingImage>(dockerClientExecutor, cubeController, cubeRegistry)
        .withContainerObjectClass(TestContainerObjectDefinedUsingImage.class)
        .onCubeCreated(cubeRef::set)
        .build();
    assertThat(containerObject, is(notNullValue()));
  } catch (IllegalAccessException|InvocationTargetException|IOException e) {
    fail();
  }
  DockerCube cube = cubeRef.get();
  assertThat(cube, is(notNullValue()));
  assertThat(cube.hasMetadata(IsContainerObject.class), is(true));
  assertThat(cube.getMetadata(IsContainerObject.class).getTestClass(), is(nullValue()));
  assertThat(cube.configuration().getImage().toImageRef(), is(BASE_IMAGE));
  verify(cubeController, times(1)).create("containerDefinedUsingImage");
  verify(cubeController, times(1)).start("containerDefinedUsingImage");
}
origin: arquillian/arquillian-cube

@Test
public void shouldStartAContainerObjectDefinedAsImageAndEnvironmentVariables() {
  CubeContainerObjectTestEnricher cubeContainerObjectTestEnricher = new CubeContainerObjectTestEnricher();
  cubeContainerObjectTestEnricher.containerObjectFactoryInstance = () -> dockerContainerObjectFactory;
  when(serviceLoader.all(TestEnricher.class)).thenReturn(Arrays.asList(cubeContainerObjectTestEnricher));
  FifthInjectableTest injectableTest = new FifthInjectableTest();
  cubeContainerObjectTestEnricher.enrich(injectableTest);
  final org.arquillian.cube.spi.Cube<?> image = cubeRegistry.getCube("image");
  assertThat(image, is(notNullValue()));
  assertThat(image.hasMetadata(IsContainerObject.class), is(true));
  assertThat(image.getMetadata(IsContainerObject.class).getTestClass().getName(), is(FifthInjectableTest.class.getName()));
  verify(cubeController, times(1)).start("image");
  verify(cubeController, times(1)).create("image");
  DockerCube dockerCube = (DockerCube) image;
  assertThat(dockerCube.configuration().getImage().toImageRef(), is("tomee:8-jre-1.7.2-webprofile"));
  assertThat(dockerCube.configuration().getEnv(), hasItems("a=b", "c=d"));
}
origin: arquillian/arquillian-cube

@Test
public void shouldStartAContainerObjectDefinedAsImageAndVolumesVariables() {
  CubeContainerObjectTestEnricher cubeContainerObjectTestEnricher = new CubeContainerObjectTestEnricher();
  cubeContainerObjectTestEnricher.containerObjectFactoryInstance = () -> dockerContainerObjectFactory;
  when(serviceLoader.all(TestEnricher.class)).thenReturn(Arrays.asList(cubeContainerObjectTestEnricher));
  SixthInjectableTest injectableTest = new SixthInjectableTest();
  cubeContainerObjectTestEnricher.enrich(injectableTest);
  final org.arquillian.cube.spi.Cube<?> image = cubeRegistry.getCube("image");
  assertThat(image, is(notNullValue()));
  assertThat(image.hasMetadata(IsContainerObject.class), is(true));
  assertThat(image.getMetadata(IsContainerObject.class).getTestClass().getName(), is(SixthInjectableTest.class.getName()));
  verify(cubeController, times(1)).start("image");
  verify(cubeController, times(1)).create("image");
  DockerCube dockerCube = (DockerCube) image;
  assertThat(dockerCube.configuration().getImage().toImageRef(), is("tomee:8-jre-1.7.2-webprofile"));
  assertThat(dockerCube.configuration().getBinds(), hasItems("/mypath:/containerPath:Z", "/mypath2:/containerPath2:Z"));
}
origin: arquillian/arquillian-cube

@Test
public void should_be_able_to_extend_and_override_toplevel() throws Exception {
  String config =
    "tomcat6:\n" +
      "  image: tutum/tomcat:6.0\n" +
      "  exposedPorts: [8089/tcp]\n" +
      "  await:\n" +
      "    strategy: static\n" +
      "    ip: localhost\n" +
      "    ports: [8080, 8089]\n" +
      "tomcat7:\n" +
      "  extends: tomcat6\n" +
      "  image: tutum/tomcat:7.0\n";
  Map<String, String> parameters = new HashMap<String, String>();
  parameters.put("dockerContainers", config);
  parameters.put("definitionFormat", DefinitionFormat.CUBE.name());
  CubeDockerConfiguration cubeConfiguration = CubeDockerConfiguration.fromMap(parameters, null);
  CubeContainer tomcat7 = cubeConfiguration.getDockerContainersContent().get("tomcat7");
  Assert.assertEquals("tutum/tomcat:7.0", tomcat7.getImage().toImageRef());
  Assert.assertTrue(tomcat7.getAwait() != null);
  Assert.assertEquals("8089/tcp", tomcat7.getExposedPorts().iterator().next().toString());
}
origin: arquillian/arquillian-cube

@Test
public void shouldStartAContainerObjectDefinedUsingImageAndVolumes() {
  final AtomicReference<DockerCube> cubeRef = new AtomicReference<>();
  try {
    CubeContainer ccconfig = new CubeContainer();
    ccconfig.setBinds(Collections.singleton("/mypath3:/containerPath3:Z"));
    CubeContainerObjectConfiguration ccoconfig = new CubeContainerObjectConfiguration(ccconfig);
    TestContainerObjectDefinedUsingImageAndVolumes containerObject = new DockerContainerObjectBuilder<TestContainerObjectDefinedUsingImageAndVolumes>(dockerClientExecutor, cubeController, cubeRegistry)
        .withContainerObjectClass(TestContainerObjectDefinedUsingImageAndVolumes.class)
        .withContainerObjectConfiguration(ccoconfig)
        .onCubeCreated(cubeRef::set)
        .build();
    assertThat(containerObject, is(notNullValue()));
  } catch (IllegalAccessException|InvocationTargetException|IOException e) {
    fail();
  }
  DockerCube cube = cubeRef.get();
  assertThat(cube, is(notNullValue()));
  assertThat(cube.hasMetadata(IsContainerObject.class), is(true));
  assertThat(cube.getMetadata(IsContainerObject.class).getTestClass(), is(nullValue()));
  assertThat(cube.configuration().getImage().toImageRef(), is(BASE_IMAGE));
  assertThat(cube.configuration().getBinds(), hasItems("/mypath:/containerPath:Z", "/mypath2:/containerPath2:Z", "/mypath3:/containerPath3:Z"));
  verify(cubeController, times(1)).create("containerWithVolumes");
  verify(cubeController, times(1)).start("containerWithVolumes");
}
origin: arquillian/arquillian-cube

@Test
public void shouldStartAContainerObjectDefinedUsingImageAndEnvironmentVariables() {
  final AtomicReference<DockerCube> cubeRef = new AtomicReference<>();
  try {
    CubeContainer ccconfig = new CubeContainer();
    ccconfig.setEnv(Collections.singleton("e=f"));
    CubeContainerObjectConfiguration ccoconfig = new CubeContainerObjectConfiguration(ccconfig);
    TestContainerObjectDefinedUsingImageAndEnvironmentVariables containerObject = new DockerContainerObjectBuilder<TestContainerObjectDefinedUsingImageAndEnvironmentVariables>(dockerClientExecutor, cubeController, cubeRegistry)
        .withContainerObjectClass(TestContainerObjectDefinedUsingImageAndEnvironmentVariables.class)
        .withContainerObjectConfiguration(ccoconfig)
        .onCubeCreated(cubeRef::set)
        .build();
    assertThat(containerObject, is(notNullValue()));
  } catch (IllegalAccessException|InvocationTargetException|IOException e) {
    fail();
  }
  DockerCube cube = cubeRef.get();
  assertThat(cube, is(notNullValue()));
  assertThat(cube.hasMetadata(IsContainerObject.class), is(true));
  assertThat(cube.getMetadata(IsContainerObject.class).getTestClass(), is(nullValue()));
  assertThat(cube.configuration().getImage().toImageRef(), is(BASE_IMAGE));
  assertThat(cube.configuration().getEnv(), hasItems("a=b", "c=d", "e=f"));
  verify(cubeController, times(1)).create("containerWithEnvironmentVariables");
  verify(cubeController, times(1)).start("containerWithEnvironmentVariables");
}
org.arquillian.cube.docker.impl.client.configImagetoImageRef

Popular methods of Image

  • getName
  • valueOf
  • getTag
  • toString
  • <init>
  • isPort

Popular in Java

  • Running tasks concurrently on multiple threads
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • requestLocationUpdates (LocationManager)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now