diff options
| author | jesus m. rodriguez <jesusr@redhat.com> | 2009-07-30 09:18:29 -0400 |
|---|---|---|
| committer | jesus m. rodriguez <jesusr@redhat.com> | 2009-07-30 09:18:29 -0400 |
| commit | c48be8d27883cb7ca0527b4d3b8003bdc2f6fe28 (patch) | |
| tree | 3c66ac65e31aad81e05535e2fe1f42cf4cfb1861 /proxy/code | |
| parent | e53b58df385618405f055a11cc5019253a587490 (diff) | |
add src jars for easier debugging.
Diffstat (limited to 'proxy/code')
| -rw-r--r-- | proxy/code/libsrc/jersey-core-1.1.0-ea-sources.jar | bin | 0 -> 257666 bytes | |||
| -rw-r--r-- | proxy/code/libsrc/jersey-json-1.1.0-ea-sources.jar | bin | 0 -> 87922 bytes | |||
| -rw-r--r-- | proxy/code/libsrc/jersey-server-1.1.0-ea-sources.jar | bin | 0 -> 500023 bytes | |||
| -rw-r--r-- | proxy/code/libsrc/jsr311-api-1.1-sources.jar | bin | 0 -> 68937 bytes | |||
| -rwxr-xr-x | proxy/code/scripts/test-userapi.py | 19 | ||||
| -rw-r--r-- | proxy/code/src/org/fedoraproject/candlepin/api/UserApi.java | 25 |
6 files changed, 42 insertions, 2 deletions
diff --git a/proxy/code/libsrc/jersey-core-1.1.0-ea-sources.jar b/proxy/code/libsrc/jersey-core-1.1.0-ea-sources.jar Binary files differnew file mode 100644 index 0000000..6317c69 --- /dev/null +++ b/proxy/code/libsrc/jersey-core-1.1.0-ea-sources.jar diff --git a/proxy/code/libsrc/jersey-json-1.1.0-ea-sources.jar b/proxy/code/libsrc/jersey-json-1.1.0-ea-sources.jar Binary files differnew file mode 100644 index 0000000..83a6fb2 --- /dev/null +++ b/proxy/code/libsrc/jersey-json-1.1.0-ea-sources.jar diff --git a/proxy/code/libsrc/jersey-server-1.1.0-ea-sources.jar b/proxy/code/libsrc/jersey-server-1.1.0-ea-sources.jar Binary files differnew file mode 100644 index 0000000..9f32d39 --- /dev/null +++ b/proxy/code/libsrc/jersey-server-1.1.0-ea-sources.jar diff --git a/proxy/code/libsrc/jsr311-api-1.1-sources.jar b/proxy/code/libsrc/jsr311-api-1.1-sources.jar Binary files differnew file mode 100644 index 0000000..6290b4c --- /dev/null +++ b/proxy/code/libsrc/jsr311-api-1.1-sources.jar diff --git a/proxy/code/scripts/test-userapi.py b/proxy/code/scripts/test-userapi.py index 6fba16e..45cc004 100755 --- a/proxy/code/scripts/test-userapi.py +++ b/proxy/code/scripts/test-userapi.py @@ -17,7 +17,7 @@ print("Status: %d Response: %s" % (response.status, response.reason)) rsp = response.read() conn.close() print("create: %s" % rsp) - +""" response = urllib.urlopen('http://localhost:8080/candlepin/user/candlepin') rsp = response.read() print("get: %s" % rsp) @@ -41,3 +41,20 @@ print("listobjects: %s" % rsp) response = urllib.urlopen('http://localhost:8080/candlepin/user/listbasemodel') rsp = response.read() print("listbasemodel: %s" % rsp) + +print("TESTING json get") +response = urllib.urlopen("http://localhost:8080/candlepin/user/testobject") +rsp = response.read() +print("testjsonobject get: %s" % rsp) +""" + +print("TESTING json create") +params = urllib.urlencode({"name":"rhim","uuid":"joprsucks"}) +headers = {"Content-type":"application/json", + "Accept": "application/json"} +conn = httplib.HTTPConnection("localhost", 8080) +conn.request("POST", '/candlepin/user/createtestobject', params, headers) +response = conn.getresponse() +print("Status: %d Response: %s" % (response.status, response.reason)) +rsp = response.read() +conn.close() diff --git a/proxy/code/src/org/fedoraproject/candlepin/api/UserApi.java b/proxy/code/src/org/fedoraproject/candlepin/api/UserApi.java index f95b514..f6c3bfe 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/api/UserApi.java +++ b/proxy/code/src/org/fedoraproject/candlepin/api/UserApi.java @@ -14,13 +14,17 @@ */ package org.fedoraproject.candlepin.api; +import org.fedoraproject.candlepin.model.BaseModel; +import org.fedoraproject.candlepin.model.JsonTestObject; import org.fedoraproject.candlepin.model.ObjectFactory; import org.fedoraproject.candlepin.model.User; import java.util.ArrayList; import java.util.List; +import javax.ws.rs.Consumes; import javax.ws.rs.GET; +import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -56,5 +60,24 @@ public class UserApi extends BaseApi { } return users; } - + + @GET @Path("/testobject") + @Produces(MediaType.APPLICATION_JSON) + public JsonTestObject returnJsonObject() { + JsonTestObject jto = new JsonTestObject(); + jto.setName("namevalue"); + jto.setUuid("uuidvalue"); + return jto; + } + + @POST @Path("/createtestobject") + @Consumes(MediaType.APPLICATION_JSON) + public void createJsonTestObject(JsonTestObject obj) { + if (obj == null) { + throw new RuntimeException("obj is null"); + } + System.out.println("object.name" + obj.getName()); + //return obj; + } + } |
