From 67405dde9ba213331dab1fc46cb18c485070fd5b Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 05 Jun 2009 09:04:50 +0000
Subject: [PATCH] svn merge -r5333:5417 https://opends.dev.java.net/svn/opends/branches/b2.0

---
 opends/tests/staf-tests/shared/python/common.py |   39 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/opends/tests/staf-tests/shared/python/common.py b/opends/tests/staf-tests/shared/python/common.py
index 84ed7a1..2ca6890 100644
--- a/opends/tests/staf-tests/shared/python/common.py
+++ b/opends/tests/staf-tests/shared/python/common.py
@@ -45,7 +45,8 @@
             "parse_stax_result",
             "dn2list",
             "list2dn",
-            "dn2rfcmailaddr" ]
+            "dn2rfcmailaddr",
+            "java_properties" ]
 
 class format_testcase:
   'Format the Test name objects'
@@ -205,6 +206,8 @@
       return Boolean.FALSE
 
 def create_property_table(output, separator):
+    'Create a table from an output'
+    
     table = {}
 
     for line in output.splitlines():
@@ -218,17 +221,19 @@
     return table
 
 def compare_property_table(refTable, newTable):
+    'Compare two tables'
+    
     import re
 
     result = ''
 
-    refKeys=newTable.keys()
+    refKeys = newTable.keys()
     for refKey in refKeys:
       if not refTable.has_key(refKey):
         result = result + 'ERROR: Entry ' + refKey + ' does not exists'
         result = result + ' in the reference table.\n'
 
-    refKeys=refTable.keys()
+    refKeys = refTable.keys()
     for refKey in refKeys:
       if not newTable.has_key(refKey):
         result = result + 'ERROR: Entry ' + refKey + ' does not exists'
@@ -588,3 +593,31 @@
     __addr.append(__rhside)
   return ".".join(__addr).lower()
 
+def java_properties(propFile, toolsName, optionList):
+  'Update java.properties file'
+
+  import fileinput
+  import string
+  import sys
+
+  try:
+    file = open(propFile, "r")
+    content = file.read()
+    file.close()
+
+    newfile = open(propFile, "w")
+    for line in content.splitlines():
+      if line.startswith(toolsName):
+        newline = line.split("=")[0] + "="
+        for item in optionList:
+          newline = newline + item + " "
+        newfile.write("%s\n" % newline)
+      else:
+        newfile.write("%s\n" % line)
+    newfile.close()
+
+    return 0
+  except:
+    print "Exception:", sys.exc_info()[0]
+
+    return 1

--
Gitblit v1.10.0