use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class CloudAppBridge method postTestSuiteResult.
@Override
public void postTestSuiteResult(TestSuiteResult testSuiteResult) throws AutomatorException {
try {
String authHeader = HttpClient.BEARER + " " + agentConfig.getJwtApiKey();
webAppHttpClient.put(ServerURLBuilder.testSuiteResultURL(testSuiteResult.getId()), testSuiteResult, null, authHeader);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AutomatorException(e.getMessage(), e);
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class CloudAppBridge method getSuggestions.
@Override
public List<SuggestionEntity> getSuggestions(Integer naturalTextActionId) throws AutomatorException {
try {
String authHeader = HttpClient.BEARER + " " + agentConfig.getJwtApiKey();
String url = ServerURLBuilder.suggestionsURL(naturalTextActionId);
HttpResponse<List<SuggestionEntity>> response = webAppHttpClient.get(url, new TypeReference<>() {
}, authHeader);
if (response.getStatusCode() != HttpStatus.OK.value()) {
throw new AutomatorException(response.getStatusMessage());
}
return response.getResponseEntity();
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AutomatorException(e.getMessage(), e);
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class CloudAppBridge method updateTestSuiteResultData.
@Override
public void updateTestSuiteResultData(TestSuiteResultRequest testSuiteResultRequest) throws AutomatorException {
try {
String url = ServerURLBuilder.testSuiteResultUpdateURL(testSuiteResultRequest.getId());
String authHeader = HttpClient.BEARER + " " + agentConfig.getJwtApiKey();
HttpResponse<String> response = webAppHttpClient.put(url, testSuiteResultRequest, new TypeReference<>() {
}, authHeader);
log.error(response.getStatusCode() + " - " + response.getResponseText());
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AutomatorException(e.getMessage(), e);
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class WdaService method startWdaOnDevice.
public void startWdaOnDevice(MobileDevice device) throws TestsigmaException, AutomatorException {
try {
log.info("Starting WDA on device - " + device.getName());
log.info("Checking for any previously started WDA processes on device - " + device.getName());
IosDeviceCommandExecutor iosDeviceCommandExecutor = new IosDeviceCommandExecutor();
stopWdaOnDevice(device);
device.setWdaExecutorService(Executors.newSingleThreadExecutor());
device.setWdaRelayExecutorService(Executors.newSingleThreadExecutor());
device.getWdaExecutorService().execute(() -> {
try {
Process p = iosDeviceCommandExecutor.runDeviceCommand(new String[] { "-u", device.getUniqueId(), "xctest", "-B", WDA_BUNDLE_ID });
device.setWdaProcess(p);
} catch (Exception e) {
log.info(e.getMessage(), e);
}
});
log.info("Putting the thread to sleep for 10 seconds so as wait for WDA process to start on device - " + device.getName());
Thread.sleep(10000);
checkWDAProcessStatus(device);
device.getWdaRelayExecutorService().execute(() -> {
try {
Process p = iosDeviceCommandExecutor.runDeviceCommand(new String[] { "-u", device.getUniqueId(), "relay", WDA_PORT.toString(), WDA_PORT.toString() });
device.setWdaRelayProcess(p);
} catch (Exception e) {
log.info(e.getMessage(), e);
}
});
log.info("Putting the thread to sleep for 2 seconds so as wait for WDA relay process to start on device - " + device.getName());
Thread.sleep(2000);
checkWDARelayProcessStatus(device);
} catch (Exception e) {
throw new TestsigmaException(e.getMessage(), e);
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class AddonAction method initRunTimeDataVariable.
private void initRunTimeDataVariable() throws AutomatorException {
try {
for (Field field : clazz.getDeclaredFields()) {
RunTimeData runTimeData = field.getAnnotation(RunTimeData.class);
if (runTimeData != null) {
log.info("Initializing Run Time Data for Addon Plugin Action Step - " + runTimeData);
Object runTimeDataInstance = addonService.getRunTimeDataInstance();
FieldUtils.writeField(instance, field.getName(), runTimeDataInstance, true);
log.info("Setting run time data to the main instance - " + field.getName());
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AutomatorException(e.getMessage(), e);
}
}
Aggregations