From b4b1d98a85e2b2a67af94f2730ed64d290dc53f0 Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Thu, 07 Mar 2013 20:46:58 +0000
Subject: [PATCH] CR-1382 Fix for fractional-replication testsuite on Windows

---
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/config.xml       |  103 +++++++++++++++++++++++++++-------
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml |   32 +++++++---
 2 files changed, 103 insertions(+), 32 deletions(-)

diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml
index 23eb875..b93ebcc 100644
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml
@@ -759,7 +759,7 @@
               #@TestMarker          rebuild-index check behavior tests
               #@TestName            rebuild-index: clearDegradedState option in 
                                     offline mode
-              #@TestIssue           OPENDJ-770
+              #@TestIssue           none
               #@TestPurpose         Verify that rebuild-index command succeeds
                                     and that the output is correct.
               #@TestPreamble        none
@@ -931,16 +931,15 @@
                 </script>
 
                 <script>
-                  msg = 'Degraded state for index(es) l, homePhone has been removed'
+                  msg = 'Degraded state of index\(es\) \[l, homePhone\] has been cleared'
                 </script>
                 <call function="'searchString'">
                   {
                   'returnString'   : returnString ,
-                  'expectedString' : msg ,
-                  'knownIssue'     : 'OPENDJ-770'
+                  'expectedString' : msg
                   }
                 </call>
-                
+
                 <call function="'testStep'">
                     { 'stepMessage' : 'Restart the server' }
                 </call>  
@@ -1120,7 +1119,7 @@
               #@TestMarker          rebuild-index check behavior tests
               #@TestName            rebuild-index: clearDegradedState option in 
                                     online mode
-              #@TestIssue           OPENDJ-770
+              #@TestIssue           OPENDJ-802
               #@TestPurpose         Verify that rebuild-index command succeeds
                                     and that the output is correct.
               #@TestPreamble        none
@@ -1240,15 +1239,28 @@
                 </script>
 
                 <script>
-                  msg = 'Degraded state for index pager has been removed'
+                  msg = 'Degraded state of index\(es\) \[pager\] has been cleared'
+                </script>
+                <call function="'searchString'">
+                  {
+                  'returnString'   : returnString ,
+                  'expectedString' : msg
+                  }
+                </call>
+
+                <script>
+                  msg = 'The backend userRoot is now taken offline'
                 </script>
                 <call function="'searchString'">
                   {
                   'returnString'   : returnString ,
                   'expectedString' : msg ,
-                  'knownIssue'     : 'OPENDJ-770'
+                  'expectedRC'     : 1 ,
+                  'knownIssue'     : 'OPENDJ-802'
+                  
                   }
                 </call>
+                
 
                 <call function="'testStep'">
                     { 'stepMessage' : 'Check index status using dbtest command after rebuild' }
@@ -1416,7 +1428,7 @@
 
                 <script>
                   msg1 = 'Option \"--rebuildAll\" cannot be specified with'
-                  msg2 = 'the \"--clearDegradedState\"\noption'
+                  msg2 = 'the \"--clearDegradedState\"%soption' % newLine
                 </script>
                 <call function="'searchString'">
                   {
@@ -1480,7 +1492,7 @@
 
                 <script>
                   msg1 = 'Option \"--rebuildDegraded\" cannot be specified with'
-                  msg2 = 'the \"--clearDegradedState\"\noption'
+                  msg2 = 'the \"--clearDegradedState\"%soption' % newLine
                 </script>
                 <call function="'searchString'">
                   {
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/config.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/config.xml
index c5b8c02..c2a0fae 100644
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/config.xml
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/fractional-replication/config.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE stax SYSTEM "../../../../shared/stax.dtd">
+<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
 <!--
  ! CDDL HEADER START
  !
@@ -24,7 +24,7 @@
  ! CDDL HEADER END
  !
  !      Copyright 2009 Sun Microsystems, Inc.
- !      Portions Copyright 2012 ForgeRock AS
+ !      Portions Copyright 2012-2013 ForgeRock AS
  ! -->
 <stax>
   <defaultcall function="fractional-replication_config"/>
@@ -649,25 +649,61 @@
             'server'            : server,
           }
         </call>
+        
         <script>
           # generating fractional-exclude option for all optional regardless of objectClass
-          excludeAllOptional = '*:'+','.join(schemaMap[ldapServer].allmay)
+          excludeAllOptional = schemaMap[ldapServer].allmay
         </script>
-        <call function="'set-ops-fractional-replication-attributes'">
-          {
-            "server"            : server,
-            "replicationDomain" : domainMap[ldapServer][0],
-            "include"           : [('reset',None)],
-            "exclude"           : [('set',excludeAllOptional)],
-            "expectedRC"        : 0
-          }
-        </call>
+        <message>'%s' % len(excludeAllOptional)</message>
+        
+        <!-- On Windows, we will add attribtues split the list to avoid command line too long -->
+        <if expr="is_windows_platform(server.getHostname())">
+          <sequence>
+            <call function="'set-ops-fractional-replication-attributes'">
+              {
+                "server"            : server,
+                "replicationDomain" : domainMap[ldapServer][0],
+                "include"           : [('reset',None)],
+                "exclude"           : [('set','*:' + excludeAllOptional[0])],
+                "expectedRC"        : 0
+              }
+            </call>
+
+            <script>
+              lenSubList = 10
+            </script>
+            <iterate var="attrs" in="[excludeAllOptional[x:x+lenSubList] for x in xrange(1, len(excludeAllOptional), lenSubList)]">
+                <call function="'set-ops-fractional-replication-attributes'">
+                  {
+                    "server"            : server,
+                    "replicationDomain" : domainMap[ldapServer][0],
+                    "include"           : [('reset',None)],
+                    "exclude"           : [('add','*:' + attr) for attr in attrs],
+                    "expectedRC"        : 0
+                  }
+                </call>
+            </iterate>
+          </sequence>
+          <else>
+            <call function="'set-ops-fractional-replication-attributes'">
+              {
+                "server"            : server,
+                "replicationDomain" : domainMap[ldapServer][0],
+                "include"           : [('reset',None)],
+                "exclude"           : [('set','*:'+','.join(excludeAllOptional))],
+                "expectedRC"        : 0
+              }
+            </call>
+          </else>
+        </if>
+
         <call function="'get-fractional-replication-attributes'">
           {
             "replicationDomain" : domainMap[ldapServer][0],
             "server"            : server,
           }
         </call>
+        
         <script>
           # generating fractional-exclude option for all optional regardless of objectClass
           from java.util import Random
@@ -687,17 +723,40 @@
               objClassesMay.append(schemaMap[ldapServer].objDict[objClass] + ':' + ','.join(mixMayAttrs))
             else:
               objClassesMay.append(objClass + ':' + ','.join(mixMayAttrs))
-          excludeAllObjClassesMay = ','.join(objClassesMay)
         </script>
-        <call function="'set-ops-fractional-replication-attributes'">
-          {
-            "server"            : server,
-            "replicationDomain" : domainMap[ldapServer][0],
-            "include"           : [('reset',None)],
-            "exclude"           : [('add','%s' % oc) for oc in objClassesMay],
-            "expectedRC"        : 0
-          }
-        </call>
+        <message>'%s' % len(objClassesMay)</message>
+        
+        <!-- On Windows, we will add attribtues split the list to avoid command line too long -->
+        <if expr="is_windows_platform(server.getHostname())">
+          <sequence>
+            <script>
+              lenSubList = 10
+            </script>
+            <iterate var="ocs" in="[objClassesMay[x:x+lenSubList] for x in xrange(0, len(objClassesMay), lenSubList)]">
+              <call function="'set-ops-fractional-replication-attributes'">
+                {
+                  "server"            : server,
+                  "replicationDomain" : domainMap[ldapServer][0],
+                  "include"           : [('reset',None)],
+                  "exclude"           : [('add',oc) for oc in ocs],
+                  "expectedRC"        : 0
+                }
+              </call>
+            </iterate>
+          </sequence>
+          <else>
+            <call function="'set-ops-fractional-replication-attributes'">
+              {
+                "server"            : server,
+                "replicationDomain" : domainMap[ldapServer][0],
+                "include"           : [('reset',None)],
+                "exclude"           : [('add','%s' % oc) for oc in objClassesMay],
+                "expectedRC"        : 0
+              }
+            </call>
+          </else>
+        </if>
+
         <call function="'get-fractional-replication-attributes'">
           {
             "replicationDomain" : domainMap[ldapServer][0],

--
Gitblit v1.10.0