HostRegistrationManagerImpl extends HostListener implements HostRegistrationManager { void importHostPublicKey( String hostId, String publicKey, boolean rh ) { KeyManager keyManager = securityManager.getKeyManager(); keyManager.savePublicKeyRing( hostId, rh ? SecurityKeyType.RESOURCE_HOST_KEY.getId() : SecurityKeyType.CONTAINER_HOST_KEY.getId(), publicKey ); } 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 testImportHostPublicKey() throws Exception { registrationManager.importHostPublicKey( "id", "key", false ); verify( keyManager ).savePublicKeyRing( "id", SecurityKeyType.CONTAINER_HOST_KEY.getId(), "key" ); }