@Test public void testGetServiceConfigInvalidServiceId() { try { m_provisioner.getServiceConfiguration("default", "invalid"); fail("Expected exception"); } catch (IllegalArgumentException e) { } }
@Test public void testGetServiceConfigNullPkgName() { try { m_provisioner.getServiceConfiguration(null, "ICMP"); fail("Expected exception"); } catch (NullPointerException e) { } }
@Test public void testGetServiceConfigNullServiceId() { try { m_provisioner.getServiceConfiguration("default", null); fail("Expected exception"); } catch (NullPointerException e) { } }
private Map<String, Object> checkServiceConfiguration( String pkgName, String svcName, int retries, int timeout, int interval, int downtimeInterval, int downtimeDuration) throws Exception { Map<String, Object> configParams = m_provisioner.getServiceConfiguration(pkgName, svcName); assertEquals(svcName, configParams.get("serviceid")); assertEquals(Integer.valueOf(interval), configParams.get("interval")); assertEquals(Integer.valueOf(downtimeInterval), configParams.get("downtime_interval")); assertEquals(Integer.valueOf(downtimeDuration), configParams.get("downtime_duration")); assertNull(configParams.get("downtime_interval1")); assertNull(configParams.get("downtime_duration1")); assertEquals(Integer.valueOf(retries), configParams.get("retries")); assertEquals(Integer.valueOf(timeout), configParams.get("timeout")); TestPollerConfigManager mgr = new TestPollerConfigManager(m_pollerConfig.getXml(), "localhost", false); Package pkg = mgr.getPackage(pkgName); assertNotNull(pkg); Service svc = mgr.getServiceInPackage(svcName, pkg); assertNotNull(svc); assertEquals(interval, svc.getInterval()); assertNotNull( "Unables to find monitor for svc " + svcName + " in origonal config", m_pollerConfig.getServiceMonitor(svcName)); assertNotNull("Unable to find monitor for svc " + svcName, mgr.getServiceMonitor(svcName)); assertNotNull( "Unable to find protocol plugin in capsdConfig for svc " + svcName, m_capsdConfig.getProtocolPlugin(svcName)); assertNotNull( "Unable to find service table entry in capsdConfig for svc " + svcName, m_syncer.getServiceId(svcName)); return configParams; }