You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2015/06/05 19:20:52 UTC
cxf git commit: Get jaxws_spring_boot to pass checkstyle
Repository: cxf
Updated Branches:
refs/heads/master 884e8a2bf -> be4e40a46
Get jaxws_spring_boot to pass checkstyle
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/be4e40a4
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/be4e40a4
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/be4e40a4
Branch: refs/heads/master
Commit: be4e40a46784d81c559b073b487255cf87334a77
Parents: 884e8a2
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Jun 5 13:20:35 2015 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Jun 5 13:20:35 2015 -0400
----------------------------------------------------------------------
.../java/sample/ws/SampleWsApplication.java | 39 +++++----
.../main/java/sample/ws/WebServiceConfig.java | 86 ++++++++++----------
.../src/main/java/sample/ws/service/Hello.java | 52 ++++++------
.../java/sample/ws/service/HelloPortImpl.java | 68 +++++++---------
.../ws/service/SampleWsApplicationTests.java | 75 +++++++++--------
5 files changed, 161 insertions(+), 159 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/be4e40a4/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/SampleWsApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/SampleWsApplication.java b/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/SampleWsApplication.java
index f84f65d..1abe821 100644
--- a/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/SampleWsApplication.java
+++ b/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/SampleWsApplication.java
@@ -1,31 +1,30 @@
-/*
- * Copyright 2012-2014 the original author or authors.
+/**
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 sample.ws;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+//CHECKSTYLE:OFF
@SpringBootApplication
public class SampleWsApplication {
-
- public static void main(String[] args) throws Exception {
- SpringApplication.run(SampleWsApplication.class, args);
- }
-
-
-
+ public static void main(String[] args) throws Exception {
+ SpringApplication.run(SampleWsApplication.class, args);
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/be4e40a4/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/WebServiceConfig.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/WebServiceConfig.java b/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/WebServiceConfig.java
index 12691a0..3f4c629 100644
--- a/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/WebServiceConfig.java
+++ b/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/WebServiceConfig.java
@@ -1,62 +1,60 @@
-/*
- * Copyright 2012-2014 the original author or authors.
+/**
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 sample.ws;
-import org.springframework.boot.context.embedded.ServletRegistrationBean;
+import javax.xml.ws.Endpoint;
+import org.apache.cxf.bus.spring.SpringBus;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.transport.servlet.CXFServlet;
-import org.springframework.context.ApplicationContext;
+import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.core.io.ClassPathResource;
import org.springframework.ws.config.annotation.EnableWs;
import org.springframework.ws.config.annotation.WsConfigurerAdapter;
-import org.springframework.ws.transport.http.MessageDispatcherServlet;
-import org.apache.cxf.bus.spring.SpringBus;
import sample.ws.service.Hello;
import sample.ws.service.HelloPortImpl;
-import javax.xml.ws.Endpoint;
-import org.apache.cxf.transport.servlet.CXFServlet;
-import org.apache.cxf.jaxws.EndpointImpl
-;
@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
- @Bean
- public ServletRegistrationBean dispatcherServlet() {
- CXFServlet cxfServlet = new CXFServlet();
- return new ServletRegistrationBean(cxfServlet, "/Service/*");
- }
-
- @Bean(name="cxf")
- public SpringBus springBus() {
- return new SpringBus();
- }
-
- @Bean
- public Hello myService() {
- return new HelloPortImpl();
- }
-
- @Bean
- public Endpoint endpoint() {
- EndpointImpl endpoint = new EndpointImpl(springBus(), myService());
- endpoint.publish("/Hello");
- return endpoint;
- }
+ @Bean
+ public ServletRegistrationBean dispatcherServlet() {
+ CXFServlet cxfServlet = new CXFServlet();
+ return new ServletRegistrationBean(cxfServlet, "/Service/*");
+ }
+
+ @Bean(name = "cxf")
+ public SpringBus springBus() {
+ return new SpringBus();
+ }
+
+ @Bean
+ public Hello myService() {
+ return new HelloPortImpl();
+ }
+
+ @Bean
+ public Endpoint endpoint() {
+ EndpointImpl endpoint = new EndpointImpl(springBus(), myService());
+ endpoint.publish("/Hello");
+ return endpoint;
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/be4e40a4/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/service/Hello.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/service/Hello.java b/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/service/Hello.java
index cd520cb..e0872b4 100644
--- a/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/service/Hello.java
+++ b/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/service/Hello.java
@@ -1,17 +1,20 @@
-/*
- * Copyright 2012-2013 the original author or authors.
- *
- * Licensed 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
+/**
+ * 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
+ * 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.
+ * 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 sample.ws.service;
@@ -19,25 +22,24 @@ import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
-import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
/**
- * Examples code for spring boot with CXF services.
- * Hello is the interface for sayHello interface.
- *
- * This class was generated by Apache CXF 3.1.0 2015-05-18T13:02:03.098-05:00
- * Generated source version: 3.1.0
- *
+ * Examples code for spring boot with CXF services. Hello is the interface for
+ * sayHello interface. This class was generated by Apache CXF 3.1.0
+ * 2015-05-18T13:02:03.098-05:00 Generated source version: 3.1.0
*/
@WebService(targetNamespace = "http://service.ws.sample/", name = "Hello")
public interface Hello {
- @WebResult(name = "return", targetNamespace = "")
- @RequestWrapper(localName = "sayHello", targetNamespace = "http://service.ws.sample/", className = "sample.ws.service.SayHello")
- @WebMethod(action = "urn:SayHello")
- @ResponseWrapper(localName = "sayHelloResponse", targetNamespace = "http://service.ws.sample/", className = "sample.ws.service.SayHelloResponse")
- public java.lang.String sayHello(
- @WebParam(name = "myname", targetNamespace = "") java.lang.String myname);
+ @WebResult(name = "return", targetNamespace = "")
+ @RequestWrapper(localName = "sayHello",
+ targetNamespace = "http://service.ws.sample/",
+ className = "sample.ws.service.SayHello")
+ @WebMethod(action = "urn:SayHello")
+ @ResponseWrapper(localName = "sayHelloResponse",
+ targetNamespace = "http://service.ws.sample/",
+ className = "sample.ws.service.SayHelloResponse")
+ String sayHello(@WebParam(name = "myname", targetNamespace = "") String myname);
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/be4e40a4/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/service/HelloPortImpl.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/service/HelloPortImpl.java b/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/service/HelloPortImpl.java
index e721698..b63fabc 100644
--- a/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/service/HelloPortImpl.java
+++ b/distribution/src/main/release/samples/jaxws_spring_boot/src/main/java/sample/ws/service/HelloPortImpl.java
@@ -1,53 +1,47 @@
-/*
- * Copyright 2012-2014 the original author or authors.
- *
- * Licensed 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
+/**
+ * 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
+ * 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.
+ * 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 sample.ws.service;
import java.util.logging.Logger;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebResult;
-import javax.jws.WebService;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.ResponseWrapper;
/**
- * Examples code for spring boot with CXF services.
- * HelloPortImpl is the implementation for Hello interface.
- *
- * This class was generated by Apache CXF 3.1.0 2015-05-18T13:02:03.098-05:00
- * Generated source version: 3.1.0
- *
+ * Examples code for spring boot with CXF services. HelloPortImpl is the
+ * implementation for Hello interface. This class was generated by Apache CXF
+ * 3.1.0 2015-05-18T13:02:03.098-05:00 Generated source version: 3.1.0
*/
-@javax.jws.WebService(serviceName = "HelloService", portName = "HelloPort", targetNamespace = "http://service.ws.sample/", endpointInterface = "sample.ws.service.Hello")
+@javax.jws.WebService(serviceName = "HelloService", portName = "HelloPort",
+ targetNamespace = "http://service.ws.sample/",
+ endpointInterface = "sample.ws.service.Hello")
public class HelloPortImpl implements Hello {
- private static final Logger LOG = Logger.getLogger(HelloPortImpl.class
- .getName());
+ private static final Logger LOG = Logger.getLogger(HelloPortImpl.class.getName());
- public java.lang.String sayHello(java.lang.String myname) {
- LOG.info("Executing operation sayHello" + myname);
- try {
- return "Hello, Welcome to CXF Spring boot " + myname + "!!!";
+ public java.lang.String sayHello(java.lang.String myname) {
+ LOG.info("Executing operation sayHello" + myname);
+ try {
+ return "Hello, Welcome to CXF Spring boot " + myname + "!!!";
- } catch (java.lang.Exception ex) {
- ex.printStackTrace();
- throw new RuntimeException(ex);
- }
- }
+ } catch (java.lang.Exception ex) {
+ ex.printStackTrace();
+ throw new RuntimeException(ex);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/be4e40a4/distribution/src/main/release/samples/jaxws_spring_boot/src/test/java/sample/ws/service/SampleWsApplicationTests.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jaxws_spring_boot/src/test/java/sample/ws/service/SampleWsApplicationTests.java b/distribution/src/main/release/samples/jaxws_spring_boot/src/test/java/sample/ws/service/SampleWsApplicationTests.java
index 6e195b5..0b9de2c 100644
--- a/distribution/src/main/release/samples/jaxws_spring_boot/src/test/java/sample/ws/service/SampleWsApplicationTests.java
+++ b/distribution/src/main/release/samples/jaxws_spring_boot/src/test/java/sample/ws/service/SampleWsApplicationTests.java
@@ -1,17 +1,20 @@
-/*
- * Copyright 2012-2014 the original author or authors.
+/**
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 sample.ws.service;
@@ -31,11 +34,12 @@ import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.ws.client.core.WebServiceTemplate;
-import sample.ws.SampleWsApplication;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertThat;
+import sample.ws.SampleWsApplication;
+
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SampleWsApplication.class)
@@ -43,31 +47,36 @@ import static org.junit.Assert.assertThat;
@IntegrationTest("server.port=0")
public class SampleWsApplicationTests {
- @Rule
- public OutputCapture output = new OutputCapture();
+ //CHECKSTYLE:OFF
+ @Rule
+ public OutputCapture output = new OutputCapture(); // SUPPRESS CHECKSTYLE
+ //CHECKSTYLE:ON
- private WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
+ private WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
- @Value("${local.server.port}")
- private int serverPort;
+ @Value("${local.server.port}")
+ private int serverPort;
- @Before
- public void setUp() {
- this.webServiceTemplate.setDefaultUri("http://localhost:" + this.serverPort
- + "/Service/Hello");
- }
+ @Before
+ public void setUp() {
+ this.webServiceTemplate.setDefaultUri("http://localhost:" + this.serverPort + "/Service/Hello");
+ }
- @Test
- public void testHelloRequest() {
- //final String request = "<q0:sayHello xmlns:q0=\"http://service.ws.sample\">Elan</q0:sayHello>";
- final String request = "<q0:sayHello xmlns:q0=\"http://service.ws.sample/\"><myname>Elan</myname></q0:sayHello>";
-
+ @Test
+ public void testHelloRequest() {
+ // final String request =
+ // "<q0:sayHello xmlns:q0=\"http://service.ws.sample\">Elan</q0:sayHello>";
+ String request = "<q0:sayHello xmlns:q0=\"http://service.ws.sample/\"><myname>Elan</myname></q0:sayHello>";
- StreamSource source = new StreamSource(new StringReader(request));
- StreamResult result = new StreamResult(System.out);
+ StreamSource source = new StreamSource(new StringReader(request));
+ StreamResult result = new StreamResult(System.out);
- this.webServiceTemplate.sendSourceAndReceiveToResult(source, result);
- assertThat(this.output.toString(), containsString("<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns2:sayHelloResponse xmlns:ns2=\"http://service.ws.sample/\"><return>Hello, Welcome to CXF Spring boot Elan!!!</return></ns2:sayHelloResponse>"));
- }
+ this.webServiceTemplate.sendSourceAndReceiveToResult(source, result);
+ assertThat(this.output.toString(),
+ containsString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + "<ns2:sayHelloResponse xmlns:ns2=\"http://service.ws.sample/\">"
+ + "<return>Hello, Welcome to CXF Spring boot Elan!!!</return>"
+ + "</ns2:sayHelloResponse>"));
+ }
}