RmiEndpointComponent extends AbstractEndpointComponent { @Override protected Endpoint createEndpoint(String resourcePath, Map<String, String> parameters, TestContext context) { RmiClient client = new RmiClient(); client.getEndpointConfiguration().setHost(RmiEndpointUtils.getHost(resourcePath)); client.getEndpointConfiguration().setPort(RmiEndpointUtils.getPort(resourcePath, client.getEndpointConfiguration())); client.getEndpointConfiguration().setBinding(RmiEndpointUtils.getBinding(resourcePath)); enrichEndpointConfiguration(client.getEndpointConfiguration(), getEndpointConfigurationParameters(parameters, RmiEndpointConfiguration.class), context); return client; } RmiEndpointComponent();   }
@Test public void testCreateClientEndpoint() throws Exception { RmiEndpointComponent component = new RmiEndpointComponent(); Endpoint endpoint = component.createEndpoint("rmi: Assert.assertEquals(endpoint.getClass(), RmiClient.class); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getHost(), "localhost"); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getPort(), 2099); Assert.assertEquals(((RmiClient) endpoint).getEndpointConfiguration().getTimeout(), 5000L); endpoint = component.createEndpoint("rmi: Assert.assertEquals(endpoint.getClass(), RmiClient.class); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getHost(), "localhost"); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getPort(), 2099); Assert.assertEquals(((RmiClient) endpoint).getEndpointConfiguration().getBinding(), "news"); Assert.assertEquals(((RmiClient) endpoint).getEndpointConfiguration().getTimeout(), 5000L); endpoint = component.createEndpoint("rmi: Assert.assertEquals(endpoint.getClass(), RmiClient.class); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getHost(), "localhost"); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getPort(), 2099); Assert.assertEquals(((RmiClient) endpoint).getEndpointConfiguration().getBinding(), "service/news"); Assert.assertEquals(((RmiClient) endpoint).getEndpointConfiguration().getTimeout(), 5000L); endpoint = component.createEndpoint("rmi:rmiserverhost", context); Assert.assertEquals(endpoint.getClass(), RmiClient.class); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getHost(), "rmiserverhost"); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getPort(), 1099); Assert.assertEquals(((RmiClient) endpoint).getEndpointConfiguration().getTimeout(), 5000L); endpoint = component.createEndpoint("rmi:localhost/service", context); Assert.assertEquals(endpoint.getClass(), RmiClient.class); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getHost(), "localhost"); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getPort(), 1099); Assert.assertEquals(((RmiClient) endpoint).getEndpointConfiguration().getBinding(), "service"); Assert.assertEquals(((RmiClient) endpoint).getEndpointConfiguration().getTimeout(), 5000L); }
@Test public void testCreateClientEndpointWithParameters() throws Exception { RmiEndpointComponent component = new RmiEndpointComponent(); Endpoint endpoint = component.createEndpoint("rmi: Assert.assertEquals(endpoint.getClass(), RmiClient.class); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getHost(), "localhost"); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getPort(), 2099); Assert.assertEquals(((RmiClient) endpoint).getEndpointConfiguration().getBinding(), "rmiBinding"); Assert.assertEquals(((RmiClient) endpoint).getEndpointConfiguration().getTimeout(), 10000L); endpoint = component.createEndpoint("rmi: Assert.assertEquals(endpoint.getClass(), RmiClient.class); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getHost(), "localhost"); Assert.assertEquals(((RmiClient)endpoint).getEndpointConfiguration().getPort(), 2099); Assert.assertEquals(((RmiClient) endpoint).getEndpointConfiguration().getBinding(), "rmiBinding"); Assert.assertEquals(((RmiClient) endpoint).getEndpointConfiguration().getTimeout(), 5000L); }