diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-25 17:51:58 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-25 17:51:58 +0000 |
commit | cd239b3c0b45860ccee96878b7cb1bedb09c717a (patch) | |
tree | 48bd8c1d2f6b6e0797c5456fb1768a6445eac489 /sca-java-2.x/trunk/modules | |
parent | c0ab823236d049e10a4ddde4f7c95c8b0b6bf52d (diff) |
Refactoring/Simplifying JSON wireFormat class names
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@937847 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
7 files changed, 1 insertions, 302 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/wireformat/json/RESTWireFormatJSON.java b/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/wireformat/json/RESTWireFormatJSON.java deleted file mode 100644 index 3181bdba58..0000000000 --- a/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/wireformat/json/RESTWireFormatJSON.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.WireFormat; - -/** - * JSON Wireformat model for REST Binding - * - * @version $Rev$ $Date$ - */ -public interface RESTWireFormatJSON extends WireFormat { - - /** - * QName representing the JSON Wireformat for REST Binding - */ - public static final QName REST_WIREFORMAT_JSON_QNAME = new QName(SCA11_TUSCANY_NS, "wireFormat.jsonrpc"); - - /** - * Return the QName identifying the wire format - * @return the QName identifying the wire format - */ - QName getSchemaName(); -} diff --git a/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/wireformat/json/RESTWireFormatJSONFactory.java b/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/wireformat/json/RESTWireFormatJSONFactory.java deleted file mode 100644 index e030207755..0000000000 --- a/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/wireformat/json/RESTWireFormatJSONFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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; - -/** - * JSON Wireformat factory for REST Binding - * - * @version $Rev$ $Date$ - */ -public interface RESTWireFormatJSONFactory { - - /** - * Create a new JSON wireformat for REST Binding - * @return the new JSON wire format - */ - RESTWireFormatJSON createRESTWireFormatJSON(); -} diff --git a/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/wireformat/json/impl/RESTWireFormatJSONFactoryImpl.java b/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/wireformat/json/impl/RESTWireFormatJSONFactoryImpl.java deleted file mode 100644 index bd10980daf..0000000000 --- a/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/wireformat/json/impl/RESTWireFormatJSONFactoryImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.impl; - -import org.apache.tuscany.sca.binding.rest.wireformat.json.RESTWireFormatJSON; -import org.apache.tuscany.sca.binding.rest.wireformat.json.RESTWireFormatJSONFactory; - -/** - * JSON Wireformat factory implementation for REST Binding - * - * @version $Rev$ $Date$ - */ -public class RESTWireFormatJSONFactoryImpl implements RESTWireFormatJSONFactory { - - public RESTWireFormatJSON createRESTWireFormatJSON() { - return new RESTWireFormatJSONImpl(); - } - -} diff --git a/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/wireformat/json/impl/RESTWireFormatJSONImpl.java b/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/wireformat/json/impl/RESTWireFormatJSONImpl.java deleted file mode 100644 index 3819ac856d..0000000000 --- a/sca-java-2.x/trunk/modules/binding-rest/src/main/java/org/apache/tuscany/sca/binding/rest/wireformat/json/impl/RESTWireFormatJSONImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.impl; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.binding.rest.wireformat.json.RESTWireFormatJSON; - - -/** - * JSON Wireformat implementation for REST Binding - * - * @version $Rev$ $Date$ - */ -public class RESTWireFormatJSONImpl implements RESTWireFormatJSON { - - public QName getSchemaName() { - return RESTWireFormatJSON.REST_WIREFORMAT_JSON_QNAME; - } - - public boolean isUnresolved() { - return false; - } - - public void setUnresolved(boolean unresolved) { - // no op - } -} diff --git a/sca-java-2.x/trunk/modules/binding-rest/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rest.wireformat.json.RESTWireFormatJSONFactory b/sca-java-2.x/trunk/modules/binding-rest/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rest.wireformat.json.RESTWireFormatJSONFactory deleted file mode 100644 index 0c23bb41c2..0000000000 --- a/sca-java-2.x/trunk/modules/binding-rest/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rest.wireformat.json.RESTWireFormatJSONFactory +++ /dev/null @@ -1,19 +0,0 @@ -# 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. - -# Implementation class for model factory -org.apache.tuscany.sca.binding.rest.wireformat.json.impl.RESTWireFormatJSONFactoryImpl
\ No newline at end of file diff --git a/sca-java-2.x/trunk/modules/binding-rest/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-2.x/trunk/modules/binding-rest/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor index a7ef76332a..56c9f1e237 100644 --- a/sca-java-2.x/trunk/modules/binding-rest/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ b/sca-java-2.x/trunk/modules/binding-rest/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -19,4 +19,4 @@ org.apache.tuscany.sca.binding.rest.xml.RESTBindingProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#binding.rest,model=org.apache.tuscany.sca.binding.rest.RESTBinding,factory=org.apache.tuscany.sca.binding.rest.RESTBindingFactory
# Implementation class for the wireFormat processor extension -org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#wireFormat.json,model=org.apache.tuscany.sca.binding.rest.wireformat.json.RESTWireFormatJSON,factory=org.apache.tuscany.sca.binding.rest.wireformat.json.RESTWireFormatJSONFactory
\ No newline at end of file +org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#wireFormat.json,model=org.apache.tuscany.sca.binding.rest.wireformat.json.JSONWireFormat,factory=org.apache.tuscany.sca.binding.rest.wireformat.json.JSONWireFormatFactory
\ No newline at end of file diff --git a/sca-java-2.x/trunk/modules/binding-rest/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/impl/RESTWireFormatJSONProcessorTestCase.java b/sca-java-2.x/trunk/modules/binding-rest/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/impl/RESTWireFormatJSONProcessorTestCase.java deleted file mode 100644 index 64cec94a78..0000000000 --- a/sca-java-2.x/trunk/modules/binding-rest/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/json/impl/RESTWireFormatJSONProcessorTestCase.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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.impl; - -import java.io.ByteArrayOutputStream; -import java.io.StringReader; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sca.assembly.WireFormat; -import org.apache.tuscany.sca.binding.rest.RESTBinding; -import org.apache.tuscany.sca.binding.rest.wireformat.json.RESTWireFormatJSON; -import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.ProcessorContext; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * JSON wire format processor tests to verify properly processing of - * wireFormat content in binding configuration in the composite file - * - * @version $Rev$ $Date$ - */ -public class RESTWireFormatJSONProcessorTestCase { - - public static final String COMPOSITE_WITH_WIRE_FORMAT = - "<?xml version='1.0' encoding='UTF-8'?>" - + "<composite xmlns=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" xmlns:ns1=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-rest\" name=\"binding-rest\">" - + "<component name=\"HelloWorldComponent\">" - + "<implementation.java class=\"services.HelloWorld\" />" - + "<service name=\"HelloWorldService\">" - + "<ns1:binding.rest xmlns:ns1=\"http://tuscany.apache.org/xmlns/sca/1.1\" uri=\"http://localhost:8080/uri\">" - + "<ns1:wireFormat.json />" - + "</ns1:binding.rest>" - + "</service>" - + "</component>" - + "</composite>"; - - public static final String BINDING_WITH_WIRE_FORMAT = - "<binding.rest xmlns=\"http://tuscany.apache.org/xmlns/sca/1.1\" uri=\"http://localhost:8080/uri\">" - + "<wireFormat.json />" - + "</binding.rest>"; - - private static XMLInputFactory inputFactory; - private static XMLOutputFactory outputFactory; - private static ExtensibleStAXArtifactProcessor staxProcessor; - private static ProcessorContext context; - - @BeforeClass - public static void setUp() throws Exception { - DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - inputFactory = XMLInputFactory.newInstance(); - outputFactory = XMLOutputFactory.newInstance(); - - context = new ProcessorContext(extensionPoints); - - StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); - staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory); - - } - - /** - * Tests the APIs: - * public WireFormat getRequstWireFormat(); - * public WireFormat getResponseWireFormat(); - * - * @throws Exception - */ - @Test - public void testWireFormat() throws Exception { - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(BINDING_WITH_WIRE_FORMAT)); - - RESTBinding binding = (RESTBinding)staxProcessor.read(reader, context); - Assert.assertNotNull(binding); - - WireFormat requestWireFormat = binding.getRequestWireFormat(); - Assert.assertEquals(RESTWireFormatJSON.class, requestWireFormat.getClass().getInterfaces()[0]); - - WireFormat responseWireFormat = binding.getResponseWireFormat(); - Assert.assertEquals(RESTWireFormatJSON.class, responseWireFormat.getClass().getInterfaces()[0]); - } - - @Test - public void testWriteWireFormat() throws Exception { - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(BINDING_WITH_WIRE_FORMAT)); - - RESTBinding binding = (RESTBinding)staxProcessor.read(reader, context); - Assert.assertNotNull(binding); - reader.close(); - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - staxProcessor.write(binding, bos, context); - - // used for debug comparison - System.out.println(BINDING_WITH_WIRE_FORMAT); - System.out.println(bos.toString()); - - Assert.assertEquals(BINDING_WITH_WIRE_FORMAT, bos.toString()); - - } -} |