From e1fa1896d8934a3832f32618040e5d8c4b0d118b Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 7 Nov 2007 18:05:53 +0000 Subject: [PATCH] Fixing the deletion of proxy connectors, by making action consistent with jsp usage. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@592838 13f79535-47bb-0310-9956-ffa450edef68 --- .../proxy/DeleteProxyConnectorAction.java | 38 +++++++++---------- .../proxy/DeleteProxyConnectorActionTest.java | 32 ++++++++-------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorAction.java index 1fa7fa538..2de3ee9a5 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorAction.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorAction.java @@ -32,21 +32,21 @@ import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; public class DeleteProxyConnectorAction extends AbstractProxyConnectorAction { - private String sourceId; + private String source; - private String targetId; + private String target; private ProxyConnectorConfiguration proxyConfig; public String confirmDelete() { - this.proxyConfig = findProxyConnector( sourceId, targetId ); + this.proxyConfig = findProxyConnector( source, target ); // Not set? Then there is nothing to delete. if ( this.proxyConfig == null ) { - addActionError( "Unable to delete proxy configuration, configuration with source [" + sourceId - + "], and target [" + targetId + "] does not exist." ); + addActionError( "Unable to delete proxy configuration, configuration with source [" + source + + "], and target [" + target + "] does not exist." ); return ERROR; } @@ -55,13 +55,13 @@ public class DeleteProxyConnectorAction public String delete() { - this.proxyConfig = findProxyConnector( sourceId, targetId ); + this.proxyConfig = findProxyConnector( source, target ); // Not set? Then there is nothing to delete. if ( this.proxyConfig == null ) { - addActionError( "Unable to delete proxy configuration, configuration with source [" + sourceId - + "], and target [" + targetId + "] does not exist." ); + addActionError( "Unable to delete proxy configuration, configuration with source [" + source + + "], and target [" + target + "] does not exist." ); return ERROR; } @@ -71,32 +71,32 @@ public class DeleteProxyConnectorAction } removeProxyConnector( proxyConfig ); - addActionMessage( "Successfully removed proxy connector [" + sourceId + " , " + targetId + " ]" ); + addActionMessage( "Successfully removed proxy connector [" + source + " , " + target + " ]" ); - setSourceId( null ); - setTargetId( null ); + setSource( null ); + setTarget( null ); return saveConfiguration(); } - public String getSourceId() + public String getSource() { - return sourceId; + return source; } - public void setSourceId( String sourceId ) + public void setSource( String id ) { - this.sourceId = sourceId; + this.source = id; } - public String getTargetId() + public String getTarget() { - return targetId; + return target; } - public void setTargetId( String targetId ) + public void setTarget( String id ) { - this.targetId = targetId; + this.target = id; } public ProxyConnectorConfiguration getProxyConfig() diff --git a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.java b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.java index 261ea21f1..d3d30f190 100644 --- a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.java +++ b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.java @@ -59,8 +59,8 @@ public class DeleteProxyConnectorActionTest // Show the confirm the delete of proxy connector screen. preRequest( action ); - action.setSourceId( TEST_SOURCE_ID ); - action.setTargetId( TEST_TARGET_ID ); + action.setSource( TEST_SOURCE_ID ); + action.setTarget( TEST_TARGET_ID ); String status = action.confirmDelete(); assertEquals( Action.INPUT, status ); assertNoErrors( action ); @@ -76,24 +76,24 @@ public class DeleteProxyConnectorActionTest // a bad source id or target id to actually delete preRequest( action ); - action.setSourceId( "bad-source" ); // id doesn't exist. - action.setTargetId( "bad-target" ); // id doesn't exist. + action.setSource( "bad-source" ); // id doesn't exist. + action.setTarget( "bad-target" ); // id doesn't exist. String status = action.confirmDelete(); // Should have resulted in an error. assertEquals( Action.ERROR, status ); assertHasErrors( action ); preRequest( action ); - action.setSourceId( "bad" ); // Bad doesn't exist. - action.setTargetId( TEST_TARGET_ID ); + action.setSource( "bad" ); // Bad doesn't exist. + action.setTarget( TEST_TARGET_ID ); status = action.confirmDelete(); // Should have resulted in an error. assertEquals( Action.ERROR, status ); assertHasErrors( action ); preRequest( action ); - action.setSourceId( TEST_SOURCE_ID ); - action.setTargetId( "bad" ); // Bad doesn't exist. + action.setSource( TEST_SOURCE_ID ); + action.setTarget( "bad" ); // Bad doesn't exist. status = action.confirmDelete(); // Should have resulted in an error. assertEquals( Action.ERROR, status ); @@ -110,24 +110,24 @@ public class DeleteProxyConnectorActionTest // the source id or target id to actually delete preRequest( action ); - action.setSourceId( null ); // No source Id. - action.setTargetId( null ); // No target Id. + action.setSource( null ); // No source Id. + action.setTarget( null ); // No target Id. String status = action.confirmDelete(); // Should have resulted in an error. assertEquals( Action.ERROR, status ); assertHasErrors( action ); preRequest( action ); - action.setSourceId( TEST_SOURCE_ID ); - action.setTargetId( null ); // No target Id. + action.setSource( TEST_SOURCE_ID ); + action.setTarget( null ); // No target Id. status = action.confirmDelete(); // Should have resulted in an error. assertEquals( Action.ERROR, status ); assertHasErrors( action ); preRequest( action ); - action.setSourceId( null ); // No source Id. - action.setTargetId( TEST_TARGET_ID ); + action.setSource( null ); // No source Id. + action.setTarget( TEST_TARGET_ID ); status = action.confirmDelete(); // Should have resulted in an error. assertEquals( Action.ERROR, status ); @@ -142,8 +142,8 @@ public class DeleteProxyConnectorActionTest // Show the confirm the delete of proxy connector screen. preRequest( action ); - action.setSourceId( TEST_SOURCE_ID ); - action.setTargetId( TEST_TARGET_ID ); + action.setSource( TEST_SOURCE_ID ); + action.setTarget( TEST_TARGET_ID ); String status = action.confirmDelete(); assertEquals( Action.INPUT, status ); assertNoErrors( action ); -- 2.39.5