use of org.opennms.netmgt.config.poller.Parameter in project opennms by OpenNMS.
the class PollerBackEndTest method addParameterToService.
private static void addParameterToService(Service pkgService, String key, String value) {
Parameter param = new Parameter();
param.setKey(key);
param.setValue(value);
pkgService.addParameter(param);
}
use of org.opennms.netmgt.config.poller.Parameter in project opennms by OpenNMS.
the class PollerBackEndTest method addParameter.
private void addParameter(Service service, String key, String value) {
Parameter param = new Parameter();
param.setKey(key);
param.setValue(value);
service.addParameter(param);
}
use of org.opennms.netmgt.config.poller.Parameter in project opennms by OpenNMS.
the class MockPollerConfig method addParameter.
public void addParameter(final String key, final String value) {
final Parameter param = new Parameter();
param.setKey(key);
param.setValue(value);
m_currentSvc.addParameter(param);
}
use of org.opennms.netmgt.config.poller.Parameter in project opennms by OpenNMS.
the class DefaultPollerBackEndTest method getParameterMapMarshallsPageSequenceParameters.
/**
* Verifies that {@link PageSequence} type parameters are marshalled to XML.
*/
@Test
public void getParameterMapMarshallsPageSequenceParameters() {
final PageSequence ps = new PageSequence();
Page page = new Page();
page.setMethod("GET");
page.setHttpVersion("1.1");
page.setScheme("http");
page.setHost("${ipaddr}");
page.setDisableSslVerification("true");
page.setPort(7080);
page.setPath("/Login.do");
page.setSuccessMatch("w00t");
page.setResponseRange("100-399");
ps.addPage(page);
Parameter paramWithPageSequenceValue = new Parameter();
paramWithPageSequenceValue.setKey("psm");
paramWithPageSequenceValue.setAnyObject(ps);
Service svc = new Service();
svc.setParameters(Lists.newArrayList(paramWithPageSequenceValue));
Map<String, Object> params = DefaultPollerBackEnd.getParameterMap(svc);
PageSequence unmarshalledPs = JaxbUtils.unmarshal(PageSequence.class, (String) params.get("psm"));
assertEquals(ps, unmarshalledPs);
}
use of org.opennms.netmgt.config.poller.Parameter in project opennms by OpenNMS.
the class DefaultPollerBackEndTest method canConvertServiceParametersToSerializableMap.
/**
* Verifies that the parameter map generated for a given
* service is serializable.
*/
@Test
public void canConvertServiceParametersToSerializableMap() {
Parameter paramWithStringValue = new Parameter();
paramWithStringValue.setKey("a");
paramWithStringValue.setValue("test");
Parameter paramWithNullValue = new Parameter();
paramWithNullValue.setKey("b");
paramWithNullValue.setAnyObject(null);
Parameter paramWithNonSerializableObject = new Parameter();
paramWithNonSerializableObject.setKey("c");
// This can be any object, provided that it does not implement the Serializable interface
paramWithNonSerializableObject.setAnyObject(new DefaultPollerBackEndTest());
Service svc = new Service();
svc.setParameters(Lists.newArrayList(paramWithStringValue, paramWithNullValue, paramWithNonSerializableObject));
// Expect no exception to be thrown
SerializationUtils.serialize(DefaultPollerBackEnd.getParameterMap(svc));
}
Aggregations