use of org.opennms.web.rest.v2.bsm.model.edge.IpServiceEdgeResponseDTO in project opennms by OpenNMS.
the class BusinessServiceRestService method transform.
private IpServiceEdgeResponseDTO transform(IpServiceEdge edge) {
final IpServiceEdgeResponseDTO response = new IpServiceEdgeResponseDTO();
response.setId(edge.getId());
response.setOperationalStatus(edge.getOperationalStatus());
response.setLocation(ResourceLocationFactory.createBusinessServiceEdgeLocation(edge.getSource().getId(), edge.getId()));
response.setReductionKeys(edge.getReductionKeys());
response.setMapFunction(transform(edge.getMapFunction()));
response.setWeight(edge.getWeight());
response.setIpService(transform(edge.getIpService()));
response.setFriendlyName(edge.getFriendlyName());
return response;
}
use of org.opennms.web.rest.v2.bsm.model.edge.IpServiceEdgeResponseDTO in project opennms by OpenNMS.
the class BusinessServiceResponseDTOMarshalTest method createIpServiceEdgeResponse.
private static IpServiceEdgeResponseDTO createIpServiceEdgeResponse(long id, IpServiceResponseDTO ipServiceResponseDTO, MapFunctionDTO mapFunctionDTO, Status status, ResourceLocation location, String friendlyName) {
IpServiceEdgeResponseDTO responseDTO = new IpServiceEdgeResponseDTO();
responseDTO.setOperationalStatus(status);
responseDTO.setId(id);
responseDTO.setLocation(location);
responseDTO.getReductionKeys().add("key1");
responseDTO.getReductionKeys().add("key2");
responseDTO.setIpService(ipServiceResponseDTO);
responseDTO.setWeight(5);
responseDTO.setMapFunction(mapFunctionDTO);
responseDTO.setFriendlyName(friendlyName);
return responseDTO;
}
use of org.opennms.web.rest.v2.bsm.model.edge.IpServiceEdgeResponseDTO in project opennms by OpenNMS.
the class BsmTestUtils method toResponseDTO.
public static IpServiceEdgeResponseDTO toResponseDTO(IPServiceEdgeEntity input) {
IpServiceResponseDTO ipService = new IpServiceResponseDTO();
// do not know that here
ipService.setNodeLabel("dummy");
ipService.setServiceName(input.getIpService().getServiceName());
ipService.setId(input.getIpService().getId());
ipService.setIpAddress(InetAddressUtils.toIpAddrString(input.getIpService().getIpAddress()));
IpServiceEdgeResponseDTO edge = new IpServiceEdgeResponseDTO();
edge.setLocation(ResourceLocationFactory.createBusinessServiceEdgeLocation(input.getBusinessService().getId(), input.getId()));
edge.setReductionKeys(ReductionKeyHelper.getReductionKeys(input.getIpService()));
edge.setIpService(ipService);
edge.setMapFunction(transform(input.getMapFunction()));
edge.setId(input.getId());
edge.setWeight(input.getWeight());
edge.setFriendlyName(input.getFriendlyName());
// we assume INDETERMINATE
edge.setOperationalStatus(Status.INDETERMINATE);
return edge;
}
use of org.opennms.web.rest.v2.bsm.model.edge.IpServiceEdgeResponseDTO in project opennms by OpenNMS.
the class IpServiceEdgeResponseDTOMarshalTest method data.
@Parameterized.Parameters
public static Collection<Object[]> data() throws IOException {
IpServiceResponseDTO ipService = new IpServiceResponseDTO();
ipService.setId(17);
ipService.setIpAddress("1.1.1.1");
ipService.setNodeLabel("dummy");
ipService.setServiceName("ICMP");
ipService.setLocation(new ResourceLocation(ApiVersion.Version2, "business-services", "ip-services", "17"));
MapFunctionDTO mapFunctionDTO = new MapFunctionDTO();
mapFunctionDTO.getProperties().put("key1", "value1");
mapFunctionDTO.setType("SetTo");
IpServiceEdgeResponseDTO edge = new IpServiceEdgeResponseDTO();
edge.setLocation(new ResourceLocation(ApiVersion.Version2, "business-services", "edges", "1"));
edge.setIpService(ipService);
edge.setOperationalStatus(Status.WARNING);
edge.getReductionKeys().add("key1");
edge.getReductionKeys().add("key2");
edge.setFriendlyName("ip-service-friendly-name");
edge.setWeight(20);
edge.setMapFunction(mapFunctionDTO);
edge.setId(1);
return Arrays.asList(new Object[][] { { IpServiceEdgeResponseDTO.class, edge, "{" + " \"id\" : 1," + " \"operational-status\" : \"WARNING\"," + " \"map-function\" : {" + " \"type\" : \"SetTo\"," + " \"properties\" : {" + " \"key1\" : \"value1\"" + " }" + " }," + " \"location\" : \"/api/v2/business-services/edges/1\"," + " \"reduction-keys\" : [" + " \"key1\", \"key2\"" + " ]," + " \"weight\" : 20," + " \"ip-service\" : {" + " \"id\" : 17," + " \"location\" : \"/api/v2/business-services/ip-services/17\"," + " \"ip-address\" : \"1.1.1.1\"," + " \"node-label\" : \"dummy\"," + " \"service-name\" : \"ICMP\"" + " }," + " \"friendly-name\" : \"ip-service-friendly-name\"" + "}", "<ip-service-edge>\n" + " <id>1</id>\n" + " <operational-status>WARNING</operational-status>\n" + " <map-function>\n" + " <type>SetTo</type>\n" + " <properties>\n" + " <entry>\n" + " <key>key1</key>\n" + " <value>value1</value>\n" + " </entry>\n" + " </properties>\n" + " </map-function>\n" + " <location>/api/v2/business-services/edges/1</location>\n" + " <reduction-keys>\n" + " <reduction-key>key1</reduction-key>\n" + " <reduction-key>key2</reduction-key>\n" + " </reduction-keys>\n" + " <weight>20</weight>\n" + " <ip-service>\n" + " <id>17</id>\n" + " <service-name>ICMP</service-name>\n" + " <node-label>dummy</node-label>\n" + " <ip-address>1.1.1.1</ip-address>\n" + " <location>/api/v2/business-services/ip-services/17</location>\n" + " </ip-service>\n" + " <friendly-name>ip-service-friendly-name</friendly-name>\n" + "</ip-service-edge>" } });
}
Aggregations