Author: oching
Date: Mon Oct 6 23:09:00 2008
New Revision: 702357
URL: http://svn.apache.org/viewvc?rev=702357&view=rev
Log:
applied codestyle formatting
Modified:
archiva/branches/MRM-124/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/AbstractArchivaXmlTestCase.java
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/maven/archiva/xmlrpc/security/XmlRpcAuthenticator.java
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/maven/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java
Modified:
archiva/branches/MRM-124/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/AbstractArchivaXmlTestCase.java
URL:
http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/AbstractArchivaXmlTestCase.java?rev=702357&r1=702356&r2=702357&view=diff
==============================================================================
---
archiva/branches/MRM-124/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/AbstractArchivaXmlTestCase.java
(original)
+++
archiva/branches/MRM-124/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/AbstractArchivaXmlTestCase.java
Mon Oct 6 23:09:00 2008
@@ -33,10 +33,13 @@
extends TestCase
{
protected static final String OSLASH = "\u00f8";
+
protected static final String TRYGVIS = "Trygve Laugst" + OSLASH + "l";
+
protected static final String INFIN = "\u221e";
+
protected static final String INFINITE_ARCHIVA = "The " + INFIN + "
Archiva";
-
+
protected File getExampleXml( String filename )
{
File examplesDir = new File( "src/test/examples" );
Modified:
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/maven/archiva/xmlrpc/security/XmlRpcAuthenticator.java
URL:
http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/maven/archiva/xmlrpc/security/XmlRpcAuthenticator.java?rev=702357&r1=702356&r2=702357&view=diff
==============================================================================
---
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/maven/archiva/xmlrpc/security/XmlRpcAuthenticator.java
(original)
+++
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/maven/archiva/xmlrpc/security/XmlRpcAuthenticator.java
Mon Oct 6 23:09:00 2008
@@ -1,3 +1,4 @@
+package org.apache.maven.archiva.xmlrpc.security;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -18,8 +19,6 @@
* under the License.
*/
-package org.apache.maven.archiva.xmlrpc.security;
-
import org.apache.maven.archiva.security.ArchivaRoleConstants;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.XmlRpcRequest;
@@ -34,58 +33,63 @@
import org.codehaus.plexus.redback.system.SecuritySystem;
import org.codehaus.plexus.redback.users.UserNotFoundException;
-public class XmlRpcAuthenticator implements AuthenticationHandler
+public class XmlRpcAuthenticator
+ implements AuthenticationHandler
{
private final SecuritySystem securitySystem;
- public XmlRpcAuthenticator(SecuritySystem securitySystem)
+ public XmlRpcAuthenticator( SecuritySystem securitySystem )
{
this.securitySystem = securitySystem;
}
- public boolean isAuthorized(XmlRpcRequest pRequest) throws XmlRpcException
{
- if (pRequest.getConfig() instanceof XmlRpcHttpRequestConfigImpl)
+ public boolean isAuthorized( XmlRpcRequest pRequest )
+ throws XmlRpcException
+ {
+ if ( pRequest.getConfig() instanceof XmlRpcHttpRequestConfigImpl )
{
- XmlRpcHttpRequestConfigImpl config =
(XmlRpcHttpRequestConfigImpl)pRequest.getConfig();
- SecuritySession session = authenticate(new
PasswordBasedAuthenticationDataSource(config.getBasicUserName(),
config.getBasicPassword()));
- AuthorizationResult result = authorize(session);
+ XmlRpcHttpRequestConfigImpl config = (XmlRpcHttpRequestConfigImpl)
pRequest.getConfig();
+ SecuritySession session =
+ authenticate( new PasswordBasedAuthenticationDataSource(
config.getBasicUserName(),
+
config.getBasicPassword() ) );
+ AuthorizationResult result = authorize( session );
return result.isAuthorized();
}
- throw new XmlRpcException("Unsupported transport (must be http)");
+ throw new XmlRpcException( "Unsupported transport (must be http)" );
}
-
- private SecuritySession authenticate(PasswordBasedAuthenticationDataSource
authenticationDataSource)
+
+ private SecuritySession authenticate(
PasswordBasedAuthenticationDataSource authenticationDataSource )
throws XmlRpcException
{
try
{
- return securitySystem.authenticate(authenticationDataSource);
+ return securitySystem.authenticate( authenticationDataSource );
}
- catch (AccountLockedException e)
+ catch ( AccountLockedException e )
{
- throw new XmlRpcException(401, e.getMessage(), e);
+ throw new XmlRpcException( 401, e.getMessage(), e );
}
- catch (AuthenticationException e)
+ catch ( AuthenticationException e )
{
- throw new XmlRpcException(401, e.getMessage(), e);
+ throw new XmlRpcException( 401, e.getMessage(), e );
}
- catch (UserNotFoundException e)
+ catch ( UserNotFoundException e )
{
- throw new XmlRpcException(401, e.getMessage(), e);
+ throw new XmlRpcException( 401, e.getMessage(), e );
}
}
-
- private AuthorizationResult authorize(SecuritySession session)
+
+ private AuthorizationResult authorize( SecuritySession session )
throws XmlRpcException
{
try
{
- return securitySystem.authorize(session,
ArchivaRoleConstants.GLOBAL_REPOSITORY_MANAGER_ROLE);
+ return securitySystem.authorize( session,
ArchivaRoleConstants.GLOBAL_REPOSITORY_MANAGER_ROLE );
}
- catch (AuthorizationException e)
+ catch ( AuthorizationException e )
{
- throw new XmlRpcException(401, e.getMessage(), e);
+ throw new XmlRpcException( 401, e.getMessage(), e );
}
}
}
Modified:
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/maven/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java
URL:
http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/maven/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java?rev=702357&r1=702356&r2=702357&view=diff
==============================================================================
---
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/maven/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java
(original)
+++
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/maven/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java
Mon Oct 6 23:09:00 2008
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -37,56 +36,68 @@
import org.codehaus.plexus.redback.users.UserManager;
import org.codehaus.plexus.redback.users.UserNotFoundException;
-public class XmlRpcAuthenticatorTest extends TestCase
+public class XmlRpcAuthenticatorTest
+ extends TestCase
{
private static final String USERNAME = "username";
+
private static final String PASSWORD = "password";
- public void testAuthentication() throws Exception
+ public void testAuthentication()
+ throws Exception
{
- MockSecuritySystem securitySystem = new MockSecuritySystem(true, true,
USERNAME, PASSWORD);
- XmlRpcAuthenticator authenticator = new
XmlRpcAuthenticator(securitySystem);
- MockXmlRpcRequest request = new MockXmlRpcRequest(USERNAME, PASSWORD);
-
- assertTrue(authenticator.isAuthorized(request));
+ MockSecuritySystem securitySystem = new MockSecuritySystem( true,
true, USERNAME, PASSWORD );
+ XmlRpcAuthenticator authenticator = new XmlRpcAuthenticator(
securitySystem );
+ MockXmlRpcRequest request = new MockXmlRpcRequest( USERNAME, PASSWORD
);
+
+ assertTrue( authenticator.isAuthorized( request ) );
}
- class MockXmlRpcRequest implements XmlRpcRequest
+ class MockXmlRpcRequest
+ implements XmlRpcRequest
{
private final XmlRpcHttpRequestConfigImpl configImpl;
-
- public MockXmlRpcRequest(String username, String password)
+
+ public MockXmlRpcRequest( String username, String password )
{
configImpl = new XmlRpcHttpRequestConfigImpl();
- configImpl.setBasicUserName(username);
- configImpl.setBasicPassword(password);
+ configImpl.setBasicUserName( username );
+ configImpl.setBasicPassword( password );
}
- public XmlRpcRequestConfig getConfig() {
+ public XmlRpcRequestConfig getConfig()
+ {
return configImpl;
}
- public String getMethodName() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String getMethodName()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public Object getParameter(int pIndex) {
- throw new UnsupportedOperationException("Not supported yet.");
+ public Object getParameter( int pIndex )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public int getParameterCount() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public int getParameterCount()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
}
- class MockSecuritySystem implements SecuritySystem
+ class MockSecuritySystem
+ implements SecuritySystem
{
private final boolean authorized;
+
private final boolean authenticate;
+
private final String username;
+
private final String password;
- public MockSecuritySystem(boolean authorized, boolean authenticate,
String username, String password)
+ public MockSecuritySystem( boolean authorized, boolean authenticate,
String username, String password )
{
this.authorized = authorized;
this.authenticate = authenticate;
@@ -94,65 +105,87 @@
this.password = password;
}
- public SecuritySession authenticate(AuthenticationDataSource
dataSource) throws AuthenticationException, UserNotFoundException,
AccountLockedException {
- return new SecuritySession() {
+ public SecuritySession authenticate( AuthenticationDataSource
dataSource )
+ throws AuthenticationException, UserNotFoundException,
AccountLockedException
+ {
+ return new SecuritySession()
+ {
- public AuthenticationResult getAuthenticationResult() {
- throw new UnsupportedOperationException("Not supported
yet.");
+ public AuthenticationResult getAuthenticationResult()
+ {
+ throw new UnsupportedOperationException( "Not supported
yet." );
}
- public User getUser() {
- throw new UnsupportedOperationException("Not supported
yet.");
+ public User getUser()
+ {
+ throw new UnsupportedOperationException( "Not supported
yet." );
}
- public boolean isAuthenticated() {
+ public boolean isAuthenticated()
+ {
throw new UnsupportedOperationException();
}
};
}
- public AuthorizationResult authorize(SecuritySession session, Object
arg1) throws AuthorizationException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public AuthorizationResult authorize( SecuritySession session, Object
arg1 )
+ throws AuthorizationException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public AuthorizationResult authorize(SecuritySession session, Object
arg1, Object arg2) throws AuthorizationException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public AuthorizationResult authorize( SecuritySession session, Object
arg1, Object arg2 )
+ throws AuthorizationException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public String getAuthenticatorId() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String getAuthenticatorId()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public String getAuthorizerId() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String getAuthorizerId()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public KeyManager getKeyManager() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public KeyManager getKeyManager()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public UserSecurityPolicy getPolicy() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public UserSecurityPolicy getPolicy()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public String getUserManagementId() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String getUserManagementId()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public UserManager getUserManager() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public UserManager getUserManager()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public boolean isAuthenticated(AuthenticationDataSource dataSource)
throws AuthenticationException, UserNotFoundException, AccountLockedException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean isAuthenticated( AuthenticationDataSource dataSource )
+ throws AuthenticationException, UserNotFoundException,
AccountLockedException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public boolean isAuthorized(SecuritySession session, Object arg1)
throws AuthorizationException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean isAuthorized( SecuritySession session, Object arg1 )
+ throws AuthorizationException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
- public boolean isAuthorized(SecuritySession session, Object arg1,
Object arg2) throws AuthorizationException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean isAuthorized( SecuritySession session, Object arg1,
Object arg2 )
+ throws AuthorizationException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
}
}
}