You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/12/04 08:08:18 UTC
svn commit: r600812 - in /directory/apacheds/branches/bigbang:
core-integ/src/test/java/org/apache/directory/server/core/
core-integ/src/test/java/org/apache/directory/server/core/exception/
core-unit/src/test/java/org/apache/directory/server/core/exce...
Author: akarasulu
Date: Mon Dec 3 23:08:15 2007
New Revision: 600812
URL: http://svn.apache.org/viewvc?rev=600812&view=rev
Log:
moving and converting yet another test to use the new framework
Added:
directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/exception/
directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java (contents, props changed)
- copied, changed from r600772, directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceITest.java
Removed:
directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/exception/
Modified:
directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java
Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java?rev=600812&r1=600811&r2=600812&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java Mon Dec 3 23:08:15 2007
@@ -22,6 +22,7 @@
import org.apache.directory.server.core.collective.CollectiveAttributeServiceIT;
import org.apache.directory.server.core.configuration.PartitionConfigurationIT;
import org.apache.directory.server.core.event.EventServiceIT;
+import org.apache.directory.server.core.exception.ExceptionServiceIT;
import org.apache.directory.server.core.integ.CiSuite;
import org.apache.directory.server.core.integ.ServiceScope;
import org.apache.directory.server.core.integ.SetupMode;
@@ -41,8 +42,9 @@
@Suite.SuiteClasses ( {
SimpleAuthenticationIT.class,
CollectiveAttributeServiceIT.class,
+ ExceptionServiceIT.class,
EventServiceIT.class,
- PartitionConfigurationIT.class // Leaves the server in a bad state (partition removal is incomplete)
+ PartitionConfigurationIT.class // Leaves the server in a bad state (partition removal is incomplete)
} )
@Scope ( ServiceScope.TESTSUITE )
@Mode ( SetupMode.ROLLBACK )
Copied: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java (from r600772, directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceITest.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java?p2=directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java&p1=directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceITest.java&r1=600772&r2=600812&rev=600812&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceITest.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java Mon Dec 3 23:08:15 2007
@@ -20,16 +20,9 @@
package org.apache.directory.server.core.exception;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.naming.ldap.LdapContext;
-
-import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.integ.CiRunner;
+import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapContextNotEmptyException;
import org.apache.directory.shared.ldap.exception.LdapNameAlreadyBoundException;
@@ -39,6 +32,14 @@
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import javax.naming.ldap.LdapContext;
/**
@@ -47,13 +48,18 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class ExceptionServiceITest extends AbstractAdminTestCase
+@RunWith ( CiRunner.class )
+public class ExceptionServiceIT
{
+ public static DirectoryService service;
+
+
private DirContext createSubContext( String type, String value ) throws NamingException
{
- return createSubContext( sysRoot, type, value );
+ return createSubContext( getSystemContext( service ), type, value );
}
+
private DirContext createSubContext( DirContext ctx, String type, String value ) throws NamingException
{
Attributes attrs = new AttributesImpl( type, value );
@@ -69,19 +75,24 @@
return ctx.createSubcontext( type + "=" + value, attrs );
}
+
// ------------------------------------------------------------------------
// Search Operation Tests
// ------------------------------------------------------------------------
+
/**
* Test search operation failure when the search base is non-existant.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testFailSearchNoSuchObject() throws NamingException
{
SearchControls ctls = new SearchControls();
try
{
- sysRoot.search( "ou=blah", "(objectClass=*)", ctls );
+ getSystemContext( service ).search( "ou=blah", "(objectClass=*)", ctls );
fail( "Execution should never get here due to exception!" );
}
catch ( LdapNameNotFoundException e )
@@ -95,11 +106,14 @@
/**
* Search operation control to test if normal search operations occur
* correctly.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testSearchControl() throws NamingException
{
SearchControls ctls = new SearchControls();
- NamingEnumeration list = sysRoot.search( "ou=users", "(objectClass=*)", ctls );
+ NamingEnumeration list = getSystemContext( service ).search( "ou=users", "(objectClass=*)", ctls );
if ( list.hasMore() )
{
@@ -118,9 +132,14 @@
/**
* Test move operation failure when the object moved is non-existant.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testFailMoveEntryAlreadyExists() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
try
{
Attributes attrs = new AttributesImpl( "ou", "users" );
@@ -163,9 +182,14 @@
/**
* Test move operation failure when the object moved is non-existant.
+
+ * @throws NamingException on error
*/
+ @Test
public void testFailMoveNoSuchObject() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
try
{
sysRoot.rename( "ou=blah", "ou=blah,ou=groups" );
@@ -195,9 +219,14 @@
/**
* Move operation control to test if normal move operations occur
* correctly.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testMoveControl() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
sysRoot.rename( "ou=users", "ou=users,ou=groups" );
assertNotNull( sysRoot.lookup( "ou=users,ou=groups" ) );
@@ -218,11 +247,17 @@
// ModifyRdn Operation Tests
// ------------------------------------------------------------------------
+
/**
* Test modifyRdn operation failure when the object renamed is non-existant.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testFailModifyRdnEntryAlreadyExists() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
try
{
sysRoot.rename( "ou=users", "ou=groups" );
@@ -238,9 +273,14 @@
/**
* Test modifyRdn operation failure when the object renamed is non-existant.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testFailModifyRdnNoSuchObject() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
try
{
sysRoot.rename( "ou=blah", "ou=asdf" );
@@ -257,9 +297,14 @@
/**
* Modify operation control to test if normal modify operations occur
* correctly.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testModifyRdnControl() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
sysRoot.rename( "ou=users", "ou=asdf" );
assertNotNull( sysRoot.lookup( "ou=asdf" ) );
@@ -280,11 +325,17 @@
// Modify Operation Tests
// ------------------------------------------------------------------------
+
/**
* Test modify operation failure when the object modified is non-existant.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testFailModifyNoSuchObject() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
Attributes attrs = new AttributesImpl( true );
Attribute ou = new AttributeImpl( "ou" );
ou.add( "users" );
@@ -321,9 +372,14 @@
/**
* Modify operation control to test if normal modify operations occur
* correctly.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testModifyControl() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
Attributes attrs = new AttributesImpl( true );
Attribute attr = new AttributeImpl( "ou" );
attr.add( "dummyValue" );
@@ -350,11 +406,17 @@
// Lookup Operation Tests
// ------------------------------------------------------------------------
+
/**
* Test lookup operation failure when the object looked up is non-existant.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testFailLookupNoSuchObject() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
try
{
sysRoot.lookup( "ou=blah" );
@@ -371,9 +433,14 @@
/**
* Lookup operation control to test if normal lookup operations occur
* correctly.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testLookupControl() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
LdapContext ctx = ( LdapContext ) sysRoot.lookup( "ou=users" );
assertNotNull( ctx );
assertEquals( "users", ctx.getAttributes( "" ).get( "ou" ).get() );
@@ -384,11 +451,17 @@
// List Operation Tests
// ------------------------------------------------------------------------
+
/**
* Test list operation failure when the base searched is non-existant.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testFailListNoSuchObject() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
try
{
sysRoot.list( "ou=blah" );
@@ -404,9 +477,14 @@
/**
* List operation control to test if normal list operations occur correctly.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testListControl() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
NamingEnumeration list = sysRoot.list( "ou=users" );
if ( list.hasMore() )
@@ -424,12 +502,18 @@
// Add Operation Tests
// ------------------------------------------------------------------------
+
/**
* Tests for add operation failure when the parent of the entry to add does
* not exist.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testFailAddOnAlias() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
Attributes attrs = new AttributesImpl( true );
Attribute attr = new AttributeImpl( "objectClass" );
attr.add( "top" );
@@ -455,9 +539,14 @@
/**
* Tests for add operation failure when the parent of the entry to add does
* not exist.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testFailAddNoSuchEntry() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
try
{
sysRoot.createSubcontext( "ou=blah,ou=abc" );
@@ -472,7 +561,10 @@
/**
* Tests for add operation failure when the entry to add already exists.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testFailAddEntryAlreadyExists() throws NamingException
{
createSubContext( "ou", "blah");
@@ -492,9 +584,14 @@
/**
* Add operation control to test if normal add operations occur correctly.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testAddControl() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
DirContext ctx = createSubContext( "ou", "blah");
createSubContext( ctx, "ou", "subctx");
Object obj = sysRoot.lookup( "ou=subctx,ou=blah" );
@@ -506,11 +603,17 @@
// Delete Operation Tests
// ------------------------------------------------------------------------
+
/**
* Tests for delete failure when the entry to be deleted has child entires.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testFailDeleteNotAllowedOnNonLeaf() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
DirContext ctx = createSubContext( "ou", "blah" );
createSubContext( ctx, "ou", "subctx" );
@@ -530,9 +633,14 @@
/**
* Tests delete to make sure it fails when we try to delete an entry that
* does not exist.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testFailDeleteNoSuchObject() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
try
{
sysRoot.destroySubcontext( "ou=blah" );
@@ -548,9 +656,14 @@
/**
* Delete operation control to test if normal delete operations occur.
+ *
+ * @throws NamingException on error
*/
+ @Test
public void testDeleteControl() throws NamingException
{
+ LdapContext sysRoot = getSystemContext( service );
+
createSubContext( "ou", "blah" );
Object obj = sysRoot.lookup( "ou=blah" );
Propchange: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Mon Dec 3 23:08:15 2007
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id