directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r1037389 - in /directory/apacheds/trunk/kerberos-shared/src: main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/ test/java/org/apache/directory/server/kerberos/shared/messages/value/flags/
Date Sun, 21 Nov 2010 06:52:15 GMT
Author: felixk
Date: Sun Nov 21 06:52:15 2010
New Revision: 1037389

URL: http://svn.apache.org/viewvc?rev=1037389&view=rev
Log:
Clean up YAGNI syndrom

Modified:
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlags.java
    directory/apacheds/trunk/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlagsTest.java

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlags.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlags.java?rev=1037389&r1=1037388&r2=1037389&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlags.java
(original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlags.java
Sun Nov 21 06:52:15 2010
@@ -155,22 +155,6 @@ public abstract class AbstractKerberosFl
         setBit( flag );
     }
     
-    
-    /**
-     * Modify a byte array to an integer value
-     * @param bytes The 1 + 4 bytes byte array to transform.
-     */
-    public void setFlags( byte[] bytes )
-    {
-        if ( (bytes== null ) || ( bytes.length != 5 ) )
-        {
-            value = -1;
-        }
-        
-        value = ( ( bytes[1] & 0x00F ) << 24 ) | ( ( bytes[2] & 0x00FF ) <<
16 ) | ( ( bytes[3] & 0x00FF ) << 8 ) | ( 0x00FF & bytes[4] ); 
-        setData( bytes );
-    }
-    
 
     /**
      * clear a flag in a list of flags
@@ -194,14 +178,4 @@ public abstract class AbstractKerberosFl
         value &= ~( 1 << flag );
         clearBit( flag );
     }
-    
-    
-    /**
-     * @return The hex value for this flag, in its position.
-     * For instance, getting the flag 5 will return 0x0000 0010 
-     */
-    public int getHexValue()
-    {
-        return 1 << value;
-    }
 }

Modified: directory/apacheds/trunk/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlagsTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlagsTest.java?rev=1037389&r1=1037388&r2=1037389&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlagsTest.java
(original)
+++ directory/apacheds/trunk/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlagsTest.java
Sun Nov 21 06:52:15 2010
@@ -86,21 +86,12 @@ public class AbstractKerberosFlagsTest
             private static final long serialVersionUID = 1L;
         };
 
-        // intValue
         assertEquals( "intValue", 0, akfEmptyConstructor.getIntValue() );
         assertEquals(
             "intValue",
             ( int ) ( Math.pow( 2, TicketFlag.FORWARDABLE.getOrdinal() )
                 + Math.pow( 2, TicketFlag.FORWARDED.getOrdinal() ) + Math.pow( 2, TicketFlag.PROXY.getOrdinal()
) + Math
                 .pow( 2, TicketFlag.RENEWABLE.getOrdinal() ) ), akfIntConstructor.getIntValue()
);
-
-        // hexValue
-        // TODO The method getHexValue() is a bit confusing WRT its comment and naming and
what the method really
-        // does. Ever seen a 'toHex' method returning an 'int'?
-        //        assertEquals( "hexValue", Integer.toHexString( 0 ), Integer.toHexString(
akfEmptyConstructor.getHexValue() ) );
-        //        assertEquals( "hexValue", Integer.toHexString( ( int ) ( Math.pow( 2, TicketFlag.FORWARDABLE.getOrdinal()
)
-        //            + Math.pow( 2, TicketFlag.FORWARDED.getOrdinal() ) + Math.pow( 2, TicketFlag.PROXY.getOrdinal()
) + Math
-        //            .pow( 2, TicketFlag.RENEWABLE.getOrdinal() ) ) ), Integer.toHexString(
akfIntConstructor.getHexValue() ) );
     }
 
 



Mime
View raw message