]> source.dussan.org Git - archiva.git/commitdiff
Fixing the last of the test failures.
authorJoakim Erdfelt <joakime@apache.org>
Wed, 14 Feb 2007 16:27:53 +0000 (16:27 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Wed, 14 Feb 2007 16:27:53 +0000 (16:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches@507603 13f79535-47bb-0310-9956-ffa450edef68

archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/AllTests.java [new file with mode: 0644]
archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/database/AllTests.java [new file with mode: 0644]
archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/processor/AllTests.java [new file with mode: 0644]
archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/reporter/AllTests.java [new file with mode: 0644]
archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/reporter/DefaultArtifactReporterTest.java

diff --git a/archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/AllTests.java b/archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/AllTests.java
new file mode 100644 (file)
index 0000000..7894f3b
--- /dev/null
@@ -0,0 +1,45 @@
+package org.apache.maven.archiva.reporting;
+
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * AllTests - Used to Aide in IDE based development.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AllTests
+{
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.reporting.*" );
+        //$JUnit-BEGIN$
+        suite.addTest( org.apache.maven.archiva.reporting.database.AllTests.suite() );
+        suite.addTest( org.apache.maven.archiva.reporting.processor.AllTests.suite() );
+        suite.addTest( org.apache.maven.archiva.reporting.reporter.AllTests.suite() );
+        //$JUnit-END$
+        return suite;
+    }
+
+}
diff --git a/archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/database/AllTests.java b/archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/database/AllTests.java
new file mode 100644 (file)
index 0000000..3e33146
--- /dev/null
@@ -0,0 +1,20 @@
+package org.apache.maven.archiva.reporting.database;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests
+{
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.reporting.database" );
+        //$JUnit-BEGIN$
+        suite.addTestSuite( ArtifactResultsDatabaseTest.class );
+        suite.addTestSuite( MetadataResultsDatabaseTest.class );
+        suite.addTestSuite( ReportingDatabaseTest.class );
+        //$JUnit-END$
+        return suite;
+    }
+
+}
diff --git a/archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/processor/AllTests.java b/archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/processor/AllTests.java
new file mode 100644 (file)
index 0000000..953cb4c
--- /dev/null
@@ -0,0 +1,24 @@
+package org.apache.maven.archiva.reporting.processor;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests
+{
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.reporting.processor" );
+        //$JUnit-BEGIN$
+        suite.addTestSuite( LocationArtifactReportProcessorTest.class );
+        suite.addTestSuite( DuplicateArtifactFileReportProcessorTest.class );
+        suite.addTestSuite( OldSnapshotArtifactReportProcessorTest.class );
+        suite.addTestSuite( DependencyArtifactReportProcessorTest.class );
+        suite.addTestSuite( OldArtifactReportProcessorTest.class );
+        suite.addTestSuite( InvalidPomArtifactReportProcessorTest.class );
+        suite.addTestSuite( BadMetadataReportProcessorTest.class );
+        //$JUnit-END$
+        return suite;
+    }
+
+}
diff --git a/archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/reporter/AllTests.java b/archiva-MRM-239/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/reporter/AllTests.java
new file mode 100644 (file)
index 0000000..b9bffef
--- /dev/null
@@ -0,0 +1,45 @@
+package org.apache.maven.archiva.reporting.reporter;
+
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * AllTests 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AllTests
+{
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.reporting.reporter" );
+        //$JUnit-BEGIN$
+        suite.addTestSuite( DefaultArtifactReporterTest.class );
+        suite.addTestSuite( ChecksumMetadataReporterTest.class );
+        suite.addTestSuite( ChecksumArtifactReporterTest.class );
+        //$JUnit-END$
+        return suite;
+    }
+
+}
index f2034e9d5c11df1f5b233a5d8a2170800978c390..5c4c426149670d788e08e5b1f2e27f5066ec866f 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.reporting.reporter;
  * under the License.
  */
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.reporting.AbstractRepositoryReportsTestCase;
 import org.apache.maven.archiva.reporting.database.ReportingDatabase;
 import org.apache.maven.archiva.reporting.model.ArtifactResults;
@@ -99,9 +100,17 @@ public class DefaultArtifactReporterTest
 
     private void assertMetadata( MetadataResults result )
     {
-        assertEquals( "check failure cause", metadata.getGroupId(), result.getGroupId() );
-        assertEquals( "check failure cause", metadata.getArtifactId(), result.getArtifactId() );
-        assertEquals( "check failure cause", metadata.getBaseVersion(), result.getVersion() );
+        /* The funky StringUtils.defaultString() is used because of database constraints.
+         * The MetadataResults object has a complex primary key consisting of groupId, artifactId, and version.
+         * This also means that none of those fields may be null.  however, that doesn't eliminate the
+         * ability to have an empty string in place of a null.
+         */
+
+        assertEquals( "check failure cause", StringUtils.defaultString( metadata.getGroupId() ), result.getGroupId() );
+        assertEquals( "check failure cause", StringUtils.defaultString( metadata.getArtifactId() ), result
+            .getArtifactId() );
+        assertEquals( "check failure cause", StringUtils.defaultString( metadata.getBaseVersion() ), result
+            .getVersion() );
     }
 
     public void testMetadataMultipleFailures()
@@ -244,11 +253,20 @@ public class DefaultArtifactReporterTest
 
     private void assertArtifact( ArtifactResults results )
     {
-        assertEquals( "check failure cause", artifact.getGroupId(), results.getGroupId() );
-        assertEquals( "check failure cause", artifact.getArtifactId(), results.getArtifactId() );
-        assertEquals( "check failure cause", artifact.getVersion(), results.getVersion() );
-        assertEquals( "check failure cause", artifact.getClassifier(), results.getClassifier() );
-        assertEquals( "check failure cause", artifact.getType(), results.getType() );
+        /* The funky StringUtils.defaultString() is used because of database constraints.
+         * The ArtifactResults object has a complex primary key consisting of groupId, artifactId, version,
+         * type, classifier.
+         * This also means that none of those fields may be null.  however, that doesn't eliminate the
+         * ability to have an empty string in place of a null.
+         */
+
+        assertEquals( "check failure cause", StringUtils.defaultString( artifact.getGroupId() ), results.getGroupId() );
+        assertEquals( "check failure cause", StringUtils.defaultString( artifact.getArtifactId() ), results
+            .getArtifactId() );
+        assertEquals( "check failure cause", StringUtils.defaultString( artifact.getVersion() ), results.getVersion() );
+        assertEquals( "check failure cause", StringUtils.defaultString( artifact.getClassifier() ), results
+            .getClassifier() );
+        assertEquals( "check failure cause", StringUtils.defaultString( artifact.getType() ), results.getType() );
     }
 
     public void testArtifactMultipleFailures()