Search in sources :

Example 1 with IpServiceResponseDTO

use of org.opennms.web.rest.v2.bsm.model.edge.IpServiceResponseDTO 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;
}
Also used : IpServiceEdgeResponseDTO(org.opennms.web.rest.v2.bsm.model.edge.IpServiceEdgeResponseDTO)

Example 2 with IpServiceResponseDTO

use of org.opennms.web.rest.v2.bsm.model.edge.IpServiceResponseDTO in project opennms by OpenNMS.

the class IpServiceResponseDTOMarshalTest 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"));
    return Arrays.asList(new Object[][] { { IpServiceResponseDTO.class, ipService, "{" + "   \"id\" : 17," + "   \"location\" : \"/api/v2/business-services/ip-services/17\"," + "   \"ip-address\" : \"1.1.1.1\"," + "   \"node-label\" : \"dummy\"," + "   \"service-name\" : \"ICMP\"" + "}", "<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>" } });
}
Also used : ResourceLocation(org.opennms.web.rest.api.ResourceLocation) IpServiceResponseDTO(org.opennms.web.rest.v2.bsm.model.edge.IpServiceResponseDTO)

Example 3 with IpServiceResponseDTO

use of org.opennms.web.rest.v2.bsm.model.edge.IpServiceResponseDTO in project opennms by OpenNMS.

the class BusinessServiceRestService method transform.

private IpServiceResponseDTO transform(IpService input) {
    IpServiceResponseDTO response = new IpServiceResponseDTO();
    response.setId(input.getId());
    response.setNodeLabel(input.getNodeLabel());
    response.setServiceName(input.getServiceName());
    response.setIpAddress(input.getIpAddress());
    response.setLocation(ResourceLocationFactory.createIpServiceLocation(String.valueOf(input.getId())));
    return response;
}
Also used : IpServiceResponseDTO(org.opennms.web.rest.v2.bsm.model.edge.IpServiceResponseDTO)

Example 4 with IpServiceResponseDTO

use of org.opennms.web.rest.v2.bsm.model.edge.IpServiceResponseDTO 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;
}
Also used : IpServiceEdgeResponseDTO(org.opennms.web.rest.v2.bsm.model.edge.IpServiceEdgeResponseDTO) IpServiceResponseDTO(org.opennms.web.rest.v2.bsm.model.edge.IpServiceResponseDTO)

Example 5 with IpServiceResponseDTO

use of org.opennms.web.rest.v2.bsm.model.edge.IpServiceResponseDTO in project opennms by OpenNMS.

the class BusinessServiceResponseDTOMarshalTest method createIpServiceResponse.

private static IpServiceResponseDTO createIpServiceResponse() {
    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"));
    return ipService;
}
Also used : ResourceLocation(org.opennms.web.rest.api.ResourceLocation) IpServiceResponseDTO(org.opennms.web.rest.v2.bsm.model.edge.IpServiceResponseDTO)

Aggregations

IpServiceResponseDTO (org.opennms.web.rest.v2.bsm.model.edge.IpServiceResponseDTO)4 ResourceLocation (org.opennms.web.rest.api.ResourceLocation)3 IpServiceEdgeResponseDTO (org.opennms.web.rest.v2.bsm.model.edge.IpServiceEdgeResponseDTO)2 MapFunctionDTO (org.opennms.web.rest.v2.bsm.model.MapFunctionDTO)1