public void testitSameValueAcrossModules() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2562/reactor"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.deleteDirectory("child-1/target"); verifier.deleteDirectory("child-2/target"); verifier.deleteDirectory("child-3/target"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); Properties props = verifier.loadProperties("target/pom.properties"); String timestamp = props.getProperty("project.properties.timestamp", ""); Properties props1 = verifier.loadProperties("child-1/target/pom.properties"); String timestamp1 = props1.getProperty("project.properties.timestamp", ""); Properties props2 = verifier.loadProperties("child-2/target/pom.properties"); String timestamp2 = props2.getProperty("project.properties.timestamp", ""); Properties props3 = verifier.loadProperties("child-3/target/pom.properties"); String timestamp3 = props3.getProperty("project.properties.timestamp", ""); assertEquals(timestamp, timestamp1); assertEquals(timestamp, timestamp2); assertEquals(timestamp, timestamp3); }
/** Test support of "@requiresDependencyResolution compile+runtime". */ public void testit() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4293"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.deleteArtifacts("org.apache.maven.its.mng4293"); Properties filterProps = verifier.newDefaultFilterProperties(); verifier.filterFile("pom-template.xml", "pom.xml", "UTF-8", filterProps); verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); verifier.getCliOptions().add("--settings"); verifier.getCliOptions().add("settings.xml"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); List compileClassPath = verifier.loadLines("target/compile-cp.txt", "UTF-8"); assertTrue(compileClassPath.toString(), compileClassPath.contains("system-0.1.jar")); assertTrue(compileClassPath.toString(), compileClassPath.contains("provided-0.1.jar")); assertTrue(compileClassPath.toString(), compileClassPath.contains("compile-0.1.jar")); assertFalse(compileClassPath.toString(), compileClassPath.contains("test-0.1.jar")); List runtimeClassPath = verifier.loadLines("target/runtime-cp.txt", "UTF-8"); assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("compile-0.1.jar")); assertTrue(runtimeClassPath.toString(), runtimeClassPath.contains("runtime-0.1.jar")); assertFalse(runtimeClassPath.toString(), runtimeClassPath.contains("test-0.1.jar")); }
/** * Test that POM interpolation uses the property values from the dominant profile source (POM vs. * profiles.xml vs. settings.xml). This boils down to the proper order of profile injection and * interpolation, i.e. interpolate after profiles from all sources are injected. */ public void testitMNG4107() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4107"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.addCliOption("--settings"); verifier.addCliOption("settings.xml"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); Properties props = verifier.loadProperties("target/pom.properties"); assertEquals("applied", props.getProperty("project.properties.pomProfile")); assertEquals("applied", props.getProperty("project.properties.settingsProfile")); assertEquals("settings", props.getProperty("project.properties.pomVsSettings")); assertEquals("settings", props.getProperty("project.properties.pomVsSettingsInterpolated")); if (matchesVersionRange("(,3.0-alpha-1)")) { // MNG-4060, profiles.xml support dropped assertEquals("applied", props.getProperty("project.properties.profilesProfile")); assertEquals("profiles", props.getProperty("project.properties.pomVsProfiles")); assertEquals("profiles", props.getProperty("project.properties.pomVsProfilesInterpolated")); assertEquals("settings", props.getProperty("project.properties.profilesVsSettings")); assertEquals( "settings", props.getProperty("project.properties.profilesVsSettingsInterpolated")); } }
/** * Verify that dependency resolution prefers newer local snapshots over outdated remote snapshots * that use the new metadata format. */ public void testit() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4955"); Verifier verifier = newVerifier(new File(testDir, "dep").getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.deleteArtifacts("org.apache.maven.its.mng4955"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.addCliOption("-s"); verifier.addCliOption("settings.xml"); verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties()); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); List<String> classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); File jarFile = new File(classpath.get(1).toString()); assertEquals("eeff09b1b80e823eeb2a615b1d4b09e003e86fd3", ItUtils.calcHash(jarFile, "SHA-1")); }
/** Test that the CLI parameter -l can be used to direct logging to a file. */ public void testit() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3183"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.addCliOption("-l"); verifier.addCliOption("maven.log"); verifier.setLogFileName("stdout.txt"); new File(testDir, "stdout.txt").delete(); new File(testDir, "maven.log").delete(); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); List<String> stdout = verifier.loadLines("stdout.txt", "UTF-8"); for (Iterator<String> it = stdout.iterator(); it.hasNext(); ) { String line = it.next(); if (line.startsWith("+") || line.startsWith("EMMA")) { it.remove(); } } assertEquals(Collections.EMPTY_LIST, stdout); List<String> log = verifier.loadLines("maven.log", "UTF-8"); assertFalse(log.isEmpty()); }
/** * Verify that a project-level plugin dependency class/resource can be loaded from both the plugin * classloader and the context classloader available to the plugin. */ public void testit0087() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0087"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.deleteArtifacts("org.apache.maven.its.it0087"); verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties()); verifier.addCliOption("--settings"); verifier.addCliOption("settings.xml"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); Properties pclProps = verifier.loadProperties("target/pcl.properties"); assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassA")); assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassB")); assertNotNull(pclProps.getProperty("org.apache.maven.its.it0087.IT0087")); assertNotNull(pclProps.getProperty("src/main/java/org/apache/maven/its/it0087/IT0087.java")); assertEquals( "1", pclProps.getProperty("src/main/java/org/apache/maven/its/it0087/IT0087.java.count")); Properties tcclProps = verifier.loadProperties("target/tccl.properties"); assertEquals(pclProps, tcclProps); }
/** * Verify that overriding a transitive compile time dependency as provided in a WAR ensures it is * not included. */ public void testitMNG1233() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1233"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.deleteArtifacts("org.apache.maven.its.it0083"); verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties()); verifier.addCliOption("--settings"); verifier.addCliOption("settings.xml"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); Collection<String> compileArtifacts = verifier.loadLines("target/compile.txt", "UTF-8"); assertTrue( compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.it0083:direct-dep:jar:0.1")); assertTrue( compileArtifacts.toString(), compileArtifacts.contains("org.apache.maven.its.it0083:trans-dep:jar:0.1")); Collection<String> runtimeArtifacts = verifier.loadLines("target/runtime.txt", "UTF-8"); assertTrue( runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.it0083:direct-dep:jar:0.1")); assertFalse( runtimeArtifacts.toString(), runtimeArtifacts.contains("org.apache.maven.its.it0083:trans-dep:jar:0.1")); }
public void testitMNG3746_UsingCLIProperty() throws Exception { // The testdir is computed from the location of this // file. File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3746"); File pluginDir = new File(testDir, "maven-mng3746-plugin"); File projectDir = new File(testDir, "project"); Verifier verifier; verifier = newVerifier(pluginDir.getAbsolutePath(), "remote"); verifier.setLogFileName("log-cli.txt"); verifier.executeGoal("install"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); verifier = newVerifier(projectDir.getAbsolutePath()); verifier.setLogFileName("log-cli.txt"); verifier.getCliOptions().add("-Dtest.verification=cli"); verifier.getCliOptions().add("-Dtest.usingCliValue=true"); verifier.getCliOptions().add("-Djava.version=cli"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); }
public void testNoClassDefFromMojoConfiguration() throws IOException, VerificationException { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2690/noclassdef-param"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); try { verifier.executeGoal("validate"); fail("should throw an error during execution."); } catch (VerificationException e) { // expected...it'd be nice if we could get the specifics of the exception right here... } finally { verifier.resetStreams(); } List lines = verifier.loadFile(new File(testDir, "log.txt"), false); int msg = indexOf(lines, "(?i).*required class (i|wa)s missing( during (mojo )?configuration)?.*"); assertTrue("User-friendly message was not found in output.", msg >= 0); int cls = lines.get(msg).toString().replace('/', '.').indexOf(TestCase.class.getName()); assertTrue("Missing class name was not found in output.", cls >= 0); }
public void testMojoComponentLookupException() throws IOException, VerificationException { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2690/mojo-complookup"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); try { verifier.executeGoal("validate"); fail("should throw an error during execution."); } catch (VerificationException e) { // expected...it'd be nice if we could get the specifics of the exception right here... } finally { verifier.resetStreams(); } List lines = verifier.loadFile(new File(testDir, "log.txt"), false); String compLookupMsg = "(?i).*unable to .* mojo 'mojo-component-lookup-exception' .* plugin " + "'org\\.apache\\.maven\\.its\\.plugins:maven-it-plugin-error.*"; assertTrue("User-friendly message was not found in output.", indexOf(lines, compLookupMsg) > 0); }
@Before public void setup() throws Exception { testDirectory = ResourceExtractor.simpleExtractResources(getClass(), TEST_DIRECTORY); verifier = new Verifier(new File(testDirectory, OPENMRS_MODULE_IDGEN).getAbsolutePath()); serverId = setupTestServer(); cloneGitProject(); addTaskParam("openMRSPath", testDirectory.getAbsolutePath()); }
/** Test that snapshot repositories are checked for ranges with snapshot boundaries. */ public void testit() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2994"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.deleteArtifacts("org.apache.maven.its.mng2994"); verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties()); verifier.getCliOptions().add("--settings"); verifier.getCliOptions().add("settings.xml"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); }
/** * Verify that default plugin executions contributed by the packaging are executed before * user-defined executions from the POM's build section, regardless whether the executions are * defined in the regular plugins section or the plugin management section. */ public void testit() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4332"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.executeGoal("process-resources"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); List<String> lines = verifier.loadLines("target/resources-resources.txt", "UTF-8"); assertEquals(Arrays.asList(new String[] {"default", "test-1", "test-2"}), lines); }
/** * Returns a <code>Verifier</code> that has been configured to use the test repository along with * the test project that was passed in as a variable. * * <p> * * @param aTestName The test project to run * @return A configured <code>Verifier</code> * @throws IOException If there is a problem with configuration. * @throws VerificationException If there is a problem with verification. */ protected Verifier getVerifier(String aTestName) throws IOException, VerificationException { Class<? extends SolrJettyMavenIntegrationTest> cls = getClass(); String name = aTestName.startsWith("/") ? aTestName : "/" + aTestName; File config = ResourceExtractor.simpleExtractResources(cls, SETTINGS); File test = ResourceExtractor.simpleExtractResources(cls, name); String solrVersion = System.getProperty(TESTED_VERSION); String absoluteTestPath = test.getAbsolutePath(); String settings = config.getAbsolutePath(); // Construct a verifier that will run our integration tests Verifier verifier = new Verifier(absoluteTestPath, settings, true); Properties verProperties = verifier.getVerifierProperties(); Properties sysProperties = verifier.getSystemProperties(); // We need to pass along the version number of our parent project sysProperties.setProperty(TESTED_VERSION, solrVersion); // use.mavenRepoLocal instructs forked tests to use the local repo verProperties.setProperty("use.mavenRepoLocal", "true"); return verifier; }
/** * Verify that aggregator-only projects (i.e. not used as parent for inheritance) get built after * their modules. */ public void testit() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4618"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); List mods = verifier.loadLines("target/log.txt", "UTF-8"); assertEquals(Arrays.asList(new String[] {"mod-a", "mod-b", "mod-c", "aggregator"}), mods); }
/** Test that exclusions defined on a dependency apply to its transitive dependencies as well. */ public void testit() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4208"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.addCliOption("-DtestProperty=PASSED"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); Properties props = verifier.loadProperties("target/pom.properties"); assertEquals("PASSED", props.getProperty("project.properties.interpolatedProperty")); }
/** Verify that active collections of core components are properly injected into plugins. */ public void testitMNG3422() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3422"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); Properties props = verifier.loadProperties("target/layout.properties"); assertFalse("0".equals(props.getProperty("layouts", "0"))); assertFalse("".equals(props.getProperty("layouts.default", ""))); }
public void testitMNG3485() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3485"); Verifier verifier; verifier = newVerifier(testDir.getAbsolutePath(), "remote"); verifier.executeGoal("deploy"); verifier.assertFilePresent("target/wagon.properties"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); }
/** * Test that wagon providers pulled in via transitive dependencies of Maven core artifacts get * excluded from plugin realms (in favor of potentially newer wagons bundled with the core). This * requirement is mostly a hack to compensate for the historic slip of Maven core artifacts * depending on wagon providers. Those old wagon providers conflict with the usually newer wagons * bundled with the core distro and cause grief under a class loader hierarchy where wagons are * loaded from the plugin realm (if available) like in Maven 3. */ public void testit() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4528"); Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote"); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); Properties props = verifier.loadProperties("target/wagon.properties"); String version = props.getProperty("version", ""); assertFalse("Bad wagon version used: " + version, version.equals("1.0-alpha-6")); }
/** * Verify that a dependency's optional flag is not subject to dependency management. This part of * the test checks the effective model. */ public void testitModel() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4600/model"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); Properties props = verifier.loadProperties("target/pom.properties"); assertEquals("dep", props.getProperty("project.dependencies.0.artifactId")); assertEquals("false", props.getProperty("project.dependencies.0.optional")); }
/** * Verify that plugin-level dependencies specified in a user's pom.xml DO NOT use compile scope. * Using any scope other than runtime for plugin dependencies may favor them and their transitive * dependencies inappropriately, leading to unpredictable results. * * <p>Plugin-dependency scope should be DISREGARDED, and runtime scope should be forced. */ public void testit() throws Exception { final File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4761"); final Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.deleteArtifacts("org.apache.maven.its.mng4761"); verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties()); verifier.addCliOption("-s"); verifier.addCliOption("settings.xml"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); }
/** * Test that plugin executions are properly merged during inheritance, even if the child plugin * section has no version. */ public void testitMNG3916() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3916"); Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); List<String> executions = verifier.loadLines("target/exec.log", "UTF-8"); // NOTE: Ordering of executions is another issue (MNG-3887), so ignore/normalize order Collections.sort(executions); List<String> expected = Arrays.asList(new String[] {"child-1", "child-default", "parent-1"}); assertEquals(expected, executions); }
public void testValidLocalParentVersionRange() throws Exception { Verifier verifier = null; File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2199-parent-version-range/local-parent"); try { verifier = newVerifier(testDir.getAbsolutePath(), "remote"); verifier.addCliOption("-U"); verifier.setAutoclean(false); verifier.executeGoal("verify"); verifier.verifyErrorFreeLog(); } finally { verifier.resetStreams(); } }
/** Tests context passing between mojos in the same plugin. */ public void testitMNG0823() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-0823"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); List<String> goals = Arrays.asList( new String[] { "org.apache.maven.its.plugins:maven-it-plugin-context-passing:throw", "org.apache.maven.its.plugins:maven-it-plugin-context-passing:catch" }); verifier.executeGoals(goals); verifier.assertFilePresent("target/thrown-value"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); }
/** * Test that unreadable metadata from one repository does not fail the entire dependency * resolution. */ public void testit() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4498"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.deleteArtifacts("org.apache.maven.its.mng4498"); verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties()); verifier.addCliOption("--settings"); verifier.addCliOption("settings.xml"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); List<String> classpath = verifier.loadLines("target/classpath.txt", "UTF-8"); assertTrue(classpath.toString(), classpath.contains("dep-0.1-SNAPSHOT.jar")); }
public void testitCustomFormat() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2562/custom"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); Date now = new Date(); Properties props = verifier.loadProperties("target/pom.properties"); String timestamp1 = props.getProperty("project.properties.timestamp", ""); Date date = new SimpleDateFormat("mm:HH dd-MM-yyyy").parse(timestamp1); assertTrue(now + " vs " + date, Math.abs(now.getTime() - date.getTime()) < 24 * 60 * 60 * 1000); }
/** * Verify that repositories which have both releases and snapshots disabled aren't touched when * looking for plugin prefix mappings. */ public void testit() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4771"); final List<String> requestedUris = Collections.synchronizedList(new ArrayList<String>()); AbstractHandler logHandler = new AbstractHandler() { public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException { requestedUris.add(request.getRequestURI()); } }; HandlerList handlerList = new HandlerList(); handlerList.addHandler(logHandler); handlerList.addHandler(new DefaultHandler()); Server server = new Server(0); server.setHandler(handlerList); server.start(); Verifier verifier = newVerifier(testDir.getAbsolutePath()); try { verifier.setAutoclean(false); verifier.deleteDirectory("target"); Properties filterProps = verifier.newDefaultFilterProperties(); filterProps.setProperty("@port@", Integer.toString(server.getConnectors()[0].getLocalPort())); verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps); verifier.addCliOption("-U"); verifier.addCliOption("-s"); verifier.addCliOption("settings.xml"); verifier.executeGoal("mng4771:touch"); verifier.verifyErrorFreeLog(); fail("Build should have failed to resolve unknown prefix"); } catch (VerificationException e) { assertTrue(true); } finally { verifier.resetStreams(); server.stop(); } assertTrue(requestedUris.toString(), requestedUris.isEmpty()); }
/** Tests that hex digits of checksums are compared without regard to case. */ public void testitMNG2744() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2744"); Verifier verifier = newVerifier(testDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteArtifacts("org.apache.maven.its.mng2744"); verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties()); verifier.addCliOption("--settings"); verifier.addCliOption("settings.xml"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); verifier.assertArtifactPresent("org.apache.maven.its.mng2744", "a", "1", "jar"); verifier.assertArtifactPresent("org.apache.maven.its.mng2744", "a", "1", "pom"); verifier.assertArtifactPresent("org.apache.maven.its.mng2744", "b", "1", "jar"); verifier.assertArtifactPresent("org.apache.maven.its.mng2744", "b", "1", "pom"); }
/** * Verify that plugin dependencies defined by plugin management of a parent profile are not lost * when the parent's main plugin management section is also present. */ public void testitMNG2174() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2174"); Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath()); verifier.setAutoclean(false); verifier.deleteDirectory("target"); verifier.deleteArtifacts("org.apache.maven.its.mng2174"); verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties()); verifier.addCliOption("--settings"); verifier.addCliOption("settings.xml"); verifier.executeGoal("validate"); verifier.verifyErrorFreeLog(); verifier.resetStreams(); Properties props = verifier.loadProperties("target/pcl.properties"); assertEquals("1", props.getProperty("mng-2174.properties.count")); assertNotNull(props.getProperty("mng-2174.properties")); }
public void testInvalidParentVersionRange() throws Exception { Verifier verifier = null; File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2199-parent-version-range/invalid"); try { verifier = newVerifier(testDir.getAbsolutePath(), "remote"); verifier.setAutoclean(false); verifier.addCliOption("-U"); verifier.executeGoal("verify"); fail("Expected 'VerificationException' not thrown."); } catch (final VerificationException e) { final List<String> lines = verifier.loadFile(new File(testDir, "log.txt"), false); int msg = indexOf(lines, ".*The requested version range.*does not specify an upper bound.*"); assertTrue("Expected error message not found.", msg >= 0); } finally { verifier.resetStreams(); } }