use of io.fabric8.maven.docker.util.AnsiLogger in project docker-maven-plugin by fabric8io.
the class DockerMachineIT method testLaunchDockerMachine.
@Test
public void testLaunchDockerMachine() throws Exception {
DockerMachineConfiguration mc = new DockerMachineConfiguration("default", "true");
DockerMachine de = new DockerMachine(new AnsiLogger(new SystemStreamLog(), true, true), mc);
Assert.assertTrue(de.getConnectionParameter(null) != null);
}
use of io.fabric8.maven.docker.util.AnsiLogger in project docker-maven-plugin by fabric8io.
the class DockerAssemblyManagerTest method assemblyFiles.
@Test
public void assemblyFiles(@Injectable final MojoParameters mojoParams, @Injectable final MavenProject project, @Injectable final Assembly assembly) throws AssemblyFormattingException, ArchiveCreationException, InvalidAssemblerConfigurationException, MojoExecutionException, AssemblyReadException, IllegalAccessException {
ReflectionUtils.setVariableValueInObject(assemblyManager, "trackArchiver", trackArchiver);
new Expectations() {
{
mojoParams.getOutputDirectory();
result = "target/";
times = 3;
mojoParams.getProject();
project.getBasedir();
result = ".";
assemblyReader.readAssemblies((AssemblerConfigurationSource) any);
result = Arrays.asList(assembly);
}
};
BuildImageConfiguration buildConfig = createBuildConfig();
assemblyManager.getAssemblyFiles("testImage", buildConfig, mojoParams, new AnsiLogger(new SystemStreamLog(), true, true));
}
use of io.fabric8.maven.docker.util.AnsiLogger in project docker-maven-plugin by fabric8io.
the class MappingTrackArchiverTest method setup.
@Before
public void setup() throws IllegalAccessException {
archiver = new MappingTrackArchiver();
archiver.init(new AnsiLogger(new SystemStreamLog(), false, false), "maven");
}
use of io.fabric8.maven.docker.util.AnsiLogger in project docker-maven-plugin by fabric8io.
the class ConfigHelperTest method filter.
@Test
public void filter() throws Exception {
List<ImageConfiguration> configs = Arrays.asList(new ImageConfiguration.Builder().name("test").build());
CatchingLog logCatcher = new CatchingLog();
List<ImageConfiguration> result = ConfigHelper.resolveImages(new AnsiLogger(logCatcher, true, true), configs, createResolver(), "bla", createCustomizer());
assertEquals(0, result.size());
assertTrue(resolverCalled);
assertTrue(customizerCalled);
assertTrue(logCatcher.getWarnMessage().contains("test"));
assertTrue(logCatcher.getWarnMessage().contains("bla"));
}
use of io.fabric8.maven.docker.util.AnsiLogger in project docker-maven-plugin by fabric8io.
the class AbstractDockerMojo method execute.
/**
* Entry point for this plugin. It will set up the helper class and then calls
* {@link #executeInternal(ServiceHub)}
* which must be implemented by subclass.
*
* @throws MojoExecutionException
* @throws MojoFailureException
*/
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (!skip) {
log = new AnsiLogger(getLog(), useColor, verbose, !settings.getInteractiveMode(), getLogPrefix());
authConfigFactory.setLog(log);
LogOutputSpecFactory logSpecFactory = new LogOutputSpecFactory(useColor, logStdout, logDate);
ConfigHelper.validateExternalPropertyActivation(project, images);
// The 'real' images configuration to use (configured images + externally resolved images)
this.minimalApiVersion = initImageConfiguration(getBuildTimestamp());
DockerAccess access = null;
try {
if (isDockerAccessRequired()) {
DockerAccessFactory.DockerAccessContext dockerAccessContext = getDockerAccessContext();
access = dockerAccessFactory.createDockerAccess(dockerAccessContext);
}
ServiceHub serviceHub = serviceHubFactory.createServiceHub(project, session, access, log, logSpecFactory);
executeInternal(serviceHub);
} catch (DockerAccessException | ExecException exp) {
logException(exp);
throw new MojoExecutionException(log.errorMessage(exp.getMessage()), exp);
} catch (MojoExecutionException exp) {
logException(exp);
throw exp;
} finally {
if (access != null) {
access.shutdown();
}
}
}
}
Aggregations