cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [8/8] git commit: updated refs/heads/master to 869a83f
Date Fri, 14 Aug 2015 06:54:49 GMT
plugins: fix test case, interface usage and checkstyle import issue

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


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 <rohit.yadav@shapeblue.com>
Authored: Fri Aug 14 12:16:09 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
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<String, Object[]> 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<String, Object[]> 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 {


Mime
View raw message