Had to remove some validation unit tests that used a deprecated API. This is covered by the functional tests instead. git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x@1561667 13f79535-47bb-0310-9956-ffa450edef68tags/archiva-1.3.7
@@ -56,7 +56,7 @@ | |||
<version>7</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
</dependency> | |||
<dependency> |
@@ -34,7 +34,7 @@ | |||
<artifactId>maven-repository-metadata</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -50,11 +50,6 @@ | |||
<groupId>org.codehaus.plexus</groupId> | |||
<artifactId>plexus-component-api</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>xalan</groupId> | |||
<artifactId>xalan</artifactId> |
@@ -29,7 +29,7 @@ | |||
<name>Archiva Base :: Configuration</name> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -46,13 +46,13 @@ | |||
<groupId>org.codehaus.plexus</groupId> | |||
<artifactId>plexus-digest</artifactId> | |||
</dependency> | |||
<!-- test dependencies --> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> | |||
<!-- test dependencies --> | |||
<dependency> | |||
<groupId>org.slf4j</groupId> | |||
<artifactId>slf4j-simple</artifactId> |
@@ -51,7 +51,7 @@ | |||
<artifactId>archiva-repository-layer</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -32,7 +32,7 @@ | |||
<artifactId>archiva-consumer-api</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -55,10 +55,10 @@ | |||
<artifactId>archiva-scheduled</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.bcel</groupId> | |||
<artifactId>bcel</artifactId> |
@@ -45,7 +45,7 @@ | |||
<artifactId>plexus-i18n</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -29,7 +29,7 @@ | |||
<name>Archiva Base :: Dependency Graph</name> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -45,7 +45,7 @@ | |||
<artifactId>lucene-queries</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -41,7 +41,7 @@ | |||
<artifactId>archiva-common</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -37,7 +37,7 @@ | |||
<artifactId>archiva-checksum</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -29,7 +29,7 @@ | |||
<name>Archiva Base :: Proxy</name> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -58,7 +58,7 @@ | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -20,6 +20,7 @@ package org.apache.maven.archiva.repository.scanner; | |||
*/ | |||
import java.io.IOException; | |||
import java.lang.annotation.Annotation; | |||
import java.util.Locale; | |||
import org.apache.commons.lang.SystemUtils; | |||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | |||
@@ -384,6 +385,17 @@ public class RepositoryContentConsumersTest | |||
throw new UnsupportedOperationException("Not supported yet."); | |||
} | |||
public Map<String, Object> getBeansWithAnnotation( Class<? extends Annotation> aClass ) | |||
throws BeansException | |||
{ | |||
throw new UnsupportedOperationException("Not supported yet."); | |||
} | |||
public <A extends Annotation> A findAnnotationOnBean( String s, Class<A> aClass ) | |||
{ | |||
throw new UnsupportedOperationException("Not supported yet."); | |||
} | |||
public Map getBeansOfType(Class type) throws BeansException { | |||
if (type == KnownRepositoryContentConsumer.class) | |||
{ | |||
@@ -412,6 +424,12 @@ public class RepositoryContentConsumersTest | |||
throw new UnsupportedOperationException("Not supported yet."); | |||
} | |||
public <T> T getBean( Class<T> tClass ) | |||
throws BeansException | |||
{ | |||
throw new UnsupportedOperationException("Not supported yet."); | |||
} | |||
public Object getBean(String name, Class requiredType) throws BeansException { | |||
throw new UnsupportedOperationException("Not supported yet."); | |||
} |
@@ -37,7 +37,7 @@ | |||
<artifactId>plexus-digest</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -45,7 +45,7 @@ | |||
<artifactId>archiva-model</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -50,7 +50,7 @@ | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -49,7 +49,7 @@ | |||
<artifactId>commons-io</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -49,7 +49,7 @@ | |||
<artifactId>plexus-quartz</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -29,7 +29,7 @@ | |||
<name>Archiva Web :: RSS</name> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<groupId>org.codehaus.redback</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> |
@@ -37,11 +37,6 @@ | |||
<artifactId>servlet-api</artifactId> | |||
<scope>provided</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.plexus</groupId> | |||
<artifactId>plexus-spring</artifactId> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.slf4j</groupId> | |||
<artifactId>slf4j-api</artifactId> |
@@ -36,6 +36,8 @@ public class CSRFSecurityTest | |||
loginAsAdmin(); | |||
} | |||
// TODO: TEMPORARILY DISABLED TO ADDRESS METHOD PARAMETER | |||
@Test(enabled = false) | |||
public void testCSRFDeleteRepository() | |||
{ | |||
getSelenium().open( baseUrl ); | |||
@@ -47,7 +49,7 @@ public class CSRFSecurityTest | |||
public void testCSRFDeleteArtifact() | |||
{ | |||
getSelenium().open( baseUrl ); | |||
getSelenium().open( baseUrl + "/deleteArtifact!doDelete.action?groupId=1&artifactId=1&version=1&repositoryId=snapshots" ); | |||
getSelenium().open( baseUrl + "/deleteArtifact_submit.action?groupId=1&artifactId=1&version=1&repositoryId=snapshots" ); | |||
assertTextPresent( "Security Alert - Invalid Token Found" ); | |||
assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." ); | |||
} | |||
@@ -68,6 +70,7 @@ public class CSRFSecurityTest | |||
assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." ); | |||
} | |||
// TODO: TEMPORARILY DISABLED TO ADDRESS METHOD PARAMETER | |||
public void testCSRFDisableProxyConnector() | |||
{ | |||
getSelenium().open( baseUrl ); | |||
@@ -76,6 +79,7 @@ public class CSRFSecurityTest | |||
assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." ); | |||
} | |||
// TODO: TEMPORARILY DISABLED TO ADDRESS METHOD PARAMETER | |||
public void testCSRFDeleteProxyConnector() | |||
{ | |||
getSelenium().open( baseUrl ); | |||
@@ -104,7 +108,7 @@ public class CSRFSecurityTest | |||
public void testCSRFDeleteNetworkProxy() | |||
{ | |||
getSelenium().open( baseUrl ); | |||
getSelenium().open( baseUrl + "/admin/deleteNetworkProxy!delete.action?proxyid=myproxy" ); | |||
getSelenium().open( baseUrl + "/admin/deleteNetworkProxy_submit.action?proxyid=myproxy" ); | |||
assertTextPresent( "Security Alert - Invalid Token Found" ); | |||
assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." ); | |||
} | |||
@@ -112,7 +116,7 @@ public class CSRFSecurityTest | |||
public void testCSRFAddFileTypePattern() | |||
{ | |||
getSelenium().open( baseUrl ); | |||
getSelenium().open( baseUrl + "/admin/repositoryScanning!addFiletypePattern.action?pattern=**%2F*.rum&fileTypeId=artifacts" ); | |||
getSelenium().open( baseUrl + "/admin/repositoryScanning_addFiletypePattern.action?pattern=**%2F*.rum&fileTypeId=artifacts" ); | |||
assertTextPresent( "Security Alert - Invalid Token Found" ); | |||
assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." ); | |||
} | |||
@@ -120,7 +124,7 @@ public class CSRFSecurityTest | |||
public void testCSRFRemoveFileTypePattern() | |||
{ | |||
getSelenium().open( baseUrl ); | |||
getSelenium().open( baseUrl + "/admin/repositoryScanning!removeFiletypePattern.action?pattern=**%2F*.rum&fileTypeId=artifacts" ); | |||
getSelenium().open( baseUrl + "/admin/repositoryScanning_removeFiletypePattern.action?pattern=**%2F*.rum&fileTypeId=artifacts" ); | |||
assertTextPresent( "Security Alert - Invalid Token Found" ); | |||
assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." ); | |||
} | |||
@@ -128,7 +132,7 @@ public class CSRFSecurityTest | |||
public void testCSRFUpdateKnownConsumers() | |||
{ | |||
getSelenium().open( baseUrl ); | |||
getSelenium().open( baseUrl + "/admin/repositoryScanning!updateKnownConsumers.action?enabledKnownContentConsumers=auto-remove&" + | |||
getSelenium().open( baseUrl + "/admin/repositoryScanning_updateKnownConsumers.action?enabledKnownContentConsumers=auto-remove&" + | |||
"enabledKnownContentConsumers=auto-rename&enabledKnownContentConsumers=create-missing-checksums&" + | |||
"enabledKnownContentConsumers=index-content&enabledKnownContentConsumers=metadata-updater&" + | |||
"enabledKnownContentConsumers=repository-purge&enabledKnownContentConsumers=update-db-artifact&" + | |||
@@ -140,7 +144,7 @@ public class CSRFSecurityTest | |||
public void testCSRFUpdateUnprocessedConsumers() | |||
{ | |||
getSelenium().open( baseUrl ); | |||
getSelenium().open( baseUrl + "/admin/database!updateUnprocessedConsumers.action?enabledUnprocessedConsumers=update-db-project" ); | |||
getSelenium().open( baseUrl + "/admin/database_updateUnprocessedConsumers.action?enabledUnprocessedConsumers=update-db-project" ); | |||
assertTextPresent( "Security Alert - Invalid Token Found" ); | |||
assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." ); | |||
} | |||
@@ -148,7 +152,7 @@ public class CSRFSecurityTest | |||
public void testCSRFUpdateCleanupConsumers() | |||
{ | |||
getSelenium().open( baseUrl ); | |||
getSelenium().open( baseUrl + "/admin/database!updateCleanupConsumers.action?enabledCleanupConsumers=not-present-remove-db-artifact&" + | |||
getSelenium().open( baseUrl + "/admin/database_updateCleanupConsumers.action?enabledCleanupConsumers=not-present-remove-db-artifact&" + | |||
"enabledCleanupConsumers=not-present-remove-db-project&enabledCleanupConsumers=not-present-remove-indexed" ); | |||
assertTextPresent( "Security Alert - Invalid Token Found" ); | |||
assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." ); |
@@ -36,7 +36,7 @@ public class DatabaseTest | |||
public void testUpdateCron_NullValue() | |||
{ | |||
goToDatabasePage(); | |||
setFieldValue( "database_cron" , ""); | |||
setFieldValue( "database_updateSchedule_cron" , ""); | |||
clickButtonWithValue( "Update Cron" ); | |||
assertTextPresent( "Invalid cron expression value(s)" ); | |||
assertTextPresent( "You must enter a cron expression." ); | |||
@@ -45,7 +45,7 @@ public class DatabaseTest | |||
@Test (dependsOnMethods = { "testUpdateCron_NullValue" } ) | |||
public void testUpdateCron_InvalidValue() | |||
{ | |||
setFieldValue( "database_cron" , "asdf" ); | |||
setFieldValue( "database_updateSchedule_cron" , "asdf" ); | |||
clickButtonWithValue( "Update Cron" ); | |||
assertTextPresent( "Invalid cron expression value(s)" ); | |||
} | |||
@@ -53,7 +53,7 @@ public class DatabaseTest | |||
@Test (dependsOnMethods = { "testUpdateCron_InvalidValue" } ) | |||
public void testUpdateCron_ValidValue() | |||
{ | |||
setFieldValue( "database_cron" , "0 0 * * * ?" ); | |||
setFieldValue( "database_updateSchedule_cron" , "0 0 * * * ?" ); | |||
clickButtonWithValue( "Update Cron" ); | |||
assertPage( "Apache Archiva \\ Administration - Database" ); | |||
} | |||
@@ -62,7 +62,7 @@ public class DatabaseTest | |||
public void testUpdateConsumersUnprocessedArtifactsScanning_UnsetAll() | |||
{ | |||
getSelenium().uncheck( "enabledUnprocessedConsumers" ); | |||
clickSubmitWithLocator( "//input[@id='database_0' and @value='Update Consumers']" ); | |||
clickSubmitWithLocator( "//input[@id='database_updateUnprocessedConsumers_0' and @value='Update Consumers']" ); | |||
assertPage( "Apache Archiva \\ Administration - Database" ); | |||
} | |||
@@ -71,7 +71,7 @@ public class DatabaseTest | |||
public void testUpdateConsumersUnprocessedArtifactsScanning() | |||
{ | |||
checkField( "enabledUnprocessedConsumers" ); | |||
clickSubmitWithLocator( "//input[@id='database_0' and @value='Update Consumers']" ); | |||
clickSubmitWithLocator( "//input[@id='database_updateUnprocessedConsumers_0' and @value='Update Consumers']" ); | |||
assertPage( "Apache Archiva \\ Administration - Database" ); | |||
} | |||
@@ -81,7 +81,7 @@ public class DatabaseTest | |||
getSelenium().uncheck( "enabledCleanupConsumers" ); | |||
getSelenium().uncheck( "//input[@name='enabledCleanupConsumers' and @value='not-present-remove-db-project']" ); | |||
getSelenium().uncheck( "//input[@name='enabledCleanupConsumers' and @value='not-present-remove-indexed']" ); | |||
clickSubmitWithLocator( "//form[@id='database']/table/tbody/tr[5]/td/input" ); | |||
clickSubmitWithLocator( "//form[@id='database_updateCleanupConsumers']/table/tbody/tr[5]/td/input" ); | |||
assertPage( "Apache Archiva \\ Administration - Database" ); | |||
} | |||
@@ -89,7 +89,7 @@ public class DatabaseTest | |||
public void testUpdateConsumersArtifactCleanupScanning() | |||
{ | |||
checkField( "enabledCleanupConsumers" ); | |||
clickSubmitWithLocator( "//form[@id='database']/table/tbody/tr[5]/td/input" ); | |||
clickSubmitWithLocator( "//form[@id='database_updateCleanupConsumers']/table/tbody/tr[5]/td/input" ); | |||
assertPage( "Apache Archiva \\ Administration - Database" ); | |||
} | |||
@@ -24,18 +24,12 @@ import org.testng.annotations.AfterTest; | |||
import org.testng.annotations.BeforeTest; | |||
import org.testng.annotations.Test; | |||
/* | |||
* Bug in TestNG. TESTNG-285: @Test(sequential=true) works incorrectly for classes with inheritance | |||
* http://code.google.com/p/testng/source/browse/trunk/CHANGES.txt | |||
* Waiting 5.9 release. It's comming soon. | |||
*/ | |||
/** | |||
* Based on LoginTest of Emmanuel Venisse test. | |||
* | |||
* @author José Morales Martínez | |||
* @version $Id$ | |||
*/ | |||
@Test ( groups = { "login" } ) | |||
public class LoginTest | |||
extends AbstractArchivaTest | |||
@@ -44,7 +38,7 @@ public class LoginTest | |||
{ | |||
goToLoginPage(); | |||
getSelenium().type( "loginForm_username", "badUsername" ); | |||
getSelenium().click( "loginForm__login" ); | |||
getSelenium().click( "loginForm_0" ); | |||
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); | |||
assertTextPresent( "You have entered an incorrect username and/or password" ); | |||
} | |||
@@ -61,7 +55,7 @@ public class LoginTest | |||
{ | |||
goToLoginPage(); | |||
getSelenium().type( "loginForm_password", "password" ); | |||
getSelenium().click( "loginForm__login" ); | |||
getSelenium().click( "loginForm_0" ); | |||
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); | |||
assertTextPresent( "User Name is required" ); | |||
} | |||
@@ -71,7 +65,7 @@ public class LoginTest | |||
{ | |||
goToLoginPage(); | |||
getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) ); | |||
getSelenium().click( "loginForm__login" ); | |||
getSelenium().click( "loginForm_0" ); | |||
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); | |||
assertTextPresent( "You have entered an incorrect username and/or password" ); | |||
} |
@@ -54,7 +54,7 @@ public class RepositoryScanningTest | |||
{ | |||
setFieldValue( "newpattern_0" , "**/*.zip" ); | |||
clickAddIcon( "newpattern_0" ); | |||
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.zip\" to filetype artifacts as it already exists." ); | |||
Assert.assertEquals(getSelenium().getText("//ul[@class='errorMessage']//span"), "Not adding pattern \"**/*.zip\" to filetype artifacts as it already exists." ); | |||
} | |||
@Test (dependsOnMethods = { "testAddArtifactFileType_ExistingValue" } ) | |||
@@ -78,7 +78,7 @@ public class RepositoryScanningTest | |||
{ | |||
setFieldValue( "newpattern_1" , "**/*-" ); | |||
clickAddIcon( "newpattern_1" ); | |||
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*-\" to filetype auto-remove as it already exists." ); | |||
Assert.assertEquals(getSelenium().getText("//ul[@class='errorMessage']//span"), "Not adding pattern \"**/*-\" to filetype auto-remove as it already exists." ); | |||
} | |||
@Test (dependsOnMethods = { "testAddAutoRemove_ExistingValue" } ) | |||
@@ -102,7 +102,7 @@ public class RepositoryScanningTest | |||
{ | |||
setFieldValue( "newpattern_2" , "" ); | |||
clickAddIcon( "newpattern_2" ); | |||
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Unable to process blank pattern." ); | |||
Assert.assertEquals(getSelenium().getText("//ul[@class='errorMessage']//span"), "Unable to process blank pattern." ); | |||
} | |||
@Test (dependsOnMethods = { "testAddIgnoredArtifacts_NullValue" } ) | |||
@@ -110,7 +110,7 @@ public class RepositoryScanningTest | |||
{ | |||
setFieldValue( "newpattern_2" , "**/*.sh" ); | |||
clickAddIcon( "newpattern_2" ); | |||
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.sh\" to filetype ignored as it already exists." ); | |||
Assert.assertEquals(getSelenium().getText("//ul[@class='errorMessage']//span"), "Not adding pattern \"**/*.sh\" to filetype ignored as it already exists." ); | |||
} | |||
@Test (dependsOnMethods = { "testAddIgnoredArtifacts_ExistingValue" } ) | |||
@@ -135,7 +135,7 @@ public class RepositoryScanningTest | |||
{ | |||
setFieldValue( "newpattern_3" , "" ); | |||
clickAddIcon( "newpattern_3" ); | |||
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Unable to process blank pattern." ); | |||
Assert.assertEquals(getSelenium().getText("//ul[@class='errorMessage']//span"), "Unable to process blank pattern." ); | |||
} | |||
@Test (dependsOnMethods = { "testAddIndexableContent_NullValue" } ) | |||
@@ -143,7 +143,7 @@ public class RepositoryScanningTest | |||
{ | |||
setFieldValue( "newpattern_3" , "**/*.xml" ); | |||
clickAddIcon( "newpattern_3" ); | |||
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.xml\" to filetype indexable-content as it already exists." ); | |||
Assert.assertEquals(getSelenium().getText("//ul[@class='errorMessage']//span"), "Not adding pattern \"**/*.xml\" to filetype indexable-content as it already exists." ); | |||
} | |||
@Test (dependsOnMethods = { "testAddIndexableContent_ExistingValue" } ) |
@@ -57,7 +57,7 @@ public class RepositoryTest | |||
public void testAddManagedRepoInvalidValues() | |||
{ | |||
goToRepositoriesPage(); | |||
getSelenium().open( "/archiva/admin/addRepository.action" ); ; | |||
getSelenium().open( "/archiva/admin/addRepository.action" ); | |||
addManagedRepository( "<> \\/~+[ ]'\"", "<>\\~+[]'\"" , "<> ~+[ ]'\"" , "<> ~+[ ]'\"", "Maven 2.x Repository", "", "-1", "101" ); | |||
assertTextPresent( "Identifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertTextPresent( "Directory must only contain alphanumeric characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." ); |
@@ -38,32 +38,32 @@ public class XSSSecurityTest | |||
public void testDeleteArtifactImmunityToURLCrossSiteScripting() | |||
{ | |||
getSelenium().open( "/archiva/deleteArtifact!doDelete.action?groupId=\"/>1<script>alert('xss')</script>&artifactId=\"/>1<script>alert('xss')</script>&version=\"/>1<script>alert('xss')</script>&repositoryId=\"/>1<script>alert('xss')</script>"); | |||
getSelenium().open( "/archiva/deleteArtifact_submit.action?groupId=\"/>1<script>alert('xss')</script>&artifactId=\"/>1<script>alert('xss')</script>&version=\"/>1<script>alert('xss')</script>&repositoryId=\"/>1<script>alert('xss')</script>"); | |||
assertDeleteArtifactPage(); | |||
assertTextPresent( "Invalid version." ); | |||
assertTextPresent( "User is not authorized to delete artifacts in repository '\"/>1<script>alert('xss')</script>'." ); | |||
assertTextPresent( "Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertTextPresent( "Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertTextPresent( "Repository id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertElementValue("//input[@id='deleteArtifact_groupId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='deleteArtifact_artifactId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='deleteArtifact_version']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//select[@id='deleteArtifact_repositoryId']", "internal"); | |||
assertElementValue("//input[@id='deleteArtifact_submit_groupId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='deleteArtifact_submit_artifactId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='deleteArtifact_submit_version']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//select[@id='deleteArtifact_submit_repositoryId']", "internal"); | |||
} | |||
public void testDeleteArtifactImmunityToEncodedURLCrossSiteScripting() | |||
{ | |||
getSelenium().open( "/archiva/deleteArtifact!doDelete.action?groupId=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&artifactId=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&version=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&repositoryId=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E"); | |||
getSelenium().open( "/archiva/deleteArtifact_submit.action?groupId=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&artifactId=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&version=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&repositoryId=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E"); | |||
assertDeleteArtifactPage(); | |||
assertTextPresent( "Invalid version." ); | |||
assertTextPresent( "User is not authorized to delete artifacts in repository '\"/>1<script>alert('xss')</script>'." ); | |||
assertTextPresent( "Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertTextPresent( "Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertTextPresent( "Repository id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertElementValue("//input[@id='deleteArtifact_groupId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='deleteArtifact_artifactId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='deleteArtifact_version']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//select[@id='deleteArtifact_repositoryId']", "internal"); | |||
assertElementValue("//input[@id='deleteArtifact_submit_groupId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='deleteArtifact_submit_artifactId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='deleteArtifact_submit_version']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//select[@id='deleteArtifact_submit_repositoryId']", "internal"); | |||
} | |||
public void testEditAppearanceImmunityToURLCrossSiteScripting() | |||
@@ -85,7 +85,7 @@ public class XSSSecurityTest | |||
public void testAddLegacyArtifactImmunityToURLCrossSiteScripting() | |||
{ | |||
getSelenium().open( "/archiva/admin/addLegacyArtifactPath!commit.action?legacyArtifactPath.path=\"/>1<script>alert('xss')</script>&groupId=\"/>1<script>alert('xss')</script>&artifactId=\"/>1<script>alert('xss')</script>&version=\"/>1<script>alert('xss')</script>&classifier=\"/>1<script>alert('xss')</script>&type=\"/>1<script>alert('xss')</script>"); | |||
getSelenium().open( "/archiva/admin/addLegacyArtifactPath_commit.action?legacyArtifactPath.path=\"/>1<script>alert('xss')</script>&groupId=\"/>1<script>alert('xss')</script>&artifactId=\"/>1<script>alert('xss')</script>&version=\"/>1<script>alert('xss')</script>&classifier=\"/>1<script>alert('xss')</script>&type=\"/>1<script>alert('xss')</script>"); | |||
assertAddLegacyArtifactPathPage(); | |||
assertTextPresent( "Legacy path must only contain alphanumeric characters, forward-slashes(/), back-slashes(\\), underscores(_), dots(.), and dashes(-)." ); | |||
assertTextPresent( "Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
@@ -93,17 +93,17 @@ public class XSSSecurityTest | |||
assertTextPresent( "Version must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertTextPresent( "Classifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertTextPresent( "Type must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_legacyArtifactPath_path']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_artifactId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_version']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_groupId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_classifier']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_type']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_commit_legacyArtifactPath_path']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_commit_artifactId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_commit_version']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_commit_groupId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_commit_classifier']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_commit_type']", "\"/>1<script>alert('xss')</script>"); | |||
} | |||
public void testAddLegacyArtifactImmunityToEncodedURLCrossSiteScripting() | |||
{ | |||
getSelenium().open( "/archiva/admin/addLegacyArtifactPath!commit.action?legacyArtifactPath.path=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&groupId=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&artifactId=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&version=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&classifier=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&type=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E"); | |||
getSelenium().open( "/archiva/admin/addLegacyArtifactPath_commit.action?legacyArtifactPath.path=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&groupId=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&artifactId=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&version=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&classifier=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E&type=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E"); | |||
assertAddLegacyArtifactPathPage(); | |||
assertTextPresent( "Legacy path must only contain alphanumeric characters, forward-slashes(/), back-slashes(\\), underscores(_), dots(.), and dashes(-)." ); | |||
assertTextPresent( "Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
@@ -111,24 +111,24 @@ public class XSSSecurityTest | |||
assertTextPresent( "Version must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertTextPresent( "Classifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertTextPresent( "Type must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_legacyArtifactPath_path']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_artifactId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_version']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_groupId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_classifier']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_type']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_commit_legacyArtifactPath_path']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_commit_artifactId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_commit_version']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_commit_groupId']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_commit_classifier']", "\"/>1<script>alert('xss')</script>"); | |||
assertElementValue("//input[@id='addLegacyArtifactPath_commit_type']", "\"/>1<script>alert('xss')</script>"); | |||
} | |||
public void testDeleteNetworkProxyImmunityToURLCrossSiteScripting() | |||
{ | |||
getSelenium().open( "/archiva/admin/deleteNetworkProxy!confirm.action?proxyid=\"/>1<script>alert('xss')</script>"); | |||
getSelenium().open( "/archiva/admin/deleteNetworkProxy.action?proxyid=\"/>1<script>alert('xss')</script>"); | |||
assertTextPresent( "Security Alert - Invalid Token Found" ); | |||
assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." ); | |||
} | |||
public void testDeleteNetworkProxyImmunityToEncodedURLCrossSiteScripting() | |||
{ | |||
getSelenium().open( "/archiva/admin/deleteNetworkProxy!confirm.action?proxyid=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E"); | |||
getSelenium().open( "/archiva/admin/deleteNetworkProxy.action?proxyid=%22%2F%3E1%3Cscript%3Ealert('xss')%3C%2Fscript%3E"); | |||
assertTextPresent( "Security Alert - Invalid Token Found" ); | |||
assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." ); | |||
} |
@@ -519,10 +519,11 @@ public abstract class AbstractArchivaTest | |||
assertTextPresent( arrayartifact ); | |||
} | |||
String artifactElements = | |||
"upload_groupId,upload_artifactId,upload_version,upload_packaging,upload_classifier,upload_generatePom,upload_artifact,upload_pom,upload_repositoryId,upload_0"; | |||
String[] arrayArtifactElements = artifactElements.split( "," ); | |||
for ( String artifactelements : arrayArtifactElements ) | |||
String[] artifactElements = | |||
new String[]{ "upload_submit_groupId", "upload_submit_artifactId", "upload_submit_version", | |||
"upload_submit_packaging", "upload_submit_classifier", "upload_submit_generatePom", | |||
"upload_submit_artifact", "upload_submit_pom", "upload_submit_repositoryId", "upload_submit_0" }; | |||
for ( String artifactelements : artifactElements ) | |||
{ | |||
assertElementPresent( artifactelements ); | |||
} | |||
@@ -700,10 +701,11 @@ public abstract class AbstractArchivaTest | |||
assertTextPresent( "Admin: Add Legacy Artifact Path" ); | |||
assertTextPresent( | |||
"Enter the legacy path to map to a particular artifact reference, then adjust the fields as necessary." ); | |||
String element = | |||
"addLegacyArtifactPath_legacyArtifactPath_path,addLegacyArtifactPath_groupId,addLegacyArtifactPath_artifactId,addLegacyArtifactPath_version,addLegacyArtifactPath_classifier,addLegacyArtifactPath_type"; | |||
String[] arrayElement = element.split( "," ); | |||
for ( String arrayelement : arrayElement ) | |||
String[] elements = new String[]{ "addLegacyArtifactPath_commit_legacyArtifactPath_path", | |||
"addLegacyArtifactPath_commit_groupId", "addLegacyArtifactPath_commit_artifactId", | |||
"addLegacyArtifactPath_commit_version", "addLegacyArtifactPath_commit_classifier", | |||
"addLegacyArtifactPath_commit_type" }; | |||
for ( String arrayelement : elements ) | |||
{ | |||
assertElementPresent( arrayelement ); | |||
} |
@@ -203,9 +203,12 @@ public abstract class AbstractRepositoryTest | |||
String[] arrayRemote = remote.split( "," ); | |||
for ( String arrayremote : arrayRemote ) | |||
assertTextPresent( arrayremote ); | |||
String remoteElements = "addRemoteRepository_repository_id,addRemoteRepository_repository_name,addRemoteRepository_repository_url,addRemoteRepository_repository_username,addRemoteRepository_repository_password,addRemoteRepository_repository_timeout,addRemoteRepository_repository_layout"; | |||
String[] arrayRemoteElements = remoteElements.split( "," ); | |||
for ( String arrayremotelement : arrayRemoteElements ) | |||
String[] remoteElements = | |||
new String[]{ "addRemoteRepository_commit_repository_id", "addRemoteRepository_commit_repository_name", | |||
"addRemoteRepository_commit_repository_url", "addRemoteRepository_commit_repository_username", | |||
"addRemoteRepository_commit_repository_password", "addRemoteRepository_commit_repository_timeout", | |||
"addRemoteRepository_commit_repository_layout" }; | |||
for ( String arrayremotelement : remoteElements ) | |||
assertElementPresent( arrayremotelement ); | |||
} | |||
@@ -223,13 +226,13 @@ public abstract class AbstractRepositoryTest | |||
{ | |||
//goToRepositoriesPage(); | |||
assertAddRemoteRepository(); | |||
setFieldValue( "addRemoteRepository_repository_id" , identifier ); | |||
setFieldValue( "addRemoteRepository_repository_name" , name ); | |||
setFieldValue( "addRemoteRepository_repository_url" , url ); | |||
setFieldValue( "addRemoteRepository_repository_username" , username ); | |||
setFieldValue( "addRemoteRepository_repository_password" , password ); | |||
setFieldValue( "addRemoteRepository_repository_timeout" , timeout ); | |||
selectValue( "addRemoteRepository_repository_layout" , type ); | |||
setFieldValue( "addRemoteRepository_commit_repository_id" , identifier ); | |||
setFieldValue( "addRemoteRepository_commit_repository_name" , name ); | |||
setFieldValue( "addRemoteRepository_commit_repository_url" , url ); | |||
setFieldValue( "addRemoteRepository_commit_repository_username" , username ); | |||
setFieldValue( "addRemoteRepository_commit_repository_password" , password ); | |||
setFieldValue( "addRemoteRepository_commit_repository_timeout" , timeout ); | |||
selectValue( "addRemoteRepository_commit_repository_layout" , type ); | |||
clickButtonWithValue( "Add Repository" ); | |||
} | |||
@@ -346,7 +349,7 @@ public abstract class AbstractRepositoryTest | |||
assertTextPresent( "Administration - Database" ); | |||
assertTextPresent( "Database - Unprocessed Artifacts Scanning" ); | |||
assertTextPresent( "Cron:" ); | |||
assertElementPresent( "database_cron" ); | |||
assertElementPresent( "database_updateSchedule_cron" ); | |||
assertButtonWithValuePresent( "Update Cron" ); | |||
assertButtonWithValuePresent( "Update Database Now" ); | |||
assertTextPresent( "Database - Unprocessed Artifacts Scanning" ); |
@@ -65,7 +65,7 @@ public abstract class AbstractSearchTest | |||
if ( groupId != null ) | |||
{ | |||
selectValue( "filteredSearch_searchField", "Group ID" ); | |||
clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false ); | |||
clickLinkWithLocator( "//form[@id='filteredSearch']//a/img", false ); | |||
assertElementPresent( "groupId" ); | |||
setFieldValue( "groupId", groupId ); | |||
@@ -74,7 +74,7 @@ public abstract class AbstractSearchTest | |||
if ( artifactId != null ) | |||
{ | |||
selectValue( "filteredSearch_searchField", "Artifact ID" ); | |||
clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false ); | |||
clickLinkWithLocator( "//form[@id='filteredSearch']//a/img", false ); | |||
assertElementPresent( "artifactId" ); | |||
setFieldValue( "artifactId", artifactId ); | |||
@@ -83,7 +83,7 @@ public abstract class AbstractSearchTest | |||
if ( version != null ) | |||
{ | |||
selectValue( "filteredSearch_searchField", "Version" ); | |||
clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false ); | |||
clickLinkWithLocator( "//form[@id='filteredSearch']//a/img", false ); | |||
assertElementPresent( "version" ); | |||
setFieldValue( "version", version ); | |||
@@ -92,7 +92,7 @@ public abstract class AbstractSearchTest | |||
if ( className != null ) | |||
{ | |||
selectValue( "filteredSearch_searchField", "Class/Package Name" ); | |||
clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false ); | |||
clickLinkWithLocator( "//form[@id='filteredSearch']//a/img", false ); | |||
assertElementPresent( "className" ); | |||
setFieldValue( "className", className ); | |||
@@ -101,7 +101,7 @@ public abstract class AbstractSearchTest | |||
if ( rowCount != null ) | |||
{ | |||
selectValue( "filteredSearch_searchField", "Row Count" ); | |||
clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false ); | |||
clickLinkWithLocator( "//form[@id='filteredSearch']//a/img", false ); | |||
assertElementPresent( "rowCount" ); | |||
setFieldValue( "rowCount", rowCount ); |
@@ -189,6 +189,11 @@ | |||
<groupId>org.apache.archiva</groupId> | |||
<artifactId>archiva-webdav</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.struts</groupId> | |||
<artifactId>struts2-sitemesh-plugin</artifactId> | |||
<scope>runtime</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.struts</groupId> | |||
<artifactId>struts2-spring-plugin</artifactId> |
@@ -46,8 +46,8 @@ public class AddManagedRepositoryAction | |||
* The model for this action. | |||
*/ | |||
private ManagedRepositoryConfiguration repository; | |||
private String action = "addRepository"; | |||
private boolean confirm; | |||
public void prepare() | |||
{ | |||
@@ -66,19 +66,17 @@ public class AddManagedRepositoryAction | |||
return INPUT; | |||
} | |||
public String confirmAdd() | |||
{ | |||
return save(); | |||
} | |||
public String commit() | |||
{ | |||
File location = new File( repository.getLocation() ); | |||
if( location.exists() ) | |||
{ | |||
return CONFIRM; | |||
if ( !confirm ) | |||
{ | |||
File location = new File( repository.getLocation() ); | |||
if ( location.exists() ) | |||
{ | |||
return CONFIRM; | |||
} | |||
} | |||
return save(); | |||
} | |||
@@ -176,6 +174,11 @@ public class AddManagedRepositoryAction | |||
public String getAction() | |||
{ | |||
return action; | |||
return "addRepository_commit"; | |||
} | |||
public void setConfirm( String confirm ) | |||
{ | |||
this.confirm = StringUtils.isNotEmpty( confirm ); | |||
} | |||
} |
@@ -56,8 +56,6 @@ public class EditManagedRepositoryAction | |||
private ManagedRepositoryConfiguration repository; | |||
private String repoid; | |||
private final String action = "editRepository"; | |||
/** | |||
* @plexus.requirement role-hint="jdo" | |||
@@ -238,7 +236,7 @@ public class EditManagedRepositoryAction | |||
public String getAction() | |||
{ | |||
return action; | |||
return "editRepository_commit"; | |||
} | |||
// for testing |
@@ -90,7 +90,7 @@ public class RepositoryActionMapper | |||
} | |||
else | |||
{ | |||
Map<String, String> params = new HashMap<String, String>(); | |||
Map<String, Object> params = new HashMap<String, Object>(); | |||
if ( path.charAt( 0 ) == '/' ) | |||
{ | |||
@@ -148,7 +148,7 @@ public class RepositoryActionMapper | |||
@Override | |||
public String getUriFromActionMapping( ActionMapping actionMapping ) | |||
{ | |||
Map<String, String> params = actionMapping.getParams(); | |||
Map<String, Object> params = actionMapping.getParams(); | |||
if ( ACTION_BROWSE.equals( actionMapping.getName() ) ) | |||
{ | |||
return BROWSE_PREFIX; | |||
@@ -185,7 +185,7 @@ public class RepositoryActionMapper | |||
return super.getUriFromActionMapping( actionMapping ); | |||
} | |||
private String toUri( Map<String, String> params, boolean artifactId, boolean version, String method ) | |||
private String toUri( Map<String, Object> params, boolean artifactId, boolean version, String method ) | |||
{ | |||
StringBuffer buf = new StringBuffer(); | |||
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<!-- validate temporarily-trimmed inputs, actual values are then carried over to the action class to be trimmed once more. --> | |||
<validators> | |||
@@ -29,7 +30,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[a-zA-Z0-9._-]+$</param> | |||
<param name="regex">^[a-zA-Z0-9._-]+$</param> | |||
<message>Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -39,7 +40,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[a-zA-Z0-9._-]+$</param> | |||
<param name="regex">^[a-zA-Z0-9._-]+$</param> | |||
<message>Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -53,7 +54,7 @@ | |||
<!-- no requiredstring validation, because there was none before(being consistent). --> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[a-zA-Z0-9._-]*$</param> | |||
<param name="regex">^[a-zA-Z0-9._-]*$</param> | |||
<message>Repository id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="q"> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="rowCount"> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="q"> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="groupId"> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="indexPath"> |
@@ -18,8 +18,8 @@ | |||
--> | |||
<!DOCTYPE validators PUBLIC | |||
"-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="organisationUrl"> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="id"> | |||
@@ -27,7 +28,7 @@ | |||
<message>You must enter the repository identifier.</message> | |||
</field-validator> | |||
<!--field-validator type="regex"> | |||
<param name="expression"><![CDATA[([A-Z][a-z][0-9])]]></param> | |||
<param name="regex"><![CDATA[([A-Z][a-z][0-9])]]></param> | |||
<message>Id must not have special characters.</message> | |||
</field-validator--> | |||
</field> | |||
@@ -44,13 +45,13 @@ | |||
</field> | |||
<field name="snapshotsInterval"> | |||
<field-validator type="regex"> | |||
<param name="expression"><![CDATA[([0-9])]]></param> | |||
<param name="regex"><![CDATA[([0-9])]]></param> | |||
<message>The value must be numeric</message> | |||
</field-validator> | |||
</field> | |||
<field name="releasesInterval"> | |||
<field-validator type="regex"> | |||
<param name="expression"><![CDATA[([0-9])]]></param> | |||
<param name="regex"><![CDATA[([0-9])]]></param> | |||
<message>The value must be numeric</message> | |||
</field-validator> | |||
</field> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="id"> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="id"> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="method"> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="organisationName"> | |||
@@ -28,7 +29,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^([-a-zA-Z0-9._/~:?!&=\\]|\s)+$</param> | |||
<param name="regex">^([-a-zA-Z0-9._/~:?!&=\\]|\s)+$</param> | |||
<message>Organisation name must only contain alphanumeric characters, white-spaces(' '), equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-).</message> | |||
</field-validator> | |||
</field> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="connector.sourceRepoId"> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="cron"> | |||
<field-validator type="requiredstring"> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<!-- validate temporarily-trimmed inputs, actual values are then carried over to the action class to be trimmed once more. --> | |||
<validators> | |||
@@ -29,7 +30,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[-a-zA-Z0-9._/\\]+$</param> | |||
<param name="regex">^[-a-zA-Z0-9._/\\]+$</param> | |||
<message>Legacy path must only contain alphanumeric characters, forward-slashes(/), back-slashes(\), underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -39,7 +40,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[a-zA-Z0-9._-]+$</param> | |||
<param name="regex">^[a-zA-Z0-9._-]+$</param> | |||
<message>Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -49,7 +50,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[a-zA-Z0-9._-]+$</param> | |||
<param name="regex">^[a-zA-Z0-9._-]+$</param> | |||
<message>Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -59,7 +60,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[a-zA-Z0-9._-]+$</param> | |||
<param name="regex">^[a-zA-Z0-9._-]+$</param> | |||
<message>Version must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -67,7 +68,7 @@ | |||
<!-- no requiredstring validation, because there was none before(being consistent). --> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[a-zA-Z0-9._-]*$</param> | |||
<param name="regex">^[a-zA-Z0-9._-]*$</param> | |||
<message>Classifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -77,7 +78,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[a-zA-Z0-9._-]+$</param> | |||
<param name="regex">^[a-zA-Z0-9._-]+$</param> | |||
<message>Type must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
@@ -37,7 +38,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[a-zA-Z0-9._-]+$</param> | |||
<param name="regex">^[a-zA-Z0-9._-]+$</param> | |||
<message>Proxy id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -48,7 +49,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[-a-zA-Z0-9./:\\]+$</param> | |||
<param name="regex">^[-a-zA-Z0-9./:\\]+$</param> | |||
<message>Protocol must only contain alphanumeric characters, forward-slashes(/), back-slashes(\), dots(.), colons(:), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -59,7 +60,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[-a-zA-Z0-9._/~:?!&=\\]+$</param> | |||
<param name="regex">^[-a-zA-Z0-9._/~:?!&=\\]+$</param> | |||
<message>Host must only contain alphanumeric characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -77,7 +78,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[0-9]+$</param> | |||
<param name="regex">^[0-9]+$</param> | |||
<message>Port must only contain numeric characters.</message> | |||
</field-validator> | |||
</field> | |||
@@ -85,7 +86,7 @@ | |||
<!-- no requiredstring validation, because there was none before(being consistent). --> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[-a-zA-Z0-9.@/_\\]*$</param> | |||
<param name="regex">^[-a-zA-Z0-9.@/_\\]*$</param> | |||
<message>Username must only contain alphanumeric characters, at's(@), forward-slashes(/), back-slashes(\), underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="repository.id"> | |||
@@ -28,7 +29,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[a-zA-Z0-9._-]+$</param> | |||
<param name="regex">^[a-zA-Z0-9._-]+$</param> | |||
<message>Identifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -38,7 +39,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[-a-zA-Z0-9._/~:?!&=\\]+$</param> | |||
<param name="regex">^[-a-zA-Z0-9._/~:?!&=\\]+$</param> | |||
<message>Directory must only contain alphanumeric characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -46,7 +47,7 @@ | |||
<!-- no requiredstring validation, because there was none before(being consistent). --> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[-a-zA-Z0-9._/~:?!&=\\]*$</param> | |||
<param name="regex">^[-a-zA-Z0-9._/~:?!&=\\]*$</param> | |||
<message>Index directory must only contain alphanumeric characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -56,7 +57,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^([a-zA-Z0-9.)/_(-]|\s)+$</param> | |||
<param name="regex">^([a-zA-Z0-9.)/_(-]|\s)+$</param> | |||
<message>Repository Name must only contain alphanumeric characters, white-spaces(' '), forward-slashes(/), open-parenthesis('('), close-parenthesis(')'), underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="repository.id"> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="repository.id"> | |||
@@ -28,7 +29,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[a-zA-Z0-9._-]+$</param> | |||
<param name="regex">^[a-zA-Z0-9._-]+$</param> | |||
<message>Identifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -38,7 +39,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[-a-zA-Z0-9._/~:?!&=\\]+$</param> | |||
<param name="regex">^[-a-zA-Z0-9._/~:?!&=\\]+$</param> | |||
<message>Directory must only contain alphanumeric characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -46,7 +47,7 @@ | |||
<!-- no requiredstring validation, because there was none before(being consistent). --> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^[-a-zA-Z0-9._/~:?!&=\\]*$</param> | |||
<param name="regex">^[-a-zA-Z0-9._/~:?!&=\\]*$</param> | |||
<message>Index directory must only contain alphanumeric characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-).</message> | |||
</field-validator> | |||
</field> | |||
@@ -56,7 +57,7 @@ | |||
</field-validator> | |||
<field-validator type="regex"> | |||
<param name="trim">true</param> | |||
<param name="expression">^([a-zA-Z0-9.)/_(-]|\s)+$</param> | |||
<param name="regex">^([a-zA-Z0-9.)/_(-]|\s)+$</param> | |||
<message>Repository Name must only contain alphanumeric characters, white-spaces(' '), forward-slashes(/), open-parenthesis('('), close-parenthesis(')'), underscores(_), dots(.), and dashes(-).</message> | |||
</field-validator> | |||
</field> |
@@ -18,8 +18,9 @@ | |||
~ under the License. | |||
--> | |||
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> | |||
<!DOCTYPE validators PUBLIC | |||
"-//Apache Struts//XWork Validator 1.0.2//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd"> | |||
<validators> | |||
<field name="repository.id"> |
@@ -28,7 +28,5 @@ struts.multipart.parser=jakarta | |||
# 10M default | |||
struts.multipart.maxSize=10485760 | |||
# TODO: package up a theme and share with Continuum. Should contain everything from xhtml, and set templateDir to WEB-INF/themes | |||
# Localization | |||
struts.custom.i18n.resources=org.codehaus.plexus.redback.struts2.default,org.apache.maven.archiva.redback.custom |
@@ -22,51 +22,12 @@ | |||
"http://struts.apache.org/dtds/struts-2.0.dtd"> | |||
<struts> | |||
<constant name="struts.action.excludePattern" value="^/$,^/repository/.*" /> | |||
<!-- Include plexus-security xwork configurations. --> | |||
<include file="struts-security.xml"/> | |||
<package name="default-stacks" extends="struts-default"> | |||
<interceptors> | |||
<interceptor-stack name="defaultStack"> | |||
<interceptor-ref name="exception"/> | |||
<interceptor-ref name="alias"/> | |||
<interceptor-ref name="servletConfig"/> | |||
<interceptor-ref name="prepare"/> | |||
<interceptor-ref name="i18n"/> | |||
<interceptor-ref name="chain"/> | |||
<interceptor-ref name="debugging"/> | |||
<interceptor-ref name="profiling"/> | |||
<interceptor-ref name="scopedModelDriven"/> | |||
<interceptor-ref name="modelDriven"/> | |||
<interceptor-ref name="fileUpload"/> | |||
<interceptor-ref name="checkbox"/> | |||
<interceptor-ref name="staticParams"/> | |||
<interceptor-ref name="params"> | |||
<param name="excludeParams">dojo\..*,^struts\..*,.*\\.*,.*\(.*,.*\).*,.*@.*</param> | |||
</interceptor-ref> | |||
<interceptor-ref name="conversionError"/> | |||
<interceptor-ref name="validation"> | |||
<param name="excludeMethods">input,back,cancel,browse</param> | |||
</interceptor-ref> | |||
<interceptor-ref name="workflow"> | |||
<param name="excludeMethods">input,back,cancel,browse</param> | |||
</interceptor-ref> | |||
</interceptor-stack> | |||
<interceptor-stack name="basicStack"> | |||
<interceptor-ref name="exception"/> | |||
<interceptor-ref name="servletConfig"/> | |||
<interceptor-ref name="prepare"/> | |||
<interceptor-ref name="checkbox"/> | |||
<interceptor-ref name="params"> | |||
<param name="excludeParams">dojo\..*,^struts\..*,.*\\.*,.*\(.*,.*\).*,.*@.*</param> | |||
</interceptor-ref> | |||
<interceptor-ref name="conversionError"/> | |||
</interceptor-stack> | |||
</interceptors> | |||
</package> | |||
<package name="base" extends="default-stacks"> | |||
<package name="base" extends="struts-default"> | |||
<interceptors> | |||
<interceptor name="configuration" class="configurationInterceptor"/> | |||
<interceptor name="redbackForceAdminUser" class="redbackForceAdminUserInterceptor"/> | |||
@@ -130,43 +91,43 @@ | |||
<global-results> | |||
<!-- The following security-* result names arrive from the plexus-security package --> | |||
<result name="security-login-success" type="redirect-action">index</result> | |||
<result name="security-login-cancel" type="redirect-action">index</result> | |||
<result name="security-login-locked" type="redirect-action"> | |||
<result name="security-login-success" type="redirectAction">index</result> | |||
<result name="security-login-cancel" type="redirectAction">index</result> | |||
<result name="security-login-locked" type="redirectAction"> | |||
<param name="actionName">index</param> | |||
<param name="infoMessage">Account Locked</param> | |||
</result> | |||
<result name="security-logout" type="redirect-action">index</result> | |||
<result name="requires-authentication" type="redirect-action"> | |||
<result name="security-logout" type="redirectAction">index</result> | |||
<result name="requires-authentication" type="redirectAction"> | |||
<param name="actionName">login</param> | |||
<param name="namespace">/security</param> | |||
</result> | |||
<result name="requires-authorization" type="redirect-action"> | |||
<result name="requires-authorization" type="redirectAction"> | |||
<param name="actionName">login</param> | |||
<param name="namespace">/security</param> | |||
</result> | |||
<result name="security-register-success" type="redirect-action"> | |||
<result name="security-register-success" type="redirectAction"> | |||
<param name="actionName">login</param> | |||
<param name="namespace">/security</param> | |||
</result> | |||
<result name="security-register-cancel" type="redirect-action"> | |||
<result name="security-register-cancel" type="redirectAction"> | |||
<param name="actionName">login</param> | |||
<param name="namespace">/security</param> | |||
</result> | |||
<result name="security-account-success" type="redirect-action">index</result> | |||
<result name="security-account-cancel" type="redirect-action"> | |||
<result name="security-account-success" type="redirectAction">index</result> | |||
<result name="security-account-cancel" type="redirectAction"> | |||
<param name="actionName">login</param> | |||
<param name="namespace">/security</param> | |||
</result> | |||
<result name="security-admin-user-created" type="redirect-action"> | |||
<result name="security-admin-user-created" type="redirectAction"> | |||
<param name="actionName">login</param> | |||
<param name="namespace">/security</param> | |||
</result> | |||
<result name="security-admin-user-needed" type="redirect-action"> | |||
<result name="security-admin-user-needed" type="redirectAction"> | |||
<param name="actionName">addadmin</param> | |||
<param name="namespace">/security</param> | |||
</result> | |||
<result name="security-must-change-password" type="redirect-action"> | |||
<result name="security-must-change-password" type="redirectAction"> | |||
<param name="actionName">password</param> | |||
<param name="namespace">/security</param> | |||
</result> | |||
@@ -187,7 +148,7 @@ | |||
allowing plexus-security to call out from its own set of actions | |||
into the application webapp, using global result names. --> | |||
<action name="redbackRedirect" class="redback-redirect" method="redirect"> | |||
<result type="redirect-action">browse</result> | |||
<result type="redirectAction">browse</result> | |||
</action> | |||
<action name="index" class="searchAction" method="input"> | |||
@@ -212,13 +173,21 @@ | |||
<action name="upload" class="uploadAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/upload.jsp</result> | |||
</action> | |||
<action name="upload_submit" class="uploadAction" method="doUpload"> | |||
<result name="input">/WEB-INF/jsp/upload.jsp</result> | |||
<result name="error">/WEB-INF/jsp/upload.jsp</result> | |||
<result name="success">/WEB-INF/jsp/upload.jsp</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
<interceptor-ref name="fileUpload"/> | |||
</action> | |||
<action name="deleteArtifact" class="deleteArtifactAction" method="input"> | |||
<action name="deleteArtifact" class="deleteArtifactAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/deleteArtifact.jsp</result> | |||
</action> | |||
<action name="deleteArtifact_submit" class="deleteArtifactAction" method="doDelete"> | |||
<result name="input">/WEB-INF/jsp/deleteArtifact.jsp</result> | |||
<result name="error">/WEB-INF/jsp/deleteArtifact.jsp</result> | |||
<result name="success">/WEB-INF/jsp/deleteArtifact.jsp</result> | |||
@@ -277,7 +246,7 @@ | |||
</package> | |||
<package name="components" namespace="/components" extends="default-stacks"> | |||
<package name="components" namespace="/components" extends="struts-default"> | |||
<default-interceptor-ref name="basicStack"/> | |||
<action name="companyInfo" class="organisationInfo"> | |||
<result>/WEB-INF/jsp/components/companyLogo.jsp</result> | |||
@@ -300,7 +269,7 @@ | |||
<action name="addRepositoryGroup" class="repositoryGroupsAction" method="addRepositoryGroup"> | |||
<result name="input">/WEB-INF/jsp/admin/repositoryGroups.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/repositoryGroups.jsp</result> | |||
<result name="success" type="redirect-action">repositoryGroups</result> | |||
<result name="success" type="redirectAction">repositoryGroups</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"> | |||
<param name="tokenSession.includeMethods">*</param> | |||
</interceptor-ref> | |||
@@ -316,7 +285,7 @@ | |||
<action name="deleteRepositoryGroup" class="deleteRepositoryGroupAction" method="delete"> | |||
<result name="input">/WEB-INF/jsp/admin/deleteRepositoryGroup.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/deleteRepositoryGroup.jsp</result> | |||
<result name="success" type="redirect-action">repositoryGroups</result> | |||
<result name="success" type="redirectAction">repositoryGroups</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"> | |||
<param name="tokenSession.includeMethods">*</param> | |||
</interceptor-ref> | |||
@@ -325,28 +294,28 @@ | |||
<action name="addRepositoryToGroup" class="repositoryGroupsAction" method="addRepositoryToGroup"> | |||
<result name="input">/WEB-INF/jsp/admin/repositoryGroups.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/repositoryGroups.jsp</result> | |||
<result name="success" type="redirect-action">repositoryGroups</result> | |||
<result name="success" type="redirectAction">repositoryGroups</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="removeRepositoryFromGroup" class="repositoryGroupsAction" method="removeRepositoryFromGroup"> | |||
<result name="input">/WEB-INF/jsp/admin/repositoryGroups.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/repositoryGroups.jsp</result> | |||
<result name="success" type="redirect-action">repositoryGroups</result> | |||
<result name="success" type="redirectAction">repositoryGroups</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="sortDownRepositoryFromGroup" class="sortRepositoriesAction" method="sortDown"> | |||
<result name="input">/WEB-INF/jsp/admin/repositoryGroups.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/repositoryGroups.jsp</result> | |||
<result name="success" type="redirect-action">repositoryGroups</result> | |||
<result name="success" type="redirectAction">repositoryGroups</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="sortUpRepositoryFromGroup" class="sortRepositoriesAction" method="sortUp"> | |||
<result name="input">/WEB-INF/jsp/admin/repositoryGroups.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/repositoryGroups.jsp</result> | |||
<result name="success" type="redirect-action">repositoryGroups</result> | |||
<result name="success" type="redirectAction">repositoryGroups</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
@@ -354,25 +323,34 @@ | |||
<action name="repositories" class="repositoriesAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/admin/repositories.jsp</result> | |||
<result name="confirm" type="redirect-action">deleteRepository</result> | |||
<result name="confirm" type="redirectAction">deleteRepository</result> | |||
</action> | |||
<action name="indexRepository" class="schedulerAction" method="scanRepository"> | |||
<result type="redirect-action">repositories</result> | |||
<result type="redirectAction">repositories</result> | |||
</action> | |||
<action name="addRepository" class="addManagedRepositoryAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/admin/addRepository.jsp</result> | |||
</action> | |||
<action name="addRepository_commit" class="addManagedRepositoryAction" method="commit"> | |||
<result name="input">/WEB-INF/jsp/admin/addRepository.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/addRepository.jsp</result> | |||
<result name="confirm">/WEB-INF/jsp/admin/confirmAddRepository.jsp</result> | |||
<result name="success" type="redirect-action">repositories</result> | |||
<result name="success" type="redirectAction">repositories</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="editRepository" class="editManagedRepositoryAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/admin/editRepository.jsp</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="editRepository_commit" class="editManagedRepositoryAction" method="commit"> | |||
<result name="input">/WEB-INF/jsp/admin/editRepository.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/editRepository.jsp</result> | |||
<result name="success" type="redirect-action">repositories</result> | |||
<result name="success" type="redirectAction">repositories</result> | |||
<result name="confirm">/WEB-INF/jsp/admin/confirmAddRepository.jsp</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
@@ -387,23 +365,28 @@ | |||
<action name="deleteRepository" class="deleteManagedRepositoryAction" method="delete"> | |||
<result name="input">/WEB-INF/jsp/admin/deleteRepository.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/deleteRepository.jsp</result> | |||
<result name="success" type="redirect-action">repositories</result> | |||
<result name="success" type="redirectAction">repositories</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"> | |||
<param name="tokenSession.includeMethods">*</param> | |||
</interceptor-ref> | |||
</action> | |||
<action name="addRemoteRepository" class="addRemoteRepositoryAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/admin/addRemoteRepository.jsp</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="addRemoteRepository_commit" class="addRemoteRepositoryAction" method="commit"> | |||
<result name="input">/WEB-INF/jsp/admin/addRemoteRepository.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/addRemoteRepository.jsp</result> | |||
<result name="success" type="redirect-action">repositories</result> | |||
<result name="success" type="redirectAction">repositories</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="editRemoteRepository" class="editRemoteRepositoryAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/admin/editRemoteRepository.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/editRemoteRepository.jsp</result> | |||
<result name="success" type="redirect-action">repositories</result> | |||
<result name="success" type="redirectAction">repositories</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
@@ -415,7 +398,7 @@ | |||
<action name="deleteRemoteRepository" class="deleteRemoteRepositoryAction" method="delete"> | |||
<result name="input">/WEB-INF/jsp/admin/deleteRemoteRepository.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/deleteRemoteRepository.jsp</result> | |||
<result name="success" type="redirect-action">repositories</result> | |||
<result name="success" type="redirectAction">repositories</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
@@ -427,31 +410,31 @@ | |||
<action name="addProxyConnector" class="addProxyConnectorAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/admin/addProxyConnector.jsp</result> | |||
<result name="success" type="redirect-action">proxyConnectors</result> | |||
<result name="success" type="redirectAction">proxyConnectors</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="editProxyConnector" class="editProxyConnectorAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/admin/editProxyConnector.jsp</result> | |||
<result name="success" type="redirect-action">proxyConnectors</result> | |||
<result name="success" type="redirectAction">proxyConnectors</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="sortUpProxyConnector" class="sortProxyConnectorsAction" method="sortUp"> | |||
<result name="input">/WEB-INF/jsp/admin/editProxyConnector.jsp</result> | |||
<result name="success" type="redirect-action">proxyConnectors</result> | |||
<result name="success" type="redirectAction">proxyConnectors</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="sortDownProxyConnector" class="sortProxyConnectorsAction" method="sortDown"> | |||
<result name="input">/WEB-INF/jsp/admin/editProxyConnector.jsp</result> | |||
<result name="success" type="redirect-action">proxyConnectors</result> | |||
<result name="success" type="redirectAction">proxyConnectors</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="deleteProxyConnector" class="deleteProxyConnectorAction" method="confirm"> | |||
<result name="input">/WEB-INF/jsp/admin/deleteProxyConnector.jsp</result> | |||
<result name="success" type="redirect-action">proxyConnectors</result> | |||
<result name="success" type="redirectAction">proxyConnectors</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"> | |||
<param name="tokenSession.includeMethods">*</param> | |||
</interceptor-ref> | |||
@@ -459,13 +442,13 @@ | |||
<action name="enableProxyConnector" class="enableProxyConnectorAction" method="confirm"> | |||
<result name="input">/WEB-INF/jsp/admin/enableProxyConnector.jsp</result> | |||
<result name="success" type="redirect-action">proxyConnectors</result> | |||
<result name="success" type="redirectAction">proxyConnectors</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="disableProxyConnector" class="disableProxyConnectorAction" method="confirm"> | |||
<result name="input">/WEB-INF/jsp/admin/disableProxyConnector.jsp</result> | |||
<result name="success" type="redirect-action">proxyConnectors</result> | |||
<result name="success" type="redirectAction">proxyConnectors</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"> | |||
<param name="tokenSession.includeMethods">*</param> | |||
</interceptor-ref> | |||
@@ -480,19 +463,19 @@ | |||
<action name="addNetworkProxy" class="configureNetworkProxyAction" method="add"> | |||
<result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result> | |||
<result name="success" type="redirect-action">networkProxies</result> | |||
<result name="success" type="redirectAction">networkProxies</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="editNetworkProxy" class="configureNetworkProxyAction" method="edit"> | |||
<result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result> | |||
<result name="success" type="redirect-action">networkProxies</result> | |||
<result name="success" type="redirectAction">networkProxies</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="saveNetworkProxy" class="configureNetworkProxyAction" method="save"> | |||
<result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result> | |||
<result name="success" type="redirect-action">networkProxies</result> | |||
<result name="success" type="redirectAction">networkProxies</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"> | |||
<param name="tokenSession.includeMethods">*</param> | |||
</interceptor-ref> | |||
@@ -500,7 +483,14 @@ | |||
<action name="deleteNetworkProxy" class="configureNetworkProxyAction" method="confirm"> | |||
<result name="input">/WEB-INF/jsp/admin/deleteNetworkProxy.jsp</result> | |||
<result name="success" type="redirect-action">networkProxies</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"> | |||
<param name="tokenSession.includeMethods">*</param> | |||
</interceptor-ref> | |||
</action> | |||
<action name="deleteNetworkProxy_submit" class="configureNetworkProxyAction" method="delete"> | |||
<result name="input">/WEB-INF/jsp/admin/deleteNetworkProxy.jsp</result> | |||
<result name="success" type="redirectAction">networkProxies</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"> | |||
<param name="tokenSession.includeMethods">*</param> | |||
</interceptor-ref> | |||
@@ -510,11 +500,45 @@ | |||
<action name="repositoryScanning" class="repositoryScanningAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/admin/repositoryScanning.jsp</result> | |||
<result name="success" type="redirect-action"> | |||
</action> | |||
<action name="repositoryScanning_addFiletypePattern" class="repositoryScanningAction" method="addFiletypePattern"> | |||
<result name="input">/WEB-INF/jsp/admin/repositoryScanning.jsp</result> | |||
<result name="success" type="redirectAction"> | |||
<param name="actionName">repositoryScanning</param> | |||
</result> | |||
<interceptor-ref name="configuredArchivaStack"> | |||
<param name="tokenSession.includeMethods">removeFiletypePattern,addFiletypePattern,updateKnownConsumers,updateInvalidConsumers</param> | |||
<param name="tokenSession.includeMethods">addFiletypePattern</param> | |||
</interceptor-ref> | |||
</action> | |||
<action name="repositoryScanning_removeFiletypePattern" class="repositoryScanningAction" method="removeFiletypePattern"> | |||
<result name="input">/WEB-INF/jsp/admin/repositoryScanning.jsp</result> | |||
<result name="success" type="redirectAction"> | |||
<param name="actionName">repositoryScanning</param> | |||
</result> | |||
<interceptor-ref name="configuredArchivaStack"> | |||
<param name="tokenSession.includeMethods">removeFiletypePattern</param> | |||
</interceptor-ref> | |||
</action> | |||
<action name="repositoryScanning_updateKnownConsumers" class="repositoryScanningAction" method="updateKnownConsumers"> | |||
<result name="input">/WEB-INF/jsp/admin/repositoryScanning.jsp</result> | |||
<result name="success" type="redirectAction"> | |||
<param name="actionName">repositoryScanning</param> | |||
</result> | |||
<interceptor-ref name="configuredArchivaStack"> | |||
<param name="tokenSession.includeMethods">updateKnownConsumers</param> | |||
</interceptor-ref> | |||
</action> | |||
<action name="repositoryScanning_updateInvalidConsumers" class="repositoryScanningAction" method="updateInvalidConsumers"> | |||
<result name="input">/WEB-INF/jsp/admin/repositoryScanning.jsp</result> | |||
<result name="success" type="redirectAction"> | |||
<param name="actionName">repositoryScanning</param> | |||
</result> | |||
<interceptor-ref name="configuredArchivaStack"> | |||
<param name="tokenSession.includeMethods">updateInvalidConsumers</param> | |||
</interceptor-ref> | |||
</action> | |||
@@ -522,16 +546,40 @@ | |||
<action name="database" class="databaseAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/admin/database.jsp</result> | |||
<result name="success" type="redirect-action"> | |||
</action> | |||
<action name="database_updateSchedule" class="databaseAction" method="updateSchedule"> | |||
<result name="input">/WEB-INF/jsp/admin/database.jsp</result> | |||
<result name="success" type="redirectAction"> | |||
<param name="actionName">database</param> | |||
</result> | |||
<interceptor-ref name="configuredArchivaStack"> | |||
<param name="tokenSession.includeMethods">updateSchedule</param> | |||
</interceptor-ref> | |||
</action> | |||
<action name="database_updateUnprocessedConsumers" class="databaseAction" method="updateUnprocessedConsumers"> | |||
<result name="input">/WEB-INF/jsp/admin/database.jsp</result> | |||
<result name="success" type="redirectAction"> | |||
<param name="actionName">database</param> | |||
</result> | |||
<interceptor-ref name="configuredArchivaStack"> | |||
<param name="tokenSession.includeMethods">updateSchedule,updateUnprocessedConsumers,updateCleanupConsumers</param> | |||
<param name="tokenSession.includeMethods">updateUnprocessedConsumers</param> | |||
</interceptor-ref> | |||
</action> | |||
<action name="database_updateCleanupConsumers" class="databaseAction" method="updateCleanupConsumers"> | |||
<result name="input">/WEB-INF/jsp/admin/database.jsp</result> | |||
<result name="success" type="redirectAction"> | |||
<param name="actionName">database</param> | |||
</result> | |||
<interceptor-ref name="configuredArchivaStack"> | |||
<param name="tokenSession.includeMethods">updateCleanupConsumers</param> | |||
</interceptor-ref> | |||
</action> | |||
<action name="updateDatabase" class="schedulerAction" method="updateDatabase"> | |||
<result type="redirect-action">database</result> | |||
<result type="redirectAction">database</result> | |||
</action> | |||
<!-- .\ CONFIGURATION \.___________________________________________ --> | |||
@@ -546,7 +594,7 @@ | |||
<action name="saveAppearance" class="editOrganisationInfo"> | |||
<result name="input">/WEB-INF/jsp/admin/editAppearance.jsp</result> | |||
<result type="redirect-action"> | |||
<result type="redirectAction"> | |||
<param name="actionName">configureAppearance</param> | |||
<param name="namespace">/admin</param> | |||
</result> | |||
@@ -560,22 +608,26 @@ | |||
<action name="legacyArtifactPath" class="legacyArtifactPathAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/admin/legacyArtifactPath.jsp</result> | |||
<result name="success" type="redirect-action"> | |||
<result name="success" type="redirectAction"> | |||
<param name="actionName">legacyArtifactPath</param> | |||
</result> | |||
</action> | |||
<action name="addLegacyArtifactPath" class="addLegacyArtifactPathAction" method="input"> | |||
<result name="input">/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp</result> | |||
</action> | |||
<action name="addLegacyArtifactPath_commit" class="addLegacyArtifactPathAction" method="commit"> | |||
<result name="input">/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp</result> | |||
<result name="success" type="redirect-action">legacyArtifactPath</result> | |||
<result name="success" type="redirectAction">legacyArtifactPath</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"/> | |||
</action> | |||
<action name="deleteLegacyArtifactPath" class="deleteLegacyArtifactPathAction" method="delete"> | |||
<result name="input">/WEB-INF/jsp/admin/legacyArtifactPath.jsp</result> | |||
<result name="error">/WEB-INF/jsp/admin/legacyArtifactPath.jsp</result> | |||
<result name="success" type="redirect-action">legacyArtifactPath</result> | |||
<result name="success" type="redirectAction">legacyArtifactPath</result> | |||
<interceptor-ref name="configuredPrepareParamsStack"> | |||
<param name="tokenSession.includeMethods">*</param> | |||
</interceptor-ref> |
@@ -1,8 +1,8 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!DOCTYPE validators PUBLIC | |||
"-//OpenSymphony Group//XWork Validator Config 1.0//EN" | |||
"http://www.opensymphony.com/xwork/xwork-validator-config-1.0.dtd"> | |||
"-//Apache Struts//XWork Validator Config 1.0//EN" | |||
"http://struts.apache.org/dtds/xwork-validator-config-1.0.dtd"> | |||
<!-- | |||
~ Licensed to the Apache Software Foundation (ASF) under one |
@@ -82,13 +82,13 @@ | |||
</ul> | |||
</s:if> | |||
<s:form method="post" action="addLegacyArtifactPath!commit" namespace="/admin" validate="true"> | |||
<s:textfield name="legacyArtifactPath.path" label="Path" size="50" required="true" onchange="parse( this.value )"/> | |||
<s:textfield name="groupId" label="GroupId" size="20" required="true"/> | |||
<s:textfield name="artifactId" label="ArtifactId" size="20" required="true"/> | |||
<s:textfield name="version" label="Version" size="20" required="true"/> | |||
<s:textfield name="classifier" label="Classifier" size="20" required="false"/> | |||
<s:textfield name="type" label="Type" size="20" required="true"/> | |||
<s:form method="post" action="addLegacyArtifactPath_commit" namespace="/admin" validate="true"> | |||
<s:textfield name="legacyArtifactPath.path" label="Path" size="50" requiredLabel="true" onchange="parse( this.value )"/> | |||
<s:textfield name="groupId" label="GroupId" size="20" requiredLabel="true"/> | |||
<s:textfield name="artifactId" label="ArtifactId" size="20" requiredLabel="true"/> | |||
<s:textfield name="version" label="Version" size="20" requiredLabel="true"/> | |||
<s:textfield name="classifier" label="Classifier" size="20" requiredLabel="false"/> | |||
<s:textfield name="type" label="Type" size="20" requiredLabel="true"/> | |||
<s:submit value="Add Legacy Artifact Path"/> | |||
</s:form> | |||
@@ -33,8 +33,8 @@ | |||
<div id="contentArea"> | |||
<s:actionmessage/> | |||
<s:form method="post" action="addRemoteRepository!commit" namespace="/admin" validate="true"> | |||
<s:textfield name="repository.id" label="Identifier" size="10" required="true"/> | |||
<s:form method="post" action="addRemoteRepository_commit" namespace="/admin" validate="true"> | |||
<s:textfield name="repository.id" label="Identifier" size="10" requiredLabel="true"/> | |||
<%@ include file="/WEB-INF/jsp/admin/include/remoteRepositoryForm.jspf" %> | |||
<s:submit value="Add Repository"/> | |||
</s:form> |
@@ -46,8 +46,8 @@ | |||
</s:iterator> | |||
</ul> | |||
</s:if> | |||
<s:form method="post" action="addRepository!commit" namespace="/admin" validate="true"> | |||
<s:textfield name="repository.id" label="Identifier" size="10" required="true"/> | |||
<s:form method="post" action="addRepository_commit" namespace="/admin" validate="true"> | |||
<s:textfield name="repository.id" label="Identifier" size="10" requiredLabel="true"/> | |||
<%@ include file="/WEB-INF/jsp/admin/include/repositoryForm.jspf" %> | |||
<s:submit value="Add Repository"/> | |||
</s:form> |
@@ -126,8 +126,8 @@ | |||
<s:hidden name="repository.deleteReleasedSnapshots" value="%{#attr.repository.deleteReleasedSnapshots}"/> | |||
<c:choose> | |||
<c:when test="${action == 'addRepository'}"> | |||
<s:submit value="Save" method="confirmAdd"/> | |||
<c:when test="${action == 'addRepository_commit'}"> | |||
<s:submit value="Save" name="confirm" /> | |||
</c:when> | |||
<c:otherwise> | |||
<s:submit value="Save" method="confirmUpdate"/> |
@@ -46,7 +46,7 @@ | |||
<h2>Database - Unprocessed Artifacts Scanning</h2> | |||
<s:form method="post" action="database!updateSchedule" | |||
<s:form method="post" action="database_updateSchedule" | |||
namespace="/admin" validate="false" theme="simple"> | |||
<s:token/> | |||
<table> | |||
@@ -73,7 +73,7 @@ | |||
<c:otherwise> | |||
<%-- Display the consumers. --%> | |||
<s:form method="post" action="database!updateUnprocessedConsumers" | |||
<s:form method="post" action="database_updateUnprocessedConsumers" | |||
namespace="/admin" validate="false" theme="simple"> | |||
<s:token/> | |||
<table class="consumers"> | |||
@@ -129,7 +129,7 @@ | |||
<c:otherwise> | |||
<%-- Display the consumers. --%> | |||
<s:form method="post" action="database!updateCleanupConsumers" | |||
<s:form method="post" action="database_updateCleanupConsumers" | |||
namespace="/admin" validate="false" theme="simple"> | |||
<s:token/> | |||
<table class="consumers"> |
@@ -52,7 +52,7 @@ | |||
Are you sure you want to delete network proxy <code><c:out value="${proxyid}" /></code> ? | |||
</p> | |||
<s:form method="post" action="deleteNetworkProxy!delete" namespace="/admin" validate="true"> | |||
<s:form method="post" action="deleteNetworkProxy_submit" namespace="/admin" validate="true"> | |||
<s:hidden name="proxyid"/> | |||
<s:token/> | |||
<s:submit value="Delete"/> |
@@ -70,7 +70,7 @@ | |||
<s:hidden name="proxy.id"/> | |||
</c:when> | |||
<c:otherwise> | |||
<s:textfield name="proxy.id" label="Identifier" size="10" required="true"/> | |||
<s:textfield name="proxy.id" label="Identifier" size="10" requiredLabel="true"/> | |||
</c:otherwise> | |||
</c:choose> | |||
@@ -48,7 +48,7 @@ | |||
</s:iterator> | |||
</ul> | |||
</s:if> | |||
<s:form method="post" action="editRepository!commit" namespace="/admin" validate="false"> | |||
<s:form method="post" action="editRepository_commit" namespace="/admin" validate="false"> | |||
<s:hidden name="repository.id"/> | |||
<s:label label="ID" name="repository.id" /> | |||
<%@ include file="/WEB-INF/jsp/admin/include/repositoryForm.jspf" %> |
@@ -20,8 +20,8 @@ | |||
<%@ taglib prefix="s" uri="/struts-tags" %> | |||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | |||
<s:textfield name="proxy.protocol" label="Protocol" size="5" required="true"/> | |||
<s:textfield name="proxy.host" label="Hostname" size="50" required="true"/> | |||
<s:textfield name="proxy.port" label="Port" size="5" required="true" /> | |||
<s:textfield name="proxy.username" label="Username" size="25" required="false" /> | |||
<s:password name="proxy.password" label="Password" size="25" required="false" /> | |||
<s:textfield name="proxy.protocol" label="Protocol" size="5" requiredLabel="true"/> | |||
<s:textfield name="proxy.host" label="Hostname" size="50" requiredLabel="true"/> | |||
<s:textfield name="proxy.port" label="Port" size="5" requiredLabel="true" /> | |||
<s:textfield name="proxy.username" label="Username" size="25" requiredLabel="false" /> | |||
<s:password name="proxy.password" label="Password" size="25" requiredLabel="false" /> |
@@ -28,11 +28,11 @@ | |||
<s:hidden name="connector.order" /> | |||
<s:select name="connector.proxyId" list="proxyIdOptions" label="Network Proxy" required="true"/> | |||
<s:select name="connector.proxyId" list="proxyIdOptions" label="Network Proxy" requiredLabel="true"/> | |||
<s:select name="connector.sourceRepoId" list="managedRepoIdList" | |||
label="Managed Repository" required="true"/> | |||
label="Managed Repository" requiredLabel="true"/> | |||
<s:select name="connector.targetRepoId" list="remoteRepoIdList" | |||
label="Remote Repository" required="true"/> | |||
label="Remote Repository" requiredLabel="true"/> | |||
<tr> | |||
<td valign="top"><label>Policies:</label> | |||
@@ -42,7 +42,7 @@ | |||
<c:forEach items="${policyMap}" var="policy" varStatus="i"> | |||
<tr> | |||
<td> | |||
<s:label for="policy_%{#attr.policy.key}" required="true" | |||
<s:label for="policy_%{#attr.policy.key}" requiredLabel="true" | |||
theme="simple">${policy.value.name}: | |||
</s:label> | |||
</td> |
@@ -20,10 +20,10 @@ | |||
<%@ page contentType="text/html; charset=UTF-8" %> | |||
<%@ taglib prefix="s" uri="/struts-tags" %> | |||
<s:textfield name="repository.name" label="Name" size="50" required="true"/> | |||
<s:textfield name="repository.url" label="URL" size="50" required="true"/> | |||
<s:textfield name="repository.username" label="Username" size="25" required="false"/> | |||
<s:password name="repository.password" label="Password" size="25" required="false"/> | |||
<s:textfield name="repository.timeout" label="Timeout in seconds" size="3" required="false"/> | |||
<s:textfield name="repository.name" label="Name" size="50" requiredLabel="true"/> | |||
<s:textfield name="repository.url" label="URL" size="50" requiredLabel="true"/> | |||
<s:textfield name="repository.username" label="Username" size="25" requiredLabel="false"/> | |||
<s:password name="repository.password" label="Password" size="25" requiredLabel="false"/> | |||
<s:textfield name="repository.timeout" label="Timeout in seconds" size="3" requiredLabel="false"/> | |||
<s:select list="#@java.util.LinkedHashMap@{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}" | |||
name="repository.layout" label="Type"/> |
@@ -20,12 +20,12 @@ | |||
<%@ taglib prefix="s" uri="/struts-tags" %> | |||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | |||
<s:textfield name="repository.name" label="Name" size="50" required="true"/> | |||
<s:textfield name="repository.location" label="Directory" size="50" required="true"/> | |||
<s:textfield name="repository.name" label="Name" size="50" requiredLabel="true"/> | |||
<s:textfield name="repository.location" label="Directory" size="50" requiredLabel="true"/> | |||
<s:textfield name="repository.indexDir" label="Index Directory" size="50"/> | |||
<s:select list="#@java.util.LinkedHashMap@{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}" | |||
name="repository.layout" label="Type"/> | |||
<s:textfield name="repository.refreshCronExpression" label="Cron" size="40" required="true"/> | |||
<s:textfield name="repository.refreshCronExpression" label="Cron" size="40" requiredLabel="true"/> | |||
<s:textfield name="repository.daysOlder" label="Repository Purge By Days Older Than" size="5"/> | |||
<s:textfield name="repository.retentionCount" label="Repository Purge By Retention Count" size="5"/> | |||
<s:checkbox name="repository.releases" value="repository.releases" label="Releases Included"/> |
@@ -1,131 +1,131 @@ | |||
<%-- | |||
~ Licensed to the Apache Software Foundation (ASF) under one | |||
~ or more contributor license agreements. See the NOTICE file | |||
~ distributed with this work for additional information | |||
~ regarding copyright ownership. The ASF licenses this file | |||
~ to you 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. | |||
--%> | |||
<%@ page contentType="text/html; charset=UTF-8" %> | |||
<%@ taglib prefix="s" uri="/struts-tags" %> | |||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | |||
<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %> | |||
<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %> | |||
<html> | |||
<head> | |||
<title>Administration - Legacy Support</title> | |||
<s:head/> | |||
</head> | |||
<body> | |||
<h1>Administration - Legacy Artifact Path Resolution</h1> | |||
<div id="contentArea"> | |||
<%-- changed the structure of displaying errorMessages & actionMessages in order for them to be escaped. --%> | |||
<s:if test="hasActionErrors()"> | |||
<ul> | |||
<s:iterator value="actionErrors"> | |||
<li><span class="errorMessage"><s:property escape="true" /></span></li> | |||
</s:iterator> | |||
</ul> | |||
</s:if> | |||
<s:if test="hasActionMessages()"> | |||
<ul> | |||
<s:iterator value="actionMessages"> | |||
<li><span class="actionMessage"><s:property escape="true" /></span></li> | |||
</s:iterator> | |||
</ul> | |||
</s:if> | |||
<div class="admin"> | |||
<div class="controls"> | |||
<redback:ifAuthorized permission="archiva-manage-configuration"> | |||
<s:url id="addLegacyArtifactPathUrl" action="addLegacyArtifactPath"/> | |||
<s:a href="%{addLegacyArtifactPathUrl}"> | |||
<img src="<c:url value="/images/icons/create.png" />" alt="" width="16" height="16"/> | |||
Add | |||
</s:a> | |||
</redback:ifAuthorized> | |||
</div> | |||
<h2>Path Mappings</h2> | |||
<c:choose> | |||
<c:when test="${empty (legacyArtifactPaths)}"> | |||
<%-- No paths. --%> | |||
<p><strong>There are no legacy artifact paths configured yet.</strong></p> | |||
</c:when> | |||
<c:otherwise> | |||
<%-- Display the paths. --%> | |||
<c:forEach items="${legacyArtifactPaths}" var="legacyArtifactPath" varStatus="i"> | |||
<c:choose> | |||
<c:when test='${(i.index)%2 eq 0}'> | |||
<c:set var="rowColor" value="dark" scope="page"/> | |||
</c:when> | |||
<c:otherwise> | |||
<c:set var="rowColor" value="lite" scope="page"/> | |||
</c:otherwise> | |||
</c:choose> | |||
<div class="legacyArtifactPath ${rowColor}"> | |||
<div class="controls"> | |||
<%-- TODO: make some icons --%> | |||
<redback:ifAnyAuthorized permissions="archiva-manage-configuration"> | |||
<s:token/> | |||
<s:url id="deleteLegacyArtifactPath" encode="true" action="deleteLegacyArtifactPath"> | |||
<s:param name="path" value="%{#attr.legacyArtifactPath.path}"/> | |||
<s:param name="struts.token.name">struts.token</s:param> | |||
<s:param name="struts.token"><s:property value="struts.token"/></s:param> | |||
</s:url> | |||
<s:a href="%{deleteLegacyArtifactPath}"> | |||
<img src="<c:url value="/images/icons/delete.gif" />" alt="" width="16" height="16"/> | |||
Delete | |||
</s:a> | |||
</redback:ifAnyAuthorized> | |||
</div> | |||
<%-- used c:out in displaying EL's so that they would be escaped --%> | |||
<table class="infoTable"> | |||
<tr> | |||
<th>Path</th> | |||
<td> | |||
<code><c:out value="${legacyArtifactPath.path}" /></code> | |||
</td> | |||
</tr> | |||
<tr> | |||
<th>Artifact</th> | |||
<td> | |||
<code><c:out value="${legacyArtifactPath.artifact}" /></code> | |||
</td> | |||
</tr> | |||
</table> | |||
</div> | |||
</c:forEach> | |||
</c:otherwise> | |||
</c:choose> | |||
</div> | |||
</div> | |||
</body> | |||
</html> | |||
<%-- | |||
~ Licensed to the Apache Software Foundation (ASF) under one | |||
~ or more contributor license agreements. See the NOTICE file | |||
~ distributed with this work for additional information | |||
~ regarding copyright ownership. The ASF licenses this file | |||
~ to you 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. | |||
--%> | |||
<%@ page contentType="text/html; charset=UTF-8" %> | |||
<%@ taglib prefix="s" uri="/struts-tags" %> | |||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | |||
<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %> | |||
<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %> | |||
<html> | |||
<head> | |||
<title>Administration - Legacy Support</title> | |||
<s:head/> | |||
</head> | |||
<body> | |||
<h1>Administration - Legacy Artifact Path Resolution</h1> | |||
<div id="contentArea"> | |||
<%-- changed the structure of displaying errorMessages & actionMessages in order for them to be escaped. --%> | |||
<s:if test="hasActionErrors()"> | |||
<ul> | |||
<s:iterator value="actionErrors"> | |||
<li><span class="errorMessage"><s:property escape="true" /></span></li> | |||
</s:iterator> | |||
</ul> | |||
</s:if> | |||
<s:if test="hasActionMessages()"> | |||
<ul> | |||
<s:iterator value="actionMessages"> | |||
<li><span class="actionMessage"><s:property escape="true" /></span></li> | |||
</s:iterator> | |||
</ul> | |||
</s:if> | |||
<div class="admin"> | |||
<div class="controls"> | |||
<redback:ifAuthorized permission="archiva-manage-configuration"> | |||
<s:url id="addLegacyArtifactPathUrl" action="addLegacyArtifactPath"/> | |||
<s:a href="%{addLegacyArtifactPathUrl}"> | |||
<img src="<c:url value="/images/icons/create.png" />" alt="" width="16" height="16"/> | |||
Add | |||
</s:a> | |||
</redback:ifAuthorized> | |||
</div> | |||
<h2>Path Mappings</h2> | |||
<c:choose> | |||
<c:when test="${empty (legacyArtifactPaths)}"> | |||
<%-- No paths. --%> | |||
<p><strong>There are no legacy artifact paths configured yet.</strong></p> | |||
</c:when> | |||
<c:otherwise> | |||
<%-- Display the paths. --%> | |||
<c:forEach items="${legacyArtifactPaths}" var="legacyArtifactPath" varStatus="i"> | |||
<c:choose> | |||
<c:when test='${(i.index)%2 eq 0}'> | |||
<c:set var="rowColor" value="dark" scope="page"/> | |||
</c:when> | |||
<c:otherwise> | |||
<c:set var="rowColor" value="lite" scope="page"/> | |||
</c:otherwise> | |||
</c:choose> | |||
<div class="legacyArtifactPath ${rowColor}"> | |||
<div class="controls"> | |||
<%-- TODO: make some icons --%> | |||
<redback:ifAnyAuthorized permissions="archiva-manage-configuration"> | |||
<s:token/> | |||
<s:url id="deleteLegacyArtifactPath" encode="true" action="deleteLegacyArtifactPath"> | |||
<s:param name="path" value="%{#attr.legacyArtifactPath.path}"/> | |||
<s:param name="struts.token.name">token</s:param> | |||
<s:param name="token"><s:property value="token"/></s:param> | |||
</s:url> | |||
<s:a href="%{deleteLegacyArtifactPath}"> | |||
<img src="<c:url value="/images/icons/delete.gif" />" alt="" width="16" height="16"/> | |||
Delete | |||
</s:a> | |||
</redback:ifAnyAuthorized> | |||
</div> | |||
<%-- used c:out in displaying EL's so that they would be escaped --%> | |||
<table class="infoTable"> | |||
<tr> | |||
<th>Path</th> | |||
<td> | |||
<code><c:out value="${legacyArtifactPath.path}" /></code> | |||
</td> | |||
</tr> | |||
<tr> | |||
<th>Artifact</th> | |||
<td> | |||
<code><c:out value="${legacyArtifactPath.artifact}" /></code> | |||
</td> | |||
</tr> | |||
</table> | |||
</div> | |||
</c:forEach> | |||
</c:otherwise> | |||
</c:choose> | |||
</div> | |||
</div> | |||
</body> | |||
</html> |
@@ -89,10 +89,10 @@ | |||
<s:url id="editNetworkProxyUrl" encode="true" action="editNetworkProxy"> | |||
<s:param name="proxyid" value="%{#attr.proxy.id}" /> | |||
</s:url> | |||
<s:url id="deleteNetworkProxyUrl" encode="true" action="deleteNetworkProxy" method="confirm"> | |||
<s:url id="deleteNetworkProxyUrl" encode="true" action="deleteNetworkProxy"> | |||
<s:param name="proxyid" value="%{#attr.proxy.id}" /> | |||
<s:param name="struts.token.name">struts.token</s:param> | |||
<s:param name="struts.token"><s:property value="struts.token"/></s:param> | |||
<s:param name="struts.token.name">token</s:param> | |||
<s:param name="token"><s:property value="token"/></s:param> | |||
</s:url> | |||
<s:a href="%{editNetworkProxyUrl}"> | |||
<img src="<c:url value="/images/icons/edit.png" />" /> |
@@ -129,8 +129,8 @@ | |||
<s:url id="deleteProxyConnectorUrl" action="deleteProxyConnector" method="confirmDelete"> | |||
<s:param name="source" value="%{#attr.connector.sourceRepoId}"/> | |||
<s:param name="target" value="%{#attr.connector.targetRepoId}"/> | |||
<s:param name="struts.token.name">struts.token</s:param> | |||
<s:param name="struts.token"><s:property value="struts.token"/></s:param> | |||
<s:param name="struts.token.name">token</s:param> | |||
<s:param name="token"><s:property value="token"/></s:param> | |||
</s:url> | |||
<s:url id="enableProxyConnectorUrl" action="enableProxyConnector" method="confirmEnable"> | |||
<s:param name="source" value="%{#attr.connector.sourceRepoId}"/> | |||
@@ -139,8 +139,8 @@ | |||
<s:url id="disableProxyConnectorUrl" action="disableProxyConnector" method="confirmDisable"> | |||
<s:param name="source" value="%{#attr.connector.sourceRepoId}"/> | |||
<s:param name="target" value="%{#attr.connector.targetRepoId}"/> | |||
<s:param name="struts.token.name">struts.token</s:param> | |||
<s:param name="struts.token"><s:property value="struts.token"/></s:param> | |||
<s:param name="struts.token.name">token</s:param> | |||
<s:param name="token"><s:property value="token"/></s:param> | |||
</s:url> | |||
<c:if test="${connector.disabled}"> | |||
<s:a href="%{enableProxyConnectorUrl}" title="Enable Proxy Connector"> |
@@ -105,8 +105,8 @@ | |||
<s:token/> | |||
<s:url id="deleteRepositoryUrl" encode="true" action="confirmDeleteRepository"> | |||
<s:param name="repoid" value="%{#attr.repository.id}"/> | |||
<s:param name="struts.token.name">struts.token</s:param> | |||
<s:param name="struts.token"><s:property value="struts.token"/></s:param> | |||
<s:param name="struts.token.name">token</s:param> | |||
<s:param name="token"><s:property value="token"/></s:param> | |||
</s:url> | |||
<s:a href="%{editRepositoryUrl}"> | |||
<img src="<c:url value="/images/icons/edit.png" />" alt="" width="16" height="16"/> | |||
@@ -320,8 +320,8 @@ | |||
<s:token/> | |||
<s:url id="deleteRepositoryUrl" encode="true" action="confirmDeleteRemoteRepository"> | |||
<s:param name="repoid" value="%{#attr.repository.id}"/> | |||
<s:param name="struts.token.name">struts.token</s:param> | |||
<s:param name="struts.token"><s:property value="struts.token"/></s:param> | |||
<s:param name="struts.token.name">token</s:param> | |||
<s:param name="token"><s:property value="token"/></s:param> | |||
</s:url> | |||
<s:a href="%{deleteRepositoryUrl}"> | |||
<img src="<c:url value="/images/icons/delete.gif" />" alt="" width="16" height="16"/> |
@@ -75,8 +75,8 @@ | |||
<s:token/> | |||
<s:url id="deleteRepositoryGroupUrl" action="confirmDeleteRepositoryGroup"> | |||
<s:param name="repoGroupId" value="%{#attr.repositoryGroup.key}" /> | |||
<s:param name="struts.token.name">struts.token</s:param> | |||
<s:param name="struts.token"><s:property value="struts.token"/></s:param> | |||
<s:param name="struts.token.name">token</s:param> | |||
<s:param name="token"><s:property value="token"/></s:param> | |||
</s:url> | |||
<s:a href="%{deleteRepositoryGroupUrl}" cssClass="delete"> | |||
<img src="${iconDeleteUrl}"/> |
@@ -41,8 +41,8 @@ | |||
<c:url var="iconDeleteUrl" value="/images/icons/delete.gif" /> | |||
<c:url var="iconCreateUrl" value="/images/icons/create.png" /> | |||
<s:url id="removeFiletypePatternUrl" action="repositoryScanning" method="removeFiletypePattern"/> | |||
<s:url id="addFiletypePatternUrl" action="repositoryScanning" method="addFiletypePattern"/> | |||
<s:url id="removeFiletypePatternUrl" action="repositoryScanning_removeFiletypePattern"/> | |||
<s:url id="addFiletypePatternUrl" action="repositoryScanning_addFiletypePattern"/> | |||
<script type="text/javascript"> | |||
<!-- | |||
@@ -154,7 +154,7 @@ | |||
<c:otherwise> | |||
<%-- Display the consumers. --%> | |||
<s:form method="post" action="repositoryScanning!updateKnownConsumers" | |||
<s:form method="post" action="repositoryScanning_updateKnownConsumers" | |||
namespace="/admin" validate="false" theme="simple"> | |||
<s:token/> | |||
<table class="consumers"> |
@@ -47,7 +47,7 @@ | |||
</s:if> | |||
<div id="contentArea"> | |||
<s:form action="deleteArtifact!doDelete" namespace="/" method="post" validate="true"> | |||
<s:form action="deleteArtifact_submit" namespace="/" method="post" validate="true"> | |||
<%@ include file="/WEB-INF/jsp/include/deleteArtifactForm.jspf" %> | |||
<s:token/> | |||
<s:submit/> |
@@ -21,8 +21,8 @@ | |||
<%@ taglib prefix="s" uri="/struts-tags" %> | |||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | |||
<s:textfield name="groupId" label="Group Id" size="50" required="true"/> | |||
<s:textfield name="artifactId" label="Artifact Id" size="50" required="true"/> | |||
<s:textfield name="version" label="Version" size="50" required="true"/> | |||
<s:textfield name="groupId" label="Group Id" size="50" requiredLabel="true"/> | |||
<s:textfield name="artifactId" label="Artifact Id" size="50" requiredLabel="true"/> | |||
<s:textfield name="version" label="Version" size="50" requiredLabel="true"/> | |||
<s:select name="repositoryId" list="managedRepos" label="Repository Id"/> | |||
@@ -23,14 +23,14 @@ | |||
<%@ taglib prefix="s" uri="/struts-tags" %> | |||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | |||
<s:textfield name="groupId" label="Group Id" size="50" required="true"/> | |||
<s:textfield name="artifactId" label="Artifact Id" size="50" required="true"/> | |||
<s:textfield name="version" label="Version" size="50" required="true"/> | |||
<s:textfield name="packaging" label="Packaging" size="50" required="true"/> | |||
<s:textfield name="classifier" label="Classifier" size="50" required="false"/> | |||
<s:textfield name="groupId" label="Group Id" size="50" requiredLabel="true"/> | |||
<s:textfield name="artifactId" label="Artifact Id" size="50" requiredLabel="true"/> | |||
<s:textfield name="version" label="Version" size="50" requiredLabel="true"/> | |||
<s:textfield name="packaging" label="Packaging" size="50" requiredLabel="true"/> | |||
<s:textfield name="classifier" label="Classifier" size="50" requiredLabel="false"/> | |||
<s:checkbox name="generatePom" value="generatePom" | |||
label="Generate Maven 2 POM"/> | |||
<s:file name="artifact" label="Artifact File" required="true"/> | |||
<s:file name="artifact" label="Artifact File" requiredLabel="true"/> | |||
<s:file name="pom" label="POM File"/> | |||
<s:select name="repositoryId" list="managedRepoIdList" label="Repository Id"/> | |||
@@ -25,7 +25,7 @@ | |||
<head> | |||
<title>Audit Log Report</title> | |||
<s:head theme="ajax" /> | |||
<s:head /> | |||
<link rel="stylesheet" href="<c:url value='/css/no-theme/jquery-ui-1.7.2.custom.css'/>" type="text/css" /> | |||
<script type="text/javascript" src="<c:url value='/js/jquery-1.3.2.min.js'/>"></script> |
@@ -25,7 +25,7 @@ | |||
<head> | |||
<title>Reports</title> | |||
<s:head theme="ajax" /> | |||
<s:head /> | |||
<link rel="stylesheet" href="<c:url value='/css/no-theme/jquery-ui-1.7.2.custom.css'/>" type="text/css" /> | |||
<script type="text/javascript" src="<c:url value='/js/jquery-1.3.2.min.js'/>"></script> |
@@ -37,7 +37,7 @@ | |||
<s:actionerror/> | |||
<s:actionmessage/> | |||
<s:form action="upload!doUpload" method="post" enctype="multipart/form-data" validate="true"> | |||
<s:form action="upload_submit" method="post" enctype="multipart/form-data" validate="true"> | |||
<%@ include file="/WEB-INF/jsp/include/uploadForm.jspf" %> | |||
<s:submit/> | |||
</s:form> |
@@ -24,24 +24,22 @@ | |||
<display-name>Apache Archiva</display-name> | |||
<filter> | |||
<filter-name>webwork-cleanup</filter-name> | |||
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class> | |||
</filter> | |||
<filter> | |||
<filter-name>sitemesh</filter-name> | |||
<filter-class> | |||
com.opensymphony.module.sitemesh.filter.PageFilter | |||
</filter-class> | |||
</filter> | |||
<filter> | |||
<filter-name>webwork</filter-name> | |||
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> | |||
</filter> | |||
<filter> | |||
<filter> | |||
<filter-name>struts-prepare</filter-name> | |||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class> | |||
</filter> | |||
<filter> | |||
<filter-name>sitemesh</filter-name> | |||
<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class> | |||
</filter> | |||
<filter> | |||
<filter-name>struts-execute</filter-name> | |||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class> | |||
</filter> | |||
<filter> | |||
<filter-name>encodingFilter</filter-name> | |||
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> | |||
<init-param> | |||
@@ -61,7 +59,7 @@ | |||
<!-- this must be before the sitemesh filter --> | |||
<filter-mapping> | |||
<filter-name>webwork-cleanup</filter-name> | |||
<filter-name>struts-prepare</filter-name> | |||
<url-pattern>/*</url-pattern> | |||
</filter-mapping> | |||
@@ -71,7 +69,7 @@ | |||
</filter-mapping> | |||
<filter-mapping> | |||
<filter-name>webwork</filter-name> | |||
<filter-name>struts-execute</filter-name> | |||
<url-pattern>/*</url-pattern> | |||
</filter-mapping> | |||
@@ -86,8 +84,11 @@ | |||
org.apache.maven.archiva.web.startup.ArchivaStartup | |||
</listener-class> | |||
</listener> | |||
<listener> | |||
<listener-class>org.apache.struts2.dispatcher.ng.listener.StrutsListener</listener-class> | |||
</listener> | |||
<context-param> | |||
<context-param> | |||
<param-name>contextClass</param-name> | |||
<param-value> | |||
org.codehaus.plexus.spring.PlexusWebApplicationContext |
@@ -1,39 +0,0 @@ | |||
<@s.iterator value="parameters.list"> | |||
<#if parameters.listKey?exists> | |||
<#assign itemKey = stack.findValue(parameters.listKey)/> | |||
<#else> | |||
<#assign itemKey = stack.findValue('top')/> | |||
</#if> | |||
<#if parameters.listValue?exists> | |||
<#assign itemValue = stack.findString(parameters.listValue)/> | |||
<#else> | |||
<#assign itemValue = stack.findString('top')/> | |||
</#if> | |||
<input type="checkbox" name="${parameters.name?html}" id="${parameters.id?html}${itemKey?html}"<#rt/> | |||
<#if tag.contains(parameters.nameValue, itemKey)> | |||
checked="checked"<#rt/> | |||
</#if> | |||
<#if itemKey?exists> | |||
value="${itemKey?html}"<#rt/> | |||
</#if> | |||
<#if parameters.disabled?default(false)> | |||
disabled="disabled"<#rt/> | |||
</#if> | |||
<#if parameters.tabindex?exists> | |||
tabindex="${parameters.tabindex?html}"<#rt/> | |||
</#if> | |||
<#if parameters.cssClass?exists> | |||
class="${parameters.cssClass?html}"<#rt/> | |||
</#if> | |||
<#if parameters.cssStyle?exists> | |||
style="${parameters.cssStyle?html}"<#rt/> | |||
</#if> | |||
<#if parameters.title?exists> | |||
title="${parameters.title?html}"<#rt/> | |||
</#if> | |||
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> | |||
/><#rt/> | |||
<label for="${parameters.id?html}${itemKey?html}"><#rt/> | |||
${itemValue}<#t/> | |||
</label><br/> | |||
</@s.iterator> |
@@ -1,39 +0,0 @@ | |||
<@s.iterator value="parameters.list"> | |||
<#if parameters.listKey?exists> | |||
<#assign itemKey = stack.findValue(parameters.listKey)/> | |||
<#else> | |||
<#assign itemKey = stack.findValue('top')/> | |||
</#if> | |||
<#if parameters.listValue?exists> | |||
<#assign itemValue = stack.findString(parameters.listValue)/> | |||
<#else> | |||
<#assign itemValue = stack.findString('top')/> | |||
</#if> | |||
<input type="radio" name="${parameters.name?html}" id="${parameters.id?html}${itemKey?html}"<#rt/> | |||
<#if tag.contains(parameters.nameValue, itemKey)> | |||
checked="checked"<#rt/> | |||
</#if> | |||
<#if itemKey?exists> | |||
value="${itemKey?html}"<#rt/> | |||
</#if> | |||
<#if parameters.disabled?default(false)> | |||
disabled="disabled"<#rt/> | |||
</#if> | |||
<#if parameters.tabindex?exists> | |||
tabindex="${parameters.tabindex?html}"<#rt/> | |||
</#if> | |||
<#if parameters.cssClass?exists> | |||
class="${parameters.cssClass?html}"<#rt/> | |||
</#if> | |||
<#if parameters.cssStyle?exists> | |||
style="${parameters.cssStyle?html}"<#rt/> | |||
</#if> | |||
<#if parameters.title?exists> | |||
title="${parameters.title?html}"<#rt/> | |||
</#if> | |||
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> | |||
/><#rt/> | |||
<label for="${parameters.id?html}${itemKey?html}"><#rt/> | |||
${itemValue}<#t/> | |||
</label><br/> | |||
</@s.iterator> |
@@ -1,20 +0,0 @@ | |||
# | |||
# Licensed to the Apache Software Foundation (ASF) under one | |||
# or more contributor license agreements. See the NOTICE file | |||
# distributed with this work for additional information | |||
# regarding copyright ownership. The ASF licenses this file | |||
# to you 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. | |||
# | |||
parent = xhtml |
@@ -1 +0,0 @@ | |||
</a><#rt/> |
@@ -1,22 +0,0 @@ | |||
<a<#rt/> | |||
<#if parameters.id?if_exists != ""> | |||
id="${parameters.id?html}"<#rt/> | |||
</#if> | |||
<#if parameters.href?if_exists != ""> | |||
href="${parameters.href}"<#rt/> | |||
</#if> | |||
<#if parameters.tabindex?exists> | |||
tabindex="${parameters.tabindex?html}"<#rt/> | |||
</#if> | |||
<#if parameters.cssClass?exists> | |||
class="${parameters.cssClass?html}"<#rt/> | |||
</#if> | |||
<#if parameters.cssStyle?exists> | |||
style="${parameters.cssStyle?html}"<#rt/> | |||
</#if> | |||
<#if parameters.title?exists> | |||
title="${parameters.title?html}"<#rt/> | |||
</#if> | |||
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> | |||
<#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> | |||
><#rt/> |
@@ -1,7 +0,0 @@ | |||
<#if (actionErrors?exists && actionErrors?size > 0)> | |||
<ul> | |||
<#list actionErrors as error> | |||
<li><span class="errorMessage">${error}</span></li> | |||
</#list> | |||
</ul> | |||
</#if> |
@@ -1,7 +0,0 @@ | |||
<#if (actionMessages?exists && actionMessages?size > 0)> | |||
<ul> | |||
<#list actionMessages as message> | |||
<li><span class="actionMessage">${message}</span></li> | |||
</#list> | |||
</ul> | |||
</#if> |
@@ -1,15 +0,0 @@ | |||
<input type="hidden"<#rt/> | |||
name="${parameters.name?default("")?html}"<#rt/> | |||
<#if parameters.nameValue?exists> | |||
value="<@s.property value="parameters.nameValue"/>"<#rt/> | |||
</#if> | |||
<#if parameters.id?exists> | |||
id="${parameters.id?html}"<#rt/> | |||
</#if> | |||
<#if parameters.cssClass?exists> | |||
class="${parameters.cssClass?html}"<#rt/> | |||
</#if> | |||
<#if parameters.cssStyle?exists> | |||
style="${parameters.cssStyle?html}"<#rt/> | |||
</#if> | |||
/> |
@@ -1,188 +0,0 @@ | |||
package org.apache.maven.archiva.web.action; | |||
/* | |||
* Licensed to the Apache Software Foundation (ASF) under one | |||
* or more contributor license agreements. See the NOTICE file | |||
* distributed with this work for additional information | |||
* regarding copyright ownership. The ASF licenses this file | |||
* to you 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. | |||
*/ | |||
import com.opensymphony.xwork2.ObjectFactory; | |||
import com.opensymphony.xwork2.validator.ActionValidatorManager; | |||
import com.opensymphony.xwork2.validator.ActionValidatorManagerFactory; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import junit.framework.TestCase; | |||
import org.apache.maven.archiva.web.validator.utils.ValidatorUtil; | |||
public class DeleteArtifactActionTest extends TestCase | |||
{ | |||
private static final String EMPTY_STRING = ""; | |||
// valid inputs | |||
private static final String GROUP_ID_VALID_INPUT = "abcXYZ0129._-"; | |||
private static final String ARTIFACT_ID_VALID_INPUT = "abcXYZ0129._-"; | |||
private static final String VERSION_VALID_INPUT = "1.2.3"; | |||
private static final String REPOSITORY_ID_VALID_INPUT = "abcXYZ0129._-"; | |||
// invalid inputs | |||
private static final String GROUP_ID_INVALID_INPUT = "<> \\/~+[ ]'\""; | |||
private static final String ARTIFACT_ID_INVALID_INPUT = "<> \\/~+[ ]'\""; | |||
private static final String VERSION_INVALID_INPUT = "<>"; | |||
private static final String REPOSITORY_ID_INVALID_INPUT = "<> \\/~+[ ]'\""; | |||
// testing requisite | |||
private DeleteArtifactAction deleteArtifactAction; | |||
private ActionValidatorManager actionValidatorManager; | |||
@Override | |||
public void setUp() throws Exception | |||
{ | |||
deleteArtifactAction = new DeleteArtifactAction(); | |||
ObjectFactory.setObjectFactory(new ObjectFactory()); | |||
actionValidatorManager = ActionValidatorManagerFactory.getInstance(); | |||
} | |||
public void testStruts2ValidationFrameworkWithNullInputs() throws Exception | |||
{ | |||
// prep | |||
populateDeleteArtifactActionFields(deleteArtifactAction, null, null, null, null); | |||
// test | |||
actionValidatorManager.validate(deleteArtifactAction, EMPTY_STRING); | |||
// verify | |||
assertTrue(deleteArtifactAction.hasFieldErrors()); | |||
Map<String, List<String>> fieldErrors = deleteArtifactAction.getFieldErrors(); | |||
// make an expected field error object | |||
Map<String, List<String>> expectedFieldErrors = new HashMap<String, List<String>>(); | |||
// populate | |||
List<String> expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a groupId."); | |||
expectedFieldErrors.put("groupId", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter an artifactId."); | |||
expectedFieldErrors.put("artifactId", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a version."); | |||
expectedFieldErrors.put("version", expectedErrorMessages); | |||
// repositoryId is not required. | |||
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors); | |||
} | |||
public void testStruts2ValidationFrameworkWithBlankInputs() throws Exception | |||
{ | |||
// prep | |||
populateDeleteArtifactActionFields(deleteArtifactAction, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING); | |||
// test | |||
actionValidatorManager.validate(deleteArtifactAction, EMPTY_STRING); | |||
// verify | |||
assertTrue(deleteArtifactAction.hasFieldErrors()); | |||
Map<String, List<String>> fieldErrors = deleteArtifactAction.getFieldErrors(); | |||
// make an expected field error object | |||
Map<String, List<String>> expectedFieldErrors = new HashMap<String, List<String>>(); | |||
// populate | |||
List<String> expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a groupId."); | |||
expectedFieldErrors.put("groupId", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter an artifactId."); | |||
expectedFieldErrors.put("artifactId", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a version."); | |||
expectedFieldErrors.put("version", expectedErrorMessages); | |||
// repositoryId is not required. | |||
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors); | |||
} | |||
public void testStruts2ValidationFrameworkWithInvalidInputs() throws Exception | |||
{ | |||
// prep | |||
populateDeleteArtifactActionFields(deleteArtifactAction, GROUP_ID_INVALID_INPUT, ARTIFACT_ID_INVALID_INPUT, VERSION_INVALID_INPUT, REPOSITORY_ID_INVALID_INPUT); | |||
// test | |||
actionValidatorManager.validate(deleteArtifactAction, EMPTY_STRING); | |||
// verify | |||
assertTrue(deleteArtifactAction.hasFieldErrors()); | |||
Map<String, List<String>> fieldErrors = deleteArtifactAction.getFieldErrors(); | |||
// make an expected field error object | |||
Map<String, List<String>> expectedFieldErrors = new HashMap<String, List<String>>(); | |||
// populate | |||
List<String> expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)."); | |||
expectedFieldErrors.put("groupId", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)."); | |||
expectedFieldErrors.put("artifactId", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Repository id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)."); | |||
expectedFieldErrors.put("repositoryId", expectedErrorMessages); | |||
// version has its validation in the validate() method of the action class. | |||
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors); | |||
} | |||
public void testStruts2ValidationFrameworkWithValidInputs() throws Exception | |||
{ | |||
// prep | |||
populateDeleteArtifactActionFields(deleteArtifactAction, GROUP_ID_VALID_INPUT, ARTIFACT_ID_VALID_INPUT, VERSION_VALID_INPUT, REPOSITORY_ID_VALID_INPUT); | |||
// test | |||
actionValidatorManager.validate(deleteArtifactAction, EMPTY_STRING); | |||
// verify | |||
assertFalse(deleteArtifactAction.hasFieldErrors()); | |||
} | |||
private void populateDeleteArtifactActionFields(DeleteArtifactAction deleteArtifactAction, String groupId, String artifactId, String version, String repositoryId) | |||
{ | |||
deleteArtifactAction.setGroupId(groupId); | |||
deleteArtifactAction.setArtifactId(artifactId); | |||
deleteArtifactAction.setVersion(version); | |||
deleteArtifactAction.setRepositoryId(repositoryId); | |||
} | |||
} |
@@ -20,47 +20,12 @@ package org.apache.maven.archiva.web.action.admin.appearance; | |||
*/ | |||
import com.opensymphony.xwork2.Action; | |||
import com.opensymphony.xwork2.ObjectFactory; | |||
import com.opensymphony.xwork2.validator.ActionValidatorManager; | |||
import com.opensymphony.xwork2.validator.ActionValidatorManagerFactory; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import org.apache.maven.archiva.configuration.OrganisationInformation; | |||
import org.apache.maven.archiva.web.validator.utils.ValidatorUtil; | |||
/** | |||
*/ | |||
public class EditOrganizationInfoActionTest extends AbstractOrganizationInfoActionTest | |||
{ | |||
private static final String EMPTY_STRING = ""; | |||
// valid inputs | |||
private static final String ORGANISATION_NAME_VALID_INPUT = "abcXYZ0129. _/\\~ :?!&=-"; | |||
private static final String ORGANISATION_URL_VALID_INPUT = "file://home/user/abcXYZ0129._/\\~:?!&=-<> ~+[ ]'\""; | |||
private static final String ORGANISATION_LOGO_VALID_INPUT = "file://home/user/abcXYZ0129._/\\~:?!&=-<> ~+[ ]'\""; | |||
// invalid inputs | |||
private static final String ORGANISATION_NAME_INVALID_INPUT = "<>~+[ ]'\""; | |||
private static final String ORGANISATION_URL_INVALID_INPUT = "/home/user/abcXYZ0129._/\\~:?!&=-<> ~+[ ]'\""; | |||
private static final String ORGANISATION_LOGO_INVALID_INPUT = "/home/user/abcXYZ0129._/\\~:?!&=-<> ~+[ ]'\""; | |||
// testing requisite | |||
private ActionValidatorManager actionValidatorManager; | |||
@Override | |||
public void setUp() throws Exception | |||
{ | |||
super.setUp(); | |||
ObjectFactory.setObjectFactory(new ObjectFactory()); | |||
actionValidatorManager = ActionValidatorManagerFactory.getInstance(); | |||
} | |||
public void testOrganisationInfoSaves() | |||
throws Exception | |||
{ | |||
@@ -91,109 +56,6 @@ public class EditOrganizationInfoActionTest extends AbstractOrganizationInfoActi | |||
assertEquals("URL1", orginfo.getUrl()); | |||
} | |||
public void testStruts2ValidationFrameworkWithNullInputs() throws Exception | |||
{ | |||
// prep | |||
action = getAction(); | |||
populateOrganisationValues(action, null, null, null); | |||
// test | |||
actionValidatorManager.validate(action, EMPTY_STRING); | |||
// verify | |||
assertTrue(action.hasFieldErrors()); | |||
Map<String, List<String>> fieldErrors = action.getFieldErrors(); | |||
// make an expected field error object | |||
Map<String, List<String>> expectedFieldErrors = new HashMap<String, List<String>>(); | |||
// populate | |||
List<String> expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a name"); | |||
expectedFieldErrors.put("organisationName", expectedErrorMessages); | |||
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors); | |||
} | |||
public void testStruts2ValidationFrameworkWithBlankInputs() throws Exception | |||
{ | |||
// prep | |||
action = getAction(); | |||
populateOrganisationValues(action, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING); | |||
// test | |||
actionValidatorManager.validate(action, EMPTY_STRING); | |||
// verify | |||
assertTrue(action.hasFieldErrors()); | |||
Map<String, List<String>> fieldErrors = action.getFieldErrors(); | |||
// make an expected field error object | |||
Map<String, List<String>> expectedFieldErrors = new HashMap<String, List<String>>(); | |||
// populate | |||
List<String> expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a name"); | |||
expectedFieldErrors.put("organisationName", expectedErrorMessages); | |||
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors); | |||
} | |||
public void testStruts2ValidationFrameworkWithInvalidInputs() throws Exception | |||
{ | |||
// prep | |||
action = getAction(); | |||
populateOrganisationValues(action, ORGANISATION_NAME_INVALID_INPUT, ORGANISATION_URL_INVALID_INPUT, ORGANISATION_LOGO_INVALID_INPUT); | |||
// test | |||
actionValidatorManager.validate(action, EMPTY_STRING); | |||
// verify | |||
assertTrue(action.hasFieldErrors()); | |||
Map<String, List<String>> fieldErrors = action.getFieldErrors(); | |||
// make an expected field error object | |||
Map<String, List<String>> expectedFieldErrors = new HashMap<String, List<String>>(); | |||
// populate | |||
List<String> expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Organisation name must only contain alphanumeric characters, white-spaces(' '), equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)."); | |||
expectedFieldErrors.put("organisationName", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a URL"); | |||
expectedFieldErrors.put("organisationUrl", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a URL"); | |||
expectedFieldErrors.put("organisationLogo", expectedErrorMessages); | |||
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors); | |||
} | |||
public void testStruts2ValidationFrameworkWithValidInputs() throws Exception | |||
{ | |||
// prep | |||
action = getAction(); | |||
populateOrganisationValues(action, ORGANISATION_NAME_VALID_INPUT, ORGANISATION_URL_VALID_INPUT, ORGANISATION_LOGO_VALID_INPUT); | |||
// test | |||
actionValidatorManager.validate(action, EMPTY_STRING); | |||
// verify | |||
assertFalse(action.hasFieldErrors()); | |||
} | |||
private void populateOrganisationValues(AbstractAppearanceAction abstractAppearanceAction , String name, String url, String logo) | |||
{ | |||
abstractAppearanceAction.setOrganisationName(name); | |||
abstractAppearanceAction.setOrganisationUrl(url); | |||
abstractAppearanceAction.setOrganisationLogo(logo); | |||
} | |||
@Override | |||
protected AbstractAppearanceAction getAction() | |||
{ |
@@ -20,19 +20,21 @@ package org.apache.maven.archiva.web.action.admin.database; | |||
*/ | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import com.opensymphony.xwork2.ActionContext; | |||
import junit.framework.TestCase; | |||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | |||
import org.apache.maven.archiva.configuration.Configuration; | |||
import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration; | |||
import org.codehaus.plexus.spring.PlexusInSpringTestCase; | |||
import org.easymock.MockControl; | |||
/** | |||
* DatabaseActionTest | |||
*/ | |||
public class DatabaseActionTest | |||
extends PlexusInSpringTestCase | |||
extends TestCase | |||
{ | |||
private DatabaseAction action; | |||
@@ -45,7 +47,7 @@ public class DatabaseActionTest | |||
protected void setUp() | |||
throws Exception | |||
{ | |||
super.setUp(); | |||
ActionContext.setContext( new ActionContext( new HashMap<String, Object>() ) ); | |||
archivaConfigControl = MockControl.createControl( ArchivaConfiguration.class ); | |||
archivaConfig = (ArchivaConfiguration) archivaConfigControl.getMock(); | |||
@@ -77,12 +79,6 @@ public class DatabaseActionTest | |||
action.setArchivaConfiguration( archivaConfig ); | |||
} | |||
protected void tearDown() | |||
throws Exception | |||
{ | |||
super.tearDown(); | |||
} | |||
public void testUpdateUnprocessedConsumers() | |||
throws Exception | |||
{ |
@@ -1,232 +0,0 @@ | |||
package org.apache.maven.archiva.web.action.admin.legacy; | |||
/* | |||
* Licensed to the Apache Software Foundation (ASF) under one | |||
* or more contributor license agreements. See the NOTICE file | |||
* distributed with this work for additional information | |||
* regarding copyright ownership. The ASF licenses this file | |||
* to you 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. | |||
*/ | |||
import com.opensymphony.xwork2.ObjectFactory; | |||
import com.opensymphony.xwork2.validator.ActionValidatorManager; | |||
import com.opensymphony.xwork2.validator.ActionValidatorManagerFactory; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import junit.framework.TestCase; | |||
import org.apache.maven.archiva.configuration.LegacyArtifactPath; | |||
import org.apache.maven.archiva.web.validator.utils.ValidatorUtil; | |||
public class AddLegacyArtifactPathActionTest extends TestCase | |||
{ | |||
private static final String EMPTY_STRING = ""; | |||
// valid inputs | |||
private static final String LEGACY_ARTIFACT_PATH_PATH_VALID_INPUT = "-abcXYZ0129._/\\"; | |||
private static final String GROUP_ID_VALID_INPUT = "abcXYZ0129._-"; | |||
private static final String ARTIFACT_ID_VALID_INPUT = "abcXYZ0129._-"; | |||
private static final String VERSION_VALID_INPUT = "abcXYZ0129._-"; | |||
private static final String CLASSIFIER_VALID_INPUT = "abcXYZ0129._-"; | |||
private static final String TYPE_VALID_INPUT = "abcXYZ0129._-"; | |||
// invalid inputs | |||
private static final String LEGACY_ARTIFACT_PATH_PATH_INVALID_INPUT = "<> ~+[ ]'\""; | |||
private static final String GROUP_ID_INVALID_INPUT = "<> \\/~+[ ]'\""; | |||
private static final String ARTIFACT_ID_INVALID_INPUT = "<> \\/~+[ ]'\""; | |||
private static final String VERSION_INVALID_INPUT = "<> \\/~+[ ]'\""; | |||
private static final String CLASSIFIER_INVALID_INPUT = "<> \\/~+[ ]'\""; | |||
private static final String TYPE_INVALID_INPUT = "<> \\/~+[ ]'\""; | |||
// testing requisite | |||
private AddLegacyArtifactPathAction addLegacyArtifactPathAction; | |||
private ActionValidatorManager actionValidatorManager; | |||
@Override | |||
public void setUp() throws Exception | |||
{ | |||
addLegacyArtifactPathAction = new AddLegacyArtifactPathAction(); | |||
ObjectFactory.setObjectFactory(new ObjectFactory()); | |||
actionValidatorManager = ActionValidatorManagerFactory.getInstance(); | |||
} | |||
public void testStruts2ValidationFrameworkWithNullInputs() throws Exception | |||
{ | |||
// prep | |||
LegacyArtifactPath legacyArtifactPath = createLegacyArtifactPath(null); | |||
populateAddLegacyArtifactPathActionFields(addLegacyArtifactPathAction, legacyArtifactPath, null, null, null, null, null); | |||
// test | |||
actionValidatorManager.validate(addLegacyArtifactPathAction, EMPTY_STRING); | |||
// verify | |||
assertTrue(addLegacyArtifactPathAction.hasFieldErrors()); | |||
Map<String, List<String>> fieldErrors = addLegacyArtifactPathAction.getFieldErrors(); | |||
// make an expected field error object | |||
Map<String, List<String>> expectedFieldErrors = new HashMap<String, List<String>>(); | |||
// populate | |||
List<String> expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a legacy path."); | |||
expectedFieldErrors.put("legacyArtifactPath.path", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a groupId."); | |||
expectedFieldErrors.put("groupId", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter an artifactId."); | |||
expectedFieldErrors.put("artifactId", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a version."); | |||
expectedFieldErrors.put("version", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a type."); | |||
expectedFieldErrors.put("type", expectedErrorMessages); | |||
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors); | |||
} | |||
public void testStruts2ValidationFrameworkWithBlankInputs() throws Exception | |||
{ | |||
// prep | |||
LegacyArtifactPath legacyArtifactPath = createLegacyArtifactPath(EMPTY_STRING); | |||
populateAddLegacyArtifactPathActionFields(addLegacyArtifactPathAction, legacyArtifactPath, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING); | |||
// test | |||
actionValidatorManager.validate(addLegacyArtifactPathAction, EMPTY_STRING); | |||
// verify | |||
assertTrue(addLegacyArtifactPathAction.hasFieldErrors()); | |||
Map<String, List<String>> fieldErrors = addLegacyArtifactPathAction.getFieldErrors(); | |||
// make an expected field error object | |||
Map<String, List<String>> expectedFieldErrors = new HashMap<String, List<String>>(); | |||
// populate | |||
List<String> expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a legacy path."); | |||
expectedFieldErrors.put("legacyArtifactPath.path", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a groupId."); | |||
expectedFieldErrors.put("groupId", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter an artifactId."); | |||
expectedFieldErrors.put("artifactId", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a version."); | |||
expectedFieldErrors.put("version", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a type."); | |||
expectedFieldErrors.put("type", expectedErrorMessages); | |||
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors); | |||
} | |||
public void testStruts2ValidationFrameworkWithInvalidInputs() throws Exception | |||
{ | |||
// prep | |||
LegacyArtifactPath legacyArtifactPath = createLegacyArtifactPath(LEGACY_ARTIFACT_PATH_PATH_INVALID_INPUT); | |||
populateAddLegacyArtifactPathActionFields(addLegacyArtifactPathAction, legacyArtifactPath, GROUP_ID_INVALID_INPUT, ARTIFACT_ID_INVALID_INPUT, VERSION_INVALID_INPUT, CLASSIFIER_INVALID_INPUT, TYPE_INVALID_INPUT); | |||
// test | |||
actionValidatorManager.validate(addLegacyArtifactPathAction, EMPTY_STRING); | |||
// verify | |||
assertTrue(addLegacyArtifactPathAction.hasFieldErrors()); | |||
Map<String, List<String>> fieldErrors = addLegacyArtifactPathAction.getFieldErrors(); | |||
// make an expected field error object | |||
Map<String, List<String>> expectedFieldErrors = new HashMap<String, List<String>>(); | |||
// populate | |||
List<String> expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Legacy path must only contain alphanumeric characters, forward-slashes(/), back-slashes(\\), underscores(_), dots(.), and dashes(-)."); | |||
expectedFieldErrors.put("legacyArtifactPath.path", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)."); | |||
expectedFieldErrors.put("groupId", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)."); | |||
expectedFieldErrors.put("artifactId", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Version must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)."); | |||
expectedFieldErrors.put("version", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Classifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)."); | |||
expectedFieldErrors.put("classifier", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Type must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)."); | |||
expectedFieldErrors.put("type", expectedErrorMessages); | |||
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors); | |||
} | |||
public void testStruts2ValidationFrameworkWithValidInputs() throws Exception | |||
{ | |||
// prep | |||
LegacyArtifactPath legacyArtifactPath = createLegacyArtifactPath(LEGACY_ARTIFACT_PATH_PATH_VALID_INPUT); | |||
populateAddLegacyArtifactPathActionFields(addLegacyArtifactPathAction, legacyArtifactPath, GROUP_ID_VALID_INPUT, ARTIFACT_ID_VALID_INPUT, VERSION_VALID_INPUT, CLASSIFIER_VALID_INPUT, TYPE_VALID_INPUT); | |||
// test | |||
actionValidatorManager.validate(addLegacyArtifactPathAction, EMPTY_STRING); | |||
// verify | |||
assertFalse(addLegacyArtifactPathAction.hasFieldErrors()); | |||
} | |||
private LegacyArtifactPath createLegacyArtifactPath(String path) | |||
{ | |||
LegacyArtifactPath legacyArtifactPath = new LegacyArtifactPath(); | |||
legacyArtifactPath.setPath(path); | |||
return legacyArtifactPath; | |||
} | |||
private void populateAddLegacyArtifactPathActionFields(AddLegacyArtifactPathAction addLegacyArtifactPathAction, LegacyArtifactPath legacyArtifactPath, String groupId, String artifactId, String version, String classifier, String type) | |||
{ | |||
addLegacyArtifactPathAction.setLegacyArtifactPath(legacyArtifactPath); | |||
addLegacyArtifactPathAction.setGroupId(groupId); | |||
addLegacyArtifactPathAction.setArtifactId(artifactId); | |||
addLegacyArtifactPathAction.setVersion(version); | |||
addLegacyArtifactPathAction.setClassifier(classifier); | |||
addLegacyArtifactPathAction.setType(type); | |||
} | |||
} |
@@ -1,216 +0,0 @@ | |||
package org.apache.maven.archiva.web.action.admin.networkproxies; | |||
/* | |||
* Licensed to the Apache Software Foundation (ASF) under one | |||
* or more contributor license agreements. See the NOTICE file | |||
* distributed with this work for additional information | |||
* regarding copyright ownership. The ASF licenses this file | |||
* to you 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. | |||
*/ | |||
import com.opensymphony.xwork2.ObjectFactory; | |||
import com.opensymphony.xwork2.validator.ActionValidatorManager; | |||
import com.opensymphony.xwork2.validator.ActionValidatorManagerFactory; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import junit.framework.TestCase; | |||
import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; | |||
import org.apache.maven.archiva.web.validator.utils.ValidatorUtil; | |||
public class ConfigureNetworkProxyActionTest extends TestCase | |||
{ | |||
private static final String EMPTY_STRING = ""; | |||
private static final String VALIDATION_CONTEXT = "saveNetworkProxy"; | |||
// valid inputs | |||
private static final String PROXY_ID_VALID_INPUT = "abcXYZ0129._-"; | |||
private static final String PROXY_PROTOCOL_VALID_INPUT = "-abcXYZ0129./:\\"; | |||
private static final String PROXY_HOST_VALID_INPUT = "abcXYZ0129._/\\~:?!&=-"; | |||
private static final int PROXY_PORT_VALID_INPUT = 8080; | |||
private static final String PROXY_USERNAME_VALID_INPUT = "abcXYZ0129.@/_-\\"; | |||
// invalid inputs | |||
private static final String PROXY_ID_INVALID_INPUT = "<> \\/~+[ ]'\""; | |||
private static final String PROXY_PROTOCOL_INVALID_INPUT = "<> ~+[ ]'\""; | |||
private static final String PROXY_HOST_INVALID_INPUT = "<> ~+[ ]'\""; | |||
private static final int PROXY_PORT_INVALID_INPUT = 0; | |||
private static final String PROXY_USERNAME_INVALID_INPUT = "<> ~+[ ]'\""; | |||
// testing requisite | |||
private ConfigureNetworkProxyAction configureNetworkProxyAction; | |||
private ActionValidatorManager actionValidatorManager; | |||
@Override | |||
public void setUp() | |||
{ | |||
configureNetworkProxyAction = new ConfigureNetworkProxyAction(); | |||
ObjectFactory.setObjectFactory(new ObjectFactory()); | |||
actionValidatorManager = ActionValidatorManagerFactory.getInstance(); | |||
} | |||
public void testStruts2ValidationFrameworkWithNullInputs() throws Exception | |||
{ | |||
// prep | |||
NetworkProxyConfiguration networkProxyConfiguration = createNetworkProxyConfiguration(null, null, null, null); | |||
configureNetworkProxyAction.setProxy(networkProxyConfiguration); | |||
// test | |||
actionValidatorManager.validate(configureNetworkProxyAction, VALIDATION_CONTEXT); | |||
// verify | |||
assertTrue(configureNetworkProxyAction.hasFieldErrors()); | |||
Map<String, List<String>> fieldErrors = configureNetworkProxyAction.getFieldErrors(); | |||
// make an expected field error object | |||
Map<String, List<String>> expectedFieldErrors = new HashMap<String, List<String>>(); | |||
// populate | |||
List<String> expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter an identifier."); | |||
expectedFieldErrors.put("proxy.id", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a protocol."); | |||
expectedFieldErrors.put("proxy.protocol", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a host."); | |||
expectedFieldErrors.put("proxy.host", expectedErrorMessages); | |||
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors); | |||
} | |||
public void testStruts2ValidationFrameworkWithBlankInputs() throws Exception | |||
{ | |||
// prep | |||
NetworkProxyConfiguration networkProxyConfiguration = createNetworkProxyConfiguration(EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING); | |||
configureNetworkProxyAction.setProxy(networkProxyConfiguration); | |||
// test | |||
actionValidatorManager.validate(configureNetworkProxyAction, VALIDATION_CONTEXT); | |||
// verify | |||
assertTrue(configureNetworkProxyAction.hasFieldErrors()); | |||
Map<String, List<String>> fieldErrors = configureNetworkProxyAction.getFieldErrors(); | |||
// make an expected field error object | |||
Map<String, List<String>> expectedFieldErrors = new HashMap<String, List<String>>(); | |||
// populate | |||
List<String> expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter an identifier."); | |||
expectedFieldErrors.put("proxy.id", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a protocol."); | |||
expectedFieldErrors.put("proxy.protocol", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("You must enter a host."); | |||
expectedFieldErrors.put("proxy.host", expectedErrorMessages); | |||
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors); | |||
} | |||
public void testStruts2ValidationFrameworkWithInvalidInputs() throws Exception | |||
{ | |||
// prep | |||
NetworkProxyConfiguration networkProxyConfiguration = createNetworkProxyConfiguration(PROXY_ID_INVALID_INPUT, PROXY_HOST_INVALID_INPUT, PROXY_PORT_INVALID_INPUT, PROXY_PROTOCOL_INVALID_INPUT, PROXY_USERNAME_INVALID_INPUT); | |||
configureNetworkProxyAction.setProxy(networkProxyConfiguration); | |||
// test | |||
actionValidatorManager.validate(configureNetworkProxyAction, VALIDATION_CONTEXT); | |||
// verify | |||
assertTrue(configureNetworkProxyAction.hasFieldErrors()); | |||
Map<String, List<String>> fieldErrors = configureNetworkProxyAction.getFieldErrors(); | |||
// make an expected field error object | |||
Map<String, List<String>> expectedFieldErrors = new HashMap<String, List<String>>(); | |||
// populate | |||
List<String> expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Proxy id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)."); | |||
expectedFieldErrors.put("proxy.id", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Protocol must only contain alphanumeric characters, forward-slashes(/), back-slashes(\\), dots(.), colons(:), and dashes(-)."); | |||
expectedFieldErrors.put("proxy.protocol", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Host must only contain alphanumeric characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)."); | |||
expectedFieldErrors.put("proxy.host", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Port needs to be larger than 1"); | |||
expectedFieldErrors.put("proxy.port", expectedErrorMessages); | |||
expectedErrorMessages = new ArrayList<String>(); | |||
expectedErrorMessages.add("Username must only contain alphanumeric characters, at's(@), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), and dashes(-)."); | |||
expectedFieldErrors.put("proxy.username", expectedErrorMessages); | |||
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors); | |||
} | |||
public void testStruts2ValidationFrameworkWithValidInputs() throws Exception | |||
{ | |||
// prep | |||
NetworkProxyConfiguration networkProxyConfiguration = createNetworkProxyConfiguration(PROXY_ID_VALID_INPUT, PROXY_HOST_VALID_INPUT, PROXY_PORT_VALID_INPUT, PROXY_PROTOCOL_VALID_INPUT, PROXY_USERNAME_VALID_INPUT); | |||
configureNetworkProxyAction.setProxy(networkProxyConfiguration); | |||
// test | |||
actionValidatorManager.validate(configureNetworkProxyAction, VALIDATION_CONTEXT); | |||
// verify | |||
assertFalse(configureNetworkProxyAction.hasFieldErrors()); | |||
} | |||
private NetworkProxyConfiguration createNetworkProxyConfiguration(String id, String host, int port, String protocol, String username) | |||
{ | |||
NetworkProxyConfiguration networkProxyConfiguration = new NetworkProxyConfiguration(); | |||
networkProxyConfiguration.setId(id); | |||
networkProxyConfiguration.setHost(host); | |||
networkProxyConfiguration.setPort(port); | |||
networkProxyConfiguration.setProtocol(protocol); | |||
networkProxyConfiguration.setUsername(username); | |||
return networkProxyConfiguration; | |||
} | |||
// over-loaded | |||
// for simulating empty/null form purposes; excluding primitive data-typed values | |||
private NetworkProxyConfiguration createNetworkProxyConfiguration(String id, String host, String protocol, String username) | |||
{ | |||
NetworkProxyConfiguration networkProxyConfiguration = new NetworkProxyConfiguration(); | |||
networkProxyConfiguration.setId(id); | |||
networkProxyConfiguration.setHost(host); | |||
networkProxyConfiguration.setProtocol(protocol); | |||
networkProxyConfiguration.setUsername(username); | |||
return networkProxyConfiguration; | |||
} | |||
} |
@@ -19,59 +19,17 @@ package org.apache.maven.archiva.web.action.admin.repositories; | |||
* under the License. | |||
*/ | |||
import com.opensymphony.xwork2.ObjectFactory; | |||
import com.opensymphony.xwork2.validator.ActionValidatorManager; | |||
import com.opensymphony.xwork2.validator.ActionValidatorManagerFactory; | |||
import java.io.File; | |||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||
import org.codehaus.plexus.spring.PlexusInSpringTestCase; | |||
public abstract class AbstractManagedRepositoryActionTest extends PlexusInSpringTestCase | |||
{ | |||
protected static final String EMPTY_STRING = ""; | |||
// valid inputs; validation testing | |||
protected static final String REPOSITORY_ID_VALID_INPUT = "abcXYZ0129._-"; | |||
protected static final String REPOSITORY_LOCATION_VALID_INPUT = "abcXYZ0129._/\\~:?!&=-"; | |||
protected static final String REPOSITORY_INDEX_DIR_VALID_INPUT = "abcXYZ0129._/\\~:?!&=-"; | |||
protected static final String REPOSITORY_NAME_VALID_INPUT = "abcXYZ 0129.)/ _(-"; | |||
protected static final int REPOSITORY_RETENTION_COUNT_VALID_INPUT = 1; | |||
protected static final int REPOSITORY_DAYS_OLDER_VALID_INPUT = 1; | |||
// invalid inputs; validation testing | |||
protected static final String REPOSITORY_ID_INVALID_INPUT = "<> \\/~+[ ]'\""; | |||
protected static final String REPOSITORY_LOCATION_INVALID_INPUT = "<> ~+[ ]'\""; | |||
protected static final String REPOSITORY_INDEX_DIR_INVALID_INPUT = "<> ~+[ ]'\""; | |||
protected static final String REPOSITORY_NAME_INVALID_INPUT = "<>\\~+[]'\""; | |||
protected static final int REPOSITORY_RETENTION_COUNT_INVALID_INPUT = 101; | |||
protected static final int REPOSITORY_DAYS_OLDER_INVALID_INPUT = -1; | |||
// testing requisite; validation testing | |||
protected ActionValidatorManager actionValidatorManager; | |||
protected static final String REPO_ID = "repo-ident"; | |||
protected File location; | |||
@Override | |||
protected void setUp() throws Exception | |||
{ | |||
super.setUp(); | |||
ObjectFactory.setObjectFactory(new ObjectFactory()); | |||
actionValidatorManager = ActionValidatorManagerFactory.getInstance(); | |||
} | |||
protected void populateRepository( ManagedRepositoryConfiguration repository ) | |||
{ | |||
repository.setId( REPO_ID ); | |||
@@ -86,32 +44,4 @@ public abstract class AbstractManagedRepositoryActionTest extends PlexusInSpring | |||
repository.setScanned( false ); | |||
repository.setDeleteReleasedSnapshots( true ); | |||
} | |||
protected ManagedRepositoryConfiguration createManagedRepositoryConfiguration(String id, String name, String location, String indexDir, int daysOlder, int retentionCount) | |||
{ | |||
ManagedRepositoryConfiguration managedRepositoryConfiguration = new ManagedRepositoryConfiguration(); | |||
managedRepositoryConfiguration.setId(id); | |||
managedRepositoryConfiguration.setName(name); | |||
managedRepositoryConfiguration.setLocation(location); | |||
managedRepositoryConfiguration.setIndexDir(indexDir); | |||
managedRepositoryConfiguration.setDaysOlder(daysOlder); | |||
managedRepositoryConfiguration.setRetentionCount(retentionCount); | |||
return managedRepositoryConfiguration; | |||
} | |||
// over-loaded | |||
// for simulating empty/null form purposes; excluding primitive data-typed values | |||
protected ManagedRepositoryConfiguration createManagedRepositoryConfiguration(String id, String name, String location, String indexDir) | |||
{ | |||
ManagedRepositoryConfiguration managedRepositoryConfiguration = new ManagedRepositoryConfiguration(); | |||
managedRepositoryConfiguration.setId(id); | |||
managedRepositoryConfiguration.setName(name); | |||
managedRepositoryConfiguration.setLocation(location); | |||
managedRepositoryConfiguration.setIndexDir(indexDir); | |||
return managedRepositoryConfiguration; | |||
} | |||
} |