Search in sources :

Example 11 with MapFunctionDTO

use of org.opennms.web.rest.v2.bsm.model.MapFunctionDTO 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>" } });
}
Also used : MapFunctionDTO(org.opennms.web.rest.v2.bsm.model.MapFunctionDTO) ResourceLocation(org.opennms.web.rest.api.ResourceLocation)

Example 12 with MapFunctionDTO

use of org.opennms.web.rest.v2.bsm.model.MapFunctionDTO 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>" } });
}
Also used : MapFunctionDTO(org.opennms.web.rest.v2.bsm.model.MapFunctionDTO) ResourceLocation(org.opennms.web.rest.api.ResourceLocation)

Example 13 with MapFunctionDTO

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

the class BsmTestUtils method transform.

private static MapFunctionDTO transform(AbstractMapFunctionEntity input) {
    Objects.requireNonNull(input);
    MapFunction mapFunction = new MapFunctionMapper().toServiceFunction(input);
    return new FunctionsManager().getMapFunctionDTO(mapFunction);
}
Also used : FunctionsManager(org.opennms.web.rest.v2.bsm.model.meta.FunctionsManager) MapFunction(org.opennms.netmgt.bsm.service.model.functions.map.MapFunction)

Aggregations

ResourceLocation (org.opennms.web.rest.api.ResourceLocation)4 MapFunctionDTO (org.opennms.web.rest.v2.bsm.model.MapFunctionDTO)4 HighestSeverity (org.opennms.netmgt.bsm.service.model.functions.reduce.HighestSeverity)2 TestHelper.createMapFunctionDTO (org.opennms.web.rest.v2.bsm.model.TestHelper.createMapFunctionDTO)2 Ignore (org.opennms.netmgt.bsm.service.model.functions.map.Ignore)1 Increase (org.opennms.netmgt.bsm.service.model.functions.map.Increase)1 MapFunction (org.opennms.netmgt.bsm.service.model.functions.map.MapFunction)1 SetTo (org.opennms.netmgt.bsm.service.model.functions.map.SetTo)1 ChildEdgeRequestDTO (org.opennms.web.rest.v2.bsm.model.edge.ChildEdgeRequestDTO)1 ChildEdgeResponseDTO (org.opennms.web.rest.v2.bsm.model.edge.ChildEdgeResponseDTO)1 IpServiceEdgeRequestDTO (org.opennms.web.rest.v2.bsm.model.edge.IpServiceEdgeRequestDTO)1 IpServiceEdgeResponseDTO (org.opennms.web.rest.v2.bsm.model.edge.IpServiceEdgeResponseDTO)1 ReductionKeyEdgeRequestDTO (org.opennms.web.rest.v2.bsm.model.edge.ReductionKeyEdgeRequestDTO)1 ReductionKeyEdgeResponseDTO (org.opennms.web.rest.v2.bsm.model.edge.ReductionKeyEdgeResponseDTO)1 FunctionsManager (org.opennms.web.rest.v2.bsm.model.meta.FunctionsManager)1