@Test public void testLoadWithEmptyConfig() throws Exception { SnmpCollection collection = new SnmpCollection(); collection.setName("default"); Assert.assertEquals(0, collection.getIncludeCollectionCount()); Assert.assertEquals(0, collection.getResourceTypeCount()); Assert.assertNull(collection.getSystems()); Assert.assertNull(collection.getGroups()); final DataCollectionConfigParser parser = new DataCollectionConfigParser("target"); parser.parseCollection(collection); Assert.assertEquals(0, collection.getResourceTypeCount()); Assert.assertNull(collection.getSystems()); Assert.assertNull(collection.getGroups()); }
public void parseCollection(SnmpCollection collection) { if (collection.getIncludeCollectionCount() > 0) { parseExternalResources(); checkCollection(collection); for (IncludeCollection include : collection.getIncludeCollection()) { if (include.getDataCollectionGroup() != null) { addDatacollectionGroup(collection, include.getDataCollectionGroup(), include.getExcludeFilterCollection()); } else { if (include.getSystemDef() == null) { throwException("You must specify at least the data collection group name or system definition name for the include-collection attribute", null); } else { addSystemDef(collection, include.getSystemDef()); } } } } else { log().info("parse: SNMP collection " + collection.getName() + " doesn't have any external reference."); } }
DataCollectionConfigParser { public void parseCollection(SnmpCollection collection) { if (collection.getIncludeCollectionCount() > 0) { parseExternalResources(); checkCollection(collection); for (IncludeCollection include : collection.getIncludeCollection()) { if (include.getDataCollectionGroup() != null) { addDatacollectionGroup(collection, include.getDataCollectionGroup(), include.getExcludeFilterCollection()); } else { if (include.getSystemDef() == null) { throwException("You must specify at least the data collection group name or system definition name for the include-collection attribute", null); } else { addSystemDef(collection, include.getSystemDef()); } } } } else { log().info("parse: SNMP collection " + collection.getName() + " doesn't have any external reference."); } } }
DataCollectionConfigParser { public void parseCollection(SnmpCollection collection) { if (collection.getIncludeCollectionCount() > 0) { parseExternalResources(); checkCollection(collection); for (IncludeCollection include : collection.getIncludeCollection()) { if (include.getDataCollectionGroup() != null) { addDatacollectionGroup(collection, include.getDataCollectionGroup(), include.getExcludeFilterCollection()); } else { if (include.getSystemDef() == null) { throwException("You must specify at least the data collection group name or system definition name for the include-collection attribute", null); } else { addSystemDef(collection, include.getSystemDef()); } } } } else { log().info("parse: SNMP collection " + collection.getName() + " doesn't have any external reference."); } } DataCollectionConfigParser(String configDirectory); }
DataCollectionConfigParser { public void parseCollection(SnmpCollection collection) { if (collection.getIncludeCollectionCount() > 0) { parseExternalResources(); checkCollection(collection); for (IncludeCollection include : collection.getIncludeCollection()) { if (include.getDataCollectionGroup() != null) { addDatacollectionGroup(collection, include.getDataCollectionGroup(), include.getExcludeFilterCollection()); } else { if (include.getSystemDef() == null) { throwException("You must specify at least the data collection group name or system definition name for the include-collection attribute", null); } else { addSystemDef(collection, include.getSystemDef()); } } } } else { log().info("parse: SNMP collection " + collection.getName() + " doesn't have any external reference."); } } DataCollectionConfigParser(String configDirectory); void parseCollection(SnmpCollection collection); Set<ResourceType> getAllResourceTypes(); }
DataCollectionConfigParser { public void parseCollection(SnmpCollection collection) { if (collection.getIncludeCollectionCount() > 0) { parseExternalResources(); checkCollection(collection); for (IncludeCollection include : collection.getIncludeCollection()) { if (include.getDataCollectionGroup() != null) { addDatacollectionGroup(collection, include.getDataCollectionGroup(), include.getExcludeFilterCollection()); } else { if (include.getSystemDef() == null) { throwException("You must specify at least the data collection group name or system definition name for the include-collection attribute", null); } else { addSystemDef(collection, include.getSystemDef()); } } } } else { log().info("parse: SNMP collection " + collection.getName() + " doesn't have any external reference."); } } DataCollectionConfigParser(String configDirectory); void parseCollection(SnmpCollection collection); Set<ResourceType> getAllResourceTypes();  }