Piotr Kliczewski has uploaded a new change for review.

Change subject: jsonrpc: Proton changes in vdsbroker
......................................................................

jsonrpc: Proton changes in vdsbroker

Proton changes for future release


Change-Id: Id6bd49a9ca9823c36611ab7c05b9f7c71c62ab62
Signed-off-by: pkliczewski <piotr.kliczew...@gmail.com>
---
M backend/manager/dependencies/pom.xml
A 
backend/manager/dependencies/src/main/modules/org/apache/qpid-proton-j/main/module.xml
M 
backend/manager/dependencies/src/main/modules/org/ovirt/vdsm-jsonrpc-java/main/module.xml
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcUtils.java
A 
backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/jsonrpc/ProtonIntegrationTest.java
M pom.xml
6 files changed, 83 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/95/27995/1

diff --git a/backend/manager/dependencies/pom.xml 
b/backend/manager/dependencies/pom.xml
index bd0af75..e98db02 100644
--- a/backend/manager/dependencies/pom.xml
+++ b/backend/manager/dependencies/pom.xml
@@ -94,6 +94,12 @@
     </dependency>
 
     <dependency>
+        <groupId>org.apache.qpid</groupId>
+        <artifactId>proton-j</artifactId>
+        <version>${proton-j.version}</version>
+    </dependency>
+
+    <dependency>
       <groupId>org.quartz-scheduler</groupId>
       <artifactId>quartz</artifactId>
       <version>${quartz.version}</version>
@@ -322,6 +328,12 @@
               </module>
 
               <module>
+                <groupId>org.apache.qpid</groupId>
+                <artifactId>proton-j</artifactId>
+                <moduleName>org.apache.qpid-proton-j</moduleName>
+              </module>
+
+              <module>
                 <groupId>org.quartz-scheduler</groupId>
                 <artifactId>quartz</artifactId>
                 <moduleName>org.quartz</moduleName>
diff --git 
a/backend/manager/dependencies/src/main/modules/org/apache/qpid-proton-j/main/module.xml
 
b/backend/manager/dependencies/src/main/modules/org/apache/qpid-proton-j/main/module.xml
new file mode 100644
index 0000000..c2c3a2a
--- /dev/null
+++ 
b/backend/manager/dependencies/src/main/modules/org/apache/qpid-proton-j/main/module.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<module xmlns="urn:jboss:module:1.1" name="org.apache.qpid-proton-j">
+
+  <resources>
+    <resource-root path="proton-j.jar"/>
+  </resources>
+
+</module>
\ No newline at end of file
diff --git 
a/backend/manager/dependencies/src/main/modules/org/ovirt/vdsm-jsonrpc-java/main/module.xml
 
b/backend/manager/dependencies/src/main/modules/org/ovirt/vdsm-jsonrpc-java/main/module.xml
index bd7ab25..e20babb 100644
--- 
a/backend/manager/dependencies/src/main/modules/org/ovirt/vdsm-jsonrpc-java/main/module.xml
+++ 
b/backend/manager/dependencies/src/main/modules/org/ovirt/vdsm-jsonrpc-java/main/module.xml
@@ -11,6 +11,7 @@
     <module name="org.apache.commons.logging"/>
     <module name="org.codehaus.jackson.jackson-mapper-asl"/>
     <module name="org.codehaus.jackson.jackson-core-asl"/>
+    <module name="org.apache.qpid-proton-j" />
   </dependencies>
 
 </module>
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcUtils.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcUtils.java
index 5f17b2c..87a2b0c 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcUtils.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/jsonrpc/JsonRpcUtils.java
@@ -17,6 +17,11 @@
 public class JsonRpcUtils {
     private static Log log = LogFactory.getLog(JsonRpcUtils.class);
 
+    public static JsonRpcClient createProtonClient(String hostname, int port, 
int connectionTimeout,
+            int clientTimeout, int connectionRetry, boolean isSecure) {
+        return createClient(hostname, port, connectionTimeout, clientTimeout, 
connectionRetry, isSecure, ReactorType.PROTON);
+    }
+
     public static JsonRpcClient createStompClient(String hostname, int port, 
int connectionTimeout,
             int clientTimeout, int connectionRetry, boolean isSecure) {
         return createClient(hostname, port, connectionTimeout, clientTimeout, 
connectionRetry, isSecure, ReactorType.STOMP);
diff --git 
a/backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/jsonrpc/ProtonIntegrationTest.java
 
b/backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/jsonrpc/ProtonIntegrationTest.java
new file mode 100644
index 0000000..261714c
--- /dev/null
+++ 
b/backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/jsonrpc/ProtonIntegrationTest.java
@@ -0,0 +1,55 @@
+package org.ovirt.engine.core.vdsbroker.jsonrpc;
+
+import static junit.framework.Assert.assertFalse;
+
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.ovirt.vdsm.jsonrpc.client.ClientConnectionException;
+import org.ovirt.vdsm.jsonrpc.client.JsonRpcClient;
+import org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest;
+import org.ovirt.vdsm.jsonrpc.client.RequestBuilder;
+
+@Ignore
+public class ProtonIntegrationTest {
+    private final static String HOST_ADDRESS = "192.168.1.10";
+    private final static int PORT = 5672;
+    private final static int TIMEOUT = 5000;
+
+    @Test
+    public void testGetVdsCapabilities() throws InterruptedException, 
ExecutionException, ClientConnectionException {
+        JsonRpcClient client = JsonRpcUtils.createProtonClient(HOST_ADDRESS, 
PORT, TIMEOUT, 0, TIMEOUT, false);
+        final JsonRpcRequest request = new 
RequestBuilder("Host.getCapabilities").build();
+        Map<String, Object> map = new FutureMap(client, request);
+        assertFalse(map.isEmpty());
+
+        final JsonRpcRequest hwInforequest = new 
RequestBuilder("Host.getHardwareInfo").build();
+        Map<String, Object> hwInfoMap = new FutureMap(client, hwInforequest);
+        assertFalse(hwInfoMap.isEmpty());
+
+        client.close();
+    }
+
+    /*
+     * For ssl this test requires ENGINE_DEFAULTS and ENGINE_VARS environment 
variables to be set.
+     *
+     * ENGINE_DEFAULTS = 
$HOME/ovirt-engine/share/ovirt-engine/services/ovirt-engine/ovirt-engine.conf
+     * ENGINE_VARS = $HOME/ovirt-engine/etc/ovirt-engine/engine.conf
+     */
+    @Test
+    public void testSecureGetVdsCapabilities() throws InterruptedException, 
ExecutionException, ClientConnectionException {
+        JsonRpcClient client = JsonRpcUtils.createProtonClient(HOST_ADDRESS, 
PORT, TIMEOUT, 0, TIMEOUT, true);
+
+        final JsonRpcRequest capsRequest = new 
RequestBuilder("Host.getCapabilities").build();
+        Map<String, Object> capsMap = new FutureMap(client, capsRequest);
+        assertFalse(capsMap.isEmpty());
+
+        final JsonRpcRequest hwInforequest = new 
RequestBuilder("Host.getHardwareInfo").build();
+        Map<String, Object> hwInfoMap = new FutureMap(client, hwInforequest);
+        assertFalse(hwInfoMap.isEmpty());
+
+        client.close();
+    }
+}
diff --git a/pom.xml b/pom.xml
index a2b460b..3c9b7ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,6 +74,7 @@
     
<org.ovirt.engine.api.ovirt-engine-extensions-api.version>0.0.0-SNAPSHOT</org.ovirt.engine.api.ovirt-engine-extensions-api.version>
     <!-- Update version -->
     
<vdsm-jsonrpc-java.version>1.0.0-master-SNAPSHOT</vdsm-jsonrpc-java.version>
+    <proton-j.version>0.7</proton-j.version>
     <slf4j.version>1.7.5</slf4j.version>
     <slf4j-jdk14.version>1.5.6</slf4j-jdk14.version>
     <gwt.version>2.5.1</gwt.version>


-- 
To view, visit http://gerrit.ovirt.org/27995
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6bd49a9ca9823c36611ab7c05b9f7c71c62ab62
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczew...@gmail.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to