Search in sources :

Example 1 with BuildPropertiesImpl

use of org.eclipse.tycho.core.shared.BuildPropertiesImpl in project tycho by eclipse.

the class BuildPropertiesParserForTesting method parse.

@Override
public BuildProperties parse(File baseDir) {
    Properties props = new Properties();
    readBuildProperties(baseDir, props);
    return new BuildPropertiesImpl(props);
}
Also used : BuildProperties(org.eclipse.tycho.core.shared.BuildProperties) Properties(java.util.Properties) BuildPropertiesImpl(org.eclipse.tycho.core.shared.BuildPropertiesImpl)

Example 2 with BuildPropertiesImpl

use of org.eclipse.tycho.core.shared.BuildPropertiesImpl in project tycho by eclipse.

the class IncludeValidationHelperTest method testCheckSourceIncludesDontExist.

@Test
public void testCheckSourceIncludesDontExist() throws Exception {
    BuildPropertiesImpl buildProperties = createBuildProperties("src.includes", "foo3, bar3*,**/*.me");
    try {
        subject.checkSourceIncludesExist(createMockProject(), buildProperties, true);
        fail();
    } catch (MojoExecutionException e) {
        assertStringContains("src.includes value(s) [foo3, bar3*] do not match any files.", e.getMessage());
    }
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) BuildPropertiesImpl(org.eclipse.tycho.core.shared.BuildPropertiesImpl) Test(org.junit.Test)

Example 3 with BuildPropertiesImpl

use of org.eclipse.tycho.core.shared.BuildPropertiesImpl in project tycho by eclipse.

the class IncludeValidationHelperTest method testCheckSourceIncludesExistAntPatterns.

@Test
public void testCheckSourceIncludesExistAntPatterns() throws Exception {
    BuildPropertiesImpl buildProperties = createBuildProperties("src.includes", "foo.txt, bar*,**/*.me");
    subject.checkSourceIncludesExist(createMockProject(), buildProperties, true);
}
Also used : BuildPropertiesImpl(org.eclipse.tycho.core.shared.BuildPropertiesImpl) Test(org.junit.Test)

Example 4 with BuildPropertiesImpl

use of org.eclipse.tycho.core.shared.BuildPropertiesImpl in project tycho by eclipse.

the class IncludeValidationHelperTest method testWarning.

@Test
public void testWarning() throws Exception {
    final List<String> warnings = new ArrayList<>();
    Logger log = new AbstractLogger(Logger.LEVEL_DEBUG, null) {

        @Override
        public void warn(String message, Throwable throwable) {
            warnings.add(message);
        }

        @Override
        public void info(String message, Throwable throwable) {
            Assert.fail();
        }

        @Override
        public Logger getChildLogger(String name) {
            return null;
        }

        @Override
        public void fatalError(String message, Throwable throwable) {
            Assert.fail();
        }

        @Override
        public void error(String message, Throwable throwable) {
            Assert.fail();
        }

        @Override
        public void debug(String message, Throwable throwable) {
            Assert.fail();
        }
    };
    IncludeValidationHelper subject = new IncludeValidationHelper(log);
    BuildPropertiesImpl buildProperties = createBuildProperties("src.includes", "foo3, bar3*,**/*.me");
    MavenProject project = createMockProject();
    subject.checkSourceIncludesExist(project, buildProperties, false);
    Assert.assertEquals(1, warnings.size());
    Assert.assertEquals(new File(project.getBasedir(), "build.properties").getAbsolutePath() + ": src.includes value(s) [foo3, bar3*] do not match any files.", warnings.get(0));
}
Also used : MavenProject(org.apache.maven.project.MavenProject) ArrayList(java.util.ArrayList) AbstractLogger(org.codehaus.plexus.logging.AbstractLogger) Logger(org.codehaus.plexus.logging.Logger) BuildPropertiesImpl(org.eclipse.tycho.core.shared.BuildPropertiesImpl) File(java.io.File) AbstractLogger(org.codehaus.plexus.logging.AbstractLogger) Test(org.junit.Test)

Example 5 with BuildPropertiesImpl

use of org.eclipse.tycho.core.shared.BuildPropertiesImpl in project tycho by eclipse.

the class IncludeValidationHelperTest method testCheckBinIncludesExistAntPatterns.

@Test
public void testCheckBinIncludesExistAntPatterns() throws Exception {
    BuildPropertiesImpl buildProperties = createBuildProperties("bin.includes", "foo.txt, bar*,**/*.me");
    subject.checkBinIncludesExist(createMockProject(), buildProperties, true);
}
Also used : BuildPropertiesImpl(org.eclipse.tycho.core.shared.BuildPropertiesImpl) Test(org.junit.Test)

Aggregations

BuildPropertiesImpl (org.eclipse.tycho.core.shared.BuildPropertiesImpl)12 Test (org.junit.Test)7 Properties (java.util.Properties)5 BuildProperties (org.eclipse.tycho.core.shared.BuildProperties)4 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)3 File (java.io.File)2 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 ZipEntry (java.util.zip.ZipEntry)1 ZipFile (java.util.zip.ZipFile)1 MavenProject (org.apache.maven.project.MavenProject)1 DefaultArchivedFileSet (org.codehaus.plexus.archiver.util.DefaultArchivedFileSet)1 AbstractLogger (org.codehaus.plexus.logging.AbstractLogger)1 Logger (org.codehaus.plexus.logging.Logger)1