cancel
Showing results for 
Search instead for 
Did you mean: 

How to edit DBdatasource configuration

SOLVED
New Contributor

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="conSmiley Very HappyataSourceStep" 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>
      <conSmiley Tongueroperty>CSKEY</conSmiley Tongueroperty>
      <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!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Leader

Re: How to edit DBdatasource configuration

@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.

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
2 REPLIES 2
Community Leader

Re: How to edit DBdatasource configuration

@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.

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
New Contributor

Re: How to edit DBdatasource configuration

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

New Here?
Join us and watch the welcome video:
Watch the New Interview
APITestingMistake#2
Top Kudoed Authors