@Test public void testSameOperationDifferentContextPaths() { OperationDefinition op = Mockito.mock(OperationDefinition.class); when(op.getParameters()).thenReturn(new Parameter[0]); ExecutionVenue ev = Mockito.mock(ExecutionVenue.class); OperationKey key = Mockito.mock(OperationKey.class); when(ev.getOperationDefinition(key)).thenReturn(op); HttpServiceBindingDescriptor serviceDescriptorV1 = new HttpServiceBindingDescriptor() { @Override public String getServiceContextPath() { return "/I/v1.0"; } @Override public OperationBindingDescriptor[] getOperationBindings() { return new OperationBindingDescriptor[0]; } @Override public Protocol getServiceProtocol() { return null; } @Override public ServiceVersion getServiceVersion() { return new ServiceVersion(1,0); } @Override public String getServiceName() { return "Wibble"; } }; HttpServiceBindingDescriptor serviceDescriptorV2 = new HttpServiceBindingDescriptor() { @Override public String getServiceContextPath() { return "/I/v2.0"; } @Override public OperationBindingDescriptor[] getOperationBindings() { return new OperationBindingDescriptor[0]; } @Override public Protocol getServiceProtocol() { return null; } @Override public ServiceVersion getServiceVersion() { return new ServiceVersion(2,0); } @Override public String getServiceName() { return "Wibble"; } }; RescriptOperationBindingDescriptor op1 = new RescriptOperationBindingDescriptor(key, "url1", "GET", Collections.<RescriptParamBindingDescriptor>emptyList(), null); RescriptTransportCommandProcessor sut = new RescriptTransportCommandProcessor(contextResolution, null); sut.setExecutionVenue(ev); sut.bindOperation(serviceDescriptorV1, op1); sut.bindOperation(serviceDescriptorV2, op1); }
public void bindOperation(ServiceBindingDescriptor serviceBindingDescriptor, OperationBindingDescriptor bindingDescriptor) { OperationDefinition operationDefinition = getOperationDefinition(bindingDescriptor.getOperationKey()); if (operationDefinition!=null) { RescriptOperationBindingDescriptor rescriptOperationBindingDescriptor = (RescriptOperationBindingDescriptor) bindingDescriptor; HttpServiceBindingDescriptor httpServiceBindingDescriptor = (HttpServiceBindingDescriptor) serviceBindingDescriptor; String uri = stripMinorVersionFromUri(httpServiceBindingDescriptor.getServiceContextPath() + httpServiceBindingDescriptor.getServiceVersion()); if (uri == null) uri = ""; uri += rescriptOperationBindingDescriptor.getURI(); if (bindings.containsKey(uri)) { throw new PanicInTheCougar("More than one operation is bound to the path [" + uri + "] edit your operation paths so that this is unique, existing = "+bindings.get(uri)+", new = "+bindingDescriptor); } bindings.put(uri, new RescriptOperationBinding(rescriptOperationBindingDescriptor, operationDefinition, hardFailEnumDeserialisation)); } }
RescriptTransportCommandProcessor extends AbstractTerminateableHttpCommandProcessor<Void> { public void bindOperation(ServiceBindingDescriptor serviceBindingDescriptor, OperationBindingDescriptor bindingDescriptor) { OperationDefinition operationDefinition = getOperationDefinition(bindingDescriptor.getOperationKey()); if (operationDefinition!=null) { RescriptOperationBindingDescriptor rescriptOperationBindingDescriptor = (RescriptOperationBindingDescriptor) bindingDescriptor; HttpServiceBindingDescriptor httpServiceBindingDescriptor = (HttpServiceBindingDescriptor) serviceBindingDescriptor; String uri = stripMinorVersionFromUri(httpServiceBindingDescriptor.getServiceContextPath() + httpServiceBindingDescriptor.getServiceVersion()); if (uri == null) uri = ""; uri += rescriptOperationBindingDescriptor.getURI(); if (bindings.containsKey(uri)) { throw new PanicInTheCougar("More than one operation is bound to the path [" + uri + "] edit your operation paths so that this is unique, existing = "+bindings.get(uri)+", new = "+bindingDescriptor); } bindings.put(uri, new RescriptOperationBinding(rescriptOperationBindingDescriptor, operationDefinition, hardFailEnumDeserialisation)); } } }
RescriptTransportCommandProcessor extends AbstractTerminateableHttpCommandProcessor<Void> { public void bindOperation(ServiceBindingDescriptor serviceBindingDescriptor, OperationBindingDescriptor bindingDescriptor) { OperationDefinition operationDefinition = getOperationDefinition(bindingDescriptor.getOperationKey()); if (operationDefinition!=null) { RescriptOperationBindingDescriptor rescriptOperationBindingDescriptor = (RescriptOperationBindingDescriptor) bindingDescriptor; HttpServiceBindingDescriptor httpServiceBindingDescriptor = (HttpServiceBindingDescriptor) serviceBindingDescriptor; String uri = stripMinorVersionFromUri(httpServiceBindingDescriptor.getServiceContextPath() + httpServiceBindingDescriptor.getServiceVersion()); if (uri == null) uri = ""; uri += rescriptOperationBindingDescriptor.getURI(); if (bindings.containsKey(uri)) { throw new PanicInTheCougar("More than one operation is bound to the path [" + uri + "] edit your operation paths so that this is unique, existing = "+bindings.get(uri)+", new = "+bindingDescriptor); } bindings.put(uri, new RescriptOperationBinding(rescriptOperationBindingDescriptor, operationDefinition, hardFailEnumDeserialisation)); } } RescriptTransportCommandProcessor(DehydratedExecutionContextResolution contextResolution, String requestTimeoutHeader); }
RescriptTransportCommandProcessor extends AbstractTerminateableHttpCommandProcessor<Void> { public void bindOperation(ServiceBindingDescriptor serviceBindingDescriptor, OperationBindingDescriptor bindingDescriptor) { OperationDefinition operationDefinition = getOperationDefinition(bindingDescriptor.getOperationKey()); if (operationDefinition!=null) { RescriptOperationBindingDescriptor rescriptOperationBindingDescriptor = (RescriptOperationBindingDescriptor) bindingDescriptor; HttpServiceBindingDescriptor httpServiceBindingDescriptor = (HttpServiceBindingDescriptor) serviceBindingDescriptor; String uri = stripMinorVersionFromUri(httpServiceBindingDescriptor.getServiceContextPath() + httpServiceBindingDescriptor.getServiceVersion()); if (uri == null) uri = ""; uri += rescriptOperationBindingDescriptor.getURI(); if (bindings.containsKey(uri)) { throw new PanicInTheCougar("More than one operation is bound to the path [" + uri + "] edit your operation paths so that this is unique, existing = "+bindings.get(uri)+", new = "+bindingDescriptor); } bindings.put(uri, new RescriptOperationBinding(rescriptOperationBindingDescriptor, operationDefinition, hardFailEnumDeserialisation)); } } RescriptTransportCommandProcessor(DehydratedExecutionContextResolution contextResolution, String requestTimeoutHeader); @Override void onCougarStart(); void bindOperation(ServiceBindingDescriptor serviceBindingDescriptor, OperationBindingDescriptor bindingDescriptor); }
RescriptTransportCommandProcessor extends AbstractTerminateableHttpCommandProcessor<Void> { public void bindOperation(ServiceBindingDescriptor serviceBindingDescriptor, OperationBindingDescriptor bindingDescriptor) { OperationDefinition operationDefinition = getOperationDefinition(bindingDescriptor.getOperationKey()); if (operationDefinition!=null) { RescriptOperationBindingDescriptor rescriptOperationBindingDescriptor = (RescriptOperationBindingDescriptor) bindingDescriptor; HttpServiceBindingDescriptor httpServiceBindingDescriptor = (HttpServiceBindingDescriptor) serviceBindingDescriptor; String uri = stripMinorVersionFromUri(httpServiceBindingDescriptor.getServiceContextPath() + httpServiceBindingDescriptor.getServiceVersion()); if (uri == null) uri = ""; uri += rescriptOperationBindingDescriptor.getURI(); if (bindings.containsKey(uri)) { throw new PanicInTheCougar("More than one operation is bound to the path [" + uri + "] edit your operation paths so that this is unique, existing = "+bindings.get(uri)+", new = "+bindingDescriptor); } bindings.put(uri, new RescriptOperationBinding(rescriptOperationBindingDescriptor, operationDefinition, hardFailEnumDeserialisation)); } } RescriptTransportCommandProcessor(DehydratedExecutionContextResolution contextResolution, String requestTimeoutHeader); @Override void onCougarStart(); void bindOperation(ServiceBindingDescriptor serviceBindingDescriptor, OperationBindingDescriptor bindingDescriptor);  }