From: Olivier Lamy Date: Mon, 13 Jun 2011 21:49:32 +0000 (+0000) Subject: fix junit ProxyConnectorsActionTest X-Git-Tag: archiva-1.4-M1~654 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1638ae466c1add5cdd5f068bfa3c65077277448e;p=archiva.git fix junit ProxyConnectorsActionTest git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1135304 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractActionSupport.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractActionSupport.java index 9b54c99c3..9afe67b22 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractActionSupport.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/AbstractActionSupport.java @@ -36,6 +36,7 @@ import org.springframework.context.ApplicationContext; import javax.annotation.PostConstruct; import javax.inject.Inject; +import javax.inject.Named; import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.HashMap; @@ -62,6 +63,7 @@ public abstract class AbstractActionSupport * plexus.requirement */ @Inject + @Named( value = "repositorySessionFactory" ) protected RepositorySessionFactory repositorySessionFactory; @Inject diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java index 64f9225d4..6a404f0f2 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java @@ -79,6 +79,12 @@ public class RepositoryActionMapper // if JEE 5 spec is correctly implemented, the "/*" pattern implies an empty string in servletpath path = httpServletRequest.getPathInfo(); } + + if (StringUtils.isEmpty( path )) + { + // try RequestURI in last at least for StrutsTestCase + path = httpServletRequest.getRequestURI(); + } if ( path.startsWith( BROWSE_PREFIX ) ) { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestRepositorySessionFactory.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestRepositorySessionFactory.java index 233333ef1..bbe5ce584 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestRepositorySessionFactory.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestRepositorySessionFactory.java @@ -21,7 +21,9 @@ package org.apache.archiva.metadata.repository.memory; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.RepositorySessionFactory; +import org.springframework.stereotype.Service; +@Service("repositorySessionFactory#test") public class TestRepositorySessionFactory implements RepositorySessionFactory { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/security/UserRepositoriesStub.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/security/UserRepositoriesStub.java index dc7cf00df..eb6ab26ed 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/security/UserRepositoriesStub.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/security/UserRepositoriesStub.java @@ -65,4 +65,13 @@ public class UserRepositoriesStub return null; } + public List getRepoIds() + { + return repoIds; + } + + public void setRepoIds( List repoIds ) + { + this.repoIds = repoIds; + } } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java index 519350759..a73607bb5 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java @@ -60,7 +60,7 @@ public class ProxyConnectorsActionTest //action = (ProxyConnectorsAction) lookup( Action.class.getName(), "proxyConnectorsAction" ); - action = (ProxyConnectorsAction) getActionProxy("/admin/proxyConnectors" ).getAction(); + action = (ProxyConnectorsAction) getActionProxy("/admin/proxyConnectors.action" ).getAction(); archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class ); archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock(); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context.xml new file mode 100644 index 000000000..f4d83a652 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/struts-security.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/struts-security.xml new file mode 100644 index 000000000..4a5c9ec8c --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/struts-security.xml @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + * + + + + + + + + + + + + + + + addadmin + /security + + /WEB-INF/jsp/redback/requiresAuthentication.jsp + /WEB-INF/jsp/redback/accessDenied.jsp + + password + /security + + + userlist + /security + + /WEB-INF/jsp/redback/invalidToken.jsp + + + + + + + security-logout + + + + + /WEB-INF/jsp/redback/register.jsp + /WEB-INF/jsp/redback/register.jsp + /WEB-INF/jsp/redback/validationNotification.jsp + + security-register-success + + + security-register-cancel + + + + + + + /WEB-INF/jsp/redback/password.jsp + /WEB-INF/jsp/redback/password.jsp + + security-login-success + + + security-register-success + + ${targetUrl} + + logout + /security + + /WEB-INF/jsp/redback/changePasswordSuccess.jsp + + + + /WEB-INF/jsp/redback/requestPasswordReset.jsp + /WEB-INF/jsp/redback/login.jsp + + + + + + + + /WEB-INF/jsp/redback/admin/systemInformation.jsp + + + + /WEB-INF/jsp/redback/admin/console.jsp + + + + userlist + + + + /WEB-INF/jsp/redback/admin/userList.jsp + /WEB-INF/jsp/redback/admin/userList.jsp + + + + /WEB-INF/jsp/redback/admin/userEdit.jsp + /WEB-INF/jsp/redback/admin/userEdit.jsp + /WEB-INF/jsp/redback/admin/confirmUserAdministrator.jsp + /WEB-INF/jsp/redback/admin/confirmUserAdministrator.jsp + userlist + userlist + + + + /WEB-INF/jsp/redback/admin/userCreate.jsp + /WEB-INF/jsp/redback/admin/userCreate.jsp + + assignments + ${user.username} + + + * + + + + + /WEB-INF/jsp/redback/admin/userDelete.jsp + userlist + userlist + userlist + + * + + + + + + + + + /WEB-INF/jsp/redback/admin/assignments.jsp + /WEB-INF/jsp/redback/include/error.jsp + /WEB-INF/jsp/redback/admin/assignments.jsp + + + + userlist + + * + + + + + userlist + + + + /WEB-INF/jsp/redback/admin/roleCreate.jsp + /WEB-INF/jsp/redback/admin/roleCreate.jsp + userlist + + * + + + + + /WEB-INF/jsp/redback/admin/role.jsp + /WEB-INF/jsp/redback/admin/role.jsp + roles + + + + /WEB-INF/jsp/redback/admin/roleEdit.jsp + /WEB-INF/jsp/redback/admin/roleEdit.jsp + roles + + + + /WEB-INF/jsp/redback/admin/roleEdit.jsp + /WEB-INF/jsp/redback/admin/roleEdit.jsp + roles + + * + + + + + /WEB-INF/jsp/redback/admin/roleEdit.jsp + /WEB-INF/jsp/redback/admin/roleEdit.jsp + /WEB-INF/jsp/redback/admin/roleEdit.jsp + + * + + + + + /WEB-INF/jsp/redback/admin/roleEdit.jsp + /WEB-INF/jsp/redback/admin/roleEdit.jsp + /WEB-INF/jsp/redback/admin/roleEdit.jsp + + * + + + + + /WEB-INF/jsp/redback/admin/roleSummary.jsp + + + + /WEB-INF/jsp/redback/admin/roleList.jsp + + + + /WEB-INF/jsp/redback/admin/permissionList.jsp + + + + /WEB-INF/jsp/redback/admin/operationList.jsp + + + + /WEB-INF/jsp/redback/admin/resourceList.jsp + + + + /WEB-INF/jsp/redback/admin/roleModel.jsp + + + + + + /WEB-INF/jsp/redback/admin/backupRestore.jsp + + + + /WEB-INF/jsp/redback/admin/backupRestore.jsp + backupRestore + + + + /WEB-INF/jsp/redback/admin/backupRestore.jsp + backupRestore + + + + +