diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-25 17:52:22 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-25 17:52:22 +0000 |
commit | b082c70417773a30d071643146bf67875932cf0d (patch) | |
tree | 8123fae35c01bcfde94fa4d0c7cd84c601baba11 /sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat | |
parent | 7aa2e556bb29e85effeb8923eadd17170ef5d95e (diff) |
Initial implementation for JSON wire format for REST binding
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@937850 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat')
2 files changed, 104 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java new file mode 100644 index 0000000000..9967fe4d71 --- /dev/null +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/CatalogServiceTestCase.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.rest.wireformat.json; + +import java.net.Socket; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import services.Catalog; +import services.Item; + +@Ignore +public class CatalogServiceTestCase { + private static Node node; + private static Catalog catalogService; + + @BeforeClass + public static void init() throws Exception { + try { + String contribution = ContributionLocationHelper.getContributionLocation(CatalogServiceTestCase.class); + node = NodeFactory.newInstance().createNode("store.composite", new Contribution("catalog", contribution)); + node.start(); + + catalogService = node.getService(Catalog.class, "Catalog"); + Assert.assertNotNull(catalogService); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @AfterClass + public static void destroy() throws Exception { + if(node != null) { + node.stop(); + } + } + + @Test + public void testPing() throws Exception { + new Socket("127.0.0.1", 8085); + System.in.read(); + } + + @Test + public void testNewsService() throws Exception { + Item[] items = catalogService.get(); + + Assert.assertNotNull(items); + Assert.assertTrue(items.length > 0); + + for(int pos = 0; pos < items.length; pos++) { + System.out.println(">>> Item[" + pos + "] - " + items[pos].getName() + " - " + items[pos].getPrice()); + } + } +} diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/JSONWireFormatTestCase.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/JSONWireFormatTestCase.java new file mode 100644 index 0000000000..5159cf6893 --- /dev/null +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/JSONWireFormatTestCase.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.rest.wireformat.json; + +public class JSONWireFormatTestCase { + +} |