use of org.springframework.remoting.support.RemoteInvocation in project gocd by gocd.
the class AgentRemoteInvokerServiceExporterTest method reportCurrentStatus_allowedForSameUUID.
@Test
void reportCurrentStatus_allowedForSameUUID() throws Exception {
final AgentRuntimeInfo agent = runtimeInfo(AGENT_UUID);
final AgentRemoteInvokerServiceExporter invoker = deserializingWith(new RemoteInvocation("reportCurrentStatus", new Class[] { AgentRuntimeInfo.class, JobIdentifier.class, JobState.class }, new Object[] { agent, null, null }));
invoker.handleRequest(req, res);
verify(target, only()).reportCurrentStatus(agent, null, null);
assertEquals(SC_OK, res.getStatus());
}
use of org.springframework.remoting.support.RemoteInvocation in project gocd by gocd.
the class AgentRemoteInvokerServiceExporterTest method getCookie_allowedForSameUUID.
@Test
void getCookie_allowedForSameUUID() throws Exception {
final AgentRuntimeInfo agent = runtimeInfo(AGENT_UUID);
final AgentRemoteInvokerServiceExporter invoker = deserializingWith(new RemoteInvocation("getCookie", new Class[] { AgentRuntimeInfo.class }, new Object[] { agent }));
invoker.handleRequest(req, res);
verify(target, only()).getCookie(agent);
assertEquals(SC_OK, res.getStatus());
}
use of org.springframework.remoting.support.RemoteInvocation in project gocd by gocd.
the class AgentRemoteInvokerServiceExporterTest method isIgnored_allowedForSameUUID.
@Test
void isIgnored_allowedForSameUUID() throws Exception {
final AgentRuntimeInfo agent = runtimeInfo(AGENT_UUID);
final AgentRemoteInvokerServiceExporter invoker = deserializingWith(new RemoteInvocation("isIgnored", new Class[] { AgentRuntimeInfo.class, JobIdentifier.class }, new Object[] { agent, null }));
invoker.handleRequest(req, res);
verify(target, only()).isIgnored(agent, null);
assertEquals(SC_OK, res.getStatus());
}
use of org.springframework.remoting.support.RemoteInvocation in project gocd by gocd.
the class AgentRemoteInvokerServiceExporterTest method getCookie_rejectedForDifferentUUID.
@Test
void getCookie_rejectedForDifferentUUID() throws Exception {
final AgentRuntimeInfo agent = runtimeInfo("other");
final AgentRemoteInvokerServiceExporter invoker = deserializingWith(new RemoteInvocation("getCookie", new Class[] { AgentRuntimeInfo.class }, new Object[] { agent }));
invoker.handleRequest(req, res);
verify(target, never()).getCookie(any(AgentRuntimeInfo.class));
assertEquals(SC_FORBIDDEN, res.getStatus());
}
use of org.springframework.remoting.support.RemoteInvocation in project spring-framework by spring-projects.
the class HttpInvokerClientInterceptor method invoke.
@Override
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
if (AopUtils.isToStringMethod(methodInvocation.getMethod())) {
return "HTTP invoker proxy for service URL [" + getServiceUrl() + "]";
}
RemoteInvocation invocation = createRemoteInvocation(methodInvocation);
RemoteInvocationResult result;
try {
result = executeRequest(invocation, methodInvocation);
} catch (Throwable ex) {
RemoteAccessException rae = convertHttpInvokerAccessException(ex);
throw (rae != null ? rae : ex);
}
try {
return recreateRemoteInvocationResult(result);
} catch (Throwable ex) {
if (result.hasInvocationTargetException()) {
throw ex;
} else {
throw new RemoteInvocationFailureException("Invocation of method [" + methodInvocation.getMethod() + "] failed in HTTP invoker remote service at [" + getServiceUrl() + "]", ex);
}
}
}
Aggregations