@Test public void testRegisterPublisherWithNoSubscribers() { MasterServer mockMaster = mock(MasterServer.class); when( mockMaster.registerPublisher(Matchers.<GraphName>any(), Matchers.<URI>any(), Matchers.<GraphName>any(), Matchers.<String>any())).thenReturn( Lists.<URI>newArrayList()); MasterXmlRpcEndpointImpl master = new MasterXmlRpcEndpointImpl(mockMaster); List<Object> response = master.registerPublisher("/caller", "/foo", "/bar", "http: assertEquals(StatusCode.SUCCESS.toInt(), response.get(0)); assertEquals(Lists.newArrayList(), response.get(2)); }
@Override public List<Object> registerPublisher(String callerId, String topicName, String topicMessageType, String callerSlaveUri) { try { List<URI> subscribers = master.registerPublisher(GraphName.of(callerId), new URI(callerSlaveUri), GraphName.of( topicName), topicMessageType); List<String> urls = Lists.newArrayList(); for (URI uri : subscribers) { urls.add(uri.toString()); } return Response.newSuccess("Success", urls).toList(); } catch (URISyntaxException e) { throw new RosRuntimeException(String.format("Improperly formatted URI %s for publisher", callerSlaveUri), e); } }
MasterXmlRpcEndpointImpl implements MasterXmlRpcEndpoint,
    ParameterServerXmlRpcEndpoint { @Override public List<Object> registerPublisher(String callerId, String topicName, String topicMessageType, String callerSlaveUri) { try { List<URI> subscribers = master.registerPublisher(GraphName.of(callerId), new URI(callerSlaveUri), GraphName.of( topicName), topicMessageType); List<String> urls = Lists.newArrayList(); for (URI uri : subscribers) { urls.add(uri.toString()); } return Response.newSuccess("Success", urls).toList(); } catch (URISyntaxException e) { throw new RosRuntimeException(String.format("Improperly formatted URI %s for publisher", callerSlaveUri), e); } } }
MasterXmlRpcEndpointImpl implements MasterXmlRpcEndpoint,
    ParameterServerXmlRpcEndpoint { @Override public List<Object> registerPublisher(String callerId, String topicName, String topicMessageType, String callerSlaveUri) { try { List<URI> subscribers = master.registerPublisher(GraphName.of(callerId), new URI(callerSlaveUri), GraphName.of( topicName), topicMessageType); List<String> urls = Lists.newArrayList(); for (URI uri : subscribers) { urls.add(uri.toString()); } return Response.newSuccess("Success", urls).toList(); } catch (URISyntaxException e) { throw new RosRuntimeException(String.format("Improperly formatted URI %s for publisher", callerSlaveUri), e); } } MasterXmlRpcEndpointImpl(MasterServer master); }
MasterXmlRpcEndpointImpl implements MasterXmlRpcEndpoint,
    ParameterServerXmlRpcEndpoint { @Override public List<Object> registerPublisher(String callerId, String topicName, String topicMessageType, String callerSlaveUri) { try { List<URI> subscribers = master.registerPublisher(GraphName.of(callerId), new URI(callerSlaveUri), GraphName.of( topicName), topicMessageType); List<String> urls = Lists.newArrayList(); for (URI uri : subscribers) { urls.add(uri.toString()); } return Response.newSuccess("Success", urls).toList(); } catch (URISyntaxException e) { throw new RosRuntimeException(String.format("Improperly formatted URI %s for publisher", callerSlaveUri), e); } } MasterXmlRpcEndpointImpl(MasterServer master); @Override List<Object> getPid(String callerId); @Override List<Object> getPublishedTopics(String callerId, String subgraph); @Override List<Object> getTopicTypes(String callerId); @Override List<Object> getSystemState(String callerId); @Override List<Object> getUri(String callerId); @Override List<Object> lookupNode(String callerId, String nodeName); @Override List<Object> registerPublisher(String callerId, String topicName, String topicMessageType,
      String callerSlaveUri); @Override List<Object> unregisterPublisher(String callerId, String topicName, String callerSlaveUri); @Override List<Object> registerSubscriber(String callerId, String topicName,
      String topicMessageType, String callerSlaveUri); @Override List<Object> unregisterSubscriber(String callerId, String topicName, String callerSlaveUri); @Override List<Object> lookupService(String callerId, String serviceName); @Override List<Object> registerService(String callerId, String serviceName, String serviceUri,
      String callerSlaveUri); @Override List<Object> unregisterService(String callerId, String serviceName, String serviceUri); @Override List<Object> setParam(String callerId, String key, Boolean value); @Override List<Object> setParam(String callerId, String key, Integer value); @Override List<Object> setParam(String callerId, String key, Double value); @Override List<Object> setParam(String callerId, String key, String value); @Override List<Object> setParam(String callerId, String key, List<?> value); @Override List<Object> setParam(String callerId, String key, Map<?, ?> value); @Override List<Object> getParam(String callerId, String key); @Override List<Object> searchParam(String callerId, String key); @Override List<Object> subscribeParam(String callerId, String callerSlaveUri, String key); @Override List<Object> unsubscribeParam(String callerId, String callerSlaveUri, String key); @Override List<Object> deleteParam(String callerId, String key); @Override List<Object> hasParam(String callerId, String key); @Override List<Object> getParamNames(String callerId); }
MasterXmlRpcEndpointImpl implements MasterXmlRpcEndpoint,
    ParameterServerXmlRpcEndpoint { @Override public List<Object> registerPublisher(String callerId, String topicName, String topicMessageType, String callerSlaveUri) { try { List<URI> subscribers = master.registerPublisher(GraphName.of(callerId), new URI(callerSlaveUri), GraphName.of( topicName), topicMessageType); List<String> urls = Lists.newArrayList(); for (URI uri : subscribers) { urls.add(uri.toString()); } return Response.newSuccess("Success", urls).toList(); } catch (URISyntaxException e) { throw new RosRuntimeException(String.format("Improperly formatted URI %s for publisher", callerSlaveUri), e); } } MasterXmlRpcEndpointImpl(MasterServer master); @Override List<Object> getPid(String callerId); @Override List<Object> getPublishedTopics(String callerId, String subgraph); @Override List<Object> getTopicTypes(String callerId); @Override List<Object> getSystemState(String callerId); @Override List<Object> getUri(String callerId); @Override List<Object> lookupNode(String callerId, String nodeName); @Override List<Object> registerPublisher(String callerId, String topicName, String topicMessageType,
      String callerSlaveUri); @Override List<Object> unregisterPublisher(String callerId, String topicName, String callerSlaveUri); @Override List<Object> registerSubscriber(String callerId, String topicName,
      String topicMessageType, String callerSlaveUri); @Override List<Object> unregisterSubscriber(String callerId, String topicName, String callerSlaveUri); @Override List<Object> lookupService(String callerId, String serviceName); @Override List<Object> registerService(String callerId, String serviceName, String serviceUri,
      String callerSlaveUri); @Override List<Object> unregisterService(String callerId, String serviceName, String serviceUri); @Override List<Object> setParam(String callerId, String key, Boolean value); @Override List<Object> setParam(String callerId, String key, Integer value); @Override List<Object> setParam(String callerId, String key, Double value); @Override List<Object> setParam(String callerId, String key, String value); @Override List<Object> setParam(String callerId, String key, List<?> value); @Override List<Object> setParam(String callerId, String key, Map<?, ?> value); @Override List<Object> getParam(String callerId, String key); @Override List<Object> searchParam(String callerId, String key); @Override List<Object> subscribeParam(String callerId, String callerSlaveUri, String key); @Override List<Object> unsubscribeParam(String callerId, String callerSlaveUri, String key); @Override List<Object> deleteParam(String callerId, String key); @Override List<Object> hasParam(String callerId, String key); @Override List<Object> getParamNames(String callerId);  }