in src/main/java/org/apache/sling/junit/remote/ide/SlingRemoteExecutionRule.java [81:108]
private void invokeRemote(String remoteUrl, String remoteUsername, String remotePassword, FrameworkMethod method) throws Throwable {
final String testClassesSelector = method.getMethod().getDeclaringClass().getName();
final String methodName = method.getMethod().getName();
final RemoteTestHttpClient testHttpClient = new RemoteTestHttpClient(remoteUrl, remoteUsername, remotePassword, false);
testHttpClient.setRequestCustomizer(this);
final RequestExecutor executor = testHttpClient.runTests(
testClassesSelector, methodName, "serialized"
);
log.debug("Ran test {} method {} at URL {}",
new Object[] { testClassesSelector, methodName, remoteUrl });
final HttpEntity entity = executor.getResponse().getEntity();
if (entity != null) {
try {
final Object o = new ObjectInputStream(entity.getContent()).readObject();
if( !(o instanceof ExecutionResult) ) {
throw new IllegalStateException("Expected an ExecutionResult, got a " + o.getClass().getName());
}
final ExecutionResult result = (ExecutionResult)o;
if (result.isFailure()) {
throw result.getException();
}
} finally {
entity.consumeContent();
}
}
}