From: Brett Porter Date: Wed, 6 Sep 2006 02:08:31 +0000 (+0000) Subject: [MRM-161] extract an interface for results X-Git-Tag: archiva-0.9-alpha-1~600 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6ba2e4dc2d27c8a4dc55ec4729be8bf50fb19b38;p=archiva.git [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 --- diff --git a/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/RepositoryMetadataResult.java b/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/RepositoryMetadataResult.java index 1c84623a9..a3c13d844 100644 --- a/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/RepositoryMetadataResult.java +++ b/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/RepositoryMetadataResult.java @@ -22,9 +22,10 @@ import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; * A result of the report for a given artifact being processed. * * @author Brett Porter - * @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; diff --git a/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/Result.java b/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/Result.java new file mode 100644 index 000000000..544113409 --- /dev/null +++ b/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/Result.java @@ -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 Brett Porter + */ +public interface Result +{ + /** + * The reason given for the result. + * + * @return the message + */ + String getReason(); +} diff --git a/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/BadMetadataReportProcessorTest.java b/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/BadMetadataReportProcessorTest.java index 30a60b1b3..79636c6f1 100644 --- a/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/BadMetadataReportProcessorTest.java +++ b/archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/BadMetadataReportProcessorTest.java @@ -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() );