HostRegistrationManagerImpl extends HostListener implements HostRegistrationManager { @Override public String generateContainerToken( final long ttlInMs ) { Preconditions.checkArgument( ttlInMs > 0, "Invalid ttl" ); String token = UUID.randomUUID().toString(); tokenCache.put( token, true, ttlInMs ); return token; } 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 testGenerateContainerTTLToken() throws Exception { registrationManager.generateContainerToken( 123L ); verify( tokenCache ).put( anyString(), anyBoolean(), eq( 123L ) ); }