UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setUdpDiscoveryAddr( discoveryAddress ); attributes.setUdpDiscoveryPort( discoveryPort );
UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setUdpDiscoveryAddr( discoveryAddress ); attributes.setUdpDiscoveryPort( discoveryPort );
/** @return a clone of this object */ @Override public Object clone() { UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setSendDelaySec( this.getSendDelaySec() ); attributes.setMaxIdleTimeSec( this.getMaxIdleTimeSec() ); attributes.setServiceName( this.getServiceName() ); attributes.setServicePort( this.getServicePort() ); attributes.setUdpDiscoveryAddr( this.getUdpDiscoveryAddr() ); attributes.setUdpDiscoveryPort( this.getUdpDiscoveryPort() ); attributes.setDark( this.isDark() ); return attributes; }
/** @return a clone of this object */ @Override public UDPDiscoveryAttributes clone() { UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setSendDelaySec( this.getSendDelaySec() ); attributes.setMaxIdleTimeSec( this.getMaxIdleTimeSec() ); attributes.setServiceName( this.getServiceName() ); attributes.setServicePort( this.getServicePort() ); attributes.setUdpDiscoveryAddr( this.getUdpDiscoveryAddr() ); attributes.setUdpDiscoveryPort( this.getUdpDiscoveryPort() ); attributes.setDark( this.isDark() ); return attributes; }
/** Verify that the list is updated. */ public void testAddOrUpdateService_NotInList() { // SETUP String host = "228.5.6.7"; int port = 6789; UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setUdpDiscoveryAddr( host ); attributes.setUdpDiscoveryPort( port ); attributes.setServicePort( 1000 ); // create the service UDPDiscoveryService service = new UDPDiscoveryService( attributes ); service.addParticipatingCacheName( "testCache1" ); MockDiscoveryListener discoveryListener = new MockDiscoveryListener(); service.addDiscoveryListener( discoveryListener ); DiscoveredService discoveredService = new DiscoveredService(); discoveredService.setServiceAddress( host ); discoveredService.setCacheNames( new ArrayList<String>() ); discoveredService.setServicePort( 1000 ); discoveredService.setLastHearFromTime( 100 ); // DO WORK service.addOrUpdateService( discoveredService ); // VERIFY assertTrue( "Service should be in the service list.", service.getDiscoveredServices() .contains( discoveredService ) ); assertTrue( "Service should be in the listener list.", discoveryListener.discoveredServices .contains( discoveredService ) ); }
/** Verify that the list is updated. */ public void testAddOrUpdateService_NotInList() { // SETUP String host = "228.5.6.7"; int port = 6789; UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setUdpDiscoveryAddr( host ); attributes.setUdpDiscoveryPort( port ); attributes.setServicePort( 1000 ); // create the service UDPDiscoveryService service = new UDPDiscoveryService( attributes ); service.startup(); service.addParticipatingCacheName( "testCache1" ); MockDiscoveryListener discoveryListener = new MockDiscoveryListener(); service.addDiscoveryListener( discoveryListener ); DiscoveredService discoveredService = new DiscoveredService(); discoveredService.setServiceAddress( host ); discoveredService.setCacheNames( new ArrayList<String>() ); discoveredService.setServicePort( 1000 ); discoveredService.setLastHearFromTime( 100 ); // DO WORK service.addOrUpdateService( discoveredService ); // VERIFY assertTrue( "Service should be in the service list.", service.getDiscoveredServices() .contains( discoveredService ) ); assertTrue( "Service should be in the listener list.", discoveryListener.discoveredServices .contains( discoveredService ) ); }
UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setUdpDiscoveryAddr( host ); attributes.setUdpDiscoveryPort( port );
throws Exception UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setUdpDiscoveryAddr( "228.5.6.7" ); attributes.setUdpDiscoveryPort( 6789 );
throws Exception UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setUdpDiscoveryAddr( "228.5.6.7" ); attributes.setUdpDiscoveryPort( 6789 );
UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setUdpDiscoveryAddr( host ); attributes.setUdpDiscoveryPort( port );
UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setUdpDiscoveryAddr( host ); attributes.setUdpDiscoveryPort( port );
UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setUdpDiscoveryAddr( host ); attributes.setUdpDiscoveryPort( port );
UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setUdpDiscoveryAddr( host ); attributes.setUdpDiscoveryPort( port );
UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setUdpDiscoveryAddr( host ); attributes.setUdpDiscoveryPort( port );