cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [2/4] git commit: updated refs/heads/master to 7ff31f1
Date Tue, 25 Nov 2014 09:03:35 GMT
Fix UnitTest ApiServlet


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/87a7810a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/87a7810a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/87a7810a

Branch: refs/heads/master
Commit: 87a7810adecb61f3793d8d73e97b450874b519e2
Parents: 4bd49df
Author: Wido den Hollander <wido@widodh.nl>
Authored: Mon Nov 24 11:48:13 2014 +0100
Committer: Wido den Hollander <wido@widodh.nl>
Committed: Mon Nov 24 11:48:13 2014 +0100

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiServlet.java      | 3 +--
 server/test/com/cloud/api/ApiServletTest.java | 6 +++---
 2 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/87a7810a/server/src/com/cloud/api/ApiServlet.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServlet.java b/server/src/com/cloud/api/ApiServlet.java
index 675ebed..a246025 100644
--- a/server/src/com/cloud/api/ApiServlet.java
+++ b/server/src/com/cloud/api/ApiServlet.java
@@ -183,8 +183,7 @@ public class ApiServlet extends HttpServlet {
                     }
 
                     try {
-                        InetAddress remoteAddr = InetAddress.getByName(remoteAddress);
-                        responseString = apiAuthenticator.authenticate(command, params, session,
remoteAddr, responseType, auditTrailSb, resp);
+                        responseString = apiAuthenticator.authenticate(command, params, session,
InetAddress.getByName(remoteAddress), responseType, auditTrailSb, resp);
                     } catch (ServerApiException e) {
                         httpResponseCode = e.getErrorCode().getHttpCode();
                         responseString = e.getMessage();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/87a7810a/server/test/com/cloud/api/ApiServletTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/api/ApiServletTest.java b/server/test/com/cloud/api/ApiServletTest.java
index 902217d..1d20bdf 100644
--- a/server/test/com/cloud/api/ApiServletTest.java
+++ b/server/test/com/cloud/api/ApiServletTest.java
@@ -101,7 +101,7 @@ public class ApiServletTest {
 
         Mockito.when(authManager.getAPIAuthenticator(Mockito.anyString())).thenReturn(authenticator);
         Mockito.when(authenticator.authenticate(Mockito.anyString(), Mockito.anyMap(), Mockito.isA(HttpSession.class),
-                InetAddress.getByName("127.0.0.1"), Mockito.anyString(), Mockito.isA(StringBuilder.class),
Mockito.isA(HttpServletResponse.class))).thenReturn("{\"loginresponse\":{}");
+                Mockito.same(InetAddress.getByName("127.0.0.1")), Mockito.anyString(), Mockito.isA(StringBuilder.class),
Mockito.isA(HttpServletResponse.class))).thenReturn("{\"loginresponse\":{}");
 
         Field authManagerField = ApiServlet.class.getDeclaredField("_authManager");
         authManagerField.setAccessible(true);
@@ -212,7 +212,7 @@ public class ApiServletTest {
 
         Mockito.verify(authManager).getAPIAuthenticator("logout");
         Mockito.verify(authenticator).authenticate(Mockito.anyString(), Mockito.anyMap(),
Mockito.isA(HttpSession.class),
-                InetAddress.getByName("127.0.0.1"), Mockito.anyString(), Mockito.isA(StringBuilder.class),
Mockito.isA(HttpServletResponse.class));
+                Mockito.eq(InetAddress.getByName("127.0.0.1")), Mockito.anyString(), Mockito.isA(StringBuilder.class),
Mockito.isA(HttpServletResponse.class));
         Mockito.verify(session).invalidate();
     }
 
@@ -234,6 +234,6 @@ public class ApiServletTest {
 
         Mockito.verify(authManager).getAPIAuthenticator("login");
         Mockito.verify(authenticator).authenticate(Mockito.anyString(), Mockito.anyMap(),
Mockito.isA(HttpSession.class),
-                InetAddress.getByName("127.0.0.1"), Mockito.anyString(), Mockito.isA(StringBuilder.class),
Mockito.isA(HttpServletResponse.class));
+                Mockito.eq(InetAddress.getByName("127.0.0.1")), Mockito.anyString(), Mockito.isA(StringBuilder.class),
Mockito.isA(HttpServletResponse.class));
     }
 }


Mime
View raw message