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"));
}
use of org.apache.maven.plugin.logging.SystemStreamLog in project tycho by eclipse.
the class OsgiCompilerTest method testUseProjectSettingsSetToTrueWithMissingPrefsFile.
public void testUseProjectSettingsSetToTrueWithMissingPrefsFile() throws Exception {
File basedir = getBasedir("projects/projectSettings/p002");
List<MavenProject> projects = getSortedProjects(basedir, null);
MavenProject project = projects.get(0);
AbstractOsgiCompilerMojo mojo = getMojo(projects, project);
setVariableValueToObject(mojo, "useProjectSettings", Boolean.TRUE);
final List<CharSequence> warnings = new ArrayList<>();
mojo.setLog(new SystemStreamLog() {
@Override
public void warn(CharSequence content) {
warnings.add(content);
}
});
mojo.execute();
assertThat((String) warnings.iterator().next(), containsString("Parameter 'useProjectSettings' is set to true, but preferences file"));
}
use of org.apache.maven.plugin.logging.SystemStreamLog in project tycho by eclipse.
the class OsgiCompilerTest method testUseProjectSettingsSetToFalse.
public void testUseProjectSettingsSetToFalse() throws Exception {
File basedir = getBasedir("projects/projectSettings/p001");
List<MavenProject> projects = getSortedProjects(basedir, null);
MavenProject project = projects.get(0);
AbstractOsgiCompilerMojo mojo = getMojo(projects, project);
setVariableValueToObject(mojo, "useProjectSettings", Boolean.FALSE);
final List<CharSequence> warnings = new ArrayList<>();
mojo.setLog(new SystemStreamLog() {
@Override
public void warn(CharSequence content) {
warnings.add(content);
}
});
mojo.execute();
assertTrue(warnings.isEmpty());
}
use of org.apache.maven.plugin.logging.SystemStreamLog in project tycho by eclipse.
the class OsgiCompilerTest method testUseProjectSettingsSetToTrue.
public void testUseProjectSettingsSetToTrue() throws Exception {
// the code in the project does use boxing and the settings file
// turns on warning for auto boxing so we expect here a warning
File basedir = getBasedir("projects/projectSettings/p001");
List<MavenProject> projects = getSortedProjects(basedir, null);
MavenProject project = projects.get(0);
AbstractOsgiCompilerMojo mojo = getMojo(projects, project);
setVariableValueToObject(mojo, "useProjectSettings", Boolean.TRUE);
final List<CharSequence> warnings = new ArrayList<>();
mojo.setLog(new SystemStreamLog() {
@Override
public void warn(CharSequence content) {
warnings.add(content);
}
});
mojo.execute();
assertThat((String) warnings.iterator().next(), containsString("is boxed"));
}
use of org.apache.maven.plugin.logging.SystemStreamLog in project camel by apache.
the class CamelSalesforceMojoIntegrationTest method createMojo.
protected CamelSalesforceMojo createMojo() throws IOException {
CamelSalesforceMojo mojo = new CamelSalesforceMojo();
mojo.setLog(new SystemStreamLog());
// set login properties
setLoginProperties(mojo);
// set defaults
mojo.version = System.getProperty("apiVersion", SalesforceEndpointConfig.DEFAULT_VERSION);
mojo.loginUrl = System.getProperty("loginUrl", SalesforceLoginConfig.DEFAULT_LOGIN_URL);
mojo.outputDirectory = new File("target/generated-sources/camel-salesforce");
mojo.packageName = "org.apache.camel.salesforce.dto";
// set code generation properties
mojo.includePattern = "(.*__c)|(PushTopic)|(Document)|(Account)";
// remove generated code directory
if (mojo.outputDirectory.exists()) {
// remove old files
for (File file : mojo.outputDirectory.listFiles()) {
file.delete();
}
mojo.outputDirectory.delete();
}
return mojo;
}
Aggregations