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()); }
@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()); }