From 81418ac3dea77db5b51e6cf65615b532fa069c16 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Mon, 06 Aug 2007 18:13:25 +0000
Subject: [PATCH] Implement a TestCaseUtils.dsconfig method that provides a more convenient mechanism for making configuration changes within the unit test framework.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/api/AlertHandlerTestCase.java | 110 ++++++++++---------------------------------------------
1 files changed, 20 insertions(+), 90 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/api/AlertHandlerTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/api/AlertHandlerTestCase.java
index 23aea65..7d531b0 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/api/AlertHandlerTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/api/AlertHandlerTestCase.java
@@ -118,17 +118,10 @@
@Test()
public void testEnabledAlert()
{
- String[] args =
- {
- "-h", "127.0.0.1",
- "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
- "-D", "cn=Directory Manager",
- "-w", "password",
+ TestCaseUtils.dsconfig(
"set-alert-handler-prop",
"--handler-name", "Dummy Alert Handler",
- "--add", "enabled-alert-type:" + ALERT_TYPE
- };
- assertEquals(DSConfig.main(args, false, System.out, System.err), 0);
+ "--add", "enabled-alert-type:" + ALERT_TYPE);
try
{
@@ -140,17 +133,10 @@
}
finally
{
- args = new String[]
- {
- "-h", "127.0.0.1",
- "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
- "-D", "cn=Directory Manager",
- "-w", "password",
+ TestCaseUtils.dsconfig(
"set-alert-handler-prop",
"--handler-name", "Dummy Alert Handler",
- "--remove", "enabled-alert-type:" + ALERT_TYPE
- };
- assertEquals(DSConfig.main(args, false, System.out, System.err), 0);
+ "--remove", "enabled-alert-type:" + ALERT_TYPE);
}
}
@@ -163,17 +149,10 @@
@Test()
public void testNotEnabledAlert()
{
- String[] args =
- {
- "-h", "127.0.0.1",
- "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
- "-D", "cn=Directory Manager",
- "-w", "password",
+ TestCaseUtils.dsconfig(
"set-alert-handler-prop",
"--handler-name", "Dummy Alert Handler",
- "--add", "enabled-alert-type:" + ALERT_TYPE + ".bogus"
- };
- assertEquals(DSConfig.main(args, false, System.out, System.err), 0);
+ "--add", "enabled-alert-type:" + ALERT_TYPE + ".bogus");
try
{
@@ -185,17 +164,10 @@
}
finally
{
- args = new String[]
- {
- "-h", "127.0.0.1",
- "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
- "-D", "cn=Directory Manager",
- "-w", "password",
+ TestCaseUtils.dsconfig(
"set-alert-handler-prop",
"--handler-name", "Dummy Alert Handler",
- "--remove", "enabled-alert-type:" + ALERT_TYPE + ".bogus"
- };
- assertEquals(DSConfig.main(args, false, System.out, System.err), 0);
+ "--remove", "enabled-alert-type:" + ALERT_TYPE + ".bogus");
}
}
@@ -208,17 +180,10 @@
@Test()
public void testDisabledAlert()
{
- String[] args =
- {
- "-h", "127.0.0.1",
- "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
- "-D", "cn=Directory Manager",
- "-w", "password",
+ TestCaseUtils.dsconfig(
"set-alert-handler-prop",
"--handler-name", "Dummy Alert Handler",
- "--add", "disabled-alert-type:" + ALERT_TYPE
- };
- assertEquals(DSConfig.main(args, false, System.out, System.err), 0);
+ "--add", "disabled-alert-type:" + ALERT_TYPE);
try
{
@@ -230,17 +195,10 @@
}
finally
{
- args = new String[]
- {
- "-h", "127.0.0.1",
- "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
- "-D", "cn=Directory Manager",
- "-w", "password",
+ TestCaseUtils.dsconfig(
"set-alert-handler-prop",
"--handler-name", "Dummy Alert Handler",
- "--remove", "disabled-alert-type:" + ALERT_TYPE
- };
- assertEquals(DSConfig.main(args, false, System.out, System.err), 0);
+ "--remove", "disabled-alert-type:" + ALERT_TYPE);
}
}
@@ -253,17 +211,10 @@
@Test()
public void testNotDisabledAlert()
{
- String[] args =
- {
- "-h", "127.0.0.1",
- "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
- "-D", "cn=Directory Manager",
- "-w", "password",
+ TestCaseUtils.dsconfig(
"set-alert-handler-prop",
"--handler-name", "Dummy Alert Handler",
- "--add", "disabled-alert-type:" + ALERT_TYPE + ".bogus"
- };
- assertEquals(DSConfig.main(args, false, System.out, System.err), 0);
+ "--add", "disabled-alert-type:" + ALERT_TYPE + ".bogus");
try
{
@@ -275,17 +226,10 @@
}
finally
{
- args = new String[]
- {
- "-h", "127.0.0.1",
- "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
- "-D", "cn=Directory Manager",
- "-w", "password",
+ TestCaseUtils.dsconfig(
"set-alert-handler-prop",
"--handler-name", "Dummy Alert Handler",
- "--remove", "disabled-alert-type:" + ALERT_TYPE + ".bogus"
- };
- assertEquals(DSConfig.main(args, false, System.out, System.err), 0);
+ "--remove", "disabled-alert-type:" + ALERT_TYPE + ".bogus");
}
}
@@ -298,18 +242,11 @@
@Test()
public void testEnabledAndDisabledAlert()
{
- String[] args =
- {
- "-h", "127.0.0.1",
- "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
- "-D", "cn=Directory Manager",
- "-w", "password",
+ TestCaseUtils.dsconfig(
"set-alert-handler-prop",
"--handler-name", "Dummy Alert Handler",
"--add", "enabled-alert-type:" + ALERT_TYPE,
- "--add", "disabled-alert-type:" + ALERT_TYPE,
- };
- assertEquals(DSConfig.main(args, false, System.out, System.err), 0);
+ "--add", "disabled-alert-type:" + ALERT_TYPE);
try
{
@@ -321,18 +258,11 @@
}
finally
{
- args = new String[]
- {
- "-h", "127.0.0.1",
- "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
- "-D", "cn=Directory Manager",
- "-w", "password",
+ TestCaseUtils.dsconfig(
"set-alert-handler-prop",
"--handler-name", "Dummy Alert Handler",
"--remove", "enabled-alert-type:" + ALERT_TYPE,
- "--remove", "disabled-alert-type:" + ALERT_TYPE,
- };
- assertEquals(DSConfig.main(args, false, System.out, System.err), 0);
+ "--remove", "disabled-alert-type:" + ALERT_TYPE);
}
}
--
Gitblit v1.10.0