Change global prereferences from command line

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in SOAtest
Scripted change of Global HTTP Authentication Properties
Howdy folks,

Please can anyone think of a way to change global preferences (specifically the Global HTTP Authentication Properties) via a script (i.e. non-interactively)?

The sitution is: We have several related applications, each with its own SOATest suite (i.e. $app-soatests.tst). Each application secures its WSDL with Basic Authentication... which we deal-with in SOATest (when we're running the tests interactively) by setting the Global HTTP Auth properties to the admin_user/password of the application we are testing. The applications cannot (without a lot of bureaucratic red-tape) use the same admin_user/password.

My task is to setup an ABT-suite for all these applications, so I guess I need to change the global-prefs on-the-fly... so please, can anyone think of a way to do this, from the command line, or otherwise via a script.

Merry Christmas all. Keith.
Tagged:

Comments

  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    Is there a reason why you need to specifically use the Global HTTP Authentication instead of the local HTTP Authentication? Using the local HTTP Authentication allows you to specify each test to use a different user/pass. You can even make it iterate over a data source that contains the different user/pass.
  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    truong,

    Is there a reason why you need to specifically use the Global HTTP Authentication instead of the local HTTP Authentication?

    Yes, there is a reason. Evidently, I have failed to clearly define my problem.

    The WSDL itself (not just the service/s described therein) are secured by basic-authentication (they are not and cannot be public). SOATest needs to retrieve the WSDL, and rhe only way to specify the username/password for this wsdl-request is to set the global-auth properties, which are an attribute of ?the current user? of the current-machine (they are evidently NOT stored in the soatest-file)... there is no facility to specify the wsdl-request-auth-properties on a per-test-suit (let alone per-wsdl, or per-test) basis.

    So... Please, is there a way to set the Global HTTP Authentication properties on the fly?

    <aside>We have another possible workaround, but it's fugly. We'd save a copy of the WSDL's locally, and point soatest at them. In the ABT environment: To regression test the WSDLs, we'd retrieve the latest WSDL's from the server and diff each one with "the local cache" in a java program. I would prefer NOT to have to maintain test-harness code and configuration outside of SOATest... I may as well have stuck with our existing junit test-cases.</aside>

    Thanking you sir.

    Cheers. Keith.
  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    edited December 2016
    Keith,

    Changing the username/password for the Global Authentication is possible but one thing you need to be aware of is that some of the Java classes exposed in the script is not part of our public API. That said, these Java classes are subject to change which may break the script in the long run. In fact, I need to provide you two different scripts one for 5.5.x and one for 6.0 as the class and interfaces does change between the two versions. In other words, you must update your .tst files with the second script when you upgrade from 5.5.x to 6.0.

    For 5.5.x use the following script:
    CODE
    from webtool.app import *

    def changeAuthValues(input, context):
      webPrefs = WebtoolApp.getWebtoolAppPreferences()
      if (webPrefs != None):
        secPrefs = webPrefs.getSecurityPreferences()
        if (secPrefs != None):
          auth = secPrefs.getAuthentication()
          if (auth != None):
            auth.getUsername().setValue("yourUserNameValue")
            auth.getPassword().setValue("yourPasswordValue")

    For 6.0 use the following script:
    CODEfrom webtool.app import *
    from com.parasoft.preferences import *

    def changeAuthValues(input, context):
      secPrefs = AppPreferenceProvider.getSecurityPreferenceProvider()
      if (secPrefs != None):
        authPrefs = secPrefs.getAuthenticationPreferenceProvider()
        if (authPrefs != None):
            authPrefs.setUsername("yourUserNameValue")
            authPrefs.setPassword("yourPasswordValue")




  • LegacyForumLegacyForum Posts: 1,669 ✭✭

    Changing the username/password for the Global Authentication is possible, but [beware that it uses SOATest's private classes, which are subject to change without notice, and in fact have changed from 5.x to 6.0].

    Truong,

    You sir, are a life saver!

    I've just gotten back into setting up this ABT environment and associated soatest-suites... That little script is going to save me a boring couple of days changing the auth-settings on every single request.... Yahoo!

    Sorry for the delayed response. I will allways get back to my posts... just have to wait for testing to come back to the top of the pile ;-)

    I thank you for your assistance... SOATest is THE best supported application I've ever used. And you can quote me on that.

    Cheers mate. Keith.

Sign In or Register to comment.