continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1161132 - in /continuum/trunk/continuum-xmlrpc: continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/
Date Wed, 24 Aug 2011 14:40:55 GMT
Author: ctan
Date: Wed Aug 24 14:40:54 2011
New Revision: 1161132

URL: http://svn.apache.org/viewvc?rev=1161132&view=rev
Log:
[CONTINUUM-2659] improve error message returned when failed to add a project via xmlrpc

Added:
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/AddingResultUtil.java
  (with props)
Modified:
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java?rev=1161132&r1=1161131&r2=1161132&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java
Wed Aug 24 14:40:54 2011
@@ -53,9 +53,7 @@ public class SampleClient
         throws Exception
     {
         client = new ContinuumXmlRpcClient( new URL( args[0] ), args[1], args[2] );
-        client.removeBuildAgentGroup( "group" );
-/*
-
+        
         // Test for [CONTINUUM-2641]: (test with distributed builds with multiple build agents
or parallel builds with > 1 build queue)
         // make sure to set the projectIds to the actual projectIds of your projects added
in Continuum
         int projectIds[] = new int[] { 2, 3, 4, 5, 6 };
@@ -268,7 +266,7 @@ public class SampleClient
         System.out.println( "Removing Local Repository '" + repository.getName() + "' ("
+ 
                             repository.getId() + ")..." );
         client.removeLocalRepository( repository.getId() );
-        System.out.println( "Done." );*/
+        System.out.println( "Done." );
     }
 
     public static void printProjectGroupSummary( ProjectGroupSummary pg )

Added: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/AddingResultUtil.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/AddingResultUtil.java?rev=1161132&view=auto
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/AddingResultUtil.java
(added)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/AddingResultUtil.java
Wed Aug 24 14:40:54 2011
@@ -0,0 +1,45 @@
+package org.apache.maven.continuum.xmlrpc.server;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class AddingResultUtil
+{
+    private static final Map<String, String> errorMap;
+
+    static 
+    {
+        errorMap = new HashMap<String, String>();
+        errorMap.put( "add.project.unknown.host.error", "The specified host is either unknown
or inaccessible." );
+        errorMap.put( "add.project.connect.error", "Unable to connect to remote server.");
+        errorMap.put( "add.project.malformed.url.error", "The URL provided is malformed."
);
+        errorMap.put( "add.project.field.required.error", "Either POM URL or Upload POM is
required." );
+        errorMap.put( "add.project.xml.parse.error", "The XML content of the POM can not
be parsed." );
+        errorMap.put( "add.project.extend.error", "Cannot use a POM with an ''extend'' element."
);
+        errorMap.put( "add.project.missing.pom.error", "POM file does not exist. Either the
POM you specified or one of its modules does not exist." );
+        errorMap.put( "add.project.missing.groupid.error", "Missing 'groupId' element in
the POM." );
+        errorMap.put( "add.project.missing.artifactid.error", "Missing 'artifactId' element
in the POM." );
+        errorMap.put( "add.project.missing.version.error", "Missing 'version' element in
the POM." );
+        errorMap.put( "add.project.missing.name.error", "Missing 'name' element in the POM."
);
+        errorMap.put( "add.project.missing.repository.error", "Missing 'repository' element
in the POM." );
+        errorMap.put( "add.project.missing.scm.error", "Missing 'scm' element in the POM
project." ); 
+        errorMap.put( "add.project.missing.scm.connection.error", "Missing 'connection' sub-element
in the 'scm' element in the POM." );
+        errorMap.put( "add.project.missing.notifier.type.error", "Missing 'type' sub-element
in the 'notifier' element in the POM." );
+        errorMap.put( "add.project.missing.notifier.configuration.error", "Missing 'configuration'
sub-element in the 'notifier' element in the POM." );
+        errorMap.put( "add.project.metadata.transfer.error", "Transfer of Metadata has failed."
);
+        errorMap.put( "add.project.validation.protocol.not_allowed", "The specified resource
isn't a file or the protocol used isn't allowed." );
+        errorMap.put( "add.project.unauthorized.error", "You are not authorized to access
the requested URL. Please verify that the correct username and password are provided." );
+        errorMap.put( "add.project.artifact.not.found.error", "Missing artifact trying to
build the POM. Check that its parent POM is available or add it first in Continuum." );
+        errorMap.put( "add.project.project.building.error", "Unknown error trying to build
POM." );
+        errorMap.put( "add.project.unknown.error", "The specified resource cannot be accessed.
Please try again later or contact your administrator." );
+        errorMap.put( "add.project.nogroup.error", "No project group specified." );
+        errorMap.put( "add.project.duplicate.error", "Trying to add duplicate projects in
the same project group." );
+    }
+
+    public static String getErrorMessage( String error )
+    {
+        String message = errorMap.get( error );
+
+        return message == null ? error : message;
+    }
+}

Propchange: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/AddingResultUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/AddingResultUtil.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?rev=1161132&r1=1161131&r2=1161132&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Wed Aug 24 14:40:54 2011
@@ -2416,9 +2416,16 @@ public class ContinuumServiceImpl
 
         if ( result.hasErrors() )
         {
-            for ( String error : result.getErrors() )
+            if ( StringUtils.isNotBlank( result.getErrorsAsString() ) )
             {
-                res.addError( error );
+                res.addError( result.getErrorsAsString() );
+            }
+            else
+            {
+                for ( String error : result.getErrors() )
+                {
+                    res.addError( AddingResultUtil.getErrorMessage( error ) );
+                }
             }
         }
 



Mime
View raw message