use of org.opennms.web.rest.v2.bsm.model.edge.ChildEdgeResponseDTO in project opennms by OpenNMS.
the class BusinessServiceRestService method transform.
private ChildEdgeResponseDTO transform(ChildEdge edge) {
final ChildEdgeResponseDTO response = new ChildEdgeResponseDTO();
response.setId(edge.getId());
response.setChildId(edge.getChild().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());
return response;
}
use of org.opennms.web.rest.v2.bsm.model.edge.ChildEdgeResponseDTO in project opennms by OpenNMS.
the class BusinessServiceResponseDTOMarshalTest method createChildEdgeResponse.
private static ChildEdgeResponseDTO createChildEdgeResponse(long id, long childId, MapFunctionDTO mapFunctionDTO, Status status, ResourceLocation location) {
ChildEdgeResponseDTO responseDTO = new ChildEdgeResponseDTO();
responseDTO.setOperationalStatus(status);
responseDTO.setId(id);
responseDTO.setLocation(location);
responseDTO.setChildId(childId);
responseDTO.setWeight(7);
responseDTO.setMapFunction(mapFunctionDTO);
return responseDTO;
}
use of org.opennms.web.rest.v2.bsm.model.edge.ChildEdgeResponseDTO in project opennms by OpenNMS.
the class ChildEdgeResponseDTOMarshalTest method data.
@Parameterized.Parameters
public static Collection<Object[]> data() throws IOException {
MapFunctionDTO mapFunctionDTO = new MapFunctionDTO();
mapFunctionDTO.getProperties().put("key1", "value1");
mapFunctionDTO.setType("SetTo");
ChildEdgeResponseDTO edge = new ChildEdgeResponseDTO();
edge.setLocation(new ResourceLocation(ApiVersion.Version2, "business-services", "edges", "1"));
edge.setOperationalStatus(Status.WARNING);
edge.getReductionKeys().add("key1");
edge.getReductionKeys().add("key2");
edge.setMapFunction(mapFunctionDTO);
edge.setChildId(127L);
edge.setWeight(20);
edge.setId(1);
return Arrays.asList(new Object[][] { { ChildEdgeResponseDTO.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," + " \"child-id\" : 127" + "}", "<child-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" + " <child-id>127</child-id>" + "</child-edge>" } });
}
use of org.opennms.web.rest.v2.bsm.model.edge.ChildEdgeResponseDTO in project opennms by OpenNMS.
the class BsmTestUtils method toResponseDTO.
public static ChildEdgeResponseDTO toResponseDTO(BusinessServiceChildEdgeEntity input) {
ChildEdgeResponseDTO edge = new ChildEdgeResponseDTO();
edge.setLocation(ResourceLocationFactory.createBusinessServiceEdgeLocation(input.getBusinessService().getId(), input.getId()));
edge.setReductionKeys(edge.getReductionKeys());
edge.setMapFunction(transform(input.getMapFunction()));
edge.setId(input.getId());
edge.setChildId(input.getChild().getId());
edge.setWeight(input.getWeight());
// we assume INDETERMINATE
edge.setOperationalStatus(Status.INDETERMINATE);
return edge;
}
Aggregations