HostRegistryImpl implements HostRegistry { void registerHost( ResourceHostInfo newRhInfo, Set<QuotaAlertValue> alerts ) { Preconditions.checkNotNull( newRhInfo, "Info is null" ); ResourceHostInfo oldRhInfo = hosts.getIfPresent( newRhInfo.getId() ); if ( oldRhInfo != null ) { ( ( ResourceHostInfoModel ) newRhInfo ) .setDateCreated( ( ( ResourceHostInfoModel ) oldRhInfo ).getDateCreated() ); } else { ( ( ResourceHostInfoModel ) newRhInfo ).setDateCreated( System.currentTimeMillis() ); } hosts.put( newRhInfo.getId(), newRhInfo ); for ( HostListener listener : hostListeners ) { threadPool.execute( new HostNotifier( listener, oldRhInfo, newRhInfo, alerts ) ); } }  @Override void updateResourceHostEntryTimestamp( final String resourceHostId ); @Override ContainerHostInfo getContainerHostInfoById( final String id ); @Override ContainerHostInfo getContainerHostInfoByHostname( final String hostname ); @Override ContainerHostInfo getContainerHostInfoByContainerName( final String containerName ); @Override Set<ContainerHostInfo> getContainerHostsInfo(); @Override ResourceHostInfo getResourceHostInfoById( final String id ); @Override ResourceHostInfo getResourceHostInfoByHostname( final String hostname ); @Override Set<ResourceHostInfo> getResourceHostsInfo(); @Override ResourceHostInfo getResourceHostByContainerHost( final ContainerHostInfo containerHostInfo ); @Override HostInfo getHostInfoById( final String hostId ); @Override void removeResourceHost( final String id ); @Override void addHostListener( final HostListener listener ); @Override void removeHostListener( final HostListener listener ); void init(); void dispose(); @Override boolean pingHost( String hostIp );  }
@Test public void testRegisterHost() throws Exception { registry.registerHost( resourceHostInfo, alerts ); verify( hosts ).put( resourceHostInfo.getId(), resourceHostInfo ); verify( notifier ).execute( isA( HostNotifier.class ) ); }