@Test public void mapFlowToFlowRequestTest() { FlowRequest flowRequest = RequestedFlowMapper.INSTANCE.toFlowRequest(flow); assertEquals(FLOW_ID, flowRequest.getFlowId()); assertEquals(SRC_SWITCH_ID, flowRequest.getSource().getSwitchId()); assertEquals(SRC_PORT, flowRequest.getSource().getPortNumber()); assertEquals(SRC_VLAN, flowRequest.getSource().getOuterVlanId()); assertEquals(DST_SWITCH_ID, flowRequest.getDestination().getSwitchId()); assertEquals(DST_PORT, flowRequest.getDestination().getPortNumber()); assertEquals(DST_VLAN, flowRequest.getDestination().getOuterVlanId()); assertEquals(PRIORITY, flowRequest.getPriority()); assertEquals(DESCRIPTION, flowRequest.getDescription()); assertEquals(BANDWIDTH, flowRequest.getBandwidth()); assertEquals(MAX_LATENCY, flowRequest.getMaxLatency()); assertEquals(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN, flowRequest.getEncapsulationType()); assertEquals(PATH_COMPUTATION_STRATEGY, flowRequest.getPathComputationStrategy()); assertTrue(flowRequest.isPinned()); assertTrue(flowRequest.isAllocateProtectedPath()); assertTrue(flowRequest.isIgnoreBandwidth()); assertTrue(flowRequest.isPeriodicPings()); assertEquals(new DetectConnectedDevicesDto(true, true, true, true, true, true, true, true), flowRequest.getDetectConnectedDevices()); }
@Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), flow.getDestVlan()))") @Mapping(target = "encapsulationType", source = "encapsulationType") @Mapping(target = "pathComputationStrategy", expression = "java(java.util.Optional.ofNullable(flow.getPathComputationStrategy())" + ".map(pcs -> pcs.toString().toLowerCase())" + ".orElse(null))") @Mapping(target = "bandwidth", source = "bandwidth") @Mapping(target = "ignoreBandwidth", source = "ignoreBandwidth") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(target = "allocateProtectedPath", source = "allocateProtectedPath") @Mapping(target = "description", source = "description") @Mapping(target = "maxLatency", source = "maxLatency") @Mapping(target = "priority", source = "priority") @Mapping(target = "pinned", source = "pinned") @Mapping(target = "detectConnectedDevices", source = "detectConnectedDevices") @Mapping(target = "transitEncapsulationId", ignore = true) @Mapping(target = "diverseFlowId", ignore = true) @Mapping(target = "type", ignore = true) @Mapping(target = "bulkUpdateFlowIds", ignore = true) @Mapping(target = "doNotRevert", ignore = true) public abstract FlowRequest toFlowRequest(Flow flow);
RequestedFlowMapper { @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), flow.getDestVlan()))") @Mapping(target = "encapsulationType", source = "encapsulationType") @Mapping(target = "pathComputationStrategy", expression = "java(java.util.Optional.ofNullable(flow.getPathComputationStrategy())" + ".map(pcs -> pcs.toString().toLowerCase())" + ".orElse(null))") @Mapping(target = "bandwidth", source = "bandwidth") @Mapping(target = "ignoreBandwidth", source = "ignoreBandwidth") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(target = "allocateProtectedPath", source = "allocateProtectedPath") @Mapping(target = "description", source = "description") @Mapping(target = "maxLatency", source = "maxLatency") @Mapping(target = "priority", source = "priority") @Mapping(target = "pinned", source = "pinned") @Mapping(target = "detectConnectedDevices", source = "detectConnectedDevices") @Mapping(target = "transitEncapsulationId", ignore = true) @Mapping(target = "diverseFlowId", ignore = true) @Mapping(target = "type", ignore = true) @Mapping(target = "bulkUpdateFlowIds", ignore = true) @Mapping(target = "doNotRevert", ignore = true) public abstract FlowRequest toFlowRequest(Flow flow); }
RequestedFlowMapper { @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), flow.getDestVlan()))") @Mapping(target = "encapsulationType", source = "encapsulationType") @Mapping(target = "pathComputationStrategy", expression = "java(java.util.Optional.ofNullable(flow.getPathComputationStrategy())" + ".map(pcs -> pcs.toString().toLowerCase())" + ".orElse(null))") @Mapping(target = "bandwidth", source = "bandwidth") @Mapping(target = "ignoreBandwidth", source = "ignoreBandwidth") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(target = "allocateProtectedPath", source = "allocateProtectedPath") @Mapping(target = "description", source = "description") @Mapping(target = "maxLatency", source = "maxLatency") @Mapping(target = "priority", source = "priority") @Mapping(target = "pinned", source = "pinned") @Mapping(target = "detectConnectedDevices", source = "detectConnectedDevices") @Mapping(target = "transitEncapsulationId", ignore = true) @Mapping(target = "diverseFlowId", ignore = true) @Mapping(target = "type", ignore = true) @Mapping(target = "bulkUpdateFlowIds", ignore = true) @Mapping(target = "doNotRevert", ignore = true) public abstract FlowRequest toFlowRequest(Flow flow);  }
RequestedFlowMapper { @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), flow.getDestVlan()))") @Mapping(target = "encapsulationType", source = "encapsulationType") @Mapping(target = "pathComputationStrategy", expression = "java(java.util.Optional.ofNullable(flow.getPathComputationStrategy())" + ".map(pcs -> pcs.toString().toLowerCase())" + ".orElse(null))") @Mapping(target = "bandwidth", source = "bandwidth") @Mapping(target = "ignoreBandwidth", source = "ignoreBandwidth") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(target = "allocateProtectedPath", source = "allocateProtectedPath") @Mapping(target = "description", source = "description") @Mapping(target = "maxLatency", source = "maxLatency") @Mapping(target = "priority", source = "priority") @Mapping(target = "pinned", source = "pinned") @Mapping(target = "detectConnectedDevices", source = "detectConnectedDevices") @Mapping(target = "transitEncapsulationId", ignore = true) @Mapping(target = "diverseFlowId", ignore = true) @Mapping(target = "type", ignore = true) @Mapping(target = "bulkUpdateFlowIds", ignore = true) @Mapping(target = "doNotRevert", ignore = true) public abstract FlowRequest toFlowRequest(Flow flow);  @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), flow.getDestVlan()))") @Mapping(target = "encapsulationType", source = "encapsulationType") @Mapping(target = "pathComputationStrategy", expression = "java(java.util.Optional.ofNullable(flow.getPathComputationStrategy())" + ".map(pcs -> pcs.toString().toLowerCase())" + ".orElse(null))") @Mapping(target = "bandwidth", source = "bandwidth") @Mapping(target = "ignoreBandwidth", source = "ignoreBandwidth") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(target = "allocateProtectedPath", source = "allocateProtectedPath") @Mapping(target = "description", source = "description") @Mapping(target = "maxLatency", source = "maxLatency") @Mapping(target = "priority", source = "priority") @Mapping(target = "pinned", source = "pinned") @Mapping(target = "detectConnectedDevices", source = "detectConnectedDevices") @Mapping(target = "transitEncapsulationId", ignore = true) @Mapping(target = "diverseFlowId", ignore = true) @Mapping(target = "type", ignore = true) @Mapping(target = "bulkUpdateFlowIds", ignore = true) @Mapping(target = "doNotRevert", ignore = true) abstract FlowRequest toFlowRequest(Flow flow); }
RequestedFlowMapper { @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), flow.getDestVlan()))") @Mapping(target = "encapsulationType", source = "encapsulationType") @Mapping(target = "pathComputationStrategy", expression = "java(java.util.Optional.ofNullable(flow.getPathComputationStrategy())" + ".map(pcs -> pcs.toString().toLowerCase())" + ".orElse(null))") @Mapping(target = "bandwidth", source = "bandwidth") @Mapping(target = "ignoreBandwidth", source = "ignoreBandwidth") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(target = "allocateProtectedPath", source = "allocateProtectedPath") @Mapping(target = "description", source = "description") @Mapping(target = "maxLatency", source = "maxLatency") @Mapping(target = "priority", source = "priority") @Mapping(target = "pinned", source = "pinned") @Mapping(target = "detectConnectedDevices", source = "detectConnectedDevices") @Mapping(target = "transitEncapsulationId", ignore = true) @Mapping(target = "diverseFlowId", ignore = true) @Mapping(target = "type", ignore = true) @Mapping(target = "bulkUpdateFlowIds", ignore = true) @Mapping(target = "doNotRevert", ignore = true) public abstract FlowRequest toFlowRequest(Flow flow);  @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), flow.getDestVlan()))") @Mapping(target = "encapsulationType", source = "encapsulationType") @Mapping(target = "pathComputationStrategy", expression = "java(java.util.Optional.ofNullable(flow.getPathComputationStrategy())" + ".map(pcs -> pcs.toString().toLowerCase())" + ".orElse(null))") @Mapping(target = "bandwidth", source = "bandwidth") @Mapping(target = "ignoreBandwidth", source = "ignoreBandwidth") @Mapping(target = "periodicPings", source = "periodicPings") @Mapping(target = "allocateProtectedPath", source = "allocateProtectedPath") @Mapping(target = "description", source = "description") @Mapping(target = "maxLatency", source = "maxLatency") @Mapping(target = "priority", source = "priority") @Mapping(target = "pinned", source = "pinned") @Mapping(target = "detectConnectedDevices", source = "detectConnectedDevices") @Mapping(target = "transitEncapsulationId", ignore = true) @Mapping(target = "diverseFlowId", ignore = true) @Mapping(target = "type", ignore = true) @Mapping(target = "bulkUpdateFlowIds", ignore = true) @Mapping(target = "doNotRevert", ignore = true) abstract FlowRequest toFlowRequest(Flow flow); static final RequestedFlowMapper INSTANCE; }