Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write test for factory to ensure it supports the config split feature.
- Loading branch information
Markus von Rüden
committed
Jul 29, 2014
1 parent
3abd0e8
commit 25eb1bc
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...ms-config/src/test/java/org/opennms/netmgt/config/JMXDataCollectionConfigFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.opennms.netmgt.config; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.FileNotFoundException; | ||
|
||
public class JMXDataCollectionConfigFactoryTest { | ||
|
||
@Test | ||
// Tests that the JmxDataCollectionConfigFactory also supports/implements the split config feature. | ||
public void shouldSupportSplitConfig() throws FileNotFoundException { | ||
File jmxCollectionConfig = new File("src/test/resources/etc/jmx-datacollection-split.xml"); | ||
Assert.assertTrue("JMX configuration file is not readable", jmxCollectionConfig.canRead()); | ||
FileInputStream configFileStream = new FileInputStream(jmxCollectionConfig); | ||
|
||
JMXDataCollectionConfigFactory factory = new JMXDataCollectionConfigFactory(configFileStream); | ||
|
||
Assert.assertNotNull(factory.getJmxCollection("jboss")); | ||
Assert.assertNotNull(factory.getJmxCollection("jsr160")); | ||
Assert.assertEquals(8, factory.getJmxCollection("jboss").getMbeans().getMbeanCount()); | ||
Assert.assertEquals(4, factory.getJmxCollection("jsr160").getMbeans().getMbeanCount()); | ||
|
||
} | ||
} |