UriEndpointMapping extends AbstractMapBasedEndpointMapping { @Override protected String getLookupKeyForMessage(MessageContext messageContext) throws Exception { TransportContext transportContext = TransportContextHolder.getTransportContext(); if (transportContext != null) { WebServiceConnection connection = transportContext.getConnection(); if (connection != null) { URI connectionUri = connection.getUri(); if (usePath) { return connectionUri.getPath(); } else { return connectionUri.toString(); } } } return null; }  void setUsePath(boolean usePath);  }
@Test public void getLookupKeyForMessage() throws Exception { WebServiceConnection connectionMock = createMock(WebServiceConnection.class); TransportContextHolder.setTransportContext(new DefaultTransportContext(connectionMock)); URI uri = new URI("jms: expect(connectionMock.getUri()).andReturn(uri); replay(connectionMock); Assert.assertEquals("Invalid lookup key", uri.toString(), mapping.getLookupKeyForMessage(context)); verify(connectionMock); }