directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r713418 - in /directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src: main/java/org/apache/directory/server/kerberos/kdc/ main/java/org/apache/directory/server/kerberos/protocol/ test/java/org/apache/directory/server/kerberos/prot...
Date Wed, 12 Nov 2008 16:26:22 GMT
Author: elecharny
Date: Wed Nov 12 08:26:21 2008
New Revision: 713418

URL: http://svn.apache.org/viewvc?rev=713418&view=rev
Log:
Fixed the DummySession to make the tests happy with MINA 2.0

Modified:
    directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
    directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosProtocolHandler.java
    directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractAuthenticationServiceTest.java
    directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java
    directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
    directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java
    directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
    directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java
    directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java
    directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java
    directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java
    directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java

Modified: directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java?rev=713418&r1=713417&r2=713418&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
Wed Nov 12 08:26:21 2008
@@ -29,10 +29,19 @@
 
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.kerberos.protocol.KerberosProtocolHandler;
+import org.apache.directory.server.kerberos.protocol.KerberosTcpProtocolCodecFactory;
+import org.apache.directory.server.kerberos.protocol.KerberosUdpProtocolCodecFactory;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
 import org.apache.directory.server.kerberos.shared.store.DirectoryPrincipalStore;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 import org.apache.directory.server.protocol.shared.DirectoryBackedService;
+import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
+import org.apache.mina.core.filterchain.IoFilterChainBuilder;
+import org.apache.mina.filter.codec.ProtocolCodecFilter;
+import org.apache.mina.transport.socket.DatagramAcceptor;
+import org.apache.mina.transport.socket.SocketAcceptor;
+import org.apache.mina.transport.socket.nio.NioDatagramAcceptor;
+import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -429,22 +438,78 @@
         PrincipalStore store;
 
         // TODO - for now ignoring this catelog crap
-        
         store = new DirectoryPrincipalStore( getDirectoryService() );
-
         
-        if ( getDatagramAcceptor() != null )
+        // Kerberos can use UDP or TCP
+        if ( getUdpPort() != -1 )
         {
-            getDatagramAcceptor().setHandler( new KerberosProtocolHandler( this, store )
);
-            getDatagramAcceptor().bind( new InetSocketAddress( getIpPort() ) );
+        	// Actually, this is not used for Datagram. But it should !
+        	int nbUdpThreads = getNbUdpThreads();
+        	
+        	// Create the acceptor
+        	DatagramAcceptor udpAcceptor = new NioDatagramAcceptor();
+        	
+        	// Stores it
+        	setDatagramAcceptor( udpAcceptor );
+        	
+        	// Now, configure the acceptor
+        	// Inject the chain
+            IoFilterChainBuilder udpChainBuilder = new DefaultIoFilterChainBuilder();
+
+            ((DefaultIoFilterChainBuilder)udpChainBuilder).addFirst( "codec", 
+            		new ProtocolCodecFilter( 
+            				KerberosUdpProtocolCodecFactory.getInstance() ) );
+
+        	udpAcceptor.setFilterChainBuilder( udpChainBuilder );
+        	
+        	// Inject the protocol handler
+        	udpAcceptor.setHandler( new KerberosProtocolHandler( this, store ) );
+        	
+        	// Bind to the configured address
+        	udpAcceptor.bind( new InetSocketAddress( getUdpPort() ) );
         }
 
-        if ( getSocketAcceptor() != null )
+        if ( getTcpPort() != -1 )
         {
-            getSocketAcceptor().setCloseOnDeactivation( false );
-            getSocketAcceptor().setReuseAddress( true );
-            getSocketAcceptor().setHandler( new KerberosProtocolHandler( this, store ) );
-            getSocketAcceptor().bind( new InetSocketAddress( getIpPort() ) );
+        	// First, create the acceptor with the configured number of threads (if defined)
+        	int nbTcpThreads = getNbTcpThreads();
+        	SocketAcceptor tcpAcceptor;
+        	
+        	if ( nbTcpThreads > 0 )
+        	{
+        		tcpAcceptor = new NioSocketAcceptor( nbTcpThreads );
+        	}
+        	else
+        	{
+        		tcpAcceptor = new NioSocketAcceptor();
+        	}
+        		
+        	setSocketAcceptor( tcpAcceptor );
+        	
+        	// Now, configure the acceptor
+            // Disable the disconnection of the clients on unbind
+        	tcpAcceptor.setCloseOnDeactivation( false );
+        	
+        	// No Nagle's algorithm
+        	tcpAcceptor.getSessionConfig().setTcpNoDelay( true );
+        	
+        	// Allow the port to be reused even if the socket is in TIME_WAIT state
+        	tcpAcceptor.setReuseAddress( true );
+        	
+        	// Inject the chain
+            IoFilterChainBuilder tcpChainBuilder = new DefaultIoFilterChainBuilder();
+
+            ((DefaultIoFilterChainBuilder)tcpChainBuilder).addFirst( "codec", 
+            		new ProtocolCodecFilter( 
+            				KerberosTcpProtocolCodecFactory.getInstance() ) );
+
+        	tcpAcceptor.setFilterChainBuilder( tcpChainBuilder );
+        	
+        	// Inject the protocol handler
+        	tcpAcceptor.setHandler( new KerberosProtocolHandler( this, store ) );
+        	
+        	// Bind to the configured address
+        	tcpAcceptor.bind( new InetSocketAddress( getTcpPort() ) );
         }
         
         LOG.info( "Kerberos service started." );

Modified: directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosProtocolHandler.java?rev=713418&r1=713417&r2=713418&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosProtocolHandler.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/protocol/KerberosProtocolHandler.java
Wed Nov 12 08:26:21 2008
@@ -62,7 +62,6 @@
     private static final String CONTEXT_KEY = "context";
     
 
-
     /**
      * Creates a new instance of KerberosProtocolHandler.
      *
@@ -204,6 +203,7 @@
         }
         catch ( Exception e )
         {
+        e.printStackTrace();
             log.error( "Unexpected exception:  " + e.getMessage(), e );
 
             session.write( getErrorMessage( config.getServicePrincipal(), new KerberosException(

Modified: directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractAuthenticationServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractAuthenticationServiceTest.java?rev=713418&r1=713417&r2=713418&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractAuthenticationServiceTest.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractAuthenticationServiceTest.java
Wed Nov 12 08:26:21 2008
@@ -27,8 +27,6 @@
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import junit.framework.TestCase;
-
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.KeyUsage;
@@ -58,7 +56,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public abstract class AbstractAuthenticationServiceTest extends TestCase
+public abstract class AbstractAuthenticationServiceTest
 {
     protected CipherTextHandler lockBox;
     protected static final SecureRandom random = new SecureRandom();
@@ -122,9 +120,27 @@
         return key;
     }
 
-    protected static class DummySession extends AbstractIoSession
+    protected static class KrbDummySession extends DummySession
     {
         Object message;
+        
+        public KrbDummySession() 
+        {
+        	super();
+        }
+        
+        public DummySession( IoService service )
+        {
+        	try
+        	{
+	            ((AbstractIoSession) this).setAttributeMap(service
+	                    .getSessionDataStructureFactory().getAttributeMap(this));
+        	}
+        	catch( Exception e ) 
+        	{
+        		
+        	}
+        }
 
 
         public IoProcessor<IoSession> getProcessor()

Modified: directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java?rev=713418&r1=713417&r2=713418&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java
Wed Nov 12 08:26:21 2008
@@ -21,8 +21,6 @@
 
 
 import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
 import java.security.SecureRandom;
 
 import javax.security.auth.kerberos.KerberosKey;
@@ -61,14 +59,6 @@
 import org.apache.directory.server.kerberos.shared.messages.value.flags.TicketFlags;
 import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
 import org.apache.directory.server.kerberos.shared.messages.value.types.PrincipalNameType;
-import org.apache.mina.core.filterchain.IoFilterChain;
-import org.apache.mina.core.service.IoHandler;
-import org.apache.mina.core.service.IoProcessor;
-import org.apache.mina.core.service.IoService;
-import org.apache.mina.core.service.TransportMetadata;
-import org.apache.mina.core.session.AbstractIoSession;
-import org.apache.mina.core.session.IoSession;
-import org.apache.mina.core.session.IoSessionConfig;
 
 
 /**
@@ -324,6 +314,7 @@
         return principalName;
     }
 
+    /*
     protected static class DummySession extends AbstractIoSession
     {
         Object message;
@@ -399,5 +390,15 @@
         {
             return null;
         }
-    }
+        
+        public DummySession() {
+	        try {
+	            IoSessionDataStructureFactory factory = new DefaultIoSessionDataStructureFactory();
+	            setAttributeMap(factory.getAttributeMap(this));
+	            setWriteRequestQueue(factory.getWriteRequestQueue(this));
+	        } catch (Exception e) {
+	            throw new InternalError();
+	        }
+        }
+    }*/
 }

Modified: directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java?rev=713418&r1=713417&r2=713418&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
Wed Nov 12 08:26:21 2008
@@ -47,6 +47,11 @@
 import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 
 /**
  * Tests various facets of working with encryption types in the Authentication Service (AS).
@@ -59,18 +64,19 @@
     private KdcServer config;
     private PrincipalStore store;
     private KerberosProtocolHandler handler;
-    private DummySession session;
+    private KrbDummySession session;
 
 
     /**
      * Creates a new instance of {@link AuthenticationEncryptionTypeTest}.
      */
-    public AuthenticationEncryptionTypeTest()
+    @Before
+    public void setUp()
     {
         config = new KdcServer();
         store = new MapPrincipalStoreImpl();
         handler = new KerberosProtocolHandler( config, store );
-        session = new DummySession();
+        session = new KrbDummySession();
         lockBox = new CipherTextHandler();
     }
 
@@ -80,6 +86,7 @@
      * 
      * @throws Exception
      */
+    @Test
     public void testRequestDesCbcMd5() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -117,6 +124,7 @@
      * 
      * @throws Exception
      */
+    @Test
     public void testRequestAes128() throws Exception
     {
         EncryptionType[] configuredEncryptionTypes =
@@ -168,6 +176,7 @@
      * 
      * @throws Exception
      */
+    @Test
     public void testNonce() throws Exception
     {
         EncryptionType[] configuredEncryptionTypes =
@@ -223,6 +232,7 @@
      * 
      * @throws Exception
      */
+    @Test
     public void testAes128Configuration() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();

Modified: directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java?rev=713418&r1=713417&r2=713418&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java
Wed Nov 12 08:26:21 2008
@@ -30,6 +30,10 @@
 import org.apache.directory.server.kerberos.shared.messages.value.RequestBodyModifier;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
 
 /**
  * Tests configuration of Authentication Service (AS) policy.
@@ -42,18 +46,19 @@
     private KdcServer config;
     private PrincipalStore store;
     private KerberosProtocolHandler handler;
-    private DummySession session;
+    private KrbDummySession session;
 
 
     /**
      * Creates a new instance of {@link AuthenticationPolicyTest}.
      */
-    public AuthenticationPolicyTest()
+    @Before
+    public void setUp()
     {
         config = new KdcServer();
         store = new MapPrincipalStoreImpl();
         handler = new KerberosProtocolHandler( config, store );
-        session = new DummySession();
+        session = new KrbDummySession();
     }
 
 
@@ -63,6 +68,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testForwardableTicket() throws Exception
     {
         // Deny FORWARDABLE tickets in policy.
@@ -98,6 +104,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testProxiableTicket() throws Exception
     {
         // Deny PROXIABLE tickets in policy.
@@ -133,6 +140,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testAllowPostdate() throws Exception
     {
         // Deny POSTDATED tickets in policy.
@@ -168,6 +176,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testPostdate() throws Exception
     {
         // Deny POSTDATED tickets in policy.
@@ -203,6 +212,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testRenewableOk() throws Exception
     {
         // Deny RENEWABLE tickets in policy.
@@ -238,6 +248,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testRenewableTicket() throws Exception
     {
         // Deny RENEWABLE tickets in policy.
@@ -276,6 +287,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testEmptyAddresses() throws Exception
     {
         // Deny empty addresses in policy.

Modified: directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java?rev=713418&r1=713417&r2=713418&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
Wed Nov 12 08:26:21 2008
@@ -38,6 +38,12 @@
 import org.apache.directory.server.kerberos.shared.messages.value.RequestBodyModifier;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
 
 /**
  * Tests the Authentication Service (AS) via the {@link KerberosProtocolHandler}.
@@ -50,18 +56,19 @@
     private KdcServer config;
     private PrincipalStore store;
     private KerberosProtocolHandler handler;
-    private DummySession session;
+    private KrbDummySession session;
 
 
     /**
      * Creates a new instance of {@link AuthenticationServiceTest}.
      */
-    public AuthenticationServiceTest()
+    @Before
+    public void setUp()
     {
         config = new KdcServer();
         store = new MapPrincipalStoreImpl();
         handler = new KerberosProtocolHandler( config, store );
-        session = new DummySession();
+        session = new KrbDummySession();
         lockBox = new CipherTextHandler();
     }
 
@@ -72,6 +79,7 @@
      * 
      * This is the request archetype.
      */
+    @Test
     public void testRequestArchetype()
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -96,6 +104,7 @@
     /**
      * Tests the protocol version number, which must be '5'.
      */
+    @Test
     public void testProtocolVersionNumber()
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -117,6 +126,7 @@
      * Tests that Kerberos reply messages sent to the KDC will be rejected with the
      * correct error message.
      */
+    @Test
     public void testIncorrectMessageDirection()
     {
         KdcRequest message = new KdcRequest( 5, KerberosMessageType.AS_REP, null, null );
@@ -142,6 +152,7 @@
      * unknown because it doesn't exist in the KDC's principal database,
      * then an error message with a KDC_ERR_C_PRINCIPAL_UNKNOWN is returned."
      */
+    @Test
     public void testClientNotFound()
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -168,6 +179,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testEncryptionTypeNoSupport() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -206,6 +218,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testServerNotFound() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -232,6 +245,7 @@
      * Tests that when a client principal is not configured with Kerberos keys that
      * the correct error message is returned.
      */
+    @Test
     public void testClientNullKey()
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -255,6 +269,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testServerNullKey() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -289,6 +304,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testStartTimeAbsentNoPostdate() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -334,6 +350,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testStartTimeInThePastNoPostdate() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -382,6 +399,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testStartTimeAcceptableClockSkewNoPostdate() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -428,6 +446,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testStartTimeOrderNeverValid() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -472,6 +491,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testStartTimeMinimumNeverValid() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -513,6 +533,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testStartTimeNoPostdated() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -564,6 +585,7 @@
      * 
      * @throws Exception
      */
+    @Test
     public void testSpecificStartTime() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -618,6 +640,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testSpecificEndTime() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -661,6 +684,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testEndTimeExceedsMaximumAllowable() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -700,6 +724,7 @@
      * 
      * @throws Exception
      */
+    @Test
     public void testEpochEndTime() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -738,6 +763,7 @@
      * 
      * @throws Exception
      */
+    @Test
     public void testInitialServiceTicket() throws Exception
     {
         String servicePrincipalName = "ldap/ldap.example.com@EXAMPLE.COM";
@@ -788,6 +814,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testRenewableOk() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -838,6 +865,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testForwardableTicket() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -882,6 +910,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testAllowPostdate() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -926,6 +955,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testProxiableTicket() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -973,6 +1003,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testRenewableTicket() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -1026,6 +1057,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testRenewableTicketExceedsMaximumAllowable() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -1074,6 +1106,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testBadOptionRenew() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -1110,6 +1143,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testBadOptionValidate() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -1146,6 +1180,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testBadOptionProxy() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -1182,6 +1217,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testBadOptionForwarded() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -1218,6 +1254,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testBadOptionEncTktInSkey() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();

Modified: directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java?rev=713418&r1=713417&r2=713418&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java
Wed Nov 12 08:26:21 2008
@@ -23,6 +23,7 @@
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.server.kerberos.kdc.KdcServer;
+import org.apache.directory.server.kerberos.protocol.AbstractAuthenticationServiceTest.KrbDummySession;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
 import org.apache.directory.server.kerberos.shared.messages.ErrorMessage;
 import org.apache.directory.server.kerberos.shared.messages.KdcRequest;
@@ -48,7 +49,7 @@
     private KdcServer config;
     private PrincipalStore store;
     private KerberosProtocolHandler handler;
-    private DummySession session;
+    private KrbDummySession session;
 
 
     /**
@@ -66,7 +67,7 @@
 
         store = new MapPrincipalStoreImpl();
         handler = new KerberosProtocolHandler( config, store );
-        session = new DummySession();
+        session = new KrbDummySession();
         lockBox = new CipherTextHandler();
     }
 

Modified: directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java?rev=713418&r1=713417&r2=713418&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java
Wed Nov 12 08:26:21 2008
@@ -38,6 +38,9 @@
 import org.apache.directory.server.kerberos.shared.messages.value.RequestBodyModifier;
 import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
 
 /**
@@ -52,18 +55,19 @@
     private KdcServer config;
     private PrincipalStore store;
     private KerberosProtocolHandler handler;
-    private DummySession session;
+    private KrbDummySession session;
 
 
     /**
      * Creates a new instance of {@link PreAuthenticationTest}.
      */
-    public PreAuthenticationTest()
+    @Before
+    public void setUp()
     {
         config = new KdcServer();
-        store = new MapPrincipalStoreImpl();
+        store  = new MapPrincipalStoreImpl();
         handler = new KerberosProtocolHandler( config, store );
-        session = new DummySession();
+        session = new KrbDummySession();
         lockBox = new CipherTextHandler();
     }
 
@@ -78,6 +82,7 @@
      * METHOD-DATA object will be stored in the e-data field of the KRB-ERROR
      * message to specify which pre-authentication mechanisms are acceptable."
      */
+    @Test
     public void testPreAuthenticationRequired()
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -106,6 +111,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testPreAuthenticationIntegrityFailed() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -142,6 +148,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testPreAuthenticationFailed() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();
@@ -179,6 +186,7 @@
      * 
      * @throws Exception 
      */
+    @Test
     public void testPreAuthenticationNoSupport() throws Exception
     {
         RequestBodyModifier modifier = new RequestBodyModifier();

Modified: directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java?rev=713418&r1=713417&r2=713418&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java
Wed Nov 12 08:26:21 2008
@@ -27,6 +27,7 @@
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.server.kerberos.kdc.KdcServer;
+import org.apache.directory.server.kerberos.protocol.AbstractAuthenticationServiceTest.KrbDummySession;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.KerberosKeyFactory;
@@ -54,7 +55,7 @@
     private KdcServer config;
     private PrincipalStore store;
     private KerberosProtocolHandler handler;
-    private DummySession session;
+    private KrbDummySession session;
 
 
     /**
@@ -72,7 +73,7 @@
 
         store = new MapPrincipalStoreImpl();
         handler = new KerberosProtocolHandler( config, store );
-        session = new DummySession();
+        session = new KrbDummySession();
         lockBox = new CipherTextHandler();
     }
 

Modified: directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java?rev=713418&r1=713417&r2=713418&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java
Wed Nov 12 08:26:21 2008
@@ -25,6 +25,7 @@
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.server.kerberos.kdc.KdcServer;
+import org.apache.directory.server.kerberos.protocol.AbstractAuthenticationServiceTest.KrbDummySession;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
 import org.apache.directory.server.kerberos.shared.messages.ErrorMessage;
 import org.apache.directory.server.kerberos.shared.messages.KdcRequest;
@@ -52,7 +53,7 @@
     private KdcServer config;
     private PrincipalStore store;
     private KerberosProtocolHandler handler;
-    private DummySession session;
+    private KrbDummySession session;
 
 
     /**
@@ -70,7 +71,7 @@
 
         store = new MapPrincipalStoreImpl();
         handler = new KerberosProtocolHandler( config, store );
-        session = new DummySession();
+        session = new KrbDummySession();
         lockBox = new CipherTextHandler();
     }
 

Modified: directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java?rev=713418&r1=713417&r2=713418&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java
Wed Nov 12 08:26:21 2008
@@ -27,6 +27,7 @@
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.server.kerberos.kdc.KdcServer;
+import org.apache.directory.server.kerberos.protocol.AbstractAuthenticationServiceTest.KrbDummySession;
 import org.apache.directory.server.kerberos.shared.KerberosMessageType;
 import org.apache.directory.server.kerberos.shared.crypto.checksum.ChecksumType;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
@@ -60,7 +61,7 @@
     private KdcServer config;
     private PrincipalStore store;
     private KerberosProtocolHandler handler;
-    private DummySession session;
+    private KrbDummySession session;
 
 
     /**
@@ -78,7 +79,7 @@
 
         store = new MapPrincipalStoreImpl();
         handler = new KerberosProtocolHandler( config, store );
-        session = new DummySession();
+        session = new KrbDummySession();
         lockBox = new CipherTextHandler();
     }
 



Mime
View raw message