Search in sources :

Example 1 with StartContainerExecutor

use of io.fabric8.maven.docker.service.helper.StartContainerExecutor in project docker-maven-plugin by fabric8io.

the class StartContainerExecutorTest method getExposedPropertyKeyPart_withRunConfig.

@Test
public void getExposedPropertyKeyPart_withRunConfig() {
    // Given
    final RunImageConfiguration runConfig = new RunImageConfiguration.Builder().exposedPropertyKey("key").build();
    final ImageConfiguration imageConfig = new ImageConfiguration.Builder().name("name").alias("alias").runConfig(runConfig).build();
    final StartContainerExecutor executor = new StartContainerExecutor.Builder().imageConfig(imageConfig).build();
    // When
    final String actual = executor.getExposedPropertyKeyPart();
    // Then
    assertEquals("key", actual);
}
Also used : ImageConfiguration(io.fabric8.maven.docker.config.ImageConfiguration) RunImageConfiguration(io.fabric8.maven.docker.config.RunImageConfiguration) RunImageConfiguration(io.fabric8.maven.docker.config.RunImageConfiguration) Test(org.junit.Test)

Example 2 with StartContainerExecutor

use of io.fabric8.maven.docker.service.helper.StartContainerExecutor in project docker-maven-plugin by fabric8io.

the class StartContainerExecutorTest method showLogs_withLogConfigEnabled.

@Test
public void showLogs_withLogConfigEnabled() {
    // Given
    final LogConfiguration logConfig = new LogConfiguration.Builder().enabled(true).build();
    final RunImageConfiguration runConfig = new RunImageConfiguration.Builder().exposedPropertyKey("key").log(logConfig).build();
    final ImageConfiguration imageConfig = new ImageConfiguration.Builder().name("name").alias("alias").runConfig(runConfig).build();
    final StartContainerExecutor executor = new StartContainerExecutor.Builder().imageConfig(imageConfig).build();
    // When
    final boolean actual = executor.showLogs();
    // Then
    assertTrue(actual);
}
Also used : ImageConfiguration(io.fabric8.maven.docker.config.ImageConfiguration) RunImageConfiguration(io.fabric8.maven.docker.config.RunImageConfiguration) LogConfiguration(io.fabric8.maven.docker.config.LogConfiguration) RunImageConfiguration(io.fabric8.maven.docker.config.RunImageConfiguration) Test(org.junit.Test)

Example 3 with StartContainerExecutor

use of io.fabric8.maven.docker.service.helper.StartContainerExecutor in project docker-maven-plugin by fabric8io.

the class StartContainerExecutorTest method showLogs_withoutLogConfigButFollowTrue.

@Test
public void showLogs_withoutLogConfigButFollowTrue() {
    // Given
    final RunImageConfiguration runConfig = new RunImageConfiguration.Builder().exposedPropertyKey("key").build();
    final ImageConfiguration imageConfig = new ImageConfiguration.Builder().name("name").alias("alias").runConfig(runConfig).build();
    final StartContainerExecutor executor = new StartContainerExecutor.Builder().imageConfig(imageConfig).follow(true).build();
    // When
    final boolean actual = executor.showLogs();
    // Then
    assertTrue(actual);
}
Also used : ImageConfiguration(io.fabric8.maven.docker.config.ImageConfiguration) RunImageConfiguration(io.fabric8.maven.docker.config.RunImageConfiguration) RunImageConfiguration(io.fabric8.maven.docker.config.RunImageConfiguration) Test(org.junit.Test)

Example 4 with StartContainerExecutor

use of io.fabric8.maven.docker.service.helper.StartContainerExecutor in project docker-maven-plugin by fabric8io.

the class StartContainerExecutorTest method showLogs_withShowLogsMatchRandomImage.

@Test
public void showLogs_withShowLogsMatchRandomImage() {
    // Given
    final ImageConfiguration imageConfig = new ImageConfiguration.Builder().name("name").alias("alias").build();
    final StartContainerExecutor executor = new StartContainerExecutor.Builder().showLogs("some_random_string").imageConfig(imageConfig).build();
    // When
    final boolean actual = executor.showLogs();
    // Then
    assertFalse(actual);
}
Also used : ImageConfiguration(io.fabric8.maven.docker.config.ImageConfiguration) RunImageConfiguration(io.fabric8.maven.docker.config.RunImageConfiguration) Test(org.junit.Test)

Example 5 with StartContainerExecutor

use of io.fabric8.maven.docker.service.helper.StartContainerExecutor in project docker-maven-plugin by fabric8io.

the class StartContainerExecutorTest method showLogs_withLogConfigDisabled.

@Test
public void showLogs_withLogConfigDisabled() {
    // Given
    final LogConfiguration logConfig = new LogConfiguration.Builder().enabled(false).build();
    final RunImageConfiguration runConfig = new RunImageConfiguration.Builder().exposedPropertyKey("key").log(logConfig).build();
    final ImageConfiguration imageConfig = new ImageConfiguration.Builder().name("name").alias("alias").runConfig(runConfig).build();
    final StartContainerExecutor executor = new StartContainerExecutor.Builder().imageConfig(imageConfig).build();
    // When
    final boolean actual = executor.showLogs();
    // Then
    assertFalse(actual);
}
Also used : ImageConfiguration(io.fabric8.maven.docker.config.ImageConfiguration) RunImageConfiguration(io.fabric8.maven.docker.config.RunImageConfiguration) LogConfiguration(io.fabric8.maven.docker.config.LogConfiguration) RunImageConfiguration(io.fabric8.maven.docker.config.RunImageConfiguration) Test(org.junit.Test)

Aggregations

RunImageConfiguration (io.fabric8.maven.docker.config.RunImageConfiguration)10 Test (org.junit.Test)9 ImageConfiguration (io.fabric8.maven.docker.config.ImageConfiguration)8 PortMapping (io.fabric8.maven.docker.access.PortMapping)2 LogConfiguration (io.fabric8.maven.docker.config.LogConfiguration)2 RunService (io.fabric8.maven.docker.service.RunService)2 Properties (java.util.Properties)2 LogDispatcher (io.fabric8.maven.docker.log.LogDispatcher)1 LogOutputSpecFactory (io.fabric8.maven.docker.log.LogOutputSpecFactory)1 ContainerDetails (io.fabric8.maven.docker.model.ContainerDetails)1 QueryService (io.fabric8.maven.docker.service.QueryService)1 StartContainerExecutor (io.fabric8.maven.docker.service.helper.StartContainerExecutor)1 GavLabel (io.fabric8.maven.docker.util.GavLabel)1 File (java.io.File)1 Date (java.util.Date)1 Expectations (mockit.Expectations)1