Java Code Examples for org.apache.maven.it.Verifier#getBasedir()
The following examples show how to use
org.apache.maven.it.Verifier#getBasedir() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XtendCompilerMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void encoding() throws Exception { Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/encoding"); String xtendDir = verifier.getBasedir() + "/src/main/java"; assertFileContainsUTF16(verifier, xtendDir + "/test/XtendA.xtend", "M�hlheim-K�rlicher B�rger"); verifier.setDebug(true); verifier.executeGoal("test"); verifier.verifyErrorFreeLog(); String gen = verifier.getBasedir() + "/src/main/generated-sources/xtend/test/XtendA.java"; assertFileContainsUTF16(verifier, gen, "M�hlheim-K�rlicher B�rger"); assertFileContainsUTF16(verifier, gen, "_builder.append(\"m�chte meine \");"); assertFileContainsUTF16(verifier, gen, "_builder.append(\"t�r �len\");"); }
Example 2
Source File: XtendCompilerMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void readXtendPrefs() throws Exception { Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/xtend-prefs"); verifier.setDebug(true); verifier.executeGoal("test"); verifier.verifyErrorFreeLog(); String xtendOutputDirFromPrefs = "generated-sources/xtend-from-pref"; String xtendGenDir = verifier.getBasedir() + "/src/main/" + xtendOutputDirFromPrefs; verifier.assertFilePresent(xtendGenDir + "/test/XtendA.java"); verifier.assertFilePresent(xtendGenDir + "/test/XtendC.java"); String xtendTestGenDir = verifier.getBasedir() + "/src/test/" + xtendOutputDirFromPrefs; verifier.assertFilePresent(xtendTestGenDir + "/tests/XtendA.java"); verifier.assertFilePresent(xtendTestGenDir + "/tests/XtendC.java"); }
Example 3
Source File: XtendCompilerMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void readXtendPrefsUnused() throws Exception { Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/xtend-prefs-unused"); verifier.setDebug(true); verifier.executeGoal("test"); verifier.verifyErrorFreeLog(); String pomsOutputDir = "xtend-dir-from-pom"; String xtendGenDir = verifier.getBasedir() + "/src/main/" + pomsOutputDir; verifier.assertFilePresent(xtendGenDir + "/test/XtendA.java"); verifier.assertFilePresent(xtendGenDir + "/test/XtendC.java"); String xtendTestGenDir = verifier.getBasedir() + "/src/test/" + pomsOutputDir; verifier.assertFilePresent(xtendTestGenDir + "/tests/XtendA.java"); verifier.assertFilePresent(xtendTestGenDir + "/tests/XtendC.java"); }
Example 4
Source File: StartStopMojoIT.java From vertx-maven-plugin with Apache License 2.0 | 5 votes |
private void assertInLog(Verifier verifier, String... snippets) throws IOException { File log = new File(verifier.getBasedir(), verifier.getLogFileName()); assertThat(log).isFile(); String content = FileUtils.readFileToString(log, "UTF-8"); for (String snippet : snippets) { assertThat(content).contains(snippet); } }
Example 5
Source File: StartStopMojoIT.java From vertx-maven-plugin with Apache License 2.0 | 5 votes |
public void assertInLog(Verifier verifier, String... snippets) throws IOException { File log = new File(verifier.getBasedir(), verifier.getLogFileName()); assertThat(log).isFile(); String content = FileUtils.readFileToString(log, "UTF-8"); for (String snippet : snippets) { assertThat(content).contains(snippet); } }
Example 6
Source File: XtendCompilerMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void aggregation() throws Exception { Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/aggregation"); verifier.setDebug(true); verifier.executeGoal("test"); verifier.verifyErrorFreeLog(); //https://bugs.eclipse.org/bugs/show_bug.cgi?id=409759 String outputdir = verifier.getBasedir() + "/relativeoutput-module/"; verifier.assertFilePresent(outputdir + "src/main/generated-sources/xtend/test/XtendA.java"); verifier.assertFilePresent(outputdir + "src/main/generated-sources/xtend/test/XtendC.java"); verifier.assertFilePresent(outputdir + "src/test/generated-sources/xtend/tests/XtendA.java"); verifier.assertFilePresent(outputdir + "src/test/generated-sources/xtend/tests/XtendC.java"); }
Example 7
Source File: XtendCompilerMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void suppressWarningsAnnotation() throws Exception { Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/suppress_warnings_annotation"); System.out.println(verifier.getLogFileName()); verifier.setDebug(true); verifier.executeGoal("test"); verifier.verifyErrorFreeLog(); String outputdir = verifier.getBasedir() + "/"; assertFileDoesNotContain(verifier, outputdir + "src/main/generated-sources/xtend/test/XtendA.java", "@SuppressWarnings"); assertFileDoesNotContain(verifier, outputdir + "src/test/generated-sources/xtend/test/XtendB.java", "@SuppressWarnings"); }
Example 8
Source File: XtendCompilerMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void emptyDirWarningFalse() throws Exception { Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/emptydir-warning-false"); verifier.setDebug(true); verifier.executeGoal("test"); verifier.verifyErrorFreeLog(); String logFileName = verifier.getBasedir() + "/" + verifier.getLogFileName(); assertFileDoesNotContain(verifier, logFileName, "is empty. Can't process."); }
Example 9
Source File: XtendCompilerMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void readSymlinks() throws Exception { String root = ResourceExtractor.simpleExtractResources(getClass(), ROOT).getAbsolutePath(); File link = new File(root + "/symlinks/src/main/java"); File link2 = new File(root + "/symlinks/src/test/java"); createSymLink(root + "/multisources/src/main/java/", link.getAbsolutePath()); createSymLink(root + "/multisources/src/test/java/", link2.getAbsolutePath()); try { Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/symlinks"); verifier.setDebug(true); verifier.executeGoal("test"); verifier.verifyErrorFreeLog(); String outputdir = verifier.getBasedir(); verifier.assertFilePresent(outputdir + "/src/main/generated-sources/xtend/test/XtendA.java"); verifier.assertFilePresent(outputdir + "/src/main/generated-sources/xtend/test/XtendC.java"); verifier.assertFilePresent(outputdir + "/src/main/generated-sources/xtend/test/.XtendA.java._trace"); verifier.assertFilePresent(outputdir + "/src/main/generated-sources/xtend/test/.XtendC.java._trace"); verifier.assertFilePresent(outputdir + "/src/test/generated-sources/xtend/foo/FooClass.java"); verifier.assertFilePresent(outputdir + "/src/test/generated-sources/xtend/foo/FooTest.java"); verifier.assertFilePresent(outputdir + "/src/test/generated-sources/xtend/foo/.FooClass.java._trace"); verifier.assertFilePresent(outputdir + "/src/test/generated-sources/xtend/foo/.FooTest.java._trace"); } finally { link.delete(); link2.delete(); } }
Example 10
Source File: XtendInstallDebugInfoMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void simpleXtendAsPrimary() throws Exception { Verifier verifier = verifyErrorFreeLog(ROOT + "/xtend_as_primary"); String xtendGenDir = verifier.getBasedir() + "/target/classes/test"; String debugInfo = new ClassFileDebugInfoExtractor().getDebugInfo(xtendGenDir); // please note that here we have source information only for Xtend String xpt = "// test {\n" + " package test; // XtendA.class\n" + " class XtendA {\n" + " void <init>() { // XtendA.xtend:5\n" + " void this;\n" + " void myvar;\n" + " }\n" + " void lambda$new$0() { // XtendA.xtend:6\n" + " void it;\n" + " }\n" + " }\n" + " \n" + " package test; // XtendA2.class\n" + " class XtendA2 {\n" + " void <init>() { // XtendA.xtend:13\n" + " void this;\n" + " }\n" + " }\n" + "}"; Assert.assertEquals(debugInfo, xpt.toString(), debugInfo); }
Example 11
Source File: XtendInstallDebugInfoMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void simpleXtendAsPrimaryWithSyntheticVars() throws Exception { Verifier verifier = verifyErrorFreeLog(ROOT + "/xtend_as_primary_with_synthetic_vars"); String xtendGenDir = verifier.getBasedir() + "/target/classes/test"; String debugInfo = new ClassFileDebugInfoExtractor().getDebugInfo(xtendGenDir); // please note that here we have source information only for Xtend String xpt = "// test {\n" + " package test; // XtendA.class\n" + " class XtendA {\n" + " void <init>() { // XtendA.xtend:5\n" + " void this;\n" + " void _function;\n" + " void myvar;\n" + " }\n" + " void lambda$new$0() { // XtendA.xtend:6\n" + " void it;\n" + " }\n" + " }\n" + " \n" + " package test; // XtendA2.class\n" + " class XtendA2 {\n" + " void <init>() { // XtendA.xtend:13\n" + " void this;\n" + " }\n" + " }\n" + "}"; Assert.assertEquals(debugInfo, xpt.toString(), debugInfo); }
Example 12
Source File: XtendCompilerMojoTraceIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void traceEnabled() throws Exception { Verifier verifier = verifyErrorFreeLog(ROOT + "/trace_enabled"); String xtendGenDir = verifier.getBasedir() + "/src/main/generated-sources/xtend/"; verifier.assertFilePresent(xtendGenDir + "test/.XtendA.java._trace"); verifier.assertFilePresent(xtendGenDir + "test/.XtendA2.java._trace"); Assert.assertEquals("test/XtendA.xtend", loadTraceSourcePath(xtendGenDir + "test/.XtendA.java._trace")); Assert.assertEquals("test/XtendA.xtend", loadTraceSourcePath(xtendGenDir + "test/.XtendA2.java._trace")); }
Example 13
Source File: XtendCompilerMojoTraceIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void traceDisabled() throws Exception { Verifier verifier = verifyErrorFreeLog(ROOT + "/trace_disabled"); String xtendGenDir = verifier.getBasedir() + "/src/main/generated-sources/xtend/"; verifier.assertFileNotPresent(xtendGenDir + "test/.XtendA.java._trace"); verifier.assertFileNotPresent(xtendGenDir + "test/.XtendA2.java._trace"); }
Example 14
Source File: XtendCompilerMojoTraceIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void traceWithTestSrc() throws Exception { Verifier verifier = verifyErrorFreeLog(ROOT + "/trace_withtestsrc"); String xtendGenDir = verifier.getBasedir() + "/src/"; verifier.assertFileNotPresent(xtendGenDir + "main/generated-sources/xtend/test/.FooTest.java._trace"); verifier.assertFileNotPresent(xtendGenDir + "test/generated-sources/xtend/test/.FooTest.java._trace"); }
Example 15
Source File: XtendInstallDebugInfoMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Test public void simpleSMAP() throws Exception { Verifier verifier = verifyErrorFreeLog(ROOT + "/simple_smap"); String xtendGenDir = verifier.getBasedir() + "/target/classes/test"; String debugInfo = new ClassFileDebugInfoExtractor().getDebugInfo(xtendGenDir); // please note that here we have source information for both Java and Xtend String xpt = "// test {\n" + " package test; // XtendA$1.class\n" + " class XtendA$1 {\n" + " void <init>() { // XtendA.java:13\n" + " // XtendA.java:13 -> XtendA.xtend:6\n" + " void this;\n" + " }\n" + " void apply() { // XtendA.java:15\n" + " // XtendA.java:15 -> XtendA.xtend:6\n" + " void this;\n" + " void it;\n" + " }\n" + " }\n" + " \n" + " package test; // XtendA.class\n" + " class XtendA {\n" + " void <init>() { // XtendA.java:11\n" + " // XtendA.java:12 -> XtendA.xtend:5\n" + " // XtendA.java:13:18 -> XtendA.xtend:6\n" + " void this;\n" + " void _function;\n" + " }\n" + " }\n" + " \n" + " package test; // XtendA2.class\n" + " class XtendA2 {\n" + " void <init>() { // XtendA2.java:7\n" + " // XtendA2.java:8 -> XtendA.xtend:12\n" + " void this;\n" + " }\n" + " }\n" + "}"; Assert.assertEquals(debugInfo, xpt.toString(), debugInfo); }
Example 16
Source File: Bug504Test.java From sarl with Apache License 2.0 | 4 votes |
@Test public void compile() throws Exception { Verifier verifier = executeMojo("bug504", "compile"); Path path = FileSystems.getDefault().getPath( "src", "main", "generated-sources", "sarl", "io", "sarl", "elevatorsim", "SimulatorInteraction.java"); assertNotNull(path); verifier.assertFilePresent(path.toString()); File file = new File(verifier.getBasedir(), path.toString()); String fileContent = FileUtils.fileRead(file); assertEquals(multilineString( "package io.sarl.elevatorsim;", "", "import io.sarl.elevatorsim.SimulatorPush;", "import io.sarl.elevatorsim.events.SendCarAction;", "import io.sarl.lang.annotation.SarlElementType;", "import io.sarl.lang.annotation.SarlSpecification;", "import io.sarl.lang.annotation.SyntheticMember;", "import io.sarl.lang.core.Agent;", "import io.sarl.lang.core.Skill;", "import java.io.IOException;", "import org.eclipse.xtext.xbase.lib.Exceptions;", "", "@SarlSpecification(\"" + SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING + "\")", "@SarlElementType(" + SarlPackage.SARL_SKILL + ")", "@SuppressWarnings(\"all\")", "public class SimulatorInteraction extends Skill implements SimulatorPush {", " public void sendCar(final int a, final int b, final int c, final Object d, final Object e) {", " }", " ", " @Override", " public void pushSendCarAction(final SendCarAction action) {", " try {", " this.sendCar(action.car, action.floor, action.nextDirection, ", " null, null);", " } catch (final Throwable _t) {", " if (_t instanceof IOException) {", " final IOException e = (IOException)_t;", " e.printStackTrace();", " } else {", " throw Exceptions.sneakyThrow(_t);", " }", " }", " }", " ", " @SyntheticMember", " public SimulatorInteraction() {", " super();", " }", " ", " @SyntheticMember", " public SimulatorInteraction(final Agent arg0) {", " super(arg0);", " }", "}"), fileContent); }