Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DAD38187F4 for ; Fri, 14 Aug 2015 06:54:43 +0000 (UTC) Received: (qmail 9193 invoked by uid 500); 14 Aug 2015 06:54:42 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 9074 invoked by uid 500); 14 Aug 2015 06:54:42 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 8602 invoked by uid 99); 14 Aug 2015 06:54:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Aug 2015 06:54:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7F88BE002C; Fri, 14 Aug 2015 06:54:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bhaisaab@apache.org To: commits@cloudstack.apache.org Date: Fri, 14 Aug 2015 06:54:49 -0000 Message-Id: <73c404302fd34221a19e2a26e845ab1f@git.apache.org> In-Reply-To: <0529c891f5c34c64bd4810628d8ee35e@git.apache.org> References: <0529c891f5c34c64bd4810628d8ee35e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [8/8] git commit: updated refs/heads/master to 869a83f plugins: fix test case, interface usage and checkstyle import issue Signed-off-by: Rohit Yadav Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/869a83f8 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/869a83f8 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/869a83f8 Branch: refs/heads/master Commit: 869a83f8f8d8a69f2029c3219bad180965adcb1c Parents: a3e6942 Author: Rohit Yadav Authored: Fri Aug 14 12:16:09 2015 +0530 Committer: Rohit Yadav Committed: Fri Aug 14 12:23:50 2015 +0530 ---------------------------------------------------------------------- .../kvm/resource/LibvirtComputingResourceTest.java | 4 ++-- .../api/command/ListAndSwitchSAMLAccountCmd.java | 3 ++- .../api/command/SAML2LoginAPIAuthenticatorCmd.java | 2 -- .../api/command/ListAndSwitchSAMLAccountCmdTest.java | 13 +++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/869a83f8/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java index 42ebf86..1651299 100644 --- a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java +++ b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java @@ -1246,7 +1246,7 @@ public class LibvirtComputingResourceTest { when(conn.domainLookupByName(vmName)).thenReturn(dm); when(libvirtComputingResource.getPrivateIp()).thenReturn("127.0.0.1"); - when(dm.getXMLDesc(0)).thenReturn("host_domain"); + when(dm.getXMLDesc(8)).thenReturn("host_domain"); when(dm.isPersistent()).thenReturn(1); doNothing().when(dm).undefine(); @@ -1274,7 +1274,7 @@ public class LibvirtComputingResourceTest { verify(libvirtComputingResource, times(1)).getDisks(conn, vmName); try { verify(conn, times(1)).domainLookupByName(vmName); - verify(dm, times(1)).getXMLDesc(0); + verify(dm, times(1)).getXMLDesc(8); } catch (final LibvirtException e) { fail(e.getMessage()); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/869a83f8/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmd.java ---------------------------------------------------------------------- diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmd.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmd.java index 80aee1b..2fdf6a1 100644 --- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmd.java +++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmd.java @@ -52,6 +52,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; +import java.net.InetAddress; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -99,7 +100,7 @@ public class ListAndSwitchSAMLAccountCmd extends BaseCmd implements APIAuthentic } @Override - public String authenticate(final String command, final Map params, final HttpSession session, final String remoteAddress, final String responseType, final StringBuilder auditTrailSb, final HttpServletRequest req, final HttpServletResponse resp) throws ServerApiException { + public String authenticate(final String command, final Map params, final HttpSession session, InetAddress remoteAddress, final String responseType, final StringBuilder auditTrailSb, final HttpServletRequest req, final HttpServletResponse resp) throws ServerApiException { if (session == null || session.isNew()) { throw new ServerApiException(ApiErrorCode.UNAUTHORIZED, _apiServer.getSerializedApiError(ApiErrorCode.UNAUTHORIZED.getHttpCode(), "Only authenticated saml users can request this API", http://git-wip-us.apache.org/repos/asf/cloudstack/blob/869a83f8/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java ---------------------------------------------------------------------- diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java index 7a1b83c..41005ab 100644 --- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java +++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java @@ -70,8 +70,6 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.stream.FactoryConfigurationError; import java.io.IOException; import java.net.InetAddress; -import java.net.URLEncoder; - import java.util.List; import java.util.Map; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/869a83f8/plugins/user-authenticators/saml2/test/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmdTest.java ---------------------------------------------------------------------- diff --git a/plugins/user-authenticators/saml2/test/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmdTest.java b/plugins/user-authenticators/saml2/test/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmdTest.java index 1423243..8985a0f 100644 --- a/plugins/user-authenticators/saml2/test/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmdTest.java +++ b/plugins/user-authenticators/saml2/test/org/apache/cloudstack/api/command/ListAndSwitchSAMLAccountCmdTest.java @@ -49,6 +49,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.lang.reflect.Field; +import java.net.InetAddress; import java.util.HashMap; import java.util.Map; @@ -121,7 +122,7 @@ public class ListAndSwitchSAMLAccountCmdTest extends TestCase { // invalid session test try { - cmd.authenticate("command", params, null, "random", HttpUtils.RESPONSE_TYPE_JSON, new StringBuilder(), req, resp); + cmd.authenticate("command", params, null, null, HttpUtils.RESPONSE_TYPE_JSON, new StringBuilder(), req, resp); } catch (ServerApiException exception) { assertEquals(exception.getErrorCode(), ApiErrorCode.UNAUTHORIZED); } finally { @@ -132,7 +133,7 @@ public class ListAndSwitchSAMLAccountCmdTest extends TestCase { params.put(ApiConstants.SESSIONKEY, new String[]{"someOtherValue"}); try { Mockito.when(session.isNew()).thenReturn(false); - cmd.authenticate("command", params, session, "random", HttpUtils.RESPONSE_TYPE_JSON, new StringBuilder(), req, resp); + cmd.authenticate("command", params, session, null, HttpUtils.RESPONSE_TYPE_JSON, new StringBuilder(), req, resp); } catch (ServerApiException exception) { assertEquals(exception.getErrorCode(), ApiErrorCode.UNAUTHORIZED); } finally { @@ -142,7 +143,7 @@ public class ListAndSwitchSAMLAccountCmdTest extends TestCase { // valid sessionkey value test params.put(ApiConstants.SESSIONKEY, new String[]{sessionKeyValue}); try { - cmd.authenticate("command", params, session, "random", HttpUtils.RESPONSE_TYPE_JSON, new StringBuilder(), req, resp); + cmd.authenticate("command", params, session, null, HttpUtils.RESPONSE_TYPE_JSON, new StringBuilder(), req, resp); } catch (ServerApiException exception) { assertEquals(exception.getErrorCode(), ApiErrorCode.ACCOUNT_ERROR); } finally { @@ -159,7 +160,7 @@ public class ListAndSwitchSAMLAccountCmdTest extends TestCase { mockedUserAccount.setSource(User.Source.UNKNOWN); Mockito.when(accountService.getUserAccountById(Mockito.anyLong())).thenReturn(mockedUserAccount); try { - cmd.authenticate("command", params, session, "random", HttpUtils.RESPONSE_TYPE_JSON, new StringBuilder(), req, resp); + cmd.authenticate("command", params, session, null, HttpUtils.RESPONSE_TYPE_JSON, new StringBuilder(), req, resp); } catch (ServerApiException exception) { assertEquals(exception.getErrorCode(), ApiErrorCode.ACCOUNT_ERROR); } finally { @@ -181,9 +182,9 @@ public class ListAndSwitchSAMLAccountCmdTest extends TestCase { loginCmdResponse.setLastName("lastName"); loginCmdResponse.setSessionKey("newSessionKeyString"); Mockito.when(apiServer.loginUser(Mockito.any(HttpSession.class), Mockito.anyString(), Mockito.anyString(), - Mockito.anyLong(), Mockito.anyString(), Mockito.anyString(), Mockito.anyMap())).thenReturn(loginCmdResponse); + Mockito.anyLong(), Mockito.anyString(), Mockito.any(InetAddress.class), Mockito.anyMap())).thenReturn(loginCmdResponse); try { - cmd.authenticate("command", params, session, "random", HttpUtils.RESPONSE_TYPE_JSON, new StringBuilder(), req, resp); + cmd.authenticate("command", params, session, null, HttpUtils.RESPONSE_TYPE_JSON, new StringBuilder(), req, resp); } catch (ServerApiException exception) { fail("SAML list and switch account API failed to pass for all valid data: " + exception.getMessage()); } finally {