Forum Discussion

Esox2's avatar
Esox2
New Contributor
5 years ago
Solved

How to edit DBdatasource configuration

Hi,

I am looking for a solution for clearing sensitive data from the JDBC / DB Datasource steps connection configuration.
I have to replace all the DB connection passwords in all xml files in my composite project.

The following Save Script is working for JDBC steps but not for DB Datasource steps:

project.getProject().getTestSuiteList().each{suite->
        suite.getTestCaseList().each{testCase->
                testCase.getTestStepList().each{step->\
                        //clearing the JDBC steps pass (working)
                        if (step instanceof JdbcRequestTestStep) {
                                step.getJdbcRequestTestStepConfig().setPassword("")
                        }
                        //clearing the DB datasource step pass (not working)
                        if (step instanceof WsdlDataSourceTestStep) {
                                if (step.getDataSource() instanceof DBDataSource) {
                                        //TODO search for a way to clear a datasource pass
                                        step.getDataSourceStepConfig() setPassword("") 
                                }
                        }
                }
        }
}

 

This is a part of the test case xml file which contains the DB datasource step and I need to modify the highlighted part (or at least the <pass> property value) :

<con:config xsi:type="con:DataSourceStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <con:dataSource type="JDBC">
        <con:configuration>
          <driver>oracle.jdbc.driver.OracleDriver</driver>
          <connstr>${#Project#oracle_conn}</connstr>
          <pass>myFakePass</pass>
          <Connection>Oracle JDBC( QA )</Connection>
          <query>select * from myTable</query>
          <fetchSize/>
          <stored-procedure>false</stored-procedure>
        </con:configuration>
      </con:dataSource>
      <con:shared>true</con:shared>
      <con:restartShared>true</con:restartShared>
      <con:property>CSKEY</con:property>
      <con:startRow/>
      <con:endRow/>
      <con:recordsPerIteration>1</con:recordsPerIteration>
      <con:completeLastOperation>true</con:completeLastOperation>
      <con:trimValues>false</con:trimValues>
      <con:entitizeValues>false</con:entitizeValues>
      <con:restartOnRun>true</con:restartOnRun>
      <con:expandProperties>false</con:expandProperties>
    </con:config>

 

Thanks!

  • Esox2 ,

     

    1. In setup script set the value at Project or any desired Properties

    2. Parameterize it in Config and fetch that value from Project level or wherever you have saved your password from setup script.

     

2 Replies

  • Esox2 ,

     

    1. In setup script set the value at Project or any desired Properties

    2. Parameterize it in Config and fetch that value from Project level or wherever you have saved your password from setup script.

     

    • Esox2's avatar
      Esox2
      New Contributor

      Actually your answer is completelly useless but thanks a lot for the answer !