@Mapping(from = StorageServerConnections.class, to = LogicalUnit.class) public static LogicalUnit map(StorageServerConnections entity, LogicalUnit template) { LogicalUnit model = template != null ? template : new LogicalUnit(); model.setAddress(entity.getConnection()); model.setTarget(entity.getIqn()); model.setPort(Integer.parseInt(entity.getPort())); model.setUsername(entity.getUserName()); if (entity.getConnection()!=null && entity.getPort()!=null && entity.getPortal()!=null) { model.setPortal(entity.getConnection() + ":" + entity.getPort() + "," + entity.getPortal()); } return model; }
@Test public void testAddIscsiLunDiskIncompleteParametersConnectionPort() { Disk model = createIscsiLunDisk(); model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setPort(null); setUriInfo(setUpBasicUriExpectations()); // Because of extra frame offset used current method name in test, while in real world used "add" method name verifyIncompleteException(assertThrows(WebApplicationException.class, () -> collection.add(model)), "LogicalUnit", "lambda$testAddIscsiLunDiskIncompleteParametersConnectionPort$7", "port"); }
to.setPort(from.getPort());
private Disk createIscsiLunDisk() { Disk model = getModel(); model.setLunStorage(new HostStorage()); model.getLunStorage().setType(StorageType.ISCSI); model.getLunStorage().setLogicalUnits(new LogicalUnits()); model.getLunStorage().getLogicalUnits().getLogicalUnits().add(new LogicalUnit()); model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setId(GUIDS[0].toString()); model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setAddress(ISCSI_SERVER_ADDRESS); model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setTarget(ISCSI_SERVER_TARGET); model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setPort(ISCSI_SERVER_CONNECTION_PORT); model.setProvisionedSize(null); return model; }
protected StorageDomain getIscsi() { StorageDomain model = getModel(0); model.getStorage().setType(StorageType.ISCSI); model.getStorage().setAddress(null); model.getStorage().setPath(null); model.getStorage().setVolumeGroup(new VolumeGroup()); model.getStorage().getVolumeGroup().setLogicalUnits(new LogicalUnits()); model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().add(new LogicalUnit()); model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setId(LUN); model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setTarget(TARGET); model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setAddress(ADDRESSES[0]); model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setPort(PORT); model.getStorage().setOverrideLuns(false); return model; }