HostRegistrationManagerImpl extends HostListener implements HostRegistrationManager { public void init() { requestDataService = new RequestDataService( daoManager ); cleaner.scheduleWithFixedDelay( new Runnable() { @Override public void run() { for ( RequestedHostImpl requestedHost : requestDataService.getAll() ) { if ( requestedHost.getStatus() == ResourceHostRegistrationStatus.REQUESTED && System.currentTimeMillis() - ( requestedHost.getDateUpdated() == null ? 0L : requestedHost.getDateUpdated() ) > TimeUnit.MINUTES .toMillis( 60 ) ) { LOG.warn( "Deleting stale registration request {} : {}", requestedHost.getHostname(), requestedHost.getAddress() ); requestDataService.remove( requestedHost.getId() ); } } } }, 3, 30, TimeUnit.MINUTES ); } HostRegistrationManagerImpl( final SecurityManager securityManager, final DaoManager daoManager ); void init(); @Override String generateContainerToken( final long ttlInMs ); @Override Boolean verifyTokenAndRegisterKey( final String token, String containerHostId, String publicKey ); void dispose(); @Override void changeRhHostname( final String rhId, String hostname ); @Override List<RequestedHost> getRequests(); @Override RequestedHost getRequest( final String requestId ); @RolesAllowed( "Resource-Management|Write" ) @Override synchronized void queueRequest( final RequestedHost requestedHost ); @Override void rejectRequest( final String requestId ); @Override void approveRequest( final String requestId ); @Override void removeRequest( final String requestId ); @Override void unblockRequest( final String requestId ); @Override void onHeartbeat( final ResourceHostInfo resourceHostInfo, final Set<QuotaAlertValue> alerts );  }
@Test public void testInit() throws Exception { registrationManager.init(); assertNotNull( registrationManager.requestDataService ); }