use of org.opennms.web.rest.v2.bsm.model.edge.ReductionKeyEdgeResponseDTO in project opennms by OpenNMS.
the class ReductionKeyEdgeResponseDTOMarshalTest method data.
@Parameterized.Parameters
public static Collection<Object[]> data() throws IOException {
MapFunctionDTO mapFunctionDTO = new MapFunctionDTO();
mapFunctionDTO.getProperties().put("key1", "value1");
mapFunctionDTO.setType("SetTo");
ReductionKeyEdgeResponseDTO edge = new ReductionKeyEdgeResponseDTO();
edge.setLocation(new ResourceLocation(ApiVersion.Version2, "business-services", "edges", "1"));
edge.setReductionKey("my-custom-reduction-key");
edge.setOperationalStatus(Status.WARNING);
edge.setMapFunction(mapFunctionDTO);
edge.setId(1);
edge.setWeight(17);
edge.setFriendlyName("reduction-key-friendly-name");
return Arrays.asList(new Object[][] { { ReductionKeyEdgeResponseDTO.class, edge, "{" + " \"id\" : 1," + " \"operational-status\" : \"WARNING\"," + " \"map-function\" : {" + " \"type\" : \"SetTo\"," + " \"properties\" : {" + " \"key1\" : \"value1\"" + " }" + " }," + " \"location\" : \"/api/v2/business-services/edges/1\"," + " \"reduction-keys\" : [" + " \"my-custom-reduction-key\"" + " ]," + " \"weight\" : 17," + " \"friendly-name\" : \"reduction-key-friendly-name\"," + "}", "<reduction-key-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>my-custom-reduction-key</reduction-key>\n" + " </reduction-keys>\n" + " <weight>17</weight>\n" + " <friendly-name>reduction-key-friendly-name</friendly-name>\n" + "</reduction-key-edge>" } });
}
use of org.opennms.web.rest.v2.bsm.model.edge.ReductionKeyEdgeResponseDTO in project opennms by OpenNMS.
the class BsmTestUtils method toResponseDTO.
public static ReductionKeyEdgeResponseDTO toResponseDTO(SingleReductionKeyEdgeEntity input) {
ReductionKeyEdgeResponseDTO edge = new ReductionKeyEdgeResponseDTO();
edge.setLocation(ResourceLocationFactory.createBusinessServiceEdgeLocation(input.getBusinessService().getId(), input.getId()));
edge.setReductionKeys(input.getReductionKeys());
edge.setReductionKey(input.getReductionKey());
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.ReductionKeyEdgeResponseDTO in project opennms by OpenNMS.
the class BusinessServiceResponseDTOMarshalTest method createReductionKeyEdgeResponse.
private static ReductionKeyEdgeResponseDTO createReductionKeyEdgeResponse(long id, String reductionKey, MapFunctionDTO mapFunctionDTO, Status status, ResourceLocation location, String friendlyName) {
ReductionKeyEdgeResponseDTO responseDTO = new ReductionKeyEdgeResponseDTO();
responseDTO.setOperationalStatus(status);
responseDTO.setId(id);
responseDTO.setWeight(9);
responseDTO.setLocation(location);
responseDTO.setReductionKeys(Sets.newHashSet(reductionKey));
responseDTO.setMapFunction(mapFunctionDTO);
responseDTO.setFriendlyName(friendlyName);
return responseDTO;
}
use of org.opennms.web.rest.v2.bsm.model.edge.ReductionKeyEdgeResponseDTO in project opennms by OpenNMS.
the class BusinessServiceRestService method transform.
private ReductionKeyEdgeResponseDTO transform(ReductionKeyEdge edge) {
final ReductionKeyEdgeResponseDTO response = new ReductionKeyEdgeResponseDTO();
response.setId(edge.getId());
response.setOperationalStatus(edge.getOperationalStatus());
response.setReductionKey(edge.getReductionKey());
response.setLocation(ResourceLocationFactory.createBusinessServiceEdgeLocation(edge.getSource().getId(), edge.getId()));
response.setReductionKeys(edge.getReductionKeys());
response.setMapFunction(transform(edge.getMapFunction()));
response.setWeight(edge.getWeight());
response.setFriendlyName(edge.getFriendlyName());
return response;
}
Aggregations