You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2008/05/23 23:51:08 UTC
svn commit: r659678 - in
/maven/core-integration-testing/trunk/core-integration-tests/src/test:
java/org/apache/maven/integrationtests/ resources/mng-2739/
resources/mng-2739/repo-id/ resources/mng-2739/repo-url/
Author: jdcasey
Date: Fri May 23 14:51:07 2008
New Revision: 659678
URL: http://svn.apache.org/viewvc?rev=659678&view=rev
Log:
[MNG-2739] Adding integration tests for missing repository-id and repository-url.
Added:
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2739RequiredRepositoryElements.java (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/pom.xml (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-id/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-id/pom.xml (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-url/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-url/pom.xml (with props)
Modified:
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java?rev=659678&r1=659677&r2=659678&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java (original)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java Fri May 23 14:51:07 2008
@@ -90,6 +90,7 @@
suite.addTestSuite( MavenITmng2972OverridePluginDependency.class );
suite.addTestSuite( MavenITmng2861RelocationsAndRanges.class );
suite.addTestSuite( MavenITmng2744checksumVerificationTest.class );
+ suite.addTestSuite( MavenITmng2739RequiredRepositoryElements.class );
suite.addTestSuite( MavenITmng2339BadProjectInterpolationTest.class );
suite.addTestSuite( MavenITmng2277AggregatorAndResolutionPluginsTest.class );
suite.addTestSuite( MavenITmng2254PomEncodingTest.class );
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2739RequiredRepositoryElements.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2739RequiredRepositoryElements.java?rev=659678&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2739RequiredRepositoryElements.java (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2739RequiredRepositoryElements.java Fri May 23 14:51:07 2008
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.maven.integrationtests;
+
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.it.VerificationException;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2739">MNG-2739</a>.
+ *
+ * @todo Fill in a better description of what this test verifies!
+ *
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ * @author jdcasey
+ *
+ */
+public class MavenITmng2739RequiredRepositoryElements
+ extends AbstractMavenIntegrationTestCase
+{
+ public MavenITmng2739RequiredRepositoryElements()
+ throws InvalidVersionSpecificationException
+ {
+ super( "(2.0.9,)" ); // only test in 2.0.9+
+ }
+
+ public void testitMNG2739_RepositoryId()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2739/repo-id" );
+
+ Verifier verifier;
+
+ verifier = new Verifier( testDir.getAbsolutePath() );
+
+ try
+ {
+ verifier.executeGoal( "validate" );
+
+ fail( "POM should NOT validate: repository <id/> element is missing in: "
+ + new File( testDir, "pom.xml" ) );
+ }
+ catch ( VerificationException e )
+ {
+ }
+
+ verifier.resetStreams();
+
+ List listing = verifier.loadFile( new File( testDir, "log.txt" ), false );
+ boolean foundNpe = false;
+ for ( Iterator it = listing.iterator(); it.hasNext(); )
+ {
+ String line = (String) it.next();
+ if ( line.indexOf( "NullPointerException" ) > -1 )
+ {
+ foundNpe = true;
+ break;
+ }
+ }
+
+ assertFalse( "Missing repository-id should not result in a NullPointerException.", foundNpe );
+ }
+
+ public void testitMNG2739_RepositoryUrl()
+ throws Exception
+ {
+ // The testdir is computed from the location of this
+ // file.
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2739/repo-url" );
+
+ Verifier verifier;
+
+ verifier = new Verifier( testDir.getAbsolutePath() );
+
+ try
+ {
+ verifier.executeGoal( "validate" );
+
+ fail( "POM should NOT validate: repository <url/> element is missing in: "
+ + new File( testDir, "pom.xml" ) );
+ }
+ catch ( VerificationException e )
+ {
+ }
+
+ verifier.resetStreams();
+
+ List listing = verifier.loadFile( new File( testDir, "log.txt" ), false );
+ boolean foundNpe = false;
+ for ( Iterator it = listing.iterator(); it.hasNext(); )
+ {
+ String line = (String) it.next();
+ if ( line.indexOf( "NullPointerException" ) > -1 )
+ {
+ foundNpe = true;
+ break;
+ }
+ }
+
+ assertFalse( "Missing repository-url should not result in a NullPointerException.", foundNpe );
+ }
+}
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2739RequiredRepositoryElements.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2739RequiredRepositoryElements.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/pom.xml?rev=659678&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/pom.xml Fri May 23 14:51:07 2008
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng2739</groupId>
+ <artifactId>mng-2739</artifactId>
+ <packaging>pom</packaging>
+ <version>1</version>
+ <name>mng-2739</name>
+ <description>
+ Verify that repositories lacking id or url fail to build/validate.
+ </description>
+ <modules>
+ <module>repo-id</module>
+ <module>repo-url</module>
+ </modules>
+</project>
\ No newline at end of file
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-id/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-id/pom.xml?rev=659678&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-id/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-id/pom.xml Fri May 23 14:51:07 2008
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+ <parent>
+ <artifactId>mng-2739</artifactId>
+ <groupId>org.apache.maven.its.mng2739</groupId>
+ <version>1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>repo-id</artifactId>
+ <name>repo-id</name>
+ <description>Test missing repository id</description>
+ <repositories>
+ <repository>
+ <url>http://maven.apache.org/</url>
+ </repository>
+ </repositories>
+</project>
\ No newline at end of file
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-id/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-id/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-url/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-url/pom.xml?rev=659678&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-url/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-url/pom.xml Fri May 23 14:51:07 2008
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+ <parent>
+ <artifactId>mng-2739</artifactId>
+ <groupId>org.apache.maven.its.mng2739</groupId>
+ <version>1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>repo-url</artifactId>
+ <name>repo-url</name>
+ <description>Test missing repository url</description>
+ <repositories>
+ <repository>
+ <id>test</id>
+ </repository>
+ </repositories>
+</project>
\ No newline at end of file
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-url/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2739/repo-url/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"