From eb9b0980f7077734371f57d753544f21acff1094 Mon Sep 17 00:00:00 2001
From: mkeyes <mkeyes@localhost>
Date: Wed, 15 Aug 2007 17:10:15 +0000
Subject: [PATCH] Adding functional tests that test the behavior of the list-xxx-yyy subcommand for dsconfig.

---
 opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig_list.xml    |  122 +++++++++++++++++
 opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig_setup.xml   |  103 ++++++++++++++
 opendj-sdk/opends/tests/functional-tests/testcases/runFuncTests.xml              |    6 
 opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig.xml         |   57 ++++++++
 opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/list.dat             |   24 +++
 opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig_cleanup.xml |   94 +++++++++++++
 6 files changed, 406 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig.xml b/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig.xml
new file mode 100755
index 0000000..9429dab
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../shared/stax.dtd">
+<!--
+ ! CDDL HEADER START
+ !
+ ! The contents of this file are subject to the terms of the
+ ! Common Development and Distribution License, Version 1.0 only
+ ! (the "License").  You may not use this file except in compliance
+ ! with the License.
+ !
+ ! You can obtain a copy of the license at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, include this CDDL HEADER in each
+ ! file and include the License file at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ ! add the following below this CDDL HEADER, with the fields enclosed
+ ! by brackets "[]" replaced with your own identifying information:
+ !      Portions Copyright [yyyy] [name of copyright owner]
+ !
+ ! CDDL HEADER END
+ !
+ !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ ! -->
+<stax>
+
+  <defaultcall function="main_dsconfig"/>
+
+  <function name="main_dsconfig">
+
+    <sequence>
+
+      <block name="'dsconfig'">
+      
+        <sequence>
+    
+          <script>
+            CurrentTestPath['group']='dsconfig'
+          </script>
+      
+          <import machine="STAF_LOCAL_HOSTNAME"
+            file="'%s/testcases/dsconfig/dsconfig_list.xml' % (TESTS_DIR)"/>
+          <call function="'dsconfig_list'" />
+  
+         
+        </sequence>
+     
+      </block>
+     
+    </sequence>
+
+  </function>
+
+</stax>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig_cleanup.xml b/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig_cleanup.xml
new file mode 100755
index 0000000..a9e3a58
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig_cleanup.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../shared/stax.dtd">
+<!--
+ ! CDDL HEADER START
+ !
+ ! The contents of this file are subject to the terms of the
+ ! Common Development and Distribution License, Version 1.0 only
+ ! (the "License").  You may not use this file except in compliance
+ ! with the License.
+ !
+ ! You can obtain a copy of the license at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, include this CDDL HEADER in each
+ ! file and include the License file at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ ! add the following below this CDDL HEADER, with the fields enclosed
+ ! by brackets "[]" replaced with your own identifying information:
+ !      Portions Copyright [yyyy] [name of copyright owner]
+ !
+ ! CDDL HEADER END
+ !
+ !      Portions Copyright 2007 Sun Microsystems, Inc.
+ ! -->
+<stax>
+
+  <defaultcall function="dsconfig_cleanup"/>
+
+  <function name="dsconfig_cleanup">
+
+    <sequence>
+
+      <block name="'cleanup'">
+      
+        <sequence>
+
+			
+          <block name="'Block DS Process Stop'">				
+          <!--- Stop DS -->
+		    <sequence>
+              <message>
+                 'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
+              </message>
+
+              <call function="'StopDsWithScript'">
+                { 'location'  : STAF_REMOTE_HOSTNAME,
+                  'dsHost'    : DIRECTORY_INSTANCE_HOST,
+                  'dsPort'    : DIRECTORY_INSTANCE_PORT,
+                  'dsBindDN'  : DIRECTORY_INSTANCE_DN,
+                  'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
+              </call>
+
+              <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+
+		    </sequence>			  
+          <!--- End Block DS Process Stop -->
+          </block>
+			
+						  			  			  
+
+		  <block name="'Block Remove DS Topology'">
+		  <!-- Remove  the topology created for the test suite -->
+			<sequence>
+				
+              <message>
+                 'Remove DS topology created for the Test Suite'
+              </message>				  
+
+			  <call function="'removeTopology'"/>
+				
+			  <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+			
+			</sequence>			  
+		  <!-- End Block Remove DS Topology-->  
+		  </block>	  														  
+			        
+			
+        </sequence>        
+      </block>
+            
+     </sequence>
+
+  </function>
+
+</stax>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig_list.xml b/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig_list.xml
new file mode 100644
index 0000000..3ef9110
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig_list.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../shared/stax.dtd">
+<!--
+ ! CDDL HEADER START
+ !
+ ! The contents of this file are subject to the terms of the
+ ! Common Development and Distribution License, Version 1.0 only
+ ! (the "License").  You may not use this file except in compliance
+ ! with the License.
+ !
+ ! You can obtain a copy of the license at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, include this CDDL HEADER in each
+ ! file and include the License file at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ ! add the following below this CDDL HEADER, with the fields enclosed
+ ! by brackets "[]" replaced with your own identifying information:
+ !      Portions Copyright [yyyy] [name of copyright owner]
+ !
+ ! CDDL HEADER END
+ !
+ !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ ! -->
+<stax>
+
+  <defaultcall function="dsconfig_list"/>
+
+  <function name="dsconfig_list">
+
+    <sequence>
+
+      <block name="'dsconfig-list'">
+      
+        <sequence>
+  
+        <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group']='aci'			  			  
+            CurrentTestPath['suite']=STAXCurrentBlock
+        </script>
+      
+        <call function="'testSuite_Preamble'"/>
+          
+        <import machine="STAF_LOCAL_HOSTNAME"
+            file="'%s/testcases/dsconfig/dsconfig_setup.xml' % (TESTS_DIR)"/>
+        <call function="'dsconfig_setup'" />
+
+												    
+        <script>
+            componentList = []
+         
+            f = open('%s/testcases/dsconfig/list.dat' % (TESTS_DIR),'r')
+            for line in f.readlines():
+                if line.startswith('#'):
+                    continue
+                else: 
+                    lineSingle = line.split(':')
+                    componentList.append(lineSingle)
+          
+            componentNumber=0
+            testNumber=0
+        </script>
+        <iterate var="dummyIndex" in="componentList">
+          <sequence>
+            <testcase name="'%s: %s' % ( CurrentTestPath['group'], componentList[componentNumber][0] )" >
+              <sequence>
+                <message>
+                    'Listing component %s, %s, %s' % (componentList[componentNumber][0], componentList[componentNumber][1], componentList[componentNumber][2])
+                </message>
+                
+                <call function="'dsconfig'">
+                {   'location'       :  location ,
+                    'dsPath'         :  dsPath ,
+                    'dsInstanceHost' :  dsInstanceHost ,
+                    'dsInstancePort' :  dsInstancePort ,
+                    'dsInstanceDn'   :  dsInstanceDn ,
+                    'dsInstancePswd' :  dsInstancePswd ,
+                    'subcommand'     :  '%s' % componentList[componentNumber][0] ,
+                    'expectedRC'     : 0 
+                }
+                </call>
+              
+                <script> 
+                 returnString = STAXResult[0][1]
+                </script> 
+    
+                <call function="'searchStringForSubstring'">
+                    { 'returnString'       : returnString ,
+                      'testString'         : componentList[componentNumber][1]  ,
+                      'expectedResult'     : '1' }
+                </call>
+                
+                <call function="'checktestString'">
+                    { 'returnString'       : returnString ,
+                      'expectedString'     : componentList[componentNumber][2] }
+                </call>
+               
+                <script>
+                    componentNumber=componentNumber+1
+                </script>
+              </sequence>
+            </testcase>
+          </sequence>
+        </iterate>
+       
+        <import machine="STAF_LOCAL_HOSTNAME"
+            file="'%s/testcases/dsconfig/dsconfig_cleanup.xml' % (TESTS_DIR)"/>
+        <call function="'dsconfig_cleanup'" />
+
+												    
+        <call function="'testSuite_Postamble'"/>
+        
+        </sequence>
+      </block>
+    </sequence>
+  </function>
+
+</stax>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig_setup.xml b/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig_setup.xml
new file mode 100755
index 0000000..1dfb425
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/dsconfig_setup.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../shared/stax.dtd">
+<!--
+ ! CDDL HEADER START
+ !
+ ! The contents of this file are subject to the terms of the
+ ! Common Development and Distribution License, Version 1.0 only
+ ! (the "License").  You may not use this file except in compliance
+ ! with the License.
+ !
+ ! You can obtain a copy of the license at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, include this CDDL HEADER in each
+ ! file and include the License file at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ ! add the following below this CDDL HEADER, with the fields enclosed
+ ! by brackets "[]" replaced with your own identifying information:
+ !      Portions Copyright [yyyy] [name of copyright owner]
+ !
+ ! CDDL HEADER END
+ !
+ !      Portions Copyright 2007 Sun Microsystems, Inc.
+ ! -->
+<stax>
+
+  <defaultcall function="dsconfig_setup"/>
+
+  <function name="dsconfig_setup">
+
+    <sequence>
+
+      <block name="'setup'">
+      
+        <sequence>
+
+          <script>
+            CurrentTestPath['group']='dsconfig'
+          </script>
+						  
+				  
+		  <block name="'Block Create DS Topology'">
+		  <!-- Create the topology necessary to the test group/suite -->
+		    <sequence>
+								
+              <message>
+                 'Create DS topology as described in config.py'
+              </message>
+				  
+			  <call function="'createTopology'">
+			    { 'initialiseInstance' : True }
+			  </call>
+				    				
+			  <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+      
+            </sequence>      
+          <!--- End Block Create DS Topology -->	
+          </block>				  				  
+
+
+		  <block name="'Block DS Process Active'">	  	
+          <!--- Start DS -->
+		    <sequence>
+				
+              <message>
+                 'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
+              </message>
+  
+              <!--- Start DS -->
+              <call function="'StartDsWithScript'">
+               { 'location'  : STAF_REMOTE_HOSTNAME }
+              </call>
+  
+              <call function="'checkRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult }
+              </call>
+  
+              <!--- Check that DS started -->
+              <call function="'isAlive'">
+                { 'noOfLoops'        : 5 ,
+                  'noOfMilliSeconds' : 2000 }
+              </call>			
+				
+            </sequence>
+          <!--- End Block DS Process Active -->
+          </block>			  			
+											
+			        
+        </sequence>        
+      </block>
+            
+     </sequence>
+
+  </function>
+
+</stax>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/list.dat b/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/list.dat
new file mode 100644
index 0000000..9b3b123
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/dsconfig/list.dat
@@ -0,0 +1,24 @@
+list-account-status-notification-handlers:Account Status Notification Handler:Error Log Handler:
+list-alert-handlers:Alert Handler:JMX Alert Handler:
+list-attribute-syntaxes:Attribute Syntax:Object Class Description:
+list-backends:monitor:tasks:
+list-certificate-mappers:Fingerprint Mapper:Subject Attribute to User Attribute:
+list-connection-handlers:LDAP Connection Handler:LDAPS Connection Handler:
+list-extended-operation-handlers:Get Connection ID:Password Policy State:
+list-group-implementations:Dynamic:Static:
+list-identity-mappers:Exact Match:Regular Expression:
+list-key-managers:JKS:PKCS12:
+list-log-publishers:File-Based Audit Logger:File-Based Error Logger:
+list-log-retention-policies:File Count Retention Policy:Free Disk Space Retention Policy:
+list-log-rotation-policies:24 Hours Time Limit Rotation Policy:7 Days Time Limit Rotation Policy:
+list-matching-rules:Case Exact Equality Matching Rule:Numeric String Equality Matching Rule:
+list-monitor-providers:Client Connections:System Info:
+list-password-generators:Password Generator:Random Password Generator:
+list-password-policies:Default Password Policy:Root Password Policy:
+list-password-storage-schemes:Salted SHA-256:MD5:
+list-password-validators:Attribute Value:Character Set:
+list-plugins:Entry UUID:Password Policy Import:
+list-sasl-mechanism-handlers:CRAM-MD5:GSSAPI:
+list-synchronization-providers:Synchronization Provider:Type:
+list-trust-managers:Blind Trust:JKS:
+list-virtual-attributes:entryUUID:isMemberOf:
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/runFuncTests.xml b/opendj-sdk/opends/tests/functional-tests/testcases/runFuncTests.xml
index 5701c05..64a0355 100755
--- a/opendj-sdk/opends/tests/functional-tests/testcases/runFuncTests.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/runFuncTests.xml
@@ -54,6 +54,12 @@
       -->
 
       <import machine="STAF_LOCAL_HOSTNAME"
+              file="'%s/testcases/dsconfig/dsconfig.xml' % TESTS_DIR" />
+      <!--
+      <call function="'main_dsconfig'" />
+      -->
+      
+      <import machine="STAF_LOCAL_HOSTNAME"
               file="'%s/testcases/backends/backends.xml' % TESTS_DIR" />
       <!--
       <call function="'main_backends'" />

--
Gitblit v1.10.0