[MRM-161] extract an interface for results

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@440570 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2006-09-06 02:08:31 +00:00
parent 201211ad99
commit 6ba2e4dc2d
3 changed files with 41 additions and 8 deletions

View File

@ -22,9 +22,10 @@ import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
* A result of the report for a given artifact being processed.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
* @version $Id:RepositoryMetadataResult.java 437105 2006-08-26 17:22:22 +1000 (Sat, 26 Aug 2006) brett $
*/
public class RepositoryMetadataResult
implements Result
{
private final RepositoryMetadata metadata;

View File

@ -0,0 +1,32 @@
package org.apache.maven.archiva.reporting;
/*
* Copyright 2005-2006 The Apache Software Foundation.
*
* Licensed 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.
*/
/**
* A result record during the reporting.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
*/
public interface Result
{
/**
* The reason given for the result.
*
* @return the message
*/
String getReason();
}

View File

@ -192,7 +192,7 @@ public class BadMetadataReportProcessorTest
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
assertTrue( "check there is a failure", failures.hasNext() );
RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
Result result = (Result) failures.next();
// TODO: should be more robust
assertEquals( "check reason", "Metadata plugin missing-plugin not found in the repository",
result.getReason() );
@ -209,7 +209,7 @@ public class BadMetadataReportProcessorTest
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
assertTrue( "check there is a failure", failures.hasNext() );
RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
Result result = (Result) failures.next();
// TODO: should be more robust
assertEquals( "check reason",
"Plugin snapshot-artifact is present in the repository but " + "missing in the metadata.",
@ -230,11 +230,11 @@ public class BadMetadataReportProcessorTest
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
assertTrue( "check there is a failure", failures.hasNext() );
RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
Result result = (Result) failures.next();
// TODO: should be more robust
assertEquals( "check reason", "Missing or empty artifactId in group metadata.", result.getReason() );
assertTrue( "check there is a 2nd failure", failures.hasNext() );
result = (RepositoryMetadataResult) failures.next();
result = (Result) failures.next();
// TODO: should be more robust
assertEquals( "check reason", "Missing or empty artifactId in group metadata.", result.getReason() );
assertFalse( "check no more failures", failures.hasNext() );
@ -251,11 +251,11 @@ public class BadMetadataReportProcessorTest
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
assertTrue( "check there is a failure", failures.hasNext() );
RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
Result result = (Result) failures.next();
// TODO: should be more robust
assertEquals( "check reason", "Missing or empty plugin prefix for artifactId artifactId.", result.getReason() );
assertTrue( "check there is a 2nd failure", failures.hasNext() );
result = (RepositoryMetadataResult) failures.next();
result = (Result) failures.next();
// TODO: should be more robust
assertEquals( "check reason", "Missing or empty plugin prefix for artifactId snapshot-artifact.",
result.getReason() );
@ -273,7 +273,7 @@ public class BadMetadataReportProcessorTest
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
assertTrue( "check there is a failure", failures.hasNext() );
RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
Result result = (Result) failures.next();
// TODO: should be more robust
assertEquals( "check reason", "Duplicate plugin prefix found: default.", result.getReason() );
assertFalse( "check no more failures", failures.hasNext() );