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

ugaston
27.36.2007 d993dc267d083728198af709abc8ca321c5d6432
opends/tests/functional-tests/shared/functions/dsconfig.xml
@@ -177,7 +177,7 @@
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
          ['PATH=/bin:/usr/bin:%s' % dsBinPath]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
@@ -295,14 +295,13 @@
        'attributeValue'         : '%s' % (attributeValue) ,
        'expectedRC'             : expectedRC }
    </call>
    <if expr="expectedRC != 'noCheck'">
        <call function="'checktestRC'">
          { 'returncode' : STAXCode ,
            'result'     : STAXReason ,
            'expected'   : expectedRC }
        </call>
    </if>
    <call function="'checktestRC'">
      { 'returncode' : STAXCode ,
        'result'     : STAXReason ,
        'expected'   : expectedRC }
    </call>
    <return>
        STAXReason
    </return>
@@ -417,7 +416,7 @@
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
          ['PATH=/bin:/usr/bin:%s' % dsBinPath]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
@@ -428,13 +427,11 @@
        STAXCode=RC
        STAXReason=STAXResult
      </script>
      <if expr="expectedRC != 'noCheck'">
        <call function="'checktestRC'">
          { 'returncode' : STAXCode ,
            'result'     : STAXReason ,
            'expected'   : expectedRC }
        </call>
      </if>
      <call function="'checktestRC'">
        { 'returncode' : STAXCode ,
          'result'     : STAXReason ,
          'expected'   : expectedRC }
      </call>
      <return>
        STAXReason
      </return>
@@ -537,13 +534,11 @@
        'expectedRC'             : expectedRC }
    </call>
            
    <if expr="expectedRC != 'noCheck'">
        <call function="'checktestRC'">
          { 'returncode' : STAXCode ,
            'result'     : STAXReason ,
            'expected'   : expectedRC }
        </call>
    </if>
    <call function="'checktestRC'">
      { 'returncode' : STAXCode ,
        'result'     : STAXReason ,
        'expected'   : expectedRC }
    </call>
    <return>
        STAXReason
    </return>
@@ -646,13 +641,11 @@
        'expectedRC'             : expectedRC }
    </call>
            
    <if expr="expectedRC != 'noCheck'">
        <call function="'checktestRC'">
          { 'returncode' : STAXCode ,
            'result'     : STAXReason ,
            'expected'   : expectedRC }
        </call>
    </if>
    <call function="'checktestRC'">
      { 'returncode' : STAXCode ,
        'result'     : STAXReason ,
        'expected'   : expectedRC }
    </call>
    <return>
        STAXReason
    </return>
@@ -662,4 +655,446 @@
  </function>
  <!-- Create synchronization provider using dsconfig -->
  <function name="createSyncProvider">
    <function-prolog>
      This function creates a synchronization provider using dsconfig
    </function-prolog>
    <function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
        <function-arg-description>
          Location of target host
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
        <function-arg-description>
          Pathname to installation root
        </function-arg-description>
        <function-arg-property name="type" value="filepath"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
        <function-arg-description>
          Directory server hostname or IP address
        </function-arg-description>
      <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePort" type="required">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="Port number"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceDn" type="required">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="required">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="providerName" type="optional" default="MultimasterSync">
        <function-arg-description>
          Name for the synchronization provider
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="providerType" type="optional" default="MultimasterType">
        <function-arg-description>
          Synchronization provider type
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="expectedRC" type="optional" default="0">
        <function-arg-description>
         Expected return code value. Default value is 0
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
        STAFCmdParams=''
        STAFCmd=''
        if dsPath:
          dsBinPath='%s/%s' % (dsPath,fileFolder)
          STAFCmd='%s/%s%s' % (dsBinPath,DSCONFIG,fileExt)
        STAFCmdParamsList=[]
        STAFCmdParamsList.append('create-synchronization-provider')
        STAFCmdParamsList.append('--provider-name "%s"' % providerName)
        STAFCmdParamsList.append('-t %s' % providerType)
        STAFCmdParamsList.append('--set "enabled:true"')
      </script>
      <call function="'_dsconfigCommonArgs'"/>
      <script>
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <message>
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Modify dsconfig object'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
      </script>
      <call function="'checktestRC'">
        { 'returncode' : STAXCode ,
          'result'     : STAXReason ,
          'expected'   : expectedRC }
      </call>
      <return>
        STAXReason
      </return>
    </sequence>
  </function>
  <!-- Create a replication server using dsconfig -->
  <function name="createReplicationServer">
    <function-prolog>
      This function creates a replication server under a given synchronization provider using dsconfig
    </function-prolog>
    <function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
        <function-arg-description>
          Location of target host
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
        <function-arg-description>
          Pathname to installation root
        </function-arg-description>
        <function-arg-property name="type" value="filepath"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
        <function-arg-description>
          Directory server hostname or IP address
        </function-arg-description>
      <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePort" type="required">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="Port number"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceDn" type="required">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="required">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="providerName" type="optional" default="MultimasterSync">
        <function-arg-description>
          Name for the synchronization provider
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="replicationPort" type="required">
        <function-arg-description>
          Replication port number
        </function-arg-description>
        <function-arg-property name="type" value="Port number"/>
      </function-arg-def>
      <function-arg-def name="replicationServerId" type="required">
        <function-arg-description>
          Replication server ID
        </function-arg-description>
        <function-arg-property name="type" value="ID number"/>
      </function-arg-def>
      <function-arg-def name="replicationServerList" type="required">
        <function-arg-description>
          List of replication servers (as in host:replicationServerPort)
        </function-arg-description>
        <function-arg-property name="type" value="list"/>
      </function-arg-def>
      <function-arg-def name="expectedRC" type="optional" default="0">
        <function-arg-description>
         Expected return code value. Default value is 0
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
        STAFCmdParams=''
        STAFCmd=''
        if dsPath:
          dsBinPath='%s/%s' % (dsPath,fileFolder)
          STAFCmd='%s/%s%s' % (dsBinPath,DSCONFIG,fileExt)
        STAFCmdParamsList=[]
        STAFCmdParamsList.append('create-replication-server')
        STAFCmdParamsList.append('--provider-name "%s"' % providerName)
        STAFCmdParamsList.append('--set "replication-port:%s"' % replicationPort)
        STAFCmdParamsList.append('--set "replication-server-id:%s"' % replicationServerId)
        for replServer in replicationServerList :
          STAFCmdParamsList.append('--set "replication-server:%s"' % replServer)
      </script>
      <call function="'_dsconfigCommonArgs'"/>
      <script>
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <message>
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Modify dsconfig object'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
      </script>
      <call function="'checktestRC'">
        { 'returncode' : STAXCode ,
          'result'     : STAXReason ,
          'expected'   : expectedRC }
      </call>
      <return>
        STAXReason
      </return>
    </sequence>
  </function>
  <!-- Create a multimaster domain using dsconfig -->
  <function name="createMultimasterDomain">
    <function-prolog>
      This function creates a multimaster domain under a given synchronization provider using dsconfig
    </function-prolog>
    <function-map-args>
      <function-arg-def name="location" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
        <function-arg-description>
          Location of target host
        </function-arg-description>
        <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
        <function-arg-description>
          Pathname to installation root
        </function-arg-description>
        <function-arg-property name="type" value="filepath"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceHost" type="optional" default="'%s' % STAF_REMOTE_HOSTNAME">
        <function-arg-description>
          Directory server hostname or IP address
        </function-arg-description>
      <function-arg-property name="type" value="hostname"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePort" type="required">
        <function-arg-description>
          Directory server port number
        </function-arg-description>
        <function-arg-property name="type" value="Port number"/>
      </function-arg-def>
      <function-arg-def name="dsInstanceDn" type="required">
        <function-arg-description>
          Bind DN
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="dsInstancePswd" type="required">
        <function-arg-description>
          Bind password
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="providerName" type="optional" default="MultimasterSync">
        <function-arg-description>
          Name for the synchronization provider
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="domainName" type="required">
        <function-arg-description>
          Name for multimaster domain
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
      <function-arg-def name="replicationDn" type="required">
        <function-arg-description>
          DN of the replicated suffix
        </function-arg-description>
        <function-arg-property name="type" value="DN"/>
      </function-arg-def>
      <function-arg-def name="serverId" type="required">
        <function-arg-description>
          Server ID
        </function-arg-description>
        <function-arg-property name="type" value="ID number"/>
      </function-arg-def>
      <function-arg-def name="replicationServerList" type="required">
        <function-arg-description>
          List of replication servers (as in host:replicationServerPort)
        </function-arg-description>
        <function-arg-property name="type" value="list"/>
      </function-arg-def>
      <function-arg-def name="expectedRC" type="optional" default="0">
        <function-arg-description>
         Expected return code value. Default value is 0
        </function-arg-description>
        <function-arg-property name="type" value="string"/>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- Local variables -->
      <script>
        mylocation=location
        STAFCmdParams=''
        STAFCmd=''
        if dsPath:
          dsBinPath='%s/%s' % (dsPath,fileFolder)
          STAFCmd='%s/%s%s' % (dsBinPath,DSCONFIG,fileExt)
        STAFCmdParamsList=[]
        STAFCmdParamsList.append('create-multimaster-domain')
        STAFCmdParamsList.append('--provider-name "%s"' % providerName)
        STAFCmdParamsList.append('--domain-name "%s"' % domainName)
        STAFCmdParamsList.append('--set "replication-dn:%s"' % replicationDn)
        STAFCmdParamsList.append('--set "server-id:%s"' % serverId)
        for replServer in replicationServerList :
          STAFCmdParamsList.append('--set "replication-server:%s"' % replServer)
      </script>
      <call function="'_dsconfigCommonArgs'"/>
      <script>
        STAFCmdParams=' '.join(STAFCmdParamsList)
      </script>
      <message>
        '%s %s' % (STAFCmd, STAFCmdParams)
      </message>
      <process name="'Modify dsconfig object'">
        <location>'%s' % location</location>
        <command>'%s' % STAFCmd</command>
        <parms>'%s' % STAFCmdParams</parms>
        <workdir>'%s' % dsBinPath</workdir>
        <envs>
          ['PATH=/bin:/usr/bin:%s' % dsBinPath]
        </envs>
        <console use="'same'"/>
        <stderr mode="'stdout'"/>
        <returnstdout/>
      </process>
      <script>
        STAXCode=RC
        STAXReason=STAXResult
      </script>
      <call function="'checktestRC'">
        { 'returncode' : STAXCode ,
          'result'     : STAXReason ,
          'expected'   : expectedRC }
      </call>
      <return>
        STAXReason
      </return>
    </sequence>
  </function>
</stax>