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
This commit is contained in:
Joakim Erdfelt 2007-11-07 18:05:53 +00:00
parent f394cb3a76
commit e1fa1896d8
2 changed files with 35 additions and 35 deletions

View File

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

View File

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