use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class DefaultForeignSourceService method addPolicyToForeignSource.
/** {@inheritDoc} */
@Override
public ForeignSource addPolicyToForeignSource(String foreignSource, String name) {
ForeignSource fs = getForeignSource(foreignSource);
PluginConfig pc = new PluginConfig(name, "unknown");
fs.addPolicy(pc);
m_pendingForeignSourceRepository.save(fs);
return fs;
}
use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class DefaultForeignSourceService method addDetectorToForeignSource.
/** {@inheritDoc} */
@Override
public ForeignSource addDetectorToForeignSource(String foreignSource, String name) {
ForeignSource fs = getForeignSource(foreignSource);
PluginConfig pc = new PluginConfig(name, "unknown");
fs.addDetector(pc);
m_pendingForeignSourceRepository.save(fs);
return fs;
}
use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class DefaultForeignSourceService method deleteDetector.
/** {@inheritDoc} */
@Override
public ForeignSource deleteDetector(String foreignSource, String name) {
ForeignSource fs = getForeignSource(foreignSource);
List<PluginConfig> detectors = fs.getDetectors();
for (Iterator<PluginConfig> i = detectors.iterator(); i.hasNext(); ) {
PluginConfig pc = i.next();
if (pc.getName().equals(name)) {
i.remove();
break;
}
}
m_pendingForeignSourceRepository.save(fs);
return fs;
}
use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class DragonWaveNodeSwitchingIT method setUp.
@Before
public void setUp() throws Exception {
final ForeignSource fs = new ForeignSource();
fs.setName("default");
fs.addDetector(new PluginConfig("SNMP", "org.opennms.netmgt.provision.detector.snmp.SnmpDetector"));
final MockForeignSourceRepository mfsr = new MockForeignSourceRepository();
mfsr.putDefaultForeignSource(fs);
m_provisioner.getProvisionService().setForeignSourceRepository(mfsr);
m_provisioner.start();
}
use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class DefaultForeignSourceServiceTest method integrationTest.
@Test
public void integrationTest() throws Exception {
assertTrue(m_deployed.getForeignSources().isEmpty());
assertTrue(m_pending.getForeignSources().isEmpty());
assertEquals(0, m_service.getAllForeignSources().size());
// create a new foreign source
ForeignSource fs = m_service.getForeignSource("test");
// test doesn't exist, so it should tell us that it's based on the default foreign source
assertTrue(fs.isDefault());
// modify it and save
fs.setDetectors(new ArrayList<PluginConfig>());
m_service.saveForeignSource("test", fs);
// now it shouln't be marked as default, since we've saved a modified version
fs = m_service.getForeignSource("test");
assertFalse(fs.isDefault());
// we like it so much, let's make it the default!
m_service.saveForeignSource("default", fs);
fs = m_service.getForeignSource("monkey");
assertTrue(fs.isDefault());
}
Aggregations