Forum Discussion

Stalsy's avatar
Stalsy
Contributor
3 years ago

ReadyAPi 3.10 unable to resolve class com.eviware.soapui.impl.rest.actions.oauth.OltuOAuth2AzureCl

I've just upgraded from 3.6 to 3.10.

I'm running data driven tests involving 1000's of calls, so I have groovy scripts to check and refresh the Auth2 Azure access token if the test goes more than 40 minutes. To do so I must import:

import com.eviware.soapui.impl.rest.actions.oauth.OltuOAuth2AzureClientFacade

However, since the upgrade I get an error:  unable to resolve class com.eviware.soapui.impl.rest.actions.oauth.OltuOAuth2AzureClientFacade

I have this code in every test so I'm currently completely blocked... Help!

 

The code to check and if necessary get a new access token:

//for every test I use the TestRunListener.beforeRun to create/intialize to 3000 seconds and property called Duration to act as a static variable.

//Then my groovy script reads the value of the Duration property and if the test has been running for more than the Duration, it gets a new token and adds // 3000 seconds to Duration:

def dur = testRunner.testCase.getPropertyValue("Duration").toInteger()

if ( testRunner.getTimeTaken() > dur)
{
def project = context.getTestCase().getTestSuite().getProject();

def oAuthProfile = project.getAuthRepository().getEntry("WindowsToken");
oAuthProfile.setClientSecret(testRunner.testCase.testSuite.project.getPropertyValue( "client_secret" ));
oAuthProfile.setClientID("7a2c87dd-14c0-4001-b3b6-bde85a5e13e1");
def oldToken = oAuthProfile.getAccessToken();
log.info 'old: ' + oldToken

// the following code for getting new access token
def oAuthClientFacade = new OltuOAuth2AzureClientFacade (TokenType.ACCESS);
oAuthClientFacade.requestAccessToken(oAuthProfile, true,true);
while(oldToken == oAuthProfile.getAccessToken()) {
sleep(100);
}
testRunner.testCase.setPropertyValue( "Duration", (dur+3000000).toString() )
dur = testRunner.testCase.getPropertyValue("Duration").toInteger()
}