@Test public void createCommandResolver_WithTimeout() { command.setPathInfo("/FirstTestOp"); when(request.getParameter("FirstOpFirstParam")).thenReturn("hello"); when(request.getScheme()).thenReturn("http"); when(request.getHeader("X-RequestTimeout")).thenReturn("10000"); when(context.getRequestTime()).thenReturn(new Date()); CommandResolver<HttpCommand> cr = rescriptCommandProcessor.createCommandResolver(command, tracer); Iterable<ExecutionCommand> executionCommands = cr.resolveExecutionCommands(); ExecutionCommand executionCommand = executionCommands.iterator().next(); TimeConstraints constraints = executionCommand.getTimeConstraints(); assertNotNull(constraints.getExpiryTime()); }
@Override protected CommandResolver<HttpCommand> createCommandResolver(final HttpCommand command, final Tracer tracer) { String uri = stripMinorVersionFromUri(command.getOperationPath()); final RescriptOperationBinding binding = bindings.get(uri); return new SingleExecutionCommandResolver<HttpCommand>(tracer) { private DehydratedExecutionContext context; private ExecutionCommand executionCommand; @Override public DehydratedExecutionContext resolveExecutionContext() { if (context == null) { context = RescriptTransportCommandProcessor.this.resolveExecutionContext(command, null); } return context; } @Override public ExecutionCommand resolveExecutionCommand(Tracer tracer) { if (binding!=null) { if (executionCommand == null) { executionCommand = RescriptTransportCommandProcessor.this.resolveExecutionCommand( binding, command, resolveExecutionContext(), tracer); } return executionCommand; } throw new CougarValidationException(ServerFaultCode.NoSuchOperation, "The request could not be resolved to an operation"); } }; }
RescriptTransportCommandProcessor extends AbstractTerminateableHttpCommandProcessor<Void> { @Override protected CommandResolver<HttpCommand> createCommandResolver(final HttpCommand command, final Tracer tracer) { String uri = stripMinorVersionFromUri(command.getOperationPath()); final RescriptOperationBinding binding = bindings.get(uri); return new SingleExecutionCommandResolver<HttpCommand>(tracer) { private DehydratedExecutionContext context; private ExecutionCommand executionCommand; @Override public DehydratedExecutionContext resolveExecutionContext() { if (context == null) { context = RescriptTransportCommandProcessor.this.resolveExecutionContext(command, null); } return context; } @Override public ExecutionCommand resolveExecutionCommand(Tracer tracer) { if (binding!=null) { if (executionCommand == null) { executionCommand = RescriptTransportCommandProcessor.this.resolveExecutionCommand( binding, command, resolveExecutionContext(), tracer); } return executionCommand; } throw new CougarValidationException(ServerFaultCode.NoSuchOperation, "The request could not be resolved to an operation"); } }; } }
RescriptTransportCommandProcessor extends AbstractTerminateableHttpCommandProcessor<Void> { @Override protected CommandResolver<HttpCommand> createCommandResolver(final HttpCommand command, final Tracer tracer) { String uri = stripMinorVersionFromUri(command.getOperationPath()); final RescriptOperationBinding binding = bindings.get(uri); return new SingleExecutionCommandResolver<HttpCommand>(tracer) { private DehydratedExecutionContext context; private ExecutionCommand executionCommand; @Override public DehydratedExecutionContext resolveExecutionContext() { if (context == null) { context = RescriptTransportCommandProcessor.this.resolveExecutionContext(command, null); } return context; } @Override public ExecutionCommand resolveExecutionCommand(Tracer tracer) { if (binding!=null) { if (executionCommand == null) { executionCommand = RescriptTransportCommandProcessor.this.resolveExecutionCommand( binding, command, resolveExecutionContext(), tracer); } return executionCommand; } throw new CougarValidationException(ServerFaultCode.NoSuchOperation, "The request could not be resolved to an operation"); } }; } RescriptTransportCommandProcessor(DehydratedExecutionContextResolution contextResolution, String requestTimeoutHeader); }
RescriptTransportCommandProcessor extends AbstractTerminateableHttpCommandProcessor<Void> { @Override protected CommandResolver<HttpCommand> createCommandResolver(final HttpCommand command, final Tracer tracer) { String uri = stripMinorVersionFromUri(command.getOperationPath()); final RescriptOperationBinding binding = bindings.get(uri); return new SingleExecutionCommandResolver<HttpCommand>(tracer) { private DehydratedExecutionContext context; private ExecutionCommand executionCommand; @Override public DehydratedExecutionContext resolveExecutionContext() { if (context == null) { context = RescriptTransportCommandProcessor.this.resolveExecutionContext(command, null); } return context; } @Override public ExecutionCommand resolveExecutionCommand(Tracer tracer) { if (binding!=null) { if (executionCommand == null) { executionCommand = RescriptTransportCommandProcessor.this.resolveExecutionCommand( binding, command, resolveExecutionContext(), tracer); } return executionCommand; } throw new CougarValidationException(ServerFaultCode.NoSuchOperation, "The request could not be resolved to an operation"); } }; } RescriptTransportCommandProcessor(DehydratedExecutionContextResolution contextResolution, String requestTimeoutHeader); @Override void onCougarStart(); void bindOperation(ServiceBindingDescriptor serviceBindingDescriptor, OperationBindingDescriptor bindingDescriptor); }
RescriptTransportCommandProcessor extends AbstractTerminateableHttpCommandProcessor<Void> { @Override protected CommandResolver<HttpCommand> createCommandResolver(final HttpCommand command, final Tracer tracer) { String uri = stripMinorVersionFromUri(command.getOperationPath()); final RescriptOperationBinding binding = bindings.get(uri); return new SingleExecutionCommandResolver<HttpCommand>(tracer) { private DehydratedExecutionContext context; private ExecutionCommand executionCommand; @Override public DehydratedExecutionContext resolveExecutionContext() { if (context == null) { context = RescriptTransportCommandProcessor.this.resolveExecutionContext(command, null); } return context; } @Override public ExecutionCommand resolveExecutionCommand(Tracer tracer) { if (binding!=null) { if (executionCommand == null) { executionCommand = RescriptTransportCommandProcessor.this.resolveExecutionCommand( binding, command, resolveExecutionContext(), tracer); } return executionCommand; } throw new CougarValidationException(ServerFaultCode.NoSuchOperation, "The request could not be resolved to an operation"); } }; } RescriptTransportCommandProcessor(DehydratedExecutionContextResolution contextResolution, String requestTimeoutHeader); @Override void onCougarStart(); void bindOperation(ServiceBindingDescriptor serviceBindingDescriptor, OperationBindingDescriptor bindingDescriptor);  }