I am using the below code to generate accessToken.
import com.eviware.soapui.impl.rest.actions.oauth.OltuOAuth2ClientFacade;
import com.eviware.soapui.support.editor.inspectors.auth.TokenType;
import com.eviware.soapui.model.support.ModelSupport;
// Set up variables
def project = ModelSupport.getModelItemProject(context.getModelItem());
def authProfile = project.getAuthRepository().getEntry("user");
def oldToken = authProfile.getAccessToken();
def tokenType = TokenType.ACCESS;
//log.info("OLD TOKEN: " + oldToken);
// Create a facade object
def oAuthFacade = new OltuOAuth2ClientFacade(tokenType);
// Request an access token in headless mode
oAuthFacade.requestAccessToken(authProfile, true, true);
// Wait until the access token gets updated
//while(oldToken == authProfile.getAccessToken()) {
//}
//The sleep method can be used instead of a while loop
//sleep(3000);
for(int i = 0; i<=6000; i++){
if(oldToken != authProfile.getAccessToken()){
break
}
sleep(1)
}
// Post the info to the log
def token = authProfile.getAccessToken();
log.info("NEW TOKEN: " + authProfile.getAccessToken());
testRunner.testCase.testSuite.project.setPropertyValue( "accessToken", token )
This code works without issues in laptop. But when configured in CI/CD pipeline, the code fails with the error message:-
An error occurred [/tmp/JxBrowser/7.12/libbrowsercore_toolkit.so: libX11.so.6: cannot open shared object file: No such file or directory], see error log for details An error occurred in the script of the Groovy Script test step [Groovy Script 3]: [errorlog] java.lang.UnsatisfiedLinkError: /tmp/JxBrowser/7.12/libbrowsercore_toolkit.so: libX11.so.6: cannot open shared object file: No such file or directory java.lang.UnsatisfiedLinkError: /tmp/JxBrowser/7.12/libbrowsercore_toolkit.so: libX11.so.6: cannot open shared object file: No such file or directory