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/05/31 17:12:56 UTC
svn commit: r1682741 - in
/directory/studio/trunk/plugins/openldap.config.editor/src:
main/java/org/apache/directory/studio/openldap/config/editor/wrappers/
test/java/org/apache/directory/studio/openldap/config/wrappers/
Author: elecharny
Date: Sun May 31 15:12:56 2015
New Revision: 1682741
URL: http://svn.apache.org/r1682741
Log:
Fixed the failing tests
Modified:
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TimeLimitWrapper.java
directory/studio/trunk/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TimeLimitWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TimeLimitWrapper.java?rev=1682741&r1=1682740&r2=1682741&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TimeLimitWrapper.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TimeLimitWrapper.java Sun May 31 15:12:56 2015
@@ -463,11 +463,11 @@ public class TimeLimitWrapper
// The globalLioit overrides the soft and hard limit
sb.append( "time=" );
- if ( globalLimit == -1 )
+ if ( globalLimit.equals( UNLIMITED ) )
{
sb.append( "unlimited" );
}
- else if ( globalLimit >= 0 )
+ else if ( globalLimit.intValue() >= 0 )
{
sb.append( globalLimit );
}
@@ -484,11 +484,11 @@ public class TimeLimitWrapper
// If hard and soft are set and equals, we use the global limit instead
sb.append( "time=" );
- if ( hardLimit == -1 )
+ if ( hardLimit.equals( UNLIMITED ) )
{
sb.append( "unlimited" );
}
- else if ( hardLimit >= 0 )
+ else if ( hardLimit.intValue() >= 0 )
{
sb.append( hardLimit );
}
@@ -496,7 +496,7 @@ public class TimeLimitWrapper
else
{
// We have both values, the aren't equal.
- if ( hardLimit == UNLIMITED )
+ if ( hardLimit.equals( UNLIMITED ) )
{
sb.append( "time.hard=unlimited time.soft=" );
sb.append( softLimit );
@@ -514,7 +514,7 @@ public class TimeLimitWrapper
else
{
// Special case : softLimit is -1
- if ( softLimit == UNLIMITED )
+ if ( softLimit.equals( UNLIMITED ) )
{
// We use the hard limit
sb.append( "time=" ).append( hardLimit );
@@ -523,22 +523,22 @@ public class TimeLimitWrapper
{
sb.append( "time.hard=" );
- if ( hardLimit == -1 )
+ if ( hardLimit.equals( UNLIMITED ) )
{
sb.append( "unlimited" );
}
- else if ( hardLimit > 0 )
+ else if ( hardLimit.intValue() > 0 )
{
sb.append( hardLimit );
}
sb.append( " time.soft=" );
- if ( softLimit == -1 )
+ if ( softLimit.equals( UNLIMITED ) )
{
sb.append( "unlimited" );
}
- else if ( softLimit >= 0 )
+ else if ( softLimit.intValue() >= 0 )
{
sb.append( softLimit );
}
@@ -551,11 +551,11 @@ public class TimeLimitWrapper
// Only an hard limit
sb.append( "time.hard=" );
- if ( hardLimit == -1 )
+ if ( hardLimit.equals( UNLIMITED ) )
{
sb.append( "unlimited" );
}
- else if ( hardLimit >= 0 )
+ else if ( hardLimit.intValue() >= 0 )
{
sb.append( hardLimit );
}
@@ -566,11 +566,11 @@ public class TimeLimitWrapper
// Only a soft limit
sb.append( "time.soft=" );
- if ( softLimit == -1 )
+ if ( softLimit.equals( UNLIMITED ) )
{
sb.append( "unlimited" );
}
- else if ( softLimit >= 0 )
+ else if ( softLimit.intValue() >= 0 )
{
sb.append( softLimit );
}
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java?rev=1682741&r1=1682740&r2=1682741&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java Sun May 31 15:12:56 2015
@@ -32,13 +32,16 @@ import org.junit.Test;
*/
public class TimeLimitWrapperTest
{
- @org.junit.Ignore
@Test
public void testToString()
{
- TimeLimitWrapper tlw = new TimeLimitWrapper( null, new Integer( 100 ), new Integer( 200 ) );
+ TimeLimitWrapper tlw = new TimeLimitWrapper( null, new Integer( 200 ), new Integer( 100 ) );
- assertEquals( "time.hard=100 time.soft=200", tlw.toString() );
+ assertEquals( "time.hard=200 time.soft=100", tlw.toString() );
+
+ tlw = new TimeLimitWrapper( null, new Integer( 100 ), new Integer( 200 ) );
+
+ assertEquals( "time=100", tlw.toString() );
tlw = new TimeLimitWrapper( null, new Integer( 100 ), new Integer( 100 ) );
@@ -78,7 +81,7 @@ public class TimeLimitWrapperTest
tlw = new TimeLimitWrapper( null, new Integer( 200 ), new Integer( -1 ) );
- assertEquals( "time.hard=200 time.soft=unlimited", tlw.toString() );
+ assertEquals( "time=200", tlw.toString() );
tlw = new TimeLimitWrapper( new Integer( -1 ), new Integer( 200 ), new Integer( -1 ) );