Laszlo Hornyak has uploaded a new change for review. Change subject: java client example ......................................................................
java client example Signed-off-by: Laszlo Hornyak <lhorn...@redhat.com> Change-Id: I49b44be2595d7bc0841c41bdcd30b8ebb3b84dff --- A tests/java/pom.xml A tests/java/src/main/java/org/ovirt/schedulerproxy/SchedulerProxy.java A tests/java/src/test/java/org/ovirt/schedulerproxy/SchedulerProxyTest.java 3 files changed, 66 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-scheduler-proxy refs/changes/31/16931/1 diff --git a/tests/java/pom.xml b/tests/java/pom.xml new file mode 100644 index 0000000..e7a23c9 --- /dev/null +++ b/tests/java/pom.xml @@ -0,0 +1,20 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.ovirt</groupId> + <artifactId>externalschedulertest</artifactId> + <version>0.0.1-SNAPSHOT</version> + <dependencies> + <dependency> + <groupId>org.apache.xmlrpc</groupId> + <artifactId>xmlrpc-client</artifactId> + <version>3.1.3</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.10</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> \ No newline at end of file diff --git a/tests/java/src/main/java/org/ovirt/schedulerproxy/SchedulerProxy.java b/tests/java/src/main/java/org/ovirt/schedulerproxy/SchedulerProxy.java new file mode 100644 index 0000000..216413c --- /dev/null +++ b/tests/java/src/main/java/org/ovirt/schedulerproxy/SchedulerProxy.java @@ -0,0 +1,24 @@ +package org.ovirt.schedulerproxy; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.apache.xmlrpc.XmlRpcException; +import org.apache.xmlrpc.client.XmlRpcClient; +import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; + +public class SchedulerProxy { + final XmlRpcClient client; + + public SchedulerProxy(String url) throws MalformedURLException { + XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); + config.setServerURL(new URL(url)); + client = new XmlRpcClient(); + client.setConfig(config); + } + + public void discover() throws XmlRpcException { + Object execute = client.execute("discover", new Object[] {}); + System.out.println(execute); + } +} diff --git a/tests/java/src/test/java/org/ovirt/schedulerproxy/SchedulerProxyTest.java b/tests/java/src/test/java/org/ovirt/schedulerproxy/SchedulerProxyTest.java new file mode 100644 index 0000000..6306309 --- /dev/null +++ b/tests/java/src/test/java/org/ovirt/schedulerproxy/SchedulerProxyTest.java @@ -0,0 +1,22 @@ +package org.ovirt.schedulerproxy; + +import java.net.MalformedURLException; + +import org.apache.xmlrpc.XmlRpcException; +import org.junit.Before; +import org.junit.Test; + +public class SchedulerProxyTest { + + SchedulerProxy proxy; + + @Before + public void setUp() throws MalformedURLException { + proxy = new SchedulerProxy("http://localhost:18781/"); + } + + @Test + public void testDiscover() throws XmlRpcException { + proxy.discover(); + } +} -- To view, visit http://gerrit.ovirt.org/16931 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I49b44be2595d7bc0841c41bdcd30b8ebb3b84dff Gerrit-PatchSet: 1 Gerrit-Project: ovirt-scheduler-proxy Gerrit-Branch: master Gerrit-Owner: Laszlo Hornyak <lhorn...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches