mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

smaguin
06.39.2007 95d6370de99c444f9f7931eb88a86401bad60068
remove the check with expectedRC in the java code
return errorCode
4 files modified
75 ■■■■ changed files
opends/tests/functional-tests/shared/java/addAnEntry.class patch | view | raw | blame | history
opends/tests/functional-tests/shared/java/addAnEntry.java 36 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/java/modifyAnAttribute.class patch | view | raw | blame | history
opends/tests/functional-tests/shared/java/modifyAnAttribute.java 39 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/java/addAnEntry.class
Binary files differ
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);
    }
}
opends/tests/functional-tests/shared/java/modifyAnAttribute.class
Binary files differ
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);
    }
}