@Override public String getValue(StorageServerConnections conn) { return conn.getPort(); } };
@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; }
protected void postDiscoverTargetsInternal(ArrayList<StorageServerConnections> items) { ArrayList<SanTargetModel> newItems = new ArrayList<>(); for (StorageServerConnections a : items) { SanTargetModel model = new SanTargetModel(); model.setAddress(a.getConnection()); model.setPort(a.getPort()); model.setPortal(a.getPortal()); model.setName(a.getIqn()); model.setLuns(new ObservableCollection<>()); model.getLoggedInEvent().addListener(this); newItems.add(model); } if (items.isEmpty()) { setMessage(ConstantsManager.getInstance().getConstants().noNewDevicesWereFoundMsg()); } postDiscoverTargets(newItems); }
@Override public String getValue(SanTargetModel model) { return model.getEntity().getPort(); } };
@Override public List<StorageServerConnections> getAllForConnection( StorageServerConnections connection) { // NOTE - any change to this stored procedure parameters should require a change in // the StorageServerConnections class, as those fields can be set only with null or a // actual value (empty string can't be used). return getCallsHandler().executeReadList("Getstorage_server_connectionsByKey", mapper, getCustomMapSqlParameterSource() .addValue("iqn", connection.getIqn()) .addValue("connection", connection.getConnection()) .addValue("port", connection.getPort()) .addValue("portal", connection.getPortal()) .addValue("username", connection.getUserName())); }
static StorageServerConnections setUpEntityExpectations(StorageServerConnections entity, int index) { when(entity.getId()).thenReturn(GUIDS[index].toString()); when(entity.getStorageType()).thenReturn(STORAGE_TYPES_MAPPED[index]); when(entity.getConnection()).thenReturn("1.1.1.255"); if (STORAGE_TYPES_MAPPED[index].equals(StorageType.ISCSI)) { when(entity.getPort()).thenReturn("3260"); } return entity; } }
private ArrayList<SanTargetModel> createTargetModelList(LUNs a) { ArrayList<SanTargetModel> targetModelList = new ArrayList<>(); if (a.getLunConnections() != null) { for (StorageServerConnections b : a.getLunConnections()) { SanTargetModel model = new SanTargetModel(); model.setAddress(b.getConnection()); model.setPort(b.getPort()); model.setPortal(b.getPortal()); model.setName(b.getIqn()); model.setIsSelected(true); model.setIsLoggedIn(true); model.setLuns(new ObservableCollection<>()); model.getLoginCommand().setIsExecutionAllowed(false); targetModelList.add(model); } } return targetModelList; }
static StorageServerConnections setUpEntityExpectations(StorageServerConnections entity, int index) { when(entity.getId()).thenReturn(GUIDS[index].toString()); when(entity.getStorageType()).thenReturn(STORAGE_TYPES_MAPPED[index]); when(entity.getConnection()).thenReturn("/data1"); if (STORAGE_TYPES_MAPPED[index].equals(StorageType.ISCSI)) { when(entity.getPort()).thenReturn("3260"); } return entity; }
_writer.writeAttributeString(getOvfUri(), LUNS_CONNECTION, conn.getConnection()); _writer.writeAttributeString(getOvfUri(), LUNS_IQN, conn.getIqn()); _writer.writeAttributeString(getOvfUri(), LUNS_PORT, conn.getPort()); _writer.writeAttributeString(XSI_URI, LUNS_STORAGE_TYPE, conn.getStorageType().name()); _writer.writeAttributeString(XSI_URI, LUNS_PORTAL, conn.getPortal());
static StorageServerConnections setUpEntityExpectations(StorageServerConnections entity, int index) { when(entity.getId()).thenReturn(GUIDS[index].toString()); when(entity.getStorageType()).thenReturn(STORAGE_TYPES_MAPPED[index]); if (STORAGE_TYPES_MAPPED[index].equals(StorageType.ISCSI)) { when(entity.getPort()).thenReturn("3260"); when(entity.getConnection()).thenReturn("1.122.10.125"); } if (STORAGE_TYPES_MAPPED[index].equals(StorageType.NFS)) { when(entity.getConnection()).thenReturn("1.122.10.125:/data1"); } return entity; }
private MapSqlParameterSource getFullParameterSource(final StorageServerConnections connection) { return getIdParameterSource(connection.getId()) .addValue("connection", connection.getConnection()) .addValue("iqn", connection.getIqn()) .addValue("port", connection.getPort()) .addValue("portal", connection.getPortal()) .addValue("password", DbFacadeUtils.encryptPassword(connection.getPassword())) .addValue("storage_type", connection.getStorageType()) .addValue("user_name", connection.getUserName()) .addValue("mount_options", connection.getMountOptions()) .addValue("vfs_type", connection.getVfsType()) .addValue("nfs_version", (connection.getNfsVersion() != null) ? connection.getNfsVersion().getValue() : null) .addValue("nfs_timeo", connection.getNfsTimeo()) .addValue("nfs_retrans", connection.getNfsRetrans()) .addValue("gluster_volume_id", connection.getGlusterVolumeId()); }
if (entity.getStorageType() == org.ovirt.engine.core.common.businessentities.storage.StorageType.ISCSI) { model.setAddress(entity.getConnection()); model.setPort(Integer.parseInt(entity.getPort())); model.setUsername(entity.getUserName()); model.setTarget(entity.getIqn());
@Test public void checkISCSISStorageConnectionsMappingsToBll() { StorageServerConnections connection = new StorageServerConnections(); Guid connId = Guid.newGuid(); connection.setId(connId.toString()); connection.setIqn("iqn.my.target1"); connection.setPort("3260"); connection.setStorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType.ISCSI); connection.setConnection("1.2.135.255"); connection.setUserName("myuser1"); connection.setPassword("123"); StorageConnection RESTConnection = new StorageConnection(); RESTConnection.setId(connId.toString()); RESTConnection.setType(StorageType.ISCSI); RESTConnection.setPort(3260); RESTConnection.setTarget("iqn.my.target1"); RESTConnection.setAddress("1.2.135.255"); RESTConnection.setUsername("myuser1"); RESTConnection.setPassword("123"); StorageServerConnections mappedResult = StorageDomainMapper.map(RESTConnection, null); assertEquals(mappedResult.getId(), mappedResult.getId()); assertEquals(mappedResult.getStorageType(), mappedResult.getStorageType()); assertEquals(mappedResult.getConnection(), mappedResult.getConnection()); assertEquals(mappedResult.getIqn(), mappedResult.getIqn()); assertEquals(mappedResult.getUserName(), mappedResult.getUserName()); assertEquals(mappedResult.getPassword(), mappedResult.getPassword()); assertEquals(mappedResult.getPort(), mappedResult.getPort()); }