private static StorageServerConnectionExtension createConnectionExtension( Guid hostId, String target, String userName, String password) { StorageServerConnectionExtension connExt = new StorageServerConnectionExtension(); connExt.setHostId(hostId); connExt.setIqn(target); connExt.setUserName(userName); connExt.setPassword(password); return connExt; }
@Test public void testCredentialsWithConnectionExtensionDifferentHostSameTarget() { StorageServerConnections conn = createConnectionWithCredentials("target1", "userConn", "pwdConn"); StorageServerConnectionExtension connExt = createConnectionExtension(Guid.newGuid(), "target1", "userConnExt", "pwdConnExt"); when(connExtDaoMock.getByHostIdAndTarget(Guid.newGuid(), connExt.getIqn())).thenReturn(connExt); Pair<String, String> credentials = helper.getStorageConnectionCredentialsForhost(connExt.getHostId(), conn); assertCredentials(credentials, conn.getuser_name(), conn.getpassword()); }