Search in sources :

Example 1 with Parameter

use of org.opennms.netmgt.config.threshd.Parameter in project opennms by OpenNMS.

the class ThresholdingVisitorIT method testBug3390.

/*
     * This test uses this files from src/test/resources:
     * - threshd-configuration-bug3390.xml
     * - test-thresholds-bug3390.xml
     * 
     * The idea is to define many threshold-group parameters on a service inside a package
     */
@Test
public void testBug3390() throws Exception {
    initFactories("/threshd-configuration-bug3390.xml", "/test-thresholds-bug3390.xml");
    // Validating threshd-configuration.xml
    ThreshdConfigManager configManager = ThreshdConfigFactory.getInstance();
    final List<Package> packages = configManager.getConfiguration().getPackages();
    assertEquals(1, packages.size());
    org.opennms.netmgt.config.threshd.Package pkg = packages.get(0);
    final List<Service> services = pkg.getServices();
    assertEquals(1, services.size());
    org.opennms.netmgt.config.threshd.Service svc = services.get(0);
    final List<Parameter> parameters = svc.getParameters();
    assertEquals(5, parameters.size());
    int count = 0;
    for (org.opennms.netmgt.config.threshd.Parameter parameter : parameters) {
        if (parameter.getKey().equals("thresholding-group"))
            count++;
    }
    assertEquals(5, count);
    // Validating Thresholding Set
    ThresholdingVisitor visitor = createVisitor();
    assertEquals(5, visitor.getThresholdGroups().size());
}
Also used : Service(org.opennms.netmgt.config.threshd.Service) Parameter(org.opennms.netmgt.config.threshd.Parameter) Package(org.opennms.netmgt.config.threshd.Package) Service(org.opennms.netmgt.config.threshd.Service) Parameter(org.opennms.netmgt.config.threshd.Parameter) Package(org.opennms.netmgt.config.threshd.Package) ThreshdConfigManager(org.opennms.netmgt.config.ThreshdConfigManager) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 ThreshdConfigManager (org.opennms.netmgt.config.ThreshdConfigManager)1 Package (org.opennms.netmgt.config.threshd.Package)1 Parameter (org.opennms.netmgt.config.threshd.Parameter)1 Service (org.opennms.netmgt.config.threshd.Service)1