discoveredService.setServiceAddress( message.getHost() ); discoveredService.setCacheNames( message.getCacheNames() ); discoveredService.setServicePort( message.getPort() );
discoveredService.setServiceAddress( message.getHost() ); discoveredService.setCacheNames( message.getCacheNames() ); discoveredService.setServicePort( message.getPort() );
discoveredService.setServiceAddress( host ); discoveredService.setCacheNames( new ArrayList<String>() ); discoveredService.setServicePort( 1000 ); differentCacheNames.add( "name1" ); DiscoveredService discoveredService2 = new DiscoveredService(); discoveredService2.setServiceAddress( host ); discoveredService2.setCacheNames( differentCacheNames ); discoveredService2.setServicePort( 1000 );
discoveredService.setServiceAddress( host ); discoveredService.setCacheNames( new ArrayList<String>() ); discoveredService.setServicePort( 1000 );
/** 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.setServiceAddress( host ); discoveredService.setCacheNames( sametCacheNames ); discoveredService.setServicePort( 1000 ); discoveredService2.setServiceAddress( host ); discoveredService2.setCacheNames( sametCacheNames ); discoveredService2.setServicePort( 1000 );
discoveredService.setServiceAddress( host ); discoveredService.setCacheNames( sametCacheNames ); discoveredService.setServicePort( 1000 ); discoveredService2.setServiceAddress( host ); discoveredService2.setCacheNames( sametCacheNames ); discoveredService2.setServicePort( 1000 );
discoveredService.setServiceAddress( host ); discoveredService.setCacheNames( new ArrayList<String>() ); discoveredService.setServicePort( 1000 ); differentCacheNames.add( "name1" ); DiscoveredService discoveredService2 = new DiscoveredService(); discoveredService2.setServiceAddress( host ); discoveredService2.setCacheNames( differentCacheNames ); discoveredService2.setServicePort( 1000 );
discoveredService.setServiceAddress( host ); discoveredService.setCacheNames( new ArrayList<String>() ); discoveredService.setServicePort( 1000 );
service.setServiceAddress( "localhost" ); service.setServicePort( 9999 );
service.setServiceAddress( "localhost" ); service.setServicePort( 9999 );
service.setServiceAddress( "localhost" ); service.setServicePort( 9999 );
service.setServiceAddress( "localhost" ); service.setServicePort( 9999 );