CamelRoutesEndpoint { @ReadOperation public Object doReadAction(@Selector String id, @Selector ReadAction action) { switch (action) { case DETAIL: return getRouteDetailsInfo(id); case INFO: return getRouteInfo(id); default: throw new IllegalArgumentException("Unsupported read action " + action); } } CamelRoutesEndpoint(CamelContext camelContext, CamelRoutesEndpointProperties properties); @ReadOperation List<RouteEndpointInfo> readRoutes(); @ReadOperation Object doReadAction(@Selector String id, @Selector ReadAction action); @WriteOperation void doWriteAction(@Selector String id, @Selector WriteAction action, @Nullable TimeInfo timeInfo);  }
@Test public void testReadOperation() throws Exception { Object answer = endpoint.doReadAction("foo-route", ReadAction.INFO); Assert.assertEquals(RouteEndpointInfo.class, answer.getClass()); Assert.assertEquals("foo-route", RouteEndpointInfo.class.cast(answer).getId()); answer = endpoint.doReadAction("foo-route", ReadAction.DETAIL); Assert.assertEquals(RouteDetailsEndpointInfo.class, answer.getClass()); }