directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1039000 - in /directory/apacheds/trunk/kerberos-codec/src: main/java/org/apache/directory/shared/kerberos/flags/ test/java/org/apache/directory/shared/kerberos/codec/flags/
Date Thu, 25 Nov 2010 11:05:25 GMT
Author: elecharny
Date: Thu Nov 25 11:05:24 2010
New Revision: 1039000

URL: http://svn.apache.org/viewvc?rev=1039000&view=rev
Log:
Added a fix for the KerberosFlags handling on values
Added a TicketFlags test

Added:
    directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/flags/
    directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/flags/TicketFlagsTest.java
Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java?rev=1039000&r1=1038999&r2=1039000&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java
Thu Nov 25 11:05:24 2010
@@ -129,8 +129,7 @@ public abstract class AbstractKerberosFl
      */
     public boolean isFlagSet( KerberosFlag flag )
     {
-        int value = flag.getValue();
-        int mask = 1 << ( MAX_SIZE - 1 - value );
+        int mask = 1 << ( MAX_SIZE - 1 - flag.getValue() );
         
         return ( value & mask ) != 0;
     }
@@ -155,7 +154,7 @@ public abstract class AbstractKerberosFl
     public void setFlag( KerberosFlag flag )
     {
         int pos = MAX_SIZE - 1 - flag.getValue();
-        setBit( pos );
+        setBit( flag.getValue() );
         value |= 1 << pos;
     }
     
@@ -168,7 +167,7 @@ public abstract class AbstractKerberosFl
     public void setFlag( int flag )
     {
         int pos = MAX_SIZE - 1 - flag;
-        setBit( pos );
+        setBit( flag );
         value |= 1 << pos;
     }
     
@@ -181,7 +180,7 @@ public abstract class AbstractKerberosFl
     public void clearFlag( KerberosFlag flag )
     {
         int pos = MAX_SIZE - 1 - flag.getValue();
-        clearBit( pos );
+        clearBit( flag.getValue() );
         value &= ~( 1 << pos );
     }
     
@@ -194,7 +193,7 @@ public abstract class AbstractKerberosFl
     public void clearFlag( int flag )
     {
         int pos = MAX_SIZE - 1 - flag;
-        clearBit( pos );
+        clearBit( flag );
         value &= ~( 1 << pos );
     }
 }

Added: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/flags/TicketFlagsTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/flags/TicketFlagsTest.java?rev=1039000&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/flags/TicketFlagsTest.java
(added)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/flags/TicketFlagsTest.java
Thu Nov 25 11:05:24 2010
@@ -0,0 +1,45 @@
+/*
+ *  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. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.flags;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.directory.shared.kerberos.flags.TicketFlag;
+import org.apache.directory.shared.kerberos.flags.TicketFlags;
+import org.junit.Test;
+
+
+/**
+ * A clss used to test the TicketFlags class
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class TicketFlagsTest
+{
+    @Test
+    public void testTicketFlags()
+    {
+        TicketFlags flags = new TicketFlags();
+        
+        flags.setFlag( TicketFlag.FORWARDABLE );
+        
+        assertTrue( flags.toString().startsWith( TicketFlag.FORWARDABLE.toString() ) );
+    }
+}



Mime
View raw message