You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/09/17 11:49:58 UTC

svn commit: r1703549 - in /directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec: EncKrbPrivPartDecoderTest.java KrbSafeBodyDecoderTest.java

Author: elecharny
Date: Thu Sep 17 09:49:57 2015
New Revision: 1703549

URL: http://svn.apache.org/r1703549
Log:
Used InetAddress.getLocalHost() instead of InetAddress.getByName( "127.0.0.1" )

Modified:
    directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.java
    directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbSafeBodyDecoderTest.java

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.java?rev=1703549&r1=1703548&r2=1703549&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.java Thu Sep 17 09:49:57 2015
@@ -145,7 +145,7 @@ public class EncKrbPrivPartDecoderTest
         EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
 
         String time = "20101119080043Z";
-        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
+        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
 
         assertTrue( Arrays.equals( new byte[]
             { 0, 1 }, encKrbPrivPart.getUserData() ) );
@@ -254,7 +254,7 @@ public class EncKrbPrivPartDecoderTest
 
         EncKrbPrivPart enKrbPrivPart = container.getEncKrbPrivPart();
 
-        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
+        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
 
         assertTrue( Arrays.equals( new byte[]
             { 0, 1 }, enKrbPrivPart.getUserData() ) );
@@ -358,7 +358,7 @@ public class EncKrbPrivPartDecoderTest
 
         EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
 
-        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
+        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
 
         assertTrue( Arrays.equals( new byte[]
             { 0, 1 }, encKrbPrivPart.getUserData() ) );
@@ -458,7 +458,7 @@ public class EncKrbPrivPartDecoderTest
 
         EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
 
-        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
+        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
 
         assertTrue( Arrays.equals( new byte[]
             { 0, 1 }, encKrbPrivPart.getUserData() ) );
@@ -582,7 +582,7 @@ public class EncKrbPrivPartDecoderTest
         EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
 
         String time = "20101119080043Z";
-        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
+        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
 
         assertTrue( Arrays.equals( new byte[]
             { 0, 1 }, encKrbPrivPart.getUserData() ) );
@@ -666,7 +666,7 @@ public class EncKrbPrivPartDecoderTest
 
         EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
 
-        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
+        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
 
         assertTrue( Arrays.equals( new byte[]
             { 0, 1 }, encKrbPrivPart.getUserData() ) );

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbSafeBodyDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbSafeBodyDecoderTest.java?rev=1703549&r1=1703548&r2=1703549&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbSafeBodyDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbSafeBodyDecoderTest.java Thu Sep 17 09:49:57 2015
@@ -145,7 +145,7 @@ public class KrbSafeBodyDecoderTest
         KrbSafeBody body = container.getKrbSafeBody();
 
         String time = "20101119080043Z";
-        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
+        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
 
         assertTrue( Arrays.equals( new byte[]
             { 0, 1 }, body.getUserData() ) );
@@ -254,7 +254,7 @@ public class KrbSafeBodyDecoderTest
 
         KrbSafeBody body = container.getKrbSafeBody();
 
-        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
+        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
 
         assertTrue( Arrays.equals( new byte[]
             { 0, 1 }, body.getUserData() ) );
@@ -358,7 +358,7 @@ public class KrbSafeBodyDecoderTest
 
         KrbSafeBody body = container.getKrbSafeBody();
 
-        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
+        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
 
         assertTrue( Arrays.equals( new byte[]
             { 0, 1 }, body.getUserData() ) );
@@ -458,7 +458,7 @@ public class KrbSafeBodyDecoderTest
 
         KrbSafeBody body = container.getKrbSafeBody();
 
-        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
+        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
 
         assertTrue( Arrays.equals( new byte[]
             { 0, 1 }, body.getUserData() ) );
@@ -582,7 +582,7 @@ public class KrbSafeBodyDecoderTest
         KrbSafeBody body = container.getKrbSafeBody();
 
         String time = "20101119080043Z";
-        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
+        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
 
         assertTrue( Arrays.equals( new byte[]
             { 0, 1 }, body.getUserData() ) );
@@ -666,7 +666,7 @@ public class KrbSafeBodyDecoderTest
 
         KrbSafeBody body = container.getKrbSafeBody();
 
-        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
+        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
 
         assertTrue( Arrays.equals( new byte[]
             { 0, 1 }, body.getUserData() ) );



Re: svn commit: r1703549

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 20/09/15 22:28, Stefan Seelmann a écrit :
> I think for those tests InetAddress.getLocalHost() doesn't make sense
> because the IP address is 127.0.0.1 is hardcoded in the encoded stream.

Ah, you are right. The tests passed on my machine, I guess the
InetAddress.getLocalHost() returned 127.0.0.1.
>
> On Jenkins the public IP is returned instead of 127.0.0.1 and the tests
> fail. I'll change back to 127.0.0.1.

Ok, makes totally sense.

thanks for the fix !


Re: svn commit: r1703549

Posted by Stefan Seelmann <ma...@stefan-seelmann.de>.
I think for those tests InetAddress.getLocalHost() doesn't make sense
because the IP address is 127.0.0.1 is hardcoded in the encoded stream.

On Jenkins the public IP is returned instead of 127.0.0.1 and the tests
fail. I'll change back to 127.0.0.1.


On 09/17/2015 11:49 AM, elecharny@apache.org wrote:
> Author: elecharny
> Date: Thu Sep 17 09:49:57 2015
> New Revision: 1703549
> 
> URL: http://svn.apache.org/r1703549
> Log:
> Used InetAddress.getLocalHost() instead of InetAddress.getByName( "127.0.0.1" )
> 
> Modified:
>     directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.java
>     directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbSafeBodyDecoderTest.java
> 
> Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.java
> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.java?rev=1703549&r1=1703548&r2=1703549&view=diff
> ==============================================================================
> --- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.java (original)
> +++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.java Thu Sep 17 09:49:57 2015
> @@ -145,7 +145,7 @@ public class EncKrbPrivPartDecoderTest
>          EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
>  
>          String time = "20101119080043Z";
> -        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
> +        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
>  
>          assertTrue( Arrays.equals( new byte[]
>              { 0, 1 }, encKrbPrivPart.getUserData() ) );
> @@ -254,7 +254,7 @@ public class EncKrbPrivPartDecoderTest
>  
>          EncKrbPrivPart enKrbPrivPart = container.getEncKrbPrivPart();
>  
> -        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
> +        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
>  
>          assertTrue( Arrays.equals( new byte[]
>              { 0, 1 }, enKrbPrivPart.getUserData() ) );
> @@ -358,7 +358,7 @@ public class EncKrbPrivPartDecoderTest
>  
>          EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
>  
> -        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
> +        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
>  
>          assertTrue( Arrays.equals( new byte[]
>              { 0, 1 }, encKrbPrivPart.getUserData() ) );
> @@ -458,7 +458,7 @@ public class EncKrbPrivPartDecoderTest
>  
>          EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
>  
> -        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
> +        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
>  
>          assertTrue( Arrays.equals( new byte[]
>              { 0, 1 }, encKrbPrivPart.getUserData() ) );
> @@ -582,7 +582,7 @@ public class EncKrbPrivPartDecoderTest
>          EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
>  
>          String time = "20101119080043Z";
> -        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
> +        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
>  
>          assertTrue( Arrays.equals( new byte[]
>              { 0, 1 }, encKrbPrivPart.getUserData() ) );
> @@ -666,7 +666,7 @@ public class EncKrbPrivPartDecoderTest
>  
>          EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
>  
> -        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
> +        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
>  
>          assertTrue( Arrays.equals( new byte[]
>              { 0, 1 }, encKrbPrivPart.getUserData() ) );
> 
> Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbSafeBodyDecoderTest.java
> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbSafeBodyDecoderTest.java?rev=1703549&r1=1703548&r2=1703549&view=diff
> ==============================================================================
> --- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbSafeBodyDecoderTest.java (original)
> +++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbSafeBodyDecoderTest.java Thu Sep 17 09:49:57 2015
> @@ -145,7 +145,7 @@ public class KrbSafeBodyDecoderTest
>          KrbSafeBody body = container.getKrbSafeBody();
>  
>          String time = "20101119080043Z";
> -        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
> +        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
>  
>          assertTrue( Arrays.equals( new byte[]
>              { 0, 1 }, body.getUserData() ) );
> @@ -254,7 +254,7 @@ public class KrbSafeBodyDecoderTest
>  
>          KrbSafeBody body = container.getKrbSafeBody();
>  
> -        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
> +        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
>  
>          assertTrue( Arrays.equals( new byte[]
>              { 0, 1 }, body.getUserData() ) );
> @@ -358,7 +358,7 @@ public class KrbSafeBodyDecoderTest
>  
>          KrbSafeBody body = container.getKrbSafeBody();
>  
> -        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
> +        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
>  
>          assertTrue( Arrays.equals( new byte[]
>              { 0, 1 }, body.getUserData() ) );
> @@ -458,7 +458,7 @@ public class KrbSafeBodyDecoderTest
>  
>          KrbSafeBody body = container.getKrbSafeBody();
>  
> -        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
> +        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
>  
>          assertTrue( Arrays.equals( new byte[]
>              { 0, 1 }, body.getUserData() ) );
> @@ -582,7 +582,7 @@ public class KrbSafeBodyDecoderTest
>          KrbSafeBody body = container.getKrbSafeBody();
>  
>          String time = "20101119080043Z";
> -        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
> +        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
>  
>          assertTrue( Arrays.equals( new byte[]
>              { 0, 1 }, body.getUserData() ) );
> @@ -666,7 +666,7 @@ public class KrbSafeBodyDecoderTest
>  
>          KrbSafeBody body = container.getKrbSafeBody();
>  
> -        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
> +        HostAddress ad = new HostAddress( InetAddress.getLocalHost() );
>  
>          assertTrue( Arrays.equals( new byte[]
>              { 0, 1 }, body.getUserData() ) );
> 
>