@Test public void testDADiscoveryOnStartup() throws Exception { StandardDirectoryAgentServer da = StandardDirectoryAgentServer.newInstance(newSettings()); da.start(); try { StandardServiceAgent sa = StandardServiceAgent.newInstance(newSettings()); sa.start(); try { List<DirectoryAgentInfo> das = sa.getDirectoryAgents(); assert das != null; assert das.size() == 1; } finally { sa.stop(); } } finally { da.stop(); } }
public static StandardServiceAgent newInstance(Settings settings) { UDPConnector.Factory udpFactory = Factories.newInstance(settings, UDP_CONNECTOR_FACTORY_KEY); TCPConnector.Factory tcpFactory = Factories.newInstance(settings, TCP_CONNECTOR_FACTORY_KEY); UDPConnectorServer.Factory udpServerFactory = Factories.newInstance(settings, UDP_CONNECTOR_SERVER_FACTORY_KEY); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); return new StandardServiceAgent(udpFactory.newUDPConnector(settings), tcpFactory.newTCPConnector(settings), udpServerFactory.newUDPConnectorServer(settings), scheduledExecutorService, settings); }
StandardServiceAgent extends AbstractServiceAgent implements ServiceAgent { public static StandardServiceAgent newInstance(Settings settings) { UDPConnector.Factory udpFactory = Factories.newInstance(settings, UDP_CONNECTOR_FACTORY_KEY); TCPConnector.Factory tcpFactory = Factories.newInstance(settings, TCP_CONNECTOR_FACTORY_KEY); UDPConnectorServer.Factory udpServerFactory = Factories.newInstance(settings, UDP_CONNECTOR_SERVER_FACTORY_KEY); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); return new StandardServiceAgent(udpFactory.newUDPConnector(settings), tcpFactory.newTCPConnector(settings), udpServerFactory.newUDPConnectorServer(settings), scheduledExecutorService, settings); } }
StandardServiceAgent extends AbstractServiceAgent implements ServiceAgent { public static StandardServiceAgent newInstance(Settings settings) { UDPConnector.Factory udpFactory = Factories.newInstance(settings, UDP_CONNECTOR_FACTORY_KEY); TCPConnector.Factory tcpFactory = Factories.newInstance(settings, TCP_CONNECTOR_FACTORY_KEY); UDPConnectorServer.Factory udpServerFactory = Factories.newInstance(settings, UDP_CONNECTOR_SERVER_FACTORY_KEY); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); return new StandardServiceAgent(udpFactory.newUDPConnector(settings), tcpFactory.newTCPConnector(settings), udpServerFactory.newUDPConnectorServer(settings), scheduledExecutorService, settings); } StandardServiceAgent(UDPConnector udpConnector, TCPConnector tcpConnector, UDPConnectorServer udpConnectorServer, ScheduledExecutorService scheduledExecutorService);  StandardServiceAgent(UDPConnector udpConnector, TCPConnector tcpConnector, UDPConnectorServer udpConnectorServer, ScheduledExecutorService scheduledExecutorService, Settings settings); }
StandardServiceAgent extends AbstractServiceAgent implements ServiceAgent { public static StandardServiceAgent newInstance(Settings settings) { UDPConnector.Factory udpFactory = Factories.newInstance(settings, UDP_CONNECTOR_FACTORY_KEY); TCPConnector.Factory tcpFactory = Factories.newInstance(settings, TCP_CONNECTOR_FACTORY_KEY); UDPConnectorServer.Factory udpServerFactory = Factories.newInstance(settings, UDP_CONNECTOR_SERVER_FACTORY_KEY); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); return new StandardServiceAgent(udpFactory.newUDPConnector(settings), tcpFactory.newTCPConnector(settings), udpServerFactory.newUDPConnectorServer(settings), scheduledExecutorService, settings); } StandardServiceAgent(UDPConnector udpConnector, TCPConnector tcpConnector, UDPConnectorServer udpConnectorServer, ScheduledExecutorService scheduledExecutorService);  StandardServiceAgent(UDPConnector udpConnector, TCPConnector tcpConnector, UDPConnectorServer udpConnectorServer, ScheduledExecutorService scheduledExecutorService, Settings settings); static StandardServiceAgent newInstance(Settings settings); boolean isPeriodicServiceRenewalEnabled(); void setPeriodicServiceRenewalEnabled(boolean periodicServiceRenewalEnabled); void register(ServiceInfo service); void addAttributes(ServiceURL serviceURL, String language, Attributes attributes); void removeAttributes(ServiceURL serviceURL, String language, Attributes attributes); void deregister(ServiceURL serviceURL, String language); }
StandardServiceAgent extends AbstractServiceAgent implements ServiceAgent { public static StandardServiceAgent newInstance(Settings settings) { UDPConnector.Factory udpFactory = Factories.newInstance(settings, UDP_CONNECTOR_FACTORY_KEY); TCPConnector.Factory tcpFactory = Factories.newInstance(settings, TCP_CONNECTOR_FACTORY_KEY); UDPConnectorServer.Factory udpServerFactory = Factories.newInstance(settings, UDP_CONNECTOR_SERVER_FACTORY_KEY); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); return new StandardServiceAgent(udpFactory.newUDPConnector(settings), tcpFactory.newTCPConnector(settings), udpServerFactory.newUDPConnectorServer(settings), scheduledExecutorService, settings); } StandardServiceAgent(UDPConnector udpConnector, TCPConnector tcpConnector, UDPConnectorServer udpConnectorServer, ScheduledExecutorService scheduledExecutorService);  StandardServiceAgent(UDPConnector udpConnector, TCPConnector tcpConnector, UDPConnectorServer udpConnectorServer, ScheduledExecutorService scheduledExecutorService, Settings settings); static StandardServiceAgent newInstance(Settings settings); boolean isPeriodicServiceRenewalEnabled(); void setPeriodicServiceRenewalEnabled(boolean periodicServiceRenewalEnabled); void register(ServiceInfo service); void addAttributes(ServiceURL serviceURL, String language, Attributes attributes); void removeAttributes(ServiceURL serviceURL, String language, Attributes attributes); void deregister(ServiceURL serviceURL, String language);  }