CommandProcessor implements RestProcessor { @Override public Set<String> getRequests( final String hostId ) { Set<String> hostRequests = Sets.newHashSet(); Collection<CacheEntry<CommandProcess>> commandProcessEntries = commands.getEntries().values(); for ( CacheEntry<CommandProcess> commandProcessEntry : commandProcessEntries ) { CommandProcess commandProcess = commandProcessEntry.getValue(); if ( commandProcess.getRhId().equals( hostId ) && commandProcess.markAsSent() ) { hostRequests.add( commandProcess.getEncryptedRequest() ); } } return hostRequests; } CommandProcessor( final HostRegistry hostRegistry, final IdentityManager identityManager ); void addListener( HeartbeatListener listener ); void removeListener( HeartbeatListener listener ); void dispose(); @Override void handleHeartbeat( final HeartBeat heartBeat ); @Override Set<String> getRequests( final String hostId ); @Override void handleResponse( final Response response );  }
@Test public void testGetRequests() throws Exception { Set<String> requests = commandProcessor.getRequests( HOST_ID ); assertNotNull( requests ); }