From ef7472507064725f7d1ac16e6b9ccdfa2f9fadea Mon Sep 17 00:00:00 2001
From: coulbeck <coulbeck@localhost>
Date: Fri, 23 Feb 2007 20:11:10 +0000
Subject: [PATCH] This change prepares the unit tests for when the ACI handler will get enabled by default. Most of the failing tests are fixed by adding bypass-acl privilege to the entries of the users the failing tests bind as.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPPasswordModifyTestCase.java | 427 +++++------------------------------------------------
1 files changed, 40 insertions(+), 387 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPPasswordModifyTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPPasswordModifyTestCase.java
index e5b6279..aa9ba20 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPPasswordModifyTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPPasswordModifyTestCase.java
@@ -339,7 +339,24 @@
"Should have been invalid because: " + invalidReason);
}
-
+ /**
+ * Add a test user.
+ */
+ private static void addTestUser() throws Exception
+ {
+ TestCaseUtils.addEntry(
+ "dn: uid=test.user,o=test",
+ "objectClass: top",
+ "objectClass: person",
+ "objectClass: organizationalPerson",
+ "objectClass: inetOrgPerson",
+ "uid: test.user",
+ "givenName: Test",
+ "sn: User",
+ "cn: Test User",
+ "ds-privilege-name: bypass-acl",
+ "userPassword: password");
+ }
/**
* Tests the ability to perform a self change including both the current and
@@ -353,24 +370,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -400,24 +400,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -446,24 +429,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -492,24 +458,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -537,24 +486,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -585,24 +517,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -634,24 +549,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -681,24 +579,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -727,24 +608,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -771,24 +635,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -817,24 +664,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -862,24 +692,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -912,24 +725,7 @@
String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
"config" + File.separator + "client.truststore";
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -960,24 +756,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -1011,24 +790,7 @@
String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
"config" + File.separator + "client.truststore";
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -1059,24 +821,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -1106,24 +851,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -1209,7 +937,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
+ TestCaseUtils.addEntry(
"dn: uid=test.user,o=test",
"objectClass: top",
"objectClass: person",
@@ -1222,13 +950,6 @@
"userPassword: password",
"ds-pwp-account-disabled: true");
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
-
String[] args =
{
"-h", "127.0.0.1",
@@ -1258,24 +979,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -1306,24 +1010,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -1355,24 +1042,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
@@ -1404,24 +1074,7 @@
{
TestCaseUtils.initializeTestBackend(true);
- Entry e = TestCaseUtils.makeEntry(
- "dn: uid=test.user,o=test",
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "objectClass: inetOrgPerson",
- "uid: test.user",
- "givenName: Test",
- "sn: User",
- "cn: Test User",
- "userPassword: password");
-
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation =
- conn.processAdd(e.getDN(), e.getObjectClasses(),
- e.getUserAttributes(), e.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+ addTestUser();
String[] args =
{
--
Gitblit v1.10.0