@Test public void subCall() { Tracer tracer = mock(Tracer.class); InProcessExecutable victim = new InProcessExecutable(tracer); ExecutionContext ctx = mock(ExecutionContext.class); OperationKey expectedOp = new OperationKey(new ServiceVersion(1,0),"Wibble","wobble"); OperationKey op = new OperationKey(expectedOp, "_IN_PROCESS"); Object[] args = new Object[1]; ExecutionObserver obs = mock(ExecutionObserver.class); ExecutionVenue venue = mock(ExecutionVenue.class); TimeConstraints constraints = mock(TimeConstraints.class); RequestUUID parentUuid = new RequestUUIDImpl(); when(ctx.getRequestUUID()).thenReturn(parentUuid); when(ctx.isTransportSecure()).thenReturn(false); IdentityChain mockIdentityChain = new IdentityChainImpl(); when(ctx.getIdentity()).thenReturn(mockIdentityChain); GeoLocationDetails mockLocation = mock(GeoLocationDetails.class); when(ctx.getLocation()).thenReturn(mockLocation); when(ctx.getReceivedTime()).thenReturn(new Date(0L)); when(ctx.getRequestTime()).thenReturn(new Date(0L)); when(ctx.getTransportSecurityStrengthFactor()).thenReturn(0); victim.execute(ctx, op, args, obs, venue, constraints); ArgumentCaptor<ExecutionContext> arg1 = ArgumentCaptor.forClass(ExecutionContext.class); ArgumentCaptor<OperationKey> arg2 = ArgumentCaptor.forClass(OperationKey.class); ArgumentCaptor<Object[]> arg3 = ArgumentCaptor.forClass(Object[].class); ArgumentCaptor<ExecutionObserver> arg4 = ArgumentCaptor.forClass(ExecutionObserver.class); ArgumentCaptor<TimeConstraints> arg5 = ArgumentCaptor.forClass(TimeConstraints.class); verify(venue, times(1)).execute(arg1.capture(), arg2.capture(), arg3.capture(), arg4.capture(), arg5.capture()); assertThat(arg1.getValue(), isSubContextOf(ctx)); assertThat(arg2.getValue(), new Equals(expectedOp)); assertThat(arg3.getValue(), new Same(args)); assertThat(arg4.getValue(), isTracingEndObserver(obs, parentUuid, expectedOp, tracer)); assertThat(arg5.getValue(), new Same(constraints)); }
@Override public void execute(ExecutionContext ctx, OperationKey key, Object[] args, ExecutionObserver observer, ExecutionVenue executionVenue, TimeConstraints timeConstraints) { OperationKey noNamespaceKey = new OperationKey(key, null); RequestUUID subUuid = ctx.getRequestUUID().getNewSubUUID(); tracer.startCall(ctx.getRequestUUID(), subUuid, noNamespaceKey); executionVenue.execute(subContext(ctx,subUuid),noNamespaceKey,args,new TracingEndObserver(tracer,observer,ctx.getRequestUUID(),subUuid,noNamespaceKey),timeConstraints); }
InProcessExecutable implements Executable { @Override public void execute(ExecutionContext ctx, OperationKey key, Object[] args, ExecutionObserver observer, ExecutionVenue executionVenue, TimeConstraints timeConstraints) { OperationKey noNamespaceKey = new OperationKey(key, null); RequestUUID subUuid = ctx.getRequestUUID().getNewSubUUID(); tracer.startCall(ctx.getRequestUUID(), subUuid, noNamespaceKey); executionVenue.execute(subContext(ctx,subUuid),noNamespaceKey,args,new TracingEndObserver(tracer,observer,ctx.getRequestUUID(),subUuid,noNamespaceKey),timeConstraints); } }
InProcessExecutable implements Executable { @Override public void execute(ExecutionContext ctx, OperationKey key, Object[] args, ExecutionObserver observer, ExecutionVenue executionVenue, TimeConstraints timeConstraints) { OperationKey noNamespaceKey = new OperationKey(key, null); RequestUUID subUuid = ctx.getRequestUUID().getNewSubUUID(); tracer.startCall(ctx.getRequestUUID(), subUuid, noNamespaceKey); executionVenue.execute(subContext(ctx,subUuid),noNamespaceKey,args,new TracingEndObserver(tracer,observer,ctx.getRequestUUID(),subUuid,noNamespaceKey),timeConstraints); } InProcessExecutable(Tracer tracer); }
InProcessExecutable implements Executable { @Override public void execute(ExecutionContext ctx, OperationKey key, Object[] args, ExecutionObserver observer, ExecutionVenue executionVenue, TimeConstraints timeConstraints) { OperationKey noNamespaceKey = new OperationKey(key, null); RequestUUID subUuid = ctx.getRequestUUID().getNewSubUUID(); tracer.startCall(ctx.getRequestUUID(), subUuid, noNamespaceKey); executionVenue.execute(subContext(ctx,subUuid),noNamespaceKey,args,new TracingEndObserver(tracer,observer,ctx.getRequestUUID(),subUuid,noNamespaceKey),timeConstraints); } InProcessExecutable(Tracer tracer); @Override void execute(ExecutionContext ctx, OperationKey key, Object[] args, ExecutionObserver observer, ExecutionVenue executionVenue, TimeConstraints timeConstraints); }
InProcessExecutable implements Executable { @Override public void execute(ExecutionContext ctx, OperationKey key, Object[] args, ExecutionObserver observer, ExecutionVenue executionVenue, TimeConstraints timeConstraints) { OperationKey noNamespaceKey = new OperationKey(key, null); RequestUUID subUuid = ctx.getRequestUUID().getNewSubUUID(); tracer.startCall(ctx.getRequestUUID(), subUuid, noNamespaceKey); executionVenue.execute(subContext(ctx,subUuid),noNamespaceKey,args,new TracingEndObserver(tracer,observer,ctx.getRequestUUID(),subUuid,noNamespaceKey),timeConstraints); } InProcessExecutable(Tracer tracer); @Override void execute(ExecutionContext ctx, OperationKey key, Object[] args, ExecutionObserver observer, ExecutionVenue executionVenue, TimeConstraints timeConstraints);  }