@Test public void islMapperTest() { IslInfoData islInfoData = IslInfoData.builder() .latency(1L) .source(new PathNode(TEST_SWITCH_A_ID, 1, 0)) .destination(new PathNode(TEST_SWITCH_B_ID, 1, 1)) .speed(2L) .state(IslChangeType.DISCOVERED) .cost(700) .availableBandwidth(4L) .underMaintenance(false) .build(); Isl isl = IslMapper.INSTANCE.map(islInfoData); Assert.assertEquals(IslStatus.ACTIVE, isl.getStatus()); IslInfoData islInfoDataMapping = IslMapper.INSTANCE.map(isl); islInfoDataMapping.setState(IslChangeType.DISCOVERED); Assert.assertEquals(islInfoData, islInfoDataMapping); }
public IslInfoData map(Isl isl) { if (isl == null) { return null; } PathNode src = new PathNode(); src.setSwitchId(isl.getSrcSwitchId()); src.setPortNo(isl.getSrcPort()); src.setSegLatency(isl.getLatency()); src.setSeqId(0); PathNode dst = new PathNode(); dst.setSwitchId(isl.getDestSwitchId()); dst.setPortNo(isl.getDestPort()); dst.setSegLatency(isl.getLatency()); dst.setSeqId(1); Long timeCreateMillis = Optional.ofNullable(isl.getTimeCreate()).map(Instant::toEpochMilli).orElse(null); Long timeModifyMillis = Optional.ofNullable(isl.getTimeModify()).map(Instant::toEpochMilli).orElse(null); return new IslInfoData(isl.getLatency(), src, dst, isl.getSpeed(), isl.getAvailableBandwidth(), isl.getMaxBandwidth(), isl.getDefaultMaxBandwidth(), map(isl.getStatus()), map(isl.getActualStatus()), isl.getCost(), timeCreateMillis, timeModifyMillis, isl.isUnderMaintenance(), isl.isEnableBfd(), map(isl.getBfdSessionStatus()), null); }
IslMapper { public IslInfoData map(Isl isl) { if (isl == null) { return null; } PathNode src = new PathNode(); src.setSwitchId(isl.getSrcSwitchId()); src.setPortNo(isl.getSrcPort()); src.setSegLatency(isl.getLatency()); src.setSeqId(0); PathNode dst = new PathNode(); dst.setSwitchId(isl.getDestSwitchId()); dst.setPortNo(isl.getDestPort()); dst.setSegLatency(isl.getLatency()); dst.setSeqId(1); Long timeCreateMillis = Optional.ofNullable(isl.getTimeCreate()).map(Instant::toEpochMilli).orElse(null); Long timeModifyMillis = Optional.ofNullable(isl.getTimeModify()).map(Instant::toEpochMilli).orElse(null); return new IslInfoData(isl.getLatency(), src, dst, isl.getSpeed(), isl.getAvailableBandwidth(), isl.getMaxBandwidth(), isl.getDefaultMaxBandwidth(), map(isl.getStatus()), map(isl.getActualStatus()), isl.getCost(), timeCreateMillis, timeModifyMillis, isl.isUnderMaintenance(), isl.isEnableBfd(), map(isl.getBfdSessionStatus()), null); } }
IslMapper { public IslInfoData map(Isl isl) { if (isl == null) { return null; } PathNode src = new PathNode(); src.setSwitchId(isl.getSrcSwitchId()); src.setPortNo(isl.getSrcPort()); src.setSegLatency(isl.getLatency()); src.setSeqId(0); PathNode dst = new PathNode(); dst.setSwitchId(isl.getDestSwitchId()); dst.setPortNo(isl.getDestPort()); dst.setSegLatency(isl.getLatency()); dst.setSeqId(1); Long timeCreateMillis = Optional.ofNullable(isl.getTimeCreate()).map(Instant::toEpochMilli).orElse(null); Long timeModifyMillis = Optional.ofNullable(isl.getTimeModify()).map(Instant::toEpochMilli).orElse(null); return new IslInfoData(isl.getLatency(), src, dst, isl.getSpeed(), isl.getAvailableBandwidth(), isl.getMaxBandwidth(), isl.getDefaultMaxBandwidth(), map(isl.getStatus()), map(isl.getActualStatus()), isl.getCost(), timeCreateMillis, timeModifyMillis, isl.isUnderMaintenance(), isl.isEnableBfd(), map(isl.getBfdSessionStatus()), null); }  }
IslMapper { public IslInfoData map(Isl isl) { if (isl == null) { return null; } PathNode src = new PathNode(); src.setSwitchId(isl.getSrcSwitchId()); src.setPortNo(isl.getSrcPort()); src.setSegLatency(isl.getLatency()); src.setSeqId(0); PathNode dst = new PathNode(); dst.setSwitchId(isl.getDestSwitchId()); dst.setPortNo(isl.getDestPort()); dst.setSegLatency(isl.getLatency()); dst.setSeqId(1); Long timeCreateMillis = Optional.ofNullable(isl.getTimeCreate()).map(Instant::toEpochMilli).orElse(null); Long timeModifyMillis = Optional.ofNullable(isl.getTimeModify()).map(Instant::toEpochMilli).orElse(null); return new IslInfoData(isl.getLatency(), src, dst, isl.getSpeed(), isl.getAvailableBandwidth(), isl.getMaxBandwidth(), isl.getDefaultMaxBandwidth(), map(isl.getStatus()), map(isl.getActualStatus()), isl.getCost(), timeCreateMillis, timeModifyMillis, isl.isUnderMaintenance(), isl.isEnableBfd(), map(isl.getBfdSessionStatus()), null); }  IslInfoData map(Isl isl); org.openkilda.model.Isl map(IslInfoData islInfoData); IslChangeType map(IslStatus status); IslStatus map(IslChangeType status); BfdSessionStatus map(String raw); String map(BfdSessionStatus status); }
IslMapper { public IslInfoData map(Isl isl) { if (isl == null) { return null; } PathNode src = new PathNode(); src.setSwitchId(isl.getSrcSwitchId()); src.setPortNo(isl.getSrcPort()); src.setSegLatency(isl.getLatency()); src.setSeqId(0); PathNode dst = new PathNode(); dst.setSwitchId(isl.getDestSwitchId()); dst.setPortNo(isl.getDestPort()); dst.setSegLatency(isl.getLatency()); dst.setSeqId(1); Long timeCreateMillis = Optional.ofNullable(isl.getTimeCreate()).map(Instant::toEpochMilli).orElse(null); Long timeModifyMillis = Optional.ofNullable(isl.getTimeModify()).map(Instant::toEpochMilli).orElse(null); return new IslInfoData(isl.getLatency(), src, dst, isl.getSpeed(), isl.getAvailableBandwidth(), isl.getMaxBandwidth(), isl.getDefaultMaxBandwidth(), map(isl.getStatus()), map(isl.getActualStatus()), isl.getCost(), timeCreateMillis, timeModifyMillis, isl.isUnderMaintenance(), isl.isEnableBfd(), map(isl.getBfdSessionStatus()), null); }  IslInfoData map(Isl isl); org.openkilda.model.Isl map(IslInfoData islInfoData); IslChangeType map(IslStatus status); IslStatus map(IslChangeType status); BfdSessionStatus map(String raw); String map(BfdSessionStatus status); static final IslMapper INSTANCE; }