From ab6904bc2f622129bc548391745b08eb0c219e57 Mon Sep 17 00:00:00 2001 From: rfeng Date: Tue, 21 Jul 2009 07:03:47 +0000 Subject: Fix svn:eol-style and svn:keywords properties for java/xml files git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@796166 13f79535-47bb-0310-9956-ffa450edef68 --- java/sca/modules/binding-jsonp-runtime/pom.xml | 170 ++++++++-------- .../jsonp/runtime/JSONPBindingProviderFactory.java | 118 +++++------ .../jsonp/runtime/JSONPServiceBindingProvider.java | 142 ++++++------- .../sca/binding/jsonp/runtime/JSONPServlet.java | 226 ++++++++++----------- .../src/test/java/helloworld/HelloWorldImpl.java | 56 ++--- .../test/java/helloworld/HelloWorldService.java | 56 ++--- .../src/test/java/test/BindingTestCase.java | 124 +++++------ .../src/test/resources/helloworld.composite | 64 +++--- 8 files changed, 478 insertions(+), 478 deletions(-) (limited to 'java/sca/modules/binding-jsonp-runtime') diff --git a/java/sca/modules/binding-jsonp-runtime/pom.xml b/java/sca/modules/binding-jsonp-runtime/pom.xml index 503ebadd1a..7906a2d4c3 100644 --- a/java/sca/modules/binding-jsonp-runtime/pom.xml +++ b/java/sca/modules/binding-jsonp-runtime/pom.xml @@ -1,85 +1,85 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-modules - 2.0-SNAPSHOT - ../pom.xml - - tuscany-binding-jsonp-runtime - Apache Tuscany SCA JSONP Binding Runtime - - - - - org.apache.tuscany.sca - tuscany-binding-jsonp - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-http - 2.0-SNAPSHOT - - - org.codehaus.jackson - jackson-core-asl - 1.0.1 - - - org.codehaus.jackson - jackson-mapper-asl - 1.0.1 - - - - javax.servlet - servlet-api - 2.5 - provided - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - test - - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - test - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - test - - - - - + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-modules + 2.0-SNAPSHOT + ../pom.xml + + tuscany-binding-jsonp-runtime + Apache Tuscany SCA JSONP Binding Runtime + + + + + org.apache.tuscany.sca + tuscany-binding-jsonp + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-http + 2.0-SNAPSHOT + + + org.codehaus.jackson + jackson-core-asl + 1.0.1 + + + org.codehaus.jackson + jackson-mapper-asl + 1.0.1 + + + + javax.servlet + servlet-api + 2.5 + provided + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + test + + + + + diff --git a/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPBindingProviderFactory.java b/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPBindingProviderFactory.java index 0954935098..f686d9d771 100644 --- a/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPBindingProviderFactory.java +++ b/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPBindingProviderFactory.java @@ -1,59 +1,59 @@ -/* - * 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.jsonp.runtime; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.Endpoint; -import org.apache.tuscany.sca.assembly.EndpointReference; -import org.apache.tuscany.sca.binding.jsonp.JSONPBinding; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.host.http.ServletHost; -import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint; -import org.apache.tuscany.sca.provider.BindingProviderFactory; -import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; - -public class JSONPBindingProviderFactory implements BindingProviderFactory { - - private ServletHost servletHost; - - public JSONPBindingProviderFactory(ExtensionPointRegistry extensionPoints) { - ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class); - List hosts = servletHosts.getServletHosts(); - if (!hosts.isEmpty()) { - this.servletHost = hosts.get(0); - } - } - - public Class getModelType() { - return JSONPBinding.class; - } - - public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference arg0) { - // TODO Auto-generated method stub - return null; - } - - public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) { - return new JSONPServiceBindingProvider(endpoint, servletHost); - } - -} +/* + * 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.jsonp.runtime; + +import java.util.List; + +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.binding.jsonp.JSONPBinding; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.host.http.ServletHost; +import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint; +import org.apache.tuscany.sca.provider.BindingProviderFactory; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; + +public class JSONPBindingProviderFactory implements BindingProviderFactory { + + private ServletHost servletHost; + + public JSONPBindingProviderFactory(ExtensionPointRegistry extensionPoints) { + ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class); + List hosts = servletHosts.getServletHosts(); + if (!hosts.isEmpty()) { + this.servletHost = hosts.get(0); + } + } + + public Class getModelType() { + return JSONPBinding.class; + } + + public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference arg0) { + // TODO Auto-generated method stub + return null; + } + + public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) { + return new JSONPServiceBindingProvider(endpoint, servletHost); + } + +} diff --git a/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServiceBindingProvider.java b/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServiceBindingProvider.java index dfd2faef7f..2876db430a 100644 --- a/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServiceBindingProvider.java +++ b/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServiceBindingProvider.java @@ -1,71 +1,71 @@ -/* - * 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.jsonp.runtime; - -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Endpoint; -import org.apache.tuscany.sca.host.http.ServletHost; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; -import org.apache.tuscany.sca.runtime.RuntimeWire; - -public class JSONPServiceBindingProvider implements ServiceBindingProvider { - - private Endpoint endpoint; - private ServletHost servletHost; - - public JSONPServiceBindingProvider(Endpoint endpoint, ServletHost servletHost) { - this.endpoint = endpoint; - this.servletHost = servletHost; - } - - public void start() { - ComponentService service = endpoint.getService(); - RuntimeWire wire = ((RuntimeComponentService)service).getRuntimeWire(endpoint.getBinding()); - Interface serviceInterface = service.getInterfaceContract().getInterface(); - for (Operation op : serviceInterface.getOperations()) { - JSONPServlet servlet = new JSONPServlet(wire, op); - String path = service.getName() + "/" + op.getName(); - servletHost.addServletMapping(path, servlet); - } - } - - public void stop() { - ComponentService service = endpoint.getService(); - Interface serviceInterface = service.getInterfaceContract().getInterface(); - for (Operation op : serviceInterface.getOperations()) { - String path = service.getName() + "/" + op.getName(); - servletHost.removeServletMapping(path); - } - } - - // TODO: Why are these two still on the ServiceBindingProvider interface? - public InterfaceContract getBindingInterfaceContract() { - return null; - } - - public boolean supportsOneWayInvocation() { - return false; - } - -} +/* + * 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.jsonp.runtime; + +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.host.http.ServletHost; +import org.apache.tuscany.sca.interfacedef.Interface; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; +import org.apache.tuscany.sca.runtime.RuntimeWire; + +public class JSONPServiceBindingProvider implements ServiceBindingProvider { + + private Endpoint endpoint; + private ServletHost servletHost; + + public JSONPServiceBindingProvider(Endpoint endpoint, ServletHost servletHost) { + this.endpoint = endpoint; + this.servletHost = servletHost; + } + + public void start() { + ComponentService service = endpoint.getService(); + RuntimeWire wire = ((RuntimeComponentService)service).getRuntimeWire(endpoint.getBinding()); + Interface serviceInterface = service.getInterfaceContract().getInterface(); + for (Operation op : serviceInterface.getOperations()) { + JSONPServlet servlet = new JSONPServlet(wire, op); + String path = service.getName() + "/" + op.getName(); + servletHost.addServletMapping(path, servlet); + } + } + + public void stop() { + ComponentService service = endpoint.getService(); + Interface serviceInterface = service.getInterfaceContract().getInterface(); + for (Operation op : serviceInterface.getOperations()) { + String path = service.getName() + "/" + op.getName(); + servletHost.removeServletMapping(path); + } + } + + // TODO: Why are these two still on the ServiceBindingProvider interface? + public InterfaceContract getBindingInterfaceContract() { + return null; + } + + public boolean supportsOneWayInvocation() { + return false; + } + +} diff --git a/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServlet.java b/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServlet.java index 6521e336e6..6eb323527c 100644 --- a/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServlet.java +++ b/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPServlet.java @@ -1,114 +1,114 @@ -/* - * 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.jsonp.runtime; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.util.Enumeration; - -import javax.servlet.GenericServlet; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; - -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.runtime.RuntimeWire; -import org.codehaus.jackson.JsonParseException; -import org.codehaus.jackson.map.JsonMappingException; -import org.codehaus.jackson.map.ObjectMapper; - -public class JSONPServlet extends GenericServlet { - private static final long serialVersionUID = 1L; - - protected transient RuntimeWire wire; - protected transient Operation operation; - protected transient ObjectMapper mapper; - - public JSONPServlet(RuntimeWire wire, Operation operation) { - this.wire = wire; - this.operation = operation; - this.mapper = new ObjectMapper(); - } - - @Override - public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { - String jsonRequest = getJSONRequest(servletRequest); - Object[] args = jsonToObjects(jsonRequest); - Object response = invokeService(args); - String jsonResponse = getJSONResponse(servletRequest, response); - servletResponse.getOutputStream().println(jsonResponse); - } - - /** - * Turn the request into JSON - */ - protected String getJSONRequest(ServletRequest servletRequest) throws IOException, JsonParseException, JsonMappingException { - String jsonRequest = "["; - for (Enumeration ns = servletRequest.getParameterNames(); ns.hasMoreElements(); ) { - String name = (String) ns.nextElement(); - if (!name.startsWith("_") && !"callback".equals(name)) { - if (jsonRequest.length() > 1) { - jsonRequest += ", "; - } - //jsonRequest += name + ":" + servletRequest.getParameter(name); - jsonRequest += "\""+ servletRequest.getParameter(name) + "\""; - } - } - jsonRequest += "]"; - return jsonRequest; - } - - /** - * Turn the response object into JSON - */ - protected String getJSONResponse(ServletRequest servletRequest, Object response) throws IOException, JsonParseException { - ByteArrayOutputStream os = new ByteArrayOutputStream(); - mapper.writeValue(os , response); - String jsonResponse = os.toString(); - - String callback = servletRequest.getParameter("callback"); - if (callback != null && callback.length() > 1) { - jsonResponse = callback + "(" + jsonResponse + ");"; - } - - return jsonResponse; - } - - /** - * Turn the request JSON into objects - */ - protected Object[] jsonToObjects(String jsonRequest) throws IOException, JsonParseException, JsonMappingException { - Class c = new Object[0].getClass(); - Object[] args = (Object[])mapper.readValue(jsonRequest, c); - return args; - } - - /** - * Send the request down the wire to invoke the service - */ - protected Object invokeService(Object[] args) { - try { - return wire.invoke(operation, args); - } catch (InvocationTargetException e) { - throw new RuntimeException(e); - } - } +/* + * 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.jsonp.runtime; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.util.Enumeration; + +import javax.servlet.GenericServlet; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.runtime.RuntimeWire; +import org.codehaus.jackson.JsonParseException; +import org.codehaus.jackson.map.JsonMappingException; +import org.codehaus.jackson.map.ObjectMapper; + +public class JSONPServlet extends GenericServlet { + private static final long serialVersionUID = 1L; + + protected transient RuntimeWire wire; + protected transient Operation operation; + protected transient ObjectMapper mapper; + + public JSONPServlet(RuntimeWire wire, Operation operation) { + this.wire = wire; + this.operation = operation; + this.mapper = new ObjectMapper(); + } + + @Override + public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { + String jsonRequest = getJSONRequest(servletRequest); + Object[] args = jsonToObjects(jsonRequest); + Object response = invokeService(args); + String jsonResponse = getJSONResponse(servletRequest, response); + servletResponse.getOutputStream().println(jsonResponse); + } + + /** + * Turn the request into JSON + */ + protected String getJSONRequest(ServletRequest servletRequest) throws IOException, JsonParseException, JsonMappingException { + String jsonRequest = "["; + for (Enumeration ns = servletRequest.getParameterNames(); ns.hasMoreElements(); ) { + String name = (String) ns.nextElement(); + if (!name.startsWith("_") && !"callback".equals(name)) { + if (jsonRequest.length() > 1) { + jsonRequest += ", "; + } + //jsonRequest += name + ":" + servletRequest.getParameter(name); + jsonRequest += "\""+ servletRequest.getParameter(name) + "\""; + } + } + jsonRequest += "]"; + return jsonRequest; + } + + /** + * Turn the response object into JSON + */ + protected String getJSONResponse(ServletRequest servletRequest, Object response) throws IOException, JsonParseException { + ByteArrayOutputStream os = new ByteArrayOutputStream(); + mapper.writeValue(os , response); + String jsonResponse = os.toString(); + + String callback = servletRequest.getParameter("callback"); + if (callback != null && callback.length() > 1) { + jsonResponse = callback + "(" + jsonResponse + ");"; + } + + return jsonResponse; + } + + /** + * Turn the request JSON into objects + */ + protected Object[] jsonToObjects(String jsonRequest) throws IOException, JsonParseException, JsonMappingException { + Class c = new Object[0].getClass(); + Object[] args = (Object[])mapper.readValue(jsonRequest, c); + return args; + } + + /** + * Send the request down the wire to invoke the service + */ + protected Object invokeService(Object[] args) { + try { + return wire.invoke(operation, args); + } catch (InvocationTargetException e) { + throw new RuntimeException(e); + } + } } \ No newline at end of file diff --git a/java/sca/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java b/java/sca/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java index 16bf1db7ab..25a5cb24e0 100644 --- a/java/sca/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java +++ b/java/sca/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java @@ -1,28 +1,28 @@ -/* - * 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 helloworld; - - -public class HelloWorldImpl implements HelloWorldService { - - public String sayHello(String name) { - return "Hello " + name; - } - -} +/* + * 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 helloworld; + + +public class HelloWorldImpl implements HelloWorldService { + + public String sayHello(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java b/java/sca/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java index 064d615c45..59b4bd0d57 100644 --- a/java/sca/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java +++ b/java/sca/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java @@ -1,28 +1,28 @@ -/* - * 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 helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface HelloWorldService { - - String sayHello(String name); - -} +/* + * 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 helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldService { + + String sayHello(String name); + +} diff --git a/java/sca/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java b/java/sca/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java index 5bd52db1dc..d817aff0ff 100644 --- a/java/sca/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java +++ b/java/sca/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java @@ -1,62 +1,62 @@ -/* - * 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 test; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.MalformedURLException; -import java.net.URL; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.http.jetty.JettyServer; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class BindingTestCase { - - private static Node node; - - @Test - public void testService() throws MalformedURLException, IOException { - URL url = new URL("http://localhost:8085/HelloWorldService/sayHello?name=petra&callback=foo"); - BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); - String response = br.readLine(); - Assert.assertEquals("foo(\"Hello petra\");", response); - - } - - @BeforeClass - public static void init() throws Exception { - JettyServer.portDefault = 8085; - node = NodeFactory.newInstance().createNode("helloworld.composite").start(); - } - - @AfterClass - public static void destroy() throws Exception { - if (node != null) { - node.stop(); - } - } - -} +/* + * 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 test; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.http.jetty.JettyServer; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class BindingTestCase { + + private static Node node; + + @Test + public void testService() throws MalformedURLException, IOException { + URL url = new URL("http://localhost:8085/HelloWorldService/sayHello?name=petra&callback=foo"); + BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); + String response = br.readLine(); + Assert.assertEquals("foo(\"Hello petra\");", response); + + } + + @BeforeClass + public static void init() throws Exception { + JettyServer.portDefault = 8085; + node = NodeFactory.newInstance().createNode("helloworld.composite").start(); + } + + @AfterClass + public static void destroy() throws Exception { + if (node != null) { + node.stop(); + } + } + +} diff --git a/java/sca/modules/binding-jsonp-runtime/src/test/resources/helloworld.composite b/java/sca/modules/binding-jsonp-runtime/src/test/resources/helloworld.composite index cbfa8a204d..3ca0b4763e 100644 --- a/java/sca/modules/binding-jsonp-runtime/src/test/resources/helloworld.composite +++ b/java/sca/modules/binding-jsonp-runtime/src/test/resources/helloworld.composite @@ -1,32 +1,32 @@ - - - - - - - - - - - - + + + + + + + + + + + + -- cgit v1.2.3