Fixing the last of the test failures.

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-MRM-239@507603 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Joakim Erdfelt 2007-02-14 16:27:53 +00:00
parent 59f1dcd3e2
commit abe1697c78
5 changed files with 160 additions and 8 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View 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()