From 6e0b9ce1068a7086973fe748d176aa9f24a74b9a Mon Sep 17 00:00:00 2001
From: andrug <andrug@localhost>
Date: Mon, 28 Apr 2008 17:20:47 +0000
Subject: [PATCH] Get automatically the name of directory built in the opends zip file

---
 opends/tests/system-tests/scenario/sample/conf.xml  |    4 ++--
 opends/tests/system-tests/phases/parser/parser.py   |   36 +++++++++++++++++++-----------------
 opends/tests/system-tests/scenario/conf.dtd         |    3 +--
 opends/tests/system-tests/scenario/sample2/conf.xml |    4 ++--
 4 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/opends/tests/system-tests/phases/parser/parser.py b/opends/tests/system-tests/phases/parser/parser.py
index 71250d8..a80624a 100755
--- a/opends/tests/system-tests/phases/parser/parser.py
+++ b/opends/tests/system-tests/phases/parser/parser.py
@@ -547,9 +547,8 @@
       result = parseGlobalParameters(thisChild)
       msg = '%s \n %s' % (msg,result[0])
       scenario   = result[1]
-      opendsName = result[2]
-      opendsZip  = result[3]
-      domain     = result[4]
+      opendsZip  = result[2]
+      domain     = result[3]
     
     #
     # Parsing instance node
@@ -574,8 +573,7 @@
       # opends instance parsing
       #
       if cProduct == 'opends':
-        result = parseOpenDs(cId,cName,cProduct,cRole,opendsName,opendsZip,\
-                             thisChild)
+        result = parseOpenDs(cId,cName,cProduct,cRole,opendsZip,thisChild)
         msg = '%s \n %s' % (msg,result[0])
         instances.append(result[1])
       
@@ -648,7 +646,7 @@
 #
 # Parse children and get information for opends instance 
 #
-def parseOpenDs(cId,cName,cProduct,cRole,opendsName,opendsZip,thisChild):
+def parseOpenDs(cId,cName,cProduct,cRole,opendsZip,thisChild):
   msg              = ''
   cHost            = 'localhost'
   cInstallDir      = NOT_DEFINED
@@ -787,7 +785,18 @@
                               cDatabaseCachePercentage,\
                               cReplicationPurgeDelay)
   
-  cInstallDir = '%s/%s/%s' % (cInstallDir,cName,opendsName)
+  #
+  # extract the name of zip and add it to the installDir path
+  #
+  # 1. Remove the file path
+  _list = opendsZip.split('/')
+  _file = _list.pop()
+  # 2. Get the name of the file without the extension
+  _fileName  = _file.split('.')
+  _extension = _fileName.pop()
+  _fileName  = '.'.join(_fileName)
+  
+  cInstallDir = '%s/%s/%s' % (cInstallDir,cName,_fileName)
   return [msg,OpendsInstance(cId,cName,cProduct,cRole,cHost,cInstallDir,\
                              opendsZip,\
                              cPortLDAP,cPortLDAPS,cPortJMX,cPortREPL,\
@@ -1178,12 +1187,11 @@
   msg        = ''
   result     = []
   scenario   = NOT_DEFINED
-  opendsName = NOT_DEFINED
   opendsZip  = NOT_DEFINED
   domain     = NOT_DEFINED
   
   #
-  # Parsing second level : opendsName,...
+  # Parsing second level
   #
   if thisChild.hasChildNodes():
     
@@ -1194,10 +1202,6 @@
       thisSubChild = subChildren.item(j)
       
       if (thisSubChild.getNodeType() == Node.ELEMENT_NODE and
-          thisSubChild.getNodeName() == 'opendsName'):
-        opendsName = _getPropValue(thisSubChild)
-        
-      elif (thisSubChild.getNodeType() == Node.ELEMENT_NODE and
           thisSubChild.getNodeName() == 'opendsZip'):
         opendsZip = _getPropValue(thisSubChild)
         
@@ -1228,12 +1232,10 @@
     msg = '%s\n ERROR: parseGlobalParameters(): no child for this node' % msg
     
     
-  if (opendsName == NOT_DEFINED):
-    msg = '%s\n ERROR: parseGlobalParameters() : opendsName not defined' % (msg)
   if (opendsZip == NOT_DEFINED):
     msg = '%s\n ERROR: parseGlobalParameters() : opendsZip not defined' % (msg)
 
-  return [msg,scenario,opendsName,opendsZip,domain]
+  return [msg,scenario,opendsZip,domain]
 
 
 
@@ -1249,7 +1251,7 @@
   description = NOT_DEFINED
   
   #
-  # Parsing second level : opendsName,...
+  # Parsing second level
   #
   if thisChild.hasChildNodes():
     
diff --git a/opends/tests/system-tests/scenario/conf.dtd b/opends/tests/system-tests/scenario/conf.dtd
index 7994472..caaea42 100755
--- a/opends/tests/system-tests/scenario/conf.dtd
+++ b/opends/tests/system-tests/scenario/conf.dtd
@@ -28,12 +28,11 @@
                                    suffix?, scheduler?)>
 
 <!-- ========== GLOBAL PARAMETERS NODE ========================= -->
-<!ELEMENT globalParameters (scenario,opendsName,opendsZip,directoryManagerDn?,
+<!ELEMENT globalParameters (scenario,opendsZip,directoryManagerDn?,
                             directoryManagerPswd?,domain?)>
   <!ELEMENT scenario (name,description)>
     <!ELEMENT name (#PCDATA)>
     <!ELEMENT description (#PCDATA)>
-  <!ELEMENT opendsName (#PCDATA)>
   <!ELEMENT opendsZip (#PCDATA)>
   <!ELEMENT directoryManagerDn (#PCDATA)>
   <!ELEMENT directoryManagerPswd (#PCDATA)>
diff --git a/opends/tests/system-tests/scenario/sample/conf.xml b/opends/tests/system-tests/scenario/sample/conf.xml
index 9200266..2321c4c 100755
--- a/opends/tests/system-tests/scenario/sample/conf.xml
+++ b/opends/tests/system-tests/scenario/sample/conf.xml
@@ -42,9 +42,9 @@
       <description>This is an example</description>
     </scenario>
     
-    <opendsName>OpenDS-1.0.0</opendsName>
     <opendsZip>NEED_VALUE</opendsZip>
-    <domain>NEED_VALUE</domain>
+    <!-- Example : <domain>france.sun.com</domain> -->
+    <domain></domain>
     
   </globalParameters>
   
diff --git a/opends/tests/system-tests/scenario/sample2/conf.xml b/opends/tests/system-tests/scenario/sample2/conf.xml
index c665ba7..8b3ae67 100755
--- a/opends/tests/system-tests/scenario/sample2/conf.xml
+++ b/opends/tests/system-tests/scenario/sample2/conf.xml
@@ -44,9 +44,9 @@
       </description>
     </scenario>
     
-    <opendsName>OpenDS-1.0.0</opendsName>
     <opendsZip>NEED_VALUE</opendsZip>
-    <domain>NEED_VALUE</domain>
+    <!-- Example : <domain>france.sun.com</domain> -->
+    <domain></domain>
     
   </globalParameters>
   

--
Gitblit v1.10.0