harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r507703 [5/9] - in /harmony/enhanced/classlib/trunk/modules: jndi/META-INF/ jndi/make/ jndi/src/main/java/javax/naming/ldap/ jndi/src/main/java/org/apache/harmony/jndi/internal/ jndi/src/main/java/org/apache/harmony/jndi/internal/nls/ jndi/...
Date Wed, 14 Feb 2007 21:42:44 GMT
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestLdapName.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestManageReferralControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestManageReferralControl.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestManageReferralControl.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestManageReferralControl.java
Wed Feb 14 13:42:41 2007
@@ -0,0 +1,117 @@
+/* 
+ *  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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+
+package org.apache.harmony.jndi.tests.javax.naming.ldap;
+
+import javax.naming.ldap.ManageReferralControl;
+import junit.framework.TestCase;
+
+/**
+ * <p>Test cases for all methods of the class ManageReferralControl.<p>
+ * 
+ * <p>The next table contains a list of the methods to be tested:<p>
+	<table class="t" cellspacing="0">
+	<tbody><th>Constructors:</th>
+		<tr>
+			<td class="c0" id="c00"><input class="a0" size="20" name="sas9nt11" readonly="readonly"
value="" id="f00"></td>
+			<td class="c0" id="c10"><input class="a0" size="40" name="sas9nt21" readonly="readonly"
value="ManageReferralControl()" id="f10"></td>
+			
+		</tr>
+		<tr>
+			<td class="c0" id="c00"><input class="a0" size="20" name="sas9nt11" readonly="readonly"
value="" id="f00"></td>
+			<td class="c0" id="c10"><input class="a0" size="40" name="sas9nt21" readonly="readonly"
value="ManageReferralControl(boolean criticality)" id="f10"></td>
+			
+		</tr>
+	</tbody>
+ *  
+ */
+public class TestManageReferralControl extends TestCase {
+
+	/**
+	 * <p>This method is not implemted.</p>
+	 * @param args Possible parameter to help us initiate all tests.
+	 */
+	public static void main(String[] args) {
+	}
+
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.ManageReferralControl.ManageReferralControl()'<p>
+	 * <p>Here we are testing the constructor method that create an object of the class
+	 * ManageReferralControl, wich has no enter parameters.<p>
+	 * <p>The expected result is a non null and critical instance of this class.<p>

+	 */
+	public void testManageReferralControl() {
+		
+		ManageReferralControl mrf=new ManageReferralControl();
+		assertNotNull(mrf);
+		assertTrue(mrf.isCritical());
+		
+	}
+
+	/**
+	 * <p>Test method for 'javax.naming.ldap.ManageReferralControl.ManageReferralControl(boolean)'<p>
+	 * <p>Here we are testing the constructor method that create an object of the class,
wich has as a 
+	 * parameter, the criticality of the object. The enter parameter in this case is true.<p>
+	 * <p>The expected result is an object with the mention criticality.<p>
+	 */
+	public void testManageReferralControlBoolean001() {
+
+		ManageReferralControl mrc = new ManageReferralControl(true);
+		assertNotNull(mrc);
+		assertTrue(mrc.isCritical());
+		
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.ManageReferralControl.ManageReferralControl(boolean)'<p>
+	 * <p>Here we are testing the constructor method that create an object of the class,
wich has as a 
+	 * parameter, the criticality of the object. The enter parameter is false.<p>
+	 * <p>The expected result is an object with the mention criticality.<p>
+	 */
+	public void testManageReferralControlBoolean002() {
+
+		ManageReferralControl mrc = new ManageReferralControl(false);
+		assertNotNull(mrc);
+		assertFalse(mrc.isCritical());
+		
+	}
+	/**
+	 * <p>Test Method for 'javax.naming.ldap.ManageReferralControl.getID()'<p>
+	 * <p>Here we are testing the ID of this object. The expected ID is the 
+	 * String : "2.16.840.1.113730.3.4.2."<p>
+	 */
+	public void testGetID(){
+		
+		ManageReferralControl mrc = new ManageReferralControl();
+		assertEquals("2.16.840.1.113730.3.4.2",mrc.getID());
+	}
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestManageReferralControl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsControls.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsControls.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsControls.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsControls.java
Wed Feb 14 13:42:41 2007
@@ -0,0 +1,313 @@
+/* 
+ *  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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.ldap;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import javax.naming.ldap.PagedResultsControl;
+import junit.framework.TestCase;
+
+/**        
+ * <p>This Test class is testing the PagedResultsControls class.</p>
+ * <p>In the next tables we are gonna see the methods that we test in this class:</p>
+ * <table class="t" cellspacing="0">
+	<tbody><th>Constructors:</th>
+		<tr>
+			<td class="c0" id="c00"><input class="a0" size="30" name="sas9nt11" readonly="readonly"
value="" id="f00"></td>
+			<td class="c0" id="c10"><input class="a0" size="60" name="sas9nt21" readonly="readonly"
value="PagedResultsControl(int pageSize, boolean criticality)" id="f10"></td>
+			
+		</tr>
+		<tr>
+			<td class="c0" id="c00"><input class="a0" size="30" name="sas9nt11" readonly="readonly"
value="" id="f00"></td>
+			<td class="c0" id="c10"><input class="a0" size="60" name="sas9nt21" readonly="readonly"
value="PagedResultsControl(int pageSize, byte[] cookie, boolean criticality)" id="f10"></td>
+			
+		</tr>     
+		      
+	</tbody></table>	
+ *
+ */
+public class TestPagedResultsControls extends TestCase {
+
+	/**
+	 * <p>This method is not implemted.</p>
+	 * @param args Possible parameter to help us initiate all tests.
+	 */
+	public static void main(String[] args) {
+	}
+
+	public TestPagedResultsControls(String name) {
+		super(name);
+	}
+
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int,
boolean)'</p>
+	 * <p>Here we are testing if this method constructs a control to set the number of
entries to be returned per page of results.</p>
+	 * <p>The expected result is an instance of this class.</p>
+	 */
+	public void testPagedResultsControlIntBoolean001() {
+		try {
+			PagedResultsControl prc=new PagedResultsControl(0,false);
+			assertNotNull(prc);
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+
+	}
+
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int,
boolean)'</p>
+	 * <p>Here we are testing if this method constructs a control to set the number of
entries to be returned per page of results.</p>
+	 * <p>The expected result is an instance of this class.</p>
+	 */
+	public void testPagedResultsControlIntBoolean002() {
+		try {
+			PagedResultsControl prc=new PagedResultsControl(0,true);
+			assertNotNull(prc);
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int,
boolean)'</p>
+	 * <p>Here we are testing if this method constructs a control to set the number of
entries to be returned per page of results.</p>
+	 * <p>The expected result is an instance of this class.</p>
+	 */
+	public void testPagedResultsControlIntBoolean003() {
+		try {
+			PagedResultsControl prc=new PagedResultsControl(100,false);
+			assertNotNull(prc);
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int,
boolean)'</p>
+	 * <p>Here we are testing if this method constructs a control to set the number of
entries to be returned per page of results.</p>
+	 * <p>The expected result is an instance of this class.</p>
+	 */
+	public void testPagedResultsControlIntBoolean004() {
+		try {
+			PagedResultsControl prc=new PagedResultsControl(100,true);
+			assertNotNull(prc);
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+
+	}
+
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int,
boolean)'</p>
+	 * <p>Here we are testing if this method constructs a control to set the number of
entries to be returned per page of results.</p>
+	 * <p>The expected result is an instance of this class.</p>
+	 */
+	public void testPagedResultsControlIntBoolean005() {
+		try {
+			PagedResultsControl prc=new PagedResultsControl(1000000,false);
+			assertNotNull(prc);
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int,
boolean)'</p>
+	 * <p>Here we are testing if this method constructs a control to set the number of
entries to be returned per page of results.</p>
+	 * <p>The expected result is an instance of this class.</p>
+	 */
+	public void testPagedResultsControlIntBoolean006() {
+		try {
+			PagedResultsControl prc=new PagedResultsControl(1000000,true);
+			assertNotNull(prc);
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+
+	}
+
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int,
byte[], boolean)'</p>
+	 * <p>Here we are testing if this method constructs a control to set the number of
entries to be returned per page of results.</p>
+	 * <p>The expected result is an instance of this class.</p> 
+	 */
+	public void testPagedResultsControlIntByteArrayBoolean001() {
+
+		try {
+			PagedResultsControl prc=new PagedResultsControl(0,null,true);
+			assertNotNull(prc);
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+
+		
+	}
+
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int,
byte[], boolean)'</p>
+	 * <p>Here we are testing if this method constructs a control to set the number of
entries to be returned per page of results.</p>
+	 * <p>The expected result is an instance of this class.</p> 
+	 */
+	public void testPagedResultsControlIntByteArrayBoolean002() {
+
+		try {
+			PagedResultsControl prc=new PagedResultsControl(0,null,false);
+			assertNotNull(prc);
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+
+		
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int,
byte[], boolean)'</p>
+	 * <p>Here we are testing if this method constructs a control to set the number of
entries to be returned per page of results.</p>
+	 * <p>The expected result is an instance of this class.</p> 
+	 */
+	public void testPagedResultsControlIntByteArrayBoolean003() {
+
+		try {
+			byte[] by={10,10};
+			PagedResultsControl prc=new PagedResultsControl(10,by,true);
+			assertNotNull(prc);
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+
+		
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int,
byte[], boolean)'</p>
+	 * <p>Here we are testing if this method constructs a control to set the number of
entries to be returned per page of results.</p>
+	 * <p>The expected result is an instance of this class.</p> 
+	 */
+	public void testPagedResultsControlIntByteArrayBoolean004() {
+
+		try {
+			byte[] by={10,10};
+			PagedResultsControl prc=new PagedResultsControl(10,by,false);
+			assertNotNull(prc);
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+
+		
+	}
+
+
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.BasicControl.getEncodedValue()'</p>
+	 * <p>Here we are testing if this method returns retrieves the control's ASN.1 BER
encoded value.</p>
+	 * <p>The expected result is a byte array representing the control's ASN.1 BER encoded
value.</p>
+	 */
+	public void testGetEncodedValue001() {
+
+		byte[] by={10,10};
+		try {
+			PagedResultsControl prc=new PagedResultsControl(10,by,false);
+			assertEquals("30 07 02 01 0a 04 02 0a 0a",toHexString(prc.getEncodedValue()));
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+	}
+
+	/**
+	 * <p>Test method for 'javax.naming.ldap.BasicControl.getEncodedValue()'</p>
+	 * <p>Here we are testing if this method returns retrieves the control's ASN.1 BER
encoded value.</p>
+	 * <p>The expected result is a byte array representing the control's ASN.1 BER encoded
value.</p>
+	 */
+	public void testGetEncodedValue002() {
+
+		try {
+			PagedResultsControl prc=new PagedResultsControl(0,null,false);
+			assertEquals("30 05 02 01 00 04 00",toHexString(prc.getEncodedValue()));
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+	}
+
+	/**
+	 * <p>Test method for 'javax.naming.ldap.BasicControl.getEncodedValue()'</p>
+	 * <p>Here we are testing if this method returns retrieves the control's ASN.1 BER
encoded value.</p>
+	 * <p>The expected result is a byte array representing the control's ASN.1 BER encoded
value.</p>
+	 */
+	public void testGetEncodedValue003() {
+
+		try {
+			PagedResultsControl prc=new PagedResultsControl(0,null,true);
+			assertEquals("30 05 02 01 00 04 00",toHexString(prc.getEncodedValue()));
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.BasicControl.getEncodedValue()'</p>
+	 * <p>Here we are testing if this method returns retrieves the control's ASN.1 BER
encoded value.</p>
+	 * <p>The expected result is a byte array representing the control's ASN.1 BER encoded
value.</p>
+	 */
+	public void testGetEncodedValue004() {
+
+		byte[] by={1,10,20};
+		try {
+			PagedResultsControl prc=new PagedResultsControl(0,by,false);
+			assertEquals("30 08 02 01 00 04 03 01 0a 14",toHexString(prc.getEncodedValue()));
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+	}
+	
+	/*
+	 * Method to get the string of a byte array.
+	 */
+	private static String toHexString(byte[] data) {
+		BigInteger bi = new BigInteger(data);
+		String s = bi.toString(16);
+		StringBuffer hex = new StringBuffer();
+		if (s.length() % 2 != 0) {
+			s = "0" + s;
+		}
+		for (int i = 0; i < s.length(); i++) {
+			hex.append(s.charAt(i));
+			if (i % 2 != 0 && i < s.length() - 1) {
+				hex.append(" ");
+			}
+		}
+		return hex.toString();
+	}
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsControls.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsResponseControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsResponseControl.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsResponseControl.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsResponseControl.java
Wed Feb 14 13:42:41 2007
@@ -0,0 +1,331 @@
+/* 
+ *  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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.ldap;
+
+import java.io.IOException;
+import javax.naming.ldap.PagedResultsResponseControl;
+import junit.framework.TestCase;
+
+/**        
+ * <p>This Test class is testing the PagedResultsControls class.</p>
+ * <p>In the next tables we are gonna see the methods that we test in this class:</p>
+ * <table class="t" cellspacing="0">
+	<tbody><th>Constructors:</th>
+		<tr>
+			<td class="c0" id="c00"><input class="a0" size="30" name="sas9nt11" readonly="readonly"
value="" id="f00"></td>
+			<td class="c0" id="c10"><input class="a0" size="60" name="sas9nt21" readonly="readonly"
value="PagedResultsResponseControl(String id, boolean criticality, byte[] value)" id="f10"></td>
+			
+		</tr>
+		</tbody></table>
+		<table>
+		<tbody><th>Method Summary:</th>
+		<tr><TD>Return</TD><TD>Method</TD></tr>
+		<tr>
+			<td class="c0" id="c00"><input class="a0" size="30" name="sas9nt11" readonly="readonly"
value="int" id="f00"></TD>
+			<td class="c0" id="c10"><input class="a0" size="65" name="sas9nt21" readonly="readonly"
value="getResultSize()" id="f10"></td>
+			
+		</tr>
+
+		<tr>
+			<td class="c0" id="c00"><input class="a0" size="30" name="sas9nt11" readonly="readonly"
value="byte[]" id="f00"></TD>
+			<td class="c0" id="c10"><input class="a0" size="65" name="sas9nt21" readonly="readonly"
value="getCookie()" id="f10"></td>
+			
+		</tr>
+		      
+	</tbody></table>	
+ *
+ */
+public class TestPagedResultsResponseControl extends TestCase {
+
+	/**
+	 * <p>This method is not implemted.</p>
+	 * @param args Possible parameter to help us initiate all tests.
+	 */
+	public static void main(String[] args) {
+	}
+
+	public TestPagedResultsResponseControl(String name) {
+		super(name);
+	}
+
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String,
boolean, byte[])'</p>
+	 * <p>Here we are testing if this method constructs a paged-results response control.</p>
+	 * <p>The expected result is a Nullpointerexception.</p>
+	 */
+	public void testPagedResultsResponseControl001() {
+
+		try {
+			PagedResultsResponseControl x=new PagedResultsResponseControl(null,false,null);
+			fail("Arguments can not be null.");
+		} catch (NullPointerException e) {
+			
+		} catch (IOException e) {
+			fail("A null pointer exception must be thrown.");
+		}
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String,
boolean, byte[])'</p>
+	 * <p>Here we are testing if this method constructs a paged-results response control.</p>
+	 * <p>The expected result is a Nullpointerexception.</p>
+	 */
+	public void testPagedResultsResponseControl002() {
+
+		try {
+			PagedResultsResponseControl x=new PagedResultsResponseControl(null,true,null);
+			fail("Arguments can not be null.");
+		} catch (NullPointerException e) {
+			
+		} catch (IOException e) {
+			fail("A null pointer exception must be thrown.");
+		}
+	}
+
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String,
boolean, byte[])'</p>
+	 * <p>Here we are testing if this method constructs a paged-results response control.</p>
+	 * <p>The expected result is a IOexception.</p>
+	 */
+	public void testPagedResultsResponseControl003() {
+
+		try {
+			byte[] b={};
+			PagedResultsResponseControl x=new PagedResultsResponseControl(null,false,b);
+			fail("The byte array must not be empty.");
+		} catch (IOException e) {
+			
+		}
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String,
boolean, byte[])'</p>
+	 * <p>Here we are testing if this method constructs a paged-results response control.</p>
+	 * <p>The expected result is a IOexception.</p>
+	 */
+	public void testPagedResultsResponseControl004() {
+
+		try {
+			byte[] b={};
+			PagedResultsResponseControl x=new PagedResultsResponseControl(null,true,b);
+			fail("The byte array must not be empty.");
+		} catch (IOException e) {
+			
+		}
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String,
boolean, byte[])'</p>
+	 * <p>Here we are testing if this method constructs a paged-results response control.</p>
+	 * <p>The expected result is a IOexception.</p>
+	 */
+	public void testPagedResultsResponseControl005() {
+
+		try {
+			byte[] b={1,2,3,4,0};
+			PagedResultsResponseControl x=new PagedResultsResponseControl(null,false,b);
+			fail("The byte array is not ok.");
+		} catch (IOException e) {
+			
+		}
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String,
boolean, byte[])'</p>
+	 * <p>Here we are testing if this method constructs a paged-results response control.</p>
+	 * <p>The expected result is a IOexception.</p>
+	 */
+	public void testPagedResultsResponseControl006() {
+
+		try {
+			byte[] b={1,2,3,4,0};
+			PagedResultsResponseControl x=new PagedResultsResponseControl(null,true,b);
+			fail("The byte array is not ok.");
+		} catch (IOException e) {
+			
+		}
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String,
boolean, byte[])'</p>
+	 * <p>Here we are testing if this method constructs a paged-results response control.</p>
+	 * <p>The expected result is an instance of the class.</p>
+	 */
+	public void testPagedResultsResponseControl007() {
+
+		try {
+			byte[] b={48,5,2,1,0,4,0};
+			PagedResultsResponseControl x=new PagedResultsResponseControl(null,true,b);
+			
+		} catch (IOException e) {
+			fail("The arguments are ok.");
+		}
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String,
boolean, byte[])'</p>
+	 * <p>Here we are testing if this method constructs a paged-results response control.</p>
+	 * <p>The expected result is an instance of the class.</p>
+	 */
+	public void testPagedResultsResponseControl008() {
+
+		try {
+			byte[] b={48,5,2,1,0,4,0};
+			PagedResultsResponseControl x=new PagedResultsResponseControl(null,false,b);
+			
+		} catch (IOException e) {
+			fail("The arguments are ok.");
+		}
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String,
boolean, byte[])'</p>
+	 * <p>Here we are testing if this method constructs a paged-results response control.</p>
+	 * <p>The expected result is an instance of the class.</p>
+	 */
+	public void testPagedResultsResponseControl010() {
+
+		try {
+			byte[] b={48,5,2,1,0,4,0};
+			PagedResultsResponseControl x=new PagedResultsResponseControl("",false,b);
+			
+		} catch (IOException e) {
+			fail("The arguments are ok.");
+		}
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.PagedResultsResponseControl(String,
boolean, byte[])'</p>
+	 * <p>Here we are testing if this method constructs a paged-results response control.</p>
+	 * <p>The expected result is that the byte array must be copy not clone so any chance
in original affect the response.</p>
+	 */
+	public void testPagedResultsResponseControl011() {
+
+		try {
+			byte[] b={48,5,2,1,0,4,0};
+			byte[] c={48,5,2,1,0,4,0};
+			PagedResultsResponseControl x=new PagedResultsResponseControl("",false,b);
+			byte[] aux = x.getEncodedValue().clone();
+			for (int i = 0; i < b.length; i++) {
+				b[i]=1;
+			}
+			for (int i = 0; i < b.length; i++) {
+				assertSame(c[i],aux[i]);
+				assertSame(b[i],x.getEncodedValue()[i]);
+			}
+		} catch (IOException e) {
+			fail("The arguments are ok.");
+		}
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.getResultSize()'</p>
+	 * <p>Here we are testing if this method retrieves (an estimate of) the number of
entries in the search result.</p>
+	 * <p>The expected result is in this case zero.</p> 
+	 */
+	public void testGetResultSize001() {
+
+		byte[] b={48,5,2,1,0,4,0};
+		try {
+			PagedResultsResponseControl x=new PagedResultsResponseControl("",false,b);
+			assertEquals(0,x.getResultSize());
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+	}
+
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.getResultSize()'</p>
+	 * <p>Here we are testing if this method retrieves (an estimate of) the number of
entries in the search result.</p>
+	 * <p>The expected result is in this case zero.</p> 
+	 */
+	public void testGetResultSize002() {
+
+		byte[] b={48,5,2,1,10,4,0};
+		try {
+			PagedResultsResponseControl x=new PagedResultsResponseControl("",false,b);
+			assertEquals(10,x.getResultSize());
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+	}
+
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.getCookie()'</p>
+	 * <p>Here we are testing if this method retrieves the server-generated cookie.</p>
+	 * <p>The expected result in this case is null.</p>
+	 */
+	public void testGetCookie001() {
+
+		byte[] b={48,5,2,1,0,4,0};
+		try {
+			PagedResultsResponseControl x=new PagedResultsResponseControl("",false,b);
+			assertEquals(null,x.getCookie());
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.getCookie()'</p>
+	 * <p>Here we are testing if this method retrieves the server-generated cookie.</p>
+	 * <p>The expected result in this case is a not null array.</p>
+	 */
+	public void testGetCookie002() {
+
+		byte[] b={48,7,2,1,0,4,2,1,1};
+		byte[] c={1,1};
+		try {
+			PagedResultsResponseControl x=new PagedResultsResponseControl("",false,b);
+			for (int i = 0; i < x.getCookie().length; i++) {
+				assertEquals(c[i],x.getCookie()[i]);
+			}	
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+	}
+	
+	/**
+	 * <p>Test method for 'javax.naming.ldap.PagedResultsResponseControl.getCookie()'</p>
+	 * <p>Here we are testing if this method retrieves the server-generated cookie.</p>
+	 * <p>The expected result in this case is not null.</p>
+	 */
+	public void testGetCookie003() {
+
+		byte[] b={48,6,2,1,0,4,1,0};
+		try {
+			PagedResultsResponseControl x=new PagedResultsResponseControl("",false,b);
+			assertNotNull(x.getCookie());
+		} catch (IOException e) {
+			fail("Failed with:"+e);
+		}
+	}
+}

Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsResponseControl.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message