@Test public void testCollector() throws Exception { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("port", getServer().getLocalPort()); NSClientCollector collector = getCollector(parameters); CollectionSet collectionSet = collector.collect(m_collectionAgent, m_eventProxy, parameters); Assert.assertEquals(ServiceCollector.COLLECTION_SUCCEEDED, collectionSet.getStatus()); CountResourcesVisitor visitor = new CountResourcesVisitor(); collectionSet.visit(visitor); Assert.assertEquals(42, visitor.getCount()); }
private NSClientCollector getCollector(Map<String, Object> parameters) { NSClientCollector collector = new NSClientCollector(); collector.initialize(m_collectionAgent, parameters); return collector; }