CaptureAgentStateServiceImpl implements CaptureAgentStateService, ManagedServiceFactory { @Override public Agent getAgent(String name) throws NotFoundException { String org = securityService.getOrganization().getId(); Agent agent = getAgent(name, org); return updateCachedLastHeardFrom(agent, org); } CaptureAgentStateServiceImpl(); @Reference(name = "security-service") void setSecurityService(SecurityService securityService); @Activate void activate(ComponentContext cc); @Deactivate void deactivate(); @Override Agent getAgent(String name); @Override String getAgentState(String agentName); @Override boolean setAgentState(String agentName, String state); @Override boolean setAgentUrl(String agentName, String agentUrl); @Override void removeAgent(String agentName); @Override Map<String, Agent> getKnownAgents(); @Override Properties getAgentCapabilities(String agentName); @Override Properties getAgentConfiguration(String agentName); @Override boolean setAgentConfiguration(String agentName, Properties configuration); @Override String getName(); @Override void updated(String pid, Dictionary<String, ?> properties); @Override void deleted(String pid); static final String PERSISTENCE_UNIT; static final String CAPTURE_AGENT_TIMEOUT_KEY; }
@Test public void nonExistantAgent() { try { service.getAgent("doesNotExist"); fail("Agent has been found"); } catch (NotFoundException e) { assertNotNull(e); } }