discoveredService.setCacheNames( message.getCacheNames() ); discoveredService.setServicePort( message.getPort() ); discoveredService.setLastHearFromTime( System.currentTimeMillis() );
discoveredService.setCacheNames( message.getCacheNames() ); discoveredService.setServicePort( message.getPort() ); discoveredService.setLastHearFromTime( System.currentTimeMillis() );
discoveredService.setCacheNames( new ArrayList<String>() ); discoveredService.setServicePort( 1000 ); discoveredService.setLastHearFromTime( 100 ); DiscoveredService discoveredService2 = new DiscoveredService(); discoveredService2.setServiceAddress( host ); discoveredService2.setCacheNames( differentCacheNames ); discoveredService2.setServicePort( 1000 ); discoveredService2.setLastHearFromTime( 500 );
discoveredService.setCacheNames( new ArrayList<String>() ); discoveredService.setServicePort( 1000 ); discoveredService.setLastHearFromTime( 100 );
/** 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 ) ); }
/** 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 ) ); }
discoveredService.setCacheNames( sametCacheNames ); discoveredService.setServicePort( 1000 ); discoveredService.setLastHearFromTime( 100 ); discoveredService2.setCacheNames( sametCacheNames ); discoveredService2.setServicePort( 1000 ); discoveredService2.setLastHearFromTime( 500 );
discoveredService.setCacheNames( sametCacheNames ); discoveredService.setServicePort( 1000 ); discoveredService.setLastHearFromTime( 100 ); discoveredService2.setCacheNames( sametCacheNames ); discoveredService2.setServicePort( 1000 ); discoveredService2.setLastHearFromTime( 500 );
discoveredService.setCacheNames( new ArrayList<String>() ); discoveredService.setServicePort( 1000 ); discoveredService.setLastHearFromTime( 100 ); DiscoveredService discoveredService2 = new DiscoveredService(); discoveredService2.setServiceAddress( host ); discoveredService2.setCacheNames( differentCacheNames ); discoveredService2.setServicePort( 1000 ); discoveredService2.setLastHearFromTime( 500 );
discoveredService.setCacheNames( new ArrayList<String>() ); discoveredService.setServicePort( 1000 ); discoveredService.setLastHearFromTime( 100 );
service.setCacheNames( cacheNames ); service.setServiceAddress( "localhost" ); service.setServicePort( 9999 );
service.setCacheNames( cacheNames ); service.setServiceAddress( "localhost" ); service.setServicePort( 9999 );
service.setCacheNames( cacheNames ); service.setServiceAddress( "localhost" ); service.setServicePort( 9999 );
service.setCacheNames( cacheNames ); service.setServiceAddress( "localhost" ); service.setServicePort( 9999 );