use of org.opennms.netmgt.model.OnmsDistPoller in project opennms by OpenNMS.
the class TrapSinkModuleTest method testEqualsAndHashCode.
@Test
public void testEqualsAndHashCode() throws Exception {
SinkModule<Message, Message> mockModule = Mockito.mock(SinkModule.class);
Mockito.when(mockModule.getId()).thenReturn("id");
OnmsDistPoller distPollerMock = Mockito.mock(OnmsDistPoller.class);
TrapdConfig config = new TrapdConfigBean();
final TrapSinkModule module = new TrapSinkModule(config, distPollerMock);
Assert.assertEquals(module, module);
Assert.assertEquals(module.hashCode(), module.hashCode());
final TrapSinkModule other = new TrapSinkModule(config, distPollerMock);
Assert.assertEquals(module, other);
Assert.assertEquals(module.hashCode(), other.hashCode());
Assert.assertNotEquals(module, mockModule);
Assert.assertNotEquals(module.hashCode(), mockModule.hashCode());
}
use of org.opennms.netmgt.model.OnmsDistPoller in project opennms by OpenNMS.
the class ProvisionerIT method setUp.
@Before
public void setUp() throws Exception {
if (m_distPollerDao.findAll().size() == 0) {
OnmsDistPoller distPoller = new OnmsDistPoller(DistPollerDao.DEFAULT_DIST_POLLER_ID);
distPoller.setLabel("localhost");
distPoller.setLocation(MonitoringLocationDao.DEFAULT_MONITORING_LOCATION_ID);
distPoller.setType(OnmsMonitoringSystem.TYPE_OPENNMS);
m_distPollerDao.save(distPoller);
}
SnmpPeerFactory.setInstance(m_snmpPeerFactory);
assertTrue(m_snmpPeerFactory instanceof ProxySnmpAgentConfigFactory);
// ensure this property is unset for tests and set it only in tests that need it
System.getProperties().remove("org.opennms.provisiond.enableDeletionOfRequisitionedEntities");
m_eventAnticipator = m_mockEventIpcManager.getEventAnticipator();
m_provisioner.start();
m_foreignSource = new ForeignSource();
m_foreignSource.setName("imported:");
m_foreignSource.setScanInterval(Duration.standardDays(1));
final PluginConfig policy = new PluginConfig("setCategory", NodeCategorySettingPolicy.class.getName());
policy.addParameter("category", "TestCategory");
policy.addParameter("label", "localhost");
m_foreignSource.addPolicy(policy);
m_foreignSourceRepository = new MockForeignSourceRepository();
m_foreignSourceRepository.save(m_foreignSource);
final ForeignSource emptyForeignSource = new ForeignSource();
emptyForeignSource.setName("empty");
emptyForeignSource.setScanInterval(Duration.standardDays(1));
m_foreignSourceRepository.save(emptyForeignSource);
final ForeignSource snmpForeignSource = new ForeignSource();
snmpForeignSource.setName("snmp");
snmpForeignSource.setScanInterval(Duration.standardDays(1));
final PluginConfig snmpDetector = new PluginConfig("SNMP", SnmpDetector.class.getName());
snmpForeignSource.addDetector(snmpDetector);
m_foreignSourceRepository.save(snmpForeignSource);
m_foreignSourceRepository.flush();
m_provisionService.setForeignSourceRepository(m_foreignSourceRepository);
// make sure node scan scheduler is running initially
getScanExecutor().resume();
getScheduledExecutor().pause();
}
use of org.opennms.netmgt.model.OnmsDistPoller in project opennms by OpenNMS.
the class BlueprintDistPollerDaoMinionIT method testDistPollerDao.
@Test
public void testDistPollerDao() throws Exception {
DistPollerDao dao = getOsgiService(DistPollerDao.class);
assertEquals(1, dao.countAll());
// Test get()
OnmsDistPoller poller = dao.get(DistPollerDao.DEFAULT_DIST_POLLER_ID);
assertNotNull(poller);
assertEquals(DistPollerDao.DEFAULT_DIST_POLLER_ID, poller.getId());
assertEquals(DistPollerDao.DEFAULT_DIST_POLLER_ID, poller.getLabel());
assertEquals(LOCATION, poller.getLocation());
assertEquals(OnmsMonitoringSystem.TYPE_MINION, poller.getType());
// Test whoami()
poller = dao.whoami();
assertNotNull(poller);
assertEquals(DistPollerDao.DEFAULT_DIST_POLLER_ID, poller.getId());
assertEquals(DistPollerDao.DEFAULT_DIST_POLLER_ID, poller.getLabel());
assertEquals(LOCATION, poller.getLocation());
assertEquals(OnmsMonitoringSystem.TYPE_MINION, poller.getType());
}
use of org.opennms.netmgt.model.OnmsDistPoller in project opennms by OpenNMS.
the class MockDistPollerDao method whoami.
@Override
public OnmsDistPoller whoami() {
final OnmsDistPoller defaultDistPoller = get(DEFAULT_DIST_POLLER_ID);
if (defaultDistPoller != null) {
return defaultDistPoller;
}
final OnmsDistPoller whoami = new OnmsDistPoller();
whoami.setId(DEFAULT_DIST_POLLER_ID);
whoami.setLabel("localhost");
whoami.setLocation(MonitoringLocationDao.DEFAULT_MONITORING_LOCATION_ID);
return whoami;
}
use of org.opennms.netmgt.model.OnmsDistPoller in project opennms by OpenNMS.
the class DistPollerDaoIT method testCreate.
@Test
@Transactional
public void testCreate() {
OnmsDistPoller distPoller = new OnmsDistPoller("otherpoller");
distPoller.setLabel("otherpoller");
distPoller.setLocation(MonitoringLocationDao.DEFAULT_MONITORING_LOCATION_ID);
distPoller.setType(OnmsMonitoringSystem.TYPE_OPENNMS);
getDistPollerDao().save(distPoller);
}
Aggregations