Search in sources :

Example 1 with SystemStreamLog

use of org.apache.maven.plugin.logging.SystemStreamLog 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);
}
Also used : DockerMachine(io.fabric8.maven.docker.access.DockerMachine) SystemStreamLog(org.apache.maven.plugin.logging.SystemStreamLog) DockerMachineConfiguration(io.fabric8.maven.docker.config.DockerMachineConfiguration) AnsiLogger(io.fabric8.maven.docker.util.AnsiLogger) Test(org.junit.Test)

Example 2 with SystemStreamLog

use of org.apache.maven.plugin.logging.SystemStreamLog 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));
}
Also used : Expectations(mockit.Expectations) SystemStreamLog(org.apache.maven.plugin.logging.SystemStreamLog) AnsiLogger(io.fabric8.maven.docker.util.AnsiLogger) BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) Test(org.junit.Test)

Example 3 with SystemStreamLog

use of org.apache.maven.plugin.logging.SystemStreamLog 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");
}
Also used : SystemStreamLog(org.apache.maven.plugin.logging.SystemStreamLog) AnsiLogger(io.fabric8.maven.docker.util.AnsiLogger) Before(org.junit.Before)

Example 4 with SystemStreamLog

use of org.apache.maven.plugin.logging.SystemStreamLog in project tycho by eclipse.

the class OsgiCompilerTest method testWarningAndErrorMessages.

public void testWarningAndErrorMessages() throws Exception {
    File basedir = getBasedir("projects/compilermessages");
    List<MavenProject> projects = getSortedProjects(basedir, null);
    MavenProject project = projects.get(0);
    AbstractOsgiCompilerMojo mojo = getMojo(projects, project);
    final List<CharSequence> warnings = new ArrayList<>();
    mojo.setLog(new SystemStreamLog() {

        @Override
        public void warn(CharSequence content) {
            warnings.add(content);
        }
    });
    try {
        mojo.execute();
        fail("compilation failure expected");
    } catch (CompilationFailureException e) {
        String message = e.getLongMessage();
        assertThat(message, containsString("3 problems (1 error, 2 warnings)"));
        // 1 error
        assertThat(message, containsString("Test.java:[23"));
        assertThat(message, containsString("System.foo();"));
    }
    // 2 warnings
    List<String> expectedWarnings = asList(// 
    "Test.java:[19", "Test.java:[21");
    assertEquals(expectedWarnings.size(), warnings.size());
    for (int i = 0; i < warnings.size(); i++) {
        String warning = (String) warnings.get(i);
        String expectedWarning = expectedWarnings.get(i);
        assertThat(warning, containsString(expectedWarning));
    }
}
Also used : SystemStreamLog(org.apache.maven.plugin.logging.SystemStreamLog) ArrayList(java.util.ArrayList) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) CompilationFailureException(copied.org.apache.maven.plugin.CompilationFailureException) MavenProject(org.apache.maven.project.MavenProject) AbstractOsgiCompilerMojo(org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo) File(java.io.File)

Example 5 with SystemStreamLog

use of org.apache.maven.plugin.logging.SystemStreamLog in project tycho by eclipse.

the class OsgiCompilerTest method testCompilerArgs.

public void testCompilerArgs() throws Exception {
    File basedir = getBasedir("projects/compiler-args");
    List<MavenProject> projects = getSortedProjects(basedir, null);
    MavenProject project = projects.get(0);
    AbstractOsgiCompilerMojo mojo = getMojo(projects, project);
    final List<CharSequence> warnings = new ArrayList<>();
    mojo.setLog(new SystemStreamLog() {

        @Override
        public void warn(CharSequence content) {
            warnings.add(content);
        }
    });
    try {
        mojo.execute();
        fail("compilation failure expected");
    } catch (CompilationFailureException e) {
        String message = e.getLongMessage();
        assertThat(message, containsString("2 problems (1 error, 1 warning)"));
        // 1 error
        assertThat(message, containsString("unused"));
    }
    // 1 warning
    assertThat((String) warnings.iterator().next(), containsString("is boxed"));
}
Also used : SystemStreamLog(org.apache.maven.plugin.logging.SystemStreamLog) MavenProject(org.apache.maven.project.MavenProject) ArrayList(java.util.ArrayList) AbstractOsgiCompilerMojo(org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) File(java.io.File) CompilationFailureException(copied.org.apache.maven.plugin.CompilationFailureException)

Aggregations

SystemStreamLog (org.apache.maven.plugin.logging.SystemStreamLog)10 File (java.io.File)6 ArrayList (java.util.ArrayList)5 MavenProject (org.apache.maven.project.MavenProject)5 AbstractOsgiCompilerMojo (org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo)5 AnsiLogger (io.fabric8.maven.docker.util.AnsiLogger)3 CompilationFailureException (copied.org.apache.maven.plugin.CompilationFailureException)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Test (org.junit.Test)2 DockerMachine (io.fabric8.maven.docker.access.DockerMachine)1 BuildImageConfiguration (io.fabric8.maven.docker.config.BuildImageConfiguration)1 DockerMachineConfiguration (io.fabric8.maven.docker.config.DockerMachineConfiguration)1 Expectations (mockit.Expectations)1 JqlQueryBuilder (org.apache.maven.plugins.jira.JqlQueryBuilder)1 Before (org.junit.Before)1