### Question:
ThresholdingVisitor extends AbstractCollectionSetVisitor { @Override public String toString() { return "ThresholdingVisitor for " + m_thresholdingSet; } protected  ThresholdingVisitor(CollectorThresholdingSet thresholdingSet); static ThresholdingVisitor create(int nodeId, String hostAddress, String serviceName, RrdRepository repo, ServiceParameters svcParams); boolean hasThresholds(); @Override void visitCollectionSet(CollectionSet set); void reload(); void reloadScheduledOutages(); boolean isNodeInOutage(); @Override void visitResource(CollectionResource resource); @Override void visitAttribute(CollectionAttribute attribute); @Override void completeResource(CollectionResource resource); Date getCollectionTimestamp(); @Override String toString();  }### Answer:
@Test public void testBug3554_withDBFilterDao() throws Exception { runTestForBug3554(); int numOfPackages = ThreshdConfigFactory.getInstance().getConfiguration().getPackage().length; LoggingEvent[] events = MockLogAppender.getEventsGreaterOrEqual(Level.DEBUG); int count = 0; String expectedMsgHeader = "createPackageIpMap: package "; for (LoggingEvent e : events) { if (e.getMessage().toString().startsWith(expectedMsgHeader)) count++; } assertEquals("expecting " + numOfPackages + " events", numOfPackages, count); }
@Test public void testBug3720() throws Exception { runTestForBug3554(); HashSet<String> filters = new HashSet<String>(); for (org.opennms.netmgt.config.threshd.Package pkg : ThreshdConfigFactory.getInstance().getConfiguration().getPackage()) { filters.add(pkg.getFilter().getContent()); } int expectedCalls = filters.size(); LoggingEvent[] events = MockLogAppender.getEventsGreaterOrEqual(Level.DEBUG); int count = 0; String expectedMsgHeader = "createPackageIpMap: package "; for (LoggingEvent e : events) { if (e.getMessage().toString().startsWith(expectedMsgHeader)) count++; } assertEquals("expecting " + expectedCalls + " events", expectedCalls, count); }
@Test public void testDisabledCollection() throws Exception { initFactories("/threshd-configuration.xml","/test-thresholds-bug3428.xml"); Integer ifIndex = 1; Long ifSpeed = 100000000l; String ifName = "wlan0"; addHighThresholdEvent(1, 90, 50, 120, ifName, ifIndex.toString(), "ifInOctets", ifName, ifIndex.toString()); SnmpIfData ifData = createSnmpIfData("127.0.0.1", ifName, ifSpeed, ifIndex, false); CollectionAgent agent = createCollectionAgent(); IfResourceType resourceType = createInterfaceResourceType(agent); ThresholdingVisitor visitor = createVisitor(); SnmpCollectionResource resource = new IfInfo(resourceType, agent, ifData); addAttributeToCollectionResource(resource, resourceType, "ifInOctets", "counter", "ifIndex", 10000); addAttributeToCollectionResource(resource, resourceType, "ifOutOctets", "counter", "ifIndex", 10000); resource.visit(visitor); resource = new IfInfo(resourceType, agent, ifData); addAttributeToCollectionResource(resource, resourceType, "ifInOctets", "counter", "ifIndex", 46000); addAttributeToCollectionResource(resource, resourceType, "ifOutOctets", "counter", "ifIndex", 46000); resource.visit(visitor); EasyMock.verify(agent); verifyEvents(1); }