From 95d6370de99c444f9f7931eb88a86401bad60068 Mon Sep 17 00:00:00 2001
From: smaguin <smaguin@localhost>
Date: Fri, 06 Jul 2007 08:39:01 +0000
Subject: [PATCH] remove the check with expectedRC in the java code return errorCode
---
opends/tests/functional-tests/shared/java/modifyAnAttribute.java | 39 ++++++++++++++-------------------------
1 files changed, 14 insertions(+), 25 deletions(-)
diff --git a/opends/tests/functional-tests/shared/java/modifyAnAttribute.java b/opends/tests/functional-tests/shared/java/modifyAnAttribute.java
index 90518fb..9663290 100644
--- a/opends/tests/functional-tests/shared/java/modifyAnAttribute.java
+++ b/opends/tests/functional-tests/shared/java/modifyAnAttribute.java
@@ -49,9 +49,7 @@
/**
* modify an entry with an attribute
* the operation can be a replace, delete or a add new attribute
- * if expectedErrorCode is set, we compare it with the ldap error code returned in the exception
- * the function returns 0 if the code are equals
- * otherwise, returns 1
+ * the function returns the ldap error code
*/
public class modifyAnAttribute {
@@ -69,7 +67,7 @@
String errorCode=null;
String errorMessage=null;
String listAttributesToModify=null;
- String expectedErrorCode="0";
+
int ind1;
String attributeName;
@@ -109,9 +107,6 @@
if (opt1.equals("-t")) {
changetype = val1;
}
- if (opt1.equals("-E")) {
- expectedErrorCode = val1;
- }
if (opt1.equals("-l")) {
listAttributesToModify = val1;
@@ -170,8 +165,8 @@
try {
- CompositeName entryDN = new CompositeName (dnToModify);
- System.out.println(changetype + " attribute " + attributeToModify + " for entry " + dnToModify);
+ CompositeName entryDN = new CompositeName (dnToModify);
+ System.out.println("Modify the entry " + dnToModify);
// connect to server
ctx = new InitialLdapContext(envLdap, null);
@@ -188,8 +183,9 @@
// add attribute
ctx.modifyAttributes(entryDN, LdapContext.REMOVE_ATTRIBUTE , attributes);
}
-
+
ctx.close();
+
} catch (CommunicationException e1) {
errorMessage = e1.getMessage();
@@ -206,20 +202,13 @@
else {
System.out.println (errorMessage);
int ind=errorMessage.indexOf("-");
- errorCode=errorMessage.substring(18, ind-1);
- }
- // Compare the errorCode and the expected error Code
- int diff=expectedErrorCode.compareTo(errorCode);
-
- if (diff == 0 ){
- // Got the expected error Code. The test is success
- System.exit(0);
- }
- else {
- System.out.println ("Error: modify request didn't return the expected error Code");
- System.out.println ("Expected " + expectedErrorCode + "; Got" + errorCode);
- System.exit(1);
+ if ( ind > 0 ) {
+ errorCode=errorMessage.substring(18, ind-1);
+ }
+ else errorCode="0";
}
-}
-}
+ int RC = Integer.parseInt(errorCode);
+ System.exit(RC);
+ }
+}
\ No newline at end of file
--
Gitblit v1.10.0