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/addAnEntry.class | 0
opends/tests/functional-tests/shared/java/modifyAnAttribute.java | 39 +++++++------------
opends/tests/functional-tests/shared/java/modifyAnAttribute.class | 0
opends/tests/functional-tests/shared/java/addAnEntry.java | 36 ++++++++++++------
4 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/opends/tests/functional-tests/shared/java/addAnEntry.class b/opends/tests/functional-tests/shared/java/addAnEntry.class
index b810108..c57794c 100644
--- a/opends/tests/functional-tests/shared/java/addAnEntry.class
+++ b/opends/tests/functional-tests/shared/java/addAnEntry.class
Binary files differ
diff --git a/opends/tests/functional-tests/shared/java/addAnEntry.java b/opends/tests/functional-tests/shared/java/addAnEntry.java
index 7c6a6d0..788ee82 100644
--- a/opends/tests/functional-tests/shared/java/addAnEntry.java
+++ b/opends/tests/functional-tests/shared/java/addAnEntry.java
@@ -70,7 +70,8 @@
String credential=null;
String dnToAdd=null;
String attributeToAdd=null;
-
+ String errorCode=null;
+ String errorMessage=null;
int ind1;
String attributeName;
@@ -156,20 +157,31 @@
ctx.close();
-
+
} catch (CommunicationException e1) {
- String error = e1.getMessage();
+ errorMessage = e1.getMessage();
- System.out.println(" Catch exception : " + e1.getMessage());
- System.exit(1);
} catch (NamingException e2) {
- // resultCode = ;
- System.out.println(" Catch exception : " + e2.getMessage());
- System.exit(1);
- } catch (Exception e3) {
+ errorMessage = e2.getMessage();
- System.out.println(" Catch exception : " + e3.getMessage());
- System.exit(1);
+ } catch (Exception e3) {
+ errorMessage= e3.getMessage();
}
-}
+ // No error, the modify is success
+ if ( errorMessage == null ) {
+ errorCode="0";
+ }
+ else {
+ System.out.println (errorMessage);
+ int ind=errorMessage.indexOf("-");
+ if ( ind > 0 ) {
+ errorCode=errorMessage.substring(18, ind-1);
+ }
+ else errorCode="0";
+ }
+
+ int RC = Integer.parseInt(errorCode);
+ System.exit(RC);
+ }
+
}
diff --git a/opends/tests/functional-tests/shared/java/modifyAnAttribute.class b/opends/tests/functional-tests/shared/java/modifyAnAttribute.class
index e8c6f8e..ae416ea 100644
--- a/opends/tests/functional-tests/shared/java/modifyAnAttribute.class
+++ b/opends/tests/functional-tests/shared/java/modifyAnAttribute.class
Binary files differ
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