Author: akarasulu
Date: Sat Jan 29 16:58:41 2011
New Revision: 1065070
URL: http://svn.apache.org/viewvc?rev=1065070&view=rev
Log:
more test fixes
Modified:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueContainer.java
directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueContainer.java?rev=1065070&r1=1065069&r2=1065070&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueContainer.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueContainer.java
Sat Jan 29 16:58:41 2011
@@ -64,7 +64,7 @@ public class SyncRequestValueContainer e
/**
* @return Returns the syncRequestValue control.
*/
- public ISyncRequestValue getSyncRequestValueControl()
+ public SyncRequestValueDecorator getSyncRequestValueControl()
{
return control;
}
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java?rev=1065070&r1=1065069&r2=1065070&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java
Sat Jan 29 16:58:41 2011
@@ -19,6 +19,7 @@
*/
package org.apache.directory.shared.ldap.codec.controls.replication;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -30,15 +31,14 @@ import org.apache.directory.junit.tools.
import org.apache.directory.junit.tools.ConcurrentJunitRunner;
import org.apache.directory.shared.asn1.DecoderException;
import org.apache.directory.shared.asn1.EncoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueDecorator;
import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueContainer;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueDecorator;
import org.apache.directory.shared.ldap.message.control.replication.SynchronizationModeEnum;
import org.apache.directory.shared.util.Strings;
import org.junit.Test;
import org.junit.runner.RunWith;
+
/**
* Test the SyncRequestControlValue codec
*
@@ -54,7 +54,6 @@ public class SyncRequestValueControlTest
@Test
public void testDecodeSyncRequestValueControlRefreshOnlySuccess()
{
- Asn1Decoder decoder = new SyncRequestValueControlDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x0D );
bb.put( new byte[]
{
@@ -68,11 +67,11 @@ public class SyncRequestValueControlTest
bb.flip();
SyncRequestValueContainer container = new SyncRequestValueContainer();
- container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
+ SyncRequestValueDecorator decorator = container.getSyncRequestValueControl();
try
{
- decoder.decode( bb, container );
+ decorator.decode( bb.array() );
}
catch ( DecoderException de )
{
@@ -123,7 +122,6 @@ public class SyncRequestValueControlTest
@Test
public void testDecodeSyncRequestValueControlRefreshAndPersistSuccess()
{
- Asn1Decoder decoder = new SyncRequestValueControlDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x0D );
bb.put( new byte[]
{
@@ -137,11 +135,11 @@ public class SyncRequestValueControlTest
bb.flip();
SyncRequestValueContainer container = new SyncRequestValueContainer();
- container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
-
+ SyncRequestValueDecorator decorator = container.getSyncRequestValueControl();
+
try
{
- decoder.decode( bb, container );
+ decorator.decode( bb.array() );
}
catch ( DecoderException de )
{
@@ -192,7 +190,6 @@ public class SyncRequestValueControlTest
@Test
public void testDecodeSyncRequestValueControlNoCookie()
{
- Asn1Decoder decoder = new SyncRequestValueControlDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x08 );
bb.put( new byte[]
{
@@ -205,11 +202,11 @@ public class SyncRequestValueControlTest
bb.flip();
SyncRequestValueContainer container = new SyncRequestValueContainer();
- container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
-
+ SyncRequestValueDecorator decorator = container.getSyncRequestValueControl();
+
try
{
- decoder.decode( bb, container );
+ decorator.decode( bb.array() );
}
catch ( DecoderException de )
{
@@ -260,7 +257,6 @@ public class SyncRequestValueControlTest
@Test
public void testDecodeSyncRequestValueControlNoCookieReloadHintTrue()
{
- Asn1Decoder decoder = new SyncRequestValueControlDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x08 );
bb.put( new byte[]
{
@@ -273,11 +269,11 @@ public class SyncRequestValueControlTest
bb.flip();
SyncRequestValueContainer container = new SyncRequestValueContainer();
- container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
-
+ SyncRequestValueDecorator decorator = container.getSyncRequestValueControl();
+
try
{
- decoder.decode( bb, container );
+ decorator.decode( bb.array() );
}
catch ( DecoderException de )
{
@@ -329,7 +325,6 @@ public class SyncRequestValueControlTest
@Test
public void testDecodeSyncRequestValueControlNoCookieNoReloadHint()
{
- Asn1Decoder decoder = new SyncRequestValueControlDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x05 );
bb.put( new byte[]
{
@@ -341,11 +336,11 @@ public class SyncRequestValueControlTest
bb.flip();
SyncRequestValueContainer container = new SyncRequestValueContainer();
- container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
-
+ SyncRequestValueDecorator decorator = container.getSyncRequestValueControl();
+
try
{
- decoder.decode( bb, container );
+ decorator.decode( bb.array() );
}
catch ( DecoderException de )
{
@@ -395,7 +390,6 @@ public class SyncRequestValueControlTest
@Test
public void testDecodeSyncRequestValueControlNoReloadHintSuccess()
{
- Asn1Decoder decoder = new SyncRequestValueControlDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x0D );
bb.put( new byte[]
{
@@ -408,11 +402,11 @@ public class SyncRequestValueControlTest
bb.flip();
SyncRequestValueContainer container = new SyncRequestValueContainer();
- container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
-
+ SyncRequestValueDecorator decorator = container.getSyncRequestValueControl();
+
try
{
- decoder.decode( bb, container );
+ decorator.decode( bb.array() );
}
catch ( DecoderException de )
{
@@ -463,7 +457,6 @@ public class SyncRequestValueControlTest
@Test
public void testDecodeSyncRequestValueControlEmptyCookie()
{
- Asn1Decoder decoder = new SyncRequestValueControlDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x07 );
bb.put( new byte[]
{
@@ -476,11 +469,11 @@ public class SyncRequestValueControlTest
bb.flip();
SyncRequestValueContainer container = new SyncRequestValueContainer();
- container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
-
+ SyncRequestValueDecorator decorator = container.getSyncRequestValueControl();
+
try
{
- decoder.decode( bb, container );
+ decorator.decode( bb.array() );
}
catch ( DecoderException de )
{
@@ -530,7 +523,6 @@ public class SyncRequestValueControlTest
@Test
public void testDecodeSyncRequestValueControlEmptySequence()
{
- Asn1Decoder decoder = new SyncRequestValueControlDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x02 );
bb.put( new byte[]
{
@@ -539,11 +531,11 @@ public class SyncRequestValueControlTest
bb.flip();
SyncRequestValueContainer container = new SyncRequestValueContainer();
- container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
-
+ SyncRequestValueDecorator decorator = container.getSyncRequestValueControl();
+
try
{
- decoder.decode( bb, container );
+ decorator.decode( bb.array() );
fail( "we should not get there" );
}
catch ( DecoderException de )
@@ -559,7 +551,6 @@ public class SyncRequestValueControlTest
@Test
public void testDecodeSyncRequestValueControlNoMode()
{
- Asn1Decoder decoder = new SyncRequestValueControlDecoder();
ByteBuffer bb = ByteBuffer.allocate( 0x07 );
bb.put( new byte[]
{
@@ -569,11 +560,11 @@ public class SyncRequestValueControlTest
bb.flip();
SyncRequestValueContainer container = new SyncRequestValueContainer();
- container.setSyncRequestValueControl( new SyncRequestValueDecorator() );
-
+ SyncRequestValueDecorator decorator = container.getSyncRequestValueControl();
+
try
{
- decoder.decode( bb, container );
+ decorator.decode( bb.array() );
fail( "we should not get there" );
}
catch ( DecoderException de )
|