Author: bentmann
Date: Mon May 31 10:22:33 2010
New Revision: 949706

URL: http://svn.apache.org/viewvc?rev=949706&view=rev
Log:
[MNG-1803] Provide line number information when there are errors processing a 
pom.xml

o Added IT

Added:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1803PomValidationErrorIncludesLineNumberTest.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1803/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1803/pom.xml
   (with props)
Modified:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java

Modified: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=949706&r1=949705&r2=949706&view=diff
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
 (original)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
 Mon May 31 10:22:33 2010
@@ -459,6 +459,7 @@ public class IntegrationTestSuite
         suite.addTestSuite( 
MavenITmng1957JdkActivationWithVersionRangeTest.class );
         suite.addTestSuite( MavenITmng1908LegacySnapshotUpdateTest.class );
         suite.addTestSuite( MavenITmng1830ShowVersionTest.class );
+        suite.addTestSuite( 
MavenITmng1803PomValidationErrorIncludesLineNumberTest.class );
         suite.addTestSuite( 
MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest.class );
         suite.addTestSuite( MavenITmng1703PluginMgmtDepInheritanceTest.class );
         suite.addTestSuite( MavenITmng1701DuplicatePluginTest.class );

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1803PomValidationErrorIncludesLineNumberTest.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1803PomValidationErrorIncludesLineNumberTest.java?rev=949706&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1803PomValidationErrorIncludesLineNumberTest.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1803PomValidationErrorIncludesLineNumberTest.java
 Mon May 31 10:22:33 2010
@@ -0,0 +1,84 @@
+package org.apache.maven.it;
+
+/*
+ * 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.
+ */
+
+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-1803";>MNG-1803</a>.
+ * 
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng1803PomValidationErrorIncludesLineNumberTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng1803PomValidationErrorIncludesLineNumberTest()
+    {
+        super( "[3.0-beta-1,)" );
+    }
+
+    /**
+     * Verify that POM errors indicate the line and column number in the input 
file.
+     */
+    public void testit()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-1803" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        try
+        {
+            verifier.executeGoal( "validate" );
+        }
+        catch ( Exception e )
+        {
+            // expected
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+
+        boolean foundError = false;
+
+        List lines = verifier.loadLines( verifier.getLogFileName(), null );
+        for ( Iterator it = lines.iterator(); it.hasNext(); )
+        {
+            String line = it.next().toString();
+            if ( line.indexOf( ":bad/id:" ) >= 0 )
+            {
+                assertTrue( "Line number not found in: " + line, line.indexOf( 
"38" ) > 0 );
+                assertTrue( "Column number not found in: " + line, 
line.indexOf( "19" ) > 0 );
+                foundError = true;
+                break;
+            }
+        }
+
+        assertTrue( "Build output did not mention validaton error!", 
foundError );
+    }
+
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1803PomValidationErrorIncludesLineNumberTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1803PomValidationErrorIncludesLineNumberTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1803/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1803/pom.xml?rev=949706&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1803/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1803/pom.xml
 Mon May 31 10:22:33 2010
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng1803</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: MNG-1803</name>
+  <description>
+    Verify that POM errors indicate the line and column number in the input 
file.
+  </description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.its.mng1803</groupId>
+      <artifactId>:::bad/id:::</artifactId>
+      <version>0.1</version>
+    </dependency>
+  </dependencies>
+</project>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1803/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1803/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision


Reply via email to