diff options
| author | jesus m. rodriguez <jesusr@redhat.com> | 2009-07-30 20:01:45 -0400 |
|---|---|---|
| committer | jesus m. rodriguez <jesusr@redhat.com> | 2009-07-30 20:01:45 -0400 |
| commit | 89e2f558f73f8934b2d0d357d307a7ae7f134263 (patch) | |
| tree | d52c6b328b8d2aa63093822daeb16964028033d4 /proxy/code/src | |
| parent | 7e49a1ff602e26b015a0a18ee824411e0061ff6d (diff) | |
| download | candlepin-89e2f558f73f8934b2d0d357d307a7ae7f134263.tar.gz candlepin-89e2f558f73f8934b2d0d357d307a7ae7f134263.tar.xz candlepin-89e2f558f73f8934b2d0d357d307a7ae7f134263.zip | |
adding test for TestApi
Diffstat (limited to 'proxy/code/src')
| -rw-r--r-- | proxy/code/src/org/fedoraproject/candlepin/api/test/TestApiTest.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/proxy/code/src/org/fedoraproject/candlepin/api/test/TestApiTest.java b/proxy/code/src/org/fedoraproject/candlepin/api/test/TestApiTest.java new file mode 100644 index 0000000..c2e74a4 --- /dev/null +++ b/proxy/code/src/org/fedoraproject/candlepin/api/test/TestApiTest.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2008 Red Hat, Inc. + * + * This software is licensed to you under the GNU General Public License, + * version 2 (GPLv2). There is NO WARRANTY for this software, express or + * implied, including the implied warranties of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 + * along with this software; if not, see + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * + * Red Hat trademarks are not licensed under GPLv2. No permission is + * granted to use or replicate Red Hat trademarks that are incorporated + * in this software or its documentation. + */ +package org.fedoraproject.candlepin.api.test; + +import org.fedoraproject.candlepin.model.JsonTestObject; + +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.api.client.config.ClientConfig; +import com.sun.jersey.api.client.config.DefaultClientConfig; + +import junit.framework.TestCase; + + +/** + * TestApiTest + * @version $Rev$ + */ +public class TestApiTest extends TestCase { + public void testJson() { + ClientConfig cc = new DefaultClientConfig(); + Client c = Client.create(cc); + + WebResource getresource = c.resource("http://localhost:8080/candlepin/test/"); + JsonTestObject jto = new JsonTestObject(); + jto.setName("testname"); + jto.setUuid("AEF"); + + WebResource postresource = c.resource("http://localhost:8080/candlepin/test/"); + postresource.accept("application/json").type("application/json").post(jto); + + System.out.println(jto.getName()); + jto = getresource.accept("application/json").get(JsonTestObject.class); + assertEquals("testname", jto.getName()); + assertEquals("AEF", jto.getUuid()); + } +} |
