cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [15/22] git commit: updated refs/heads/master to 443acac
Date Fri, 14 Feb 2014 17:38:15 GMT
Findbugs finding

Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>


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

Branch: refs/heads/master
Commit: 33c2c872878874f83c25c656de4325a32c3b8d8c
Parents: 1237bf3
Author: Ian Southam <isoutham@schubergphilis.com>
Authored: Mon Feb 10 16:04:48 2014 +0100
Committer: Hugo Trippaers <htrippaers@schubergphilis.com>
Committed: Fri Feb 14 18:37:46 2014 +0100

----------------------------------------------------------------------
 .../consoleproxy/ConsoleProxyRdpClient.java     | 12 ++++--
 .../consoleproxy/ConsoleProxyRdpClientTest.java | 45 ++++++++++++++++++++
 2 files changed, 53 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/33c2c872/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyRdpClient.java
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyRdpClient.java
b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyRdpClient.java
index 7d49b19..dc3f31b 100644
--- a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyRdpClient.java
+++ b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyRdpClient.java
@@ -179,9 +179,11 @@ public class ConsoleProxyRdpClient extends ConsoleProxyClientBase {
         int mod = mapModifier(modifiers);
         switch (code) {
         case 0:
-            return mod = mod | MouseEvent.BUTTON1_DOWN_MASK;
+            mod = mod | MouseEvent.BUTTON1_DOWN_MASK;
+            break;
         case 2:
-            return mod = mod | MouseEvent.BUTTON3_DOWN_MASK;
+            mod = mod | MouseEvent.BUTTON3_DOWN_MASK;
+            break;
         default:
         }
         return mod;
@@ -191,9 +193,11 @@ public class ConsoleProxyRdpClient extends ConsoleProxyClientBase {
         int mod = mapModifier(modifiers);
         switch (code) {
         case 0:
-            return mod = mod | MouseEvent.BUTTON1_MASK;
+            mod = mod | MouseEvent.BUTTON1_MASK;
+            break;
         case 2:
-            return mod = mod | MouseEvent.BUTTON3_MASK;
+            mod = mod | MouseEvent.BUTTON3_MASK;
+            break;
         default:
         }
         return mod;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/33c2c872/services/console-proxy/server/test/com/cloud/consoleproxy/ConsoleProxyRdpClientTest.java
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/test/com/cloud/consoleproxy/ConsoleProxyRdpClientTest.java
b/services/console-proxy/server/test/com/cloud/consoleproxy/ConsoleProxyRdpClientTest.java
new file mode 100644
index 0000000..038f438
--- /dev/null
+++ b/services/console-proxy/server/test/com/cloud/consoleproxy/ConsoleProxyRdpClientTest.java
@@ -0,0 +1,45 @@
+package com.cloud.consoleproxy;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+public class ConsoleProxyRdpClientTest {
+
+    @Test
+    public void testMapMouseDownModifierButton1Mask() throws Exception {
+        int code = 0;
+        int modifiers = 960;
+        int expected = 1024 + 960;
+
+        ConsoleProxyRdpClient rdpc = new ConsoleProxyRdpClient();
+        int actual = rdpc.mapMouseDownModifier(code, modifiers);
+
+        Assert.assertEquals(expected, actual);
+    }
+
+    @Test
+    public void testMapMouseDownModifierButton2() throws Exception {
+        int code = 1;
+        int modifiers = 0xffff;
+        int expected = 960;
+
+        ConsoleProxyRdpClient rdpc = new ConsoleProxyRdpClient();
+        int actual = rdpc.mapMouseDownModifier(code, modifiers);
+
+        Assert.assertEquals(expected, actual);
+    }
+
+    @Test
+    public void testMapMouseDownModifierButton3Mask() throws Exception {
+        int code = 2;
+        int modifiers = 960;
+        int expected = 4096 + 960;
+
+        ConsoleProxyRdpClient rdpc = new ConsoleProxyRdpClient();
+        int actual = rdpc.mapMouseDownModifier(code, modifiers);
+
+        Assert.assertEquals(expected, actual);
+    }
+
+}


Mime
View raw message