Search in sources :

Example 6 with ArtifactProcessor

use of com.google.cloud.tools.jib.cli.ArtifactProcessor in project jib by google.

the class ArtifactProcessorsTest method testFromJar_standardPackaged.

@Test
public void testFromJar_standardPackaged() throws IOException, URISyntaxException {
    Path jarPath = Paths.get(Resources.getResource(STANDARD).toURI());
    when(mockJarCommand.getMode()).thenReturn(ProcessingMode.packaged);
    ArtifactProcessor processor = ArtifactProcessors.fromJar(jarPath, mockCacheDirectories, mockJarCommand, mockCommonContainerConfigCliOptions);
    verifyNoInteractions(mockCacheDirectories);
    assertThat(processor).isInstanceOf(StandardPackagedProcessor.class);
}
Also used : Path(java.nio.file.Path) AbsoluteUnixPath(com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath) ArtifactProcessor(com.google.cloud.tools.jib.cli.ArtifactProcessor) Test(org.junit.Test)

Example 7 with ArtifactProcessor

use of com.google.cloud.tools.jib.cli.ArtifactProcessor in project jib by google.

the class ArtifactProcessorsTest method testFromJar_standardExploded.

@Test
public void testFromJar_standardExploded() throws IOException, URISyntaxException {
    Path jarPath = Paths.get(Resources.getResource(STANDARD).toURI());
    Path explodedJarRoot = temporaryFolder.getRoot().toPath();
    when(mockCacheDirectories.getExplodedArtifactDirectory()).thenReturn(explodedJarRoot);
    when(mockJarCommand.getMode()).thenReturn(ProcessingMode.exploded);
    ArtifactProcessor processor = ArtifactProcessors.fromJar(jarPath, mockCacheDirectories, mockJarCommand, mockCommonContainerConfigCliOptions);
    verify(mockCacheDirectories).getExplodedArtifactDirectory();
    assertThat(processor).isInstanceOf(StandardExplodedProcessor.class);
}
Also used : Path(java.nio.file.Path) AbsoluteUnixPath(com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath) ArtifactProcessor(com.google.cloud.tools.jib.cli.ArtifactProcessor) Test(org.junit.Test)

Example 8 with ArtifactProcessor

use of com.google.cloud.tools.jib.cli.ArtifactProcessor in project jib by google.

the class ArtifactProcessorsTest method testFromJar_springBootPackaged.

@Test
public void testFromJar_springBootPackaged() throws IOException, URISyntaxException {
    Path jarPath = Paths.get(Resources.getResource(SPRING_BOOT).toURI());
    when(mockJarCommand.getMode()).thenReturn(ProcessingMode.packaged);
    ArtifactProcessor processor = ArtifactProcessors.fromJar(jarPath, mockCacheDirectories, mockJarCommand, mockCommonContainerConfigCliOptions);
    verifyNoInteractions(mockCacheDirectories);
    assertThat(processor).isInstanceOf(SpringBootPackagedProcessor.class);
}
Also used : Path(java.nio.file.Path) AbsoluteUnixPath(com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath) ArtifactProcessor(com.google.cloud.tools.jib.cli.ArtifactProcessor) Test(org.junit.Test)

Example 9 with ArtifactProcessor

use of com.google.cloud.tools.jib.cli.ArtifactProcessor in project jib by google.

the class ArtifactProcessorsTest method testFromJar_incompatibleDefaultBaseImage_baseImageSpecified.

@Test
public void testFromJar_incompatibleDefaultBaseImage_baseImageSpecified() throws URISyntaxException, IOException {
    Path jarPath = Paths.get(Resources.getResource(JAVA_18_JAR).toURI());
    when(mockJarCommand.getMode()).thenReturn(ProcessingMode.exploded);
    when(mockCommonContainerConfigCliOptions.getFrom()).thenReturn(Optional.of("base-image"));
    ArtifactProcessor processor = ArtifactProcessors.fromJar(jarPath, mockCacheDirectories, mockJarCommand, mockCommonContainerConfigCliOptions);
    verify(mockCacheDirectories).getExplodedArtifactDirectory();
    assertThat(processor).isInstanceOf(StandardExplodedProcessor.class);
}
Also used : Path(java.nio.file.Path) AbsoluteUnixPath(com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath) ArtifactProcessor(com.google.cloud.tools.jib.cli.ArtifactProcessor) Test(org.junit.Test)

Example 10 with ArtifactProcessor

use of com.google.cloud.tools.jib.cli.ArtifactProcessor in project jib by google.

the class ArtifactProcessorsTest method testFromWar_jettyBaseImageSpecified_success.

@Test
public void testFromWar_jettyBaseImageSpecified_success() throws InvalidImageReferenceException {
    when(mockCommonContainerConfigCliOptions.isJettyBaseimage()).thenReturn(true);
    ArtifactProcessor processor = ArtifactProcessors.fromWar(Paths.get("my-app.war"), mockCacheDirectories, mockWarCommand, mockCommonContainerConfigCliOptions);
    assertThat(processor).isInstanceOf(StandardWarExplodedProcessor.class);
}
Also used : ArtifactProcessor(com.google.cloud.tools.jib.cli.ArtifactProcessor) Test(org.junit.Test)

Aggregations

ArtifactProcessor (com.google.cloud.tools.jib.cli.ArtifactProcessor)14 Test (org.junit.Test)14 AbsoluteUnixPath (com.google.cloud.tools.jib.api.buildplan.AbsoluteUnixPath)10 Path (java.nio.file.Path)10