Java Code Examples for org.apache.maven.it.Verifier#setDebug()
The following examples show how to use
org.apache.maven.it.Verifier#setDebug() .
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 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 3
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 4
Source File: XtendCompilerMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void emptyDirWarningTrue() throws Exception { Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/emptydir-warning-true"); verifier.setDebug(true); verifier.executeGoal("test"); verifier.verifyErrorFreeLog(); verifier.verifyTextInLog("is empty. Can't process."); }
Example 5
Source File: PitMojoIT.java From pitest with Apache License 2.0 | 5 votes |
private File prepare(String testPath) throws IOException, VerificationException { String path = ResourceExtractor.extractResourcePath(getClass(), testPath, testFolder.getRoot(), true).getAbsolutePath(); verifier = new Verifier(path); verifier.setAutoclean(false); verifier.setDebug(true); verifier.getCliOptions().add("-Dpit.version=" + VERSION); verifier.getCliOptions().add( "-Dthreads=" + (Runtime.getRuntime().availableProcessors())); return new File(testFolder.getRoot().getAbsolutePath() + testPath); }
Example 6
Source File: AbstractMojoTest.java From sarl with Apache License 2.0 | 5 votes |
/** Execute a Mojo. * * @param projectName the name of the project to test for the unit test. * @param goalName the goal to run. * @return the verifier. * @throws Exception any exception. */ protected Verifier executeMojo(String projectName, String goalName) throws Exception { String tempDirPath = System.getProperty("maven.test.tmpdir", //$NON-NLS-1$ System.getProperty("java.io.tmpdir")); //$NON-NLS-1$ File tempDir = new File(tempDirPath); File baseDir = new File(tempDir, projectName); assertNotNull(baseDir); FileUtils.deleteDirectory(baseDir); URL url = getClass().getResource("/projects/" + projectName); //$NON-NLS-1$ if (url == null) { throw new IllegalArgumentException("Resource not found: " + projectName); //$NON-NLS-1$ } File resourceFile = new File(new URI(url.toExternalForm())); assertTrue(resourceFile.isDirectory()); FileUtils.copyDirectoryStructure(resourceFile, baseDir); assertTrue(baseDir.exists()); assertTrue(baseDir.isDirectory()); recursiveDeleteOnShutdownHook(baseDir); Verifier verifier = new Verifier(baseDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.setDebug(false); final String m2home = findDefaultMavenHome(); if (m2home != null && !m2home.isEmpty()) { verifier.setForkJvm(false); verifier.getSystemProperties().put("maven.multiModuleProjectDirectory", m2home); //$NON-NLS-1$ verifier.getVerifierProperties().put("use.mavenRepoLocal", Boolean.FALSE.toString()); //$NON-NLS-1$ } verifier.executeGoals(Arrays.asList("clean", goalName)); //$NON-NLS-1$ return verifier; }
Example 7
Source File: XtendCompilerMojoTraceIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
private Verifier verifyErrorFreeLog(String pathToTestProject, String goal) throws IOException, VerificationException { Verifier verifier = newVerifier(pathToTestProject, debug); verifier.setMavenDebug(debug); verifier.executeGoal(goal); verifier.verifyErrorFreeLog(); verifier.setDebug(true); verifier.resetStreams(); return verifier; }
Example 8
Source File: XtendInstallDebugInfoMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
private Verifier verifyErrorFreeLog(String pathToTestProject, String goal) throws IOException, VerificationException { Verifier verifier = newVerifier(pathToTestProject); // verifier.setForkJvm(false); verifier.setDebug(true); verifier.executeGoal(goal); verifier.verifyErrorFreeLog(); verifier.resetStreams(); return verifier; }
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: 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 11
Source File: SetupIT.java From vertx-maven-plugin with Apache License 2.0 | 5 votes |
private void initVerifier(File root) throws VerificationException { verifier = new Verifier(root.getAbsolutePath()); verifier.setAutoclean(false); verifier.setDebug(true); verifier.setForkJvm(true); verifier.setMavenDebug(true); installPluginToLocalRepository(verifier.getLocalRepository()); }
Example 12
Source File: XtendCompilerMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void emptyDirWarningDefault() throws Exception { Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/emptydir-warning-default"); verifier.setDebug(true); verifier.executeGoal("test"); verifier.verifyErrorFreeLog(); verifier.verifyTextInLog("is empty. Can't process."); }
Example 13
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 14
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 15
Source File: XtendCompilerMojoIT.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void fileSystemAccess() throws Exception { deleteFileIfExist("myusercode/UserCode.css"); deleteFileIfExist("com/itemis/myusercode/UserCode2.css"); Verifier annotationVerifier = MavenVerifierUtil.newVerifier(ROOT + "/filesystemaccess"); annotationVerifier.setDebug(true); annotationVerifier.executeGoal("install"); annotationVerifier.verifyErrorFreeLog(); Verifier clientVerifier = MavenVerifierUtil.newVerifier(ROOT + "/filesystemaccess-client"); clientVerifier.setDebug(true); clientVerifier.executeGoal("compile"); clientVerifier.verifyErrorFreeLog(); }
Example 16
Source File: MavenVerifierUtil.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
public static Verifier newVerifier(String pathToTestProject) throws IOException, VerificationException { File testDir = ResourceExtractor.simpleExtractResources(MavenVerifierUtil.class, pathToTestProject); Verifier verifier = new Verifier(testDir.getAbsolutePath()); System.out.println("gradle: " + System.getProperty("gradleMavenRepo")); for (Object iterable_element : System.getProperties().keySet()) { System.out.println(iterable_element + "=" + System.getProperty(iterable_element.toString())); } String gradleMavenRepo = System.getProperty("gradleMavenRepo"); Assert.assertNotNull("gradleMavenRepo is null", gradleMavenRepo); verifier.setSystemProperty("gradleMavenRepo", gradleMavenRepo); verifier.setSystemProperty("nonTestMavenRepo", System.getProperty("maven.repo.local")); verifier.setSystemProperty("WORKSPACE", System.getProperty("WORKSPACE")); String testMavenRepo = System.getProperty("testMavenRepo"); Assert.assertNotNull("testMavenRepo is null", testMavenRepo); verifier.setLocalRepo(testMavenRepo); verifier.setDebug(true); String testSettingsXML = System.getProperty("testSettingsXML"); if (testSettingsXML != null) { verifier.addCliOption("-s"); verifier.addCliOption(testSettingsXML); } verifier.addCliOption("-U"); verifier.setMavenDebug(true); // verifier.setDebugJvm(true); // verifier.setForkJvm(false); return verifier; }
Example 17
Source File: SetupIT.java From vertx-maven-plugin with Apache License 2.0 | 5 votes |
private void initVerifier(File root) throws VerificationException { verifier = new Verifier(root.getAbsolutePath()); verifier.setAutoclean(false); verifier.setDebug(true); verifier.setForkJvm(true); verifier.setMavenDebug(true); installPluginToLocalRepository(verifier.getLocalRepository()); }