use of org.springframework.remoting.support.RemoteInvocation in project gocd by gocd.
the class AgentRemoteInvokerServiceExporterTest method reportCompleting_rejectedForDifferentUUID.
@Test
void reportCompleting_rejectedForDifferentUUID() throws Exception {
final AgentRuntimeInfo agent = runtimeInfo("other");
final AgentRemoteInvokerServiceExporter invoker = deserializingWith(new RemoteInvocation("reportCompleting", new Class[] { AgentRuntimeInfo.class, JobIdentifier.class, JobResult.class }, new Object[] { agent, null, null }));
invoker.handleRequest(req, res);
verify(target, never()).reportCompleting(any(AgentRuntimeInfo.class), any(JobIdentifier.class), any(JobResult.class));
assertEquals(SC_FORBIDDEN, res.getStatus());
}
use of org.springframework.remoting.support.RemoteInvocation in project gocd by gocd.
the class AgentRemoteInvokerServiceExporterTest method getWork_allowedForSameUUID.
@Test
void getWork_allowedForSameUUID() throws Exception {
final AgentRuntimeInfo agent = runtimeInfo(AGENT_UUID);
final AgentRemoteInvokerServiceExporter invoker = deserializingWith(new RemoteInvocation("getWork", new Class[] { AgentRuntimeInfo.class }, new Object[] { agent }));
invoker.handleRequest(req, res);
verify(target, only()).getWork(agent);
assertEquals(SC_OK, res.getStatus());
}
use of org.springframework.remoting.support.RemoteInvocation in project gocd by gocd.
the class AgentRemoteInvokerServiceExporterTest method reportCurrentStatus_rejectedForDifferentUUID.
@Test
void reportCurrentStatus_rejectedForDifferentUUID() throws Exception {
final AgentRuntimeInfo agent = runtimeInfo("other");
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, never()).reportCurrentStatus(any(AgentRuntimeInfo.class), any(JobIdentifier.class), any(JobState.class));
assertEquals(SC_FORBIDDEN, res.getStatus());
}
use of org.springframework.remoting.support.RemoteInvocation in project gocd by gocd.
the class AgentRemoteInvokerServiceExporterTest method rejectsWhenLegacyDisabled.
@Test
void rejectsWhenLegacyDisabled() throws Exception {
when(env.get(AGENT_EXTRA_PROPERTIES)).thenReturn("");
final AgentRuntimeInfo agent = runtimeInfo(AGENT_UUID);
final AgentRemoteInvokerServiceExporter invoker = deserializingWith(new RemoteInvocation("ping", new Class[] { AgentRuntimeInfo.class }, new Object[] { agent }));
invoker.handleRequest(req, res);
verify(target, never()).ping(agent);
assertEquals(SC_GONE, res.getStatus());
}
use of org.springframework.remoting.support.RemoteInvocation in project gocd by gocd.
the class AgentRemoteInvokerServiceExporterTest method ping_rejectedForDifferentUUID.
@Test
void ping_rejectedForDifferentUUID() throws Exception {
final AgentRuntimeInfo agent = runtimeInfo("other");
final AgentRemoteInvokerServiceExporter invoker = deserializingWith(new RemoteInvocation("ping", new Class[] { AgentRuntimeInfo.class }, new Object[] { agent }));
invoker.handleRequest(req, res);
verify(target, never()).ping(any(AgentRuntimeInfo.class));
assertEquals(SC_FORBIDDEN, res.getStatus());
}
Aggregations