You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2014/06/27 19:51:02 UTC
svn commit: r1606164 - in /tomee/tomee/trunk/examples: ./
applicationcomposer-jaxws-cdi/ applicationcomposer-jaxws-cdi/src/
applicationcomposer-jaxws-cdi/src/main/
applicationcomposer-jaxws-cdi/src/main/java/
applicationcomposer-jaxws-cdi/src/main/java...
Author: rmannibucau
Date: Fri Jun 27 17:51:01 2014
New Revision: 1606164
URL: http://svn.apache.org/r1606164
Log:
a sample of applicationcomposer + cdi + jaxws
Added:
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/pom.xml
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/Agenda.java
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/LazyAgenda.java
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/MeetingPlanner.java
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/MeetingPlannerImpl.java
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/resources/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/resources/META-INF/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/resources/META-INF/beans.xml
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/test/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/test/java/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/test/java/org/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/test/java/org/superbiz/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/test/java/org/superbiz/example/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/test/java/org/superbiz/example/jaxws/
tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/test/java/org/superbiz/example/jaxws/MeetingPlannerTest.java
Modified:
tomee/tomee/trunk/examples/pom.xml
Added: tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/pom.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/pom.xml?rev=1606164&view=auto
==============================================================================
--- tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/pom.xml (added)
+++ tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/pom.xml Fri Jun 27 17:51:01 2014
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.superbiz</groupId>
+ <artifactId>ws-pojo-cdi</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>OpenEJB :: Examples :: Application Composer, JAX-WS and CDI are in a boat</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>apache-m2-snapshot</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://repository.apache.org/snapshots</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>6.0-6</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- The <scope>test</scope> guarantees that none of your runtime code
+ is dependent on any OpenEJB classes. -->
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-cxf</artifactId>
+ <version>4.7.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>ziplock</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <!-- This section allows you to configure where to publish libraries for
+ sharing. It is not required and may be deleted. For more information see:
+ http://maven.apache.org/plugins/maven-deploy-plugin/ -->
+ <distributionManagement>
+ <repository>
+ <id>localhost</id>
+ <url>file://${basedir}/target/repo/</url>
+ </repository>
+ <snapshotRepository>
+ <id>localhost</id>
+ <url>file://${basedir}/target/snapshot-repo/</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+</project>
Added: tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/Agenda.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/Agenda.java?rev=1606164&view=auto
==============================================================================
--- tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/Agenda.java (added)
+++ tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/Agenda.java Fri Jun 27 17:51:01 2014
@@ -0,0 +1,23 @@
+/**
+ * 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.superbiz.example.jaxws;
+
+import java.util.Date;
+
+public interface Agenda {
+ boolean isBookable(Date d);
+}
Added: tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/LazyAgenda.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/LazyAgenda.java?rev=1606164&view=auto
==============================================================================
--- tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/LazyAgenda.java (added)
+++ tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/LazyAgenda.java Fri Jun 27 17:51:01 2014
@@ -0,0 +1,26 @@
+/**
+ * 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.superbiz.example.jaxws;
+
+import java.util.Date;
+
+public class LazyAgenda implements Agenda {
+ @Override
+ public boolean isBookable(final Date d) {
+ return d.after(new Date());
+ }
+}
Added: tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/MeetingPlanner.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/MeetingPlanner.java?rev=1606164&view=auto
==============================================================================
--- tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/MeetingPlanner.java (added)
+++ tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/MeetingPlanner.java Fri Jun 27 17:51:01 2014
@@ -0,0 +1,25 @@
+/**
+ * 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.superbiz.example.jaxws;
+
+import javax.jws.WebService;
+import java.util.Date;
+
+@WebService
+public interface MeetingPlanner {
+ boolean book(final Date date);
+}
Added: tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/MeetingPlannerImpl.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/MeetingPlannerImpl.java?rev=1606164&view=auto
==============================================================================
--- tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/MeetingPlannerImpl.java (added)
+++ tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/java/org/superbiz/example/jaxws/MeetingPlannerImpl.java Fri Jun 27 17:51:01 2014
@@ -0,0 +1,32 @@
+/**
+ * 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.superbiz.example.jaxws;
+
+import javax.inject.Inject;
+import javax.jws.WebService;
+import java.util.Date;
+
+@WebService
+public class MeetingPlannerImpl implements MeetingPlanner {
+ @Inject
+ private Agenda agenda;
+
+ @Override
+ public boolean book(final Date date) {
+ return agenda.isBookable(date);
+ }
+}
Added: tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/resources/META-INF/beans.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/resources/META-INF/beans.xml?rev=1606164&view=auto
==============================================================================
--- tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/resources/META-INF/beans.xml (added)
+++ tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/main/resources/META-INF/beans.xml Fri Jun 27 17:51:01 2014
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"/>
Added: tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/test/java/org/superbiz/example/jaxws/MeetingPlannerTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/test/java/org/superbiz/example/jaxws/MeetingPlannerTest.java?rev=1606164&view=auto
==============================================================================
--- tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/test/java/org/superbiz/example/jaxws/MeetingPlannerTest.java (added)
+++ tomee/tomee/trunk/examples/applicationcomposer-jaxws-cdi/src/test/java/org/superbiz/example/jaxws/MeetingPlannerTest.java Fri Jun 27 17:51:01 2014
@@ -0,0 +1,66 @@
+/**
+ * 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.superbiz.example.jaxws;
+
+import org.apache.openejb.jee.WebApp;
+import org.apache.openejb.junit.ApplicationComposer;
+import org.apache.openejb.testing.Classes;
+import org.apache.openejb.testing.Configuration;
+import org.apache.openejb.testing.EnableServices;
+import org.apache.openejb.testing.Module;
+
+import static java.lang.Integer.toString;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.openejb.testng.PropertiesBuilder;
+import org.apache.openejb.util.NetworkUtil;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Date;
+import java.util.Properties;
+
+@EnableServices("jax-ws")
+@RunWith(ApplicationComposer.class)
+public class MeetingPlannerTest {
+ private static final int JAX_WS_PORT = NetworkUtil.getNextAvailablePort();
+
+ @Configuration
+ public Properties configuration() {
+ return new PropertiesBuilder().p("httpejbd.port", Integer.toString(JAX_WS_PORT)).build();
+ }
+ @Module
+ @Classes(cdi = true, value = { MeetingPlannerImpl.class, LazyAgenda.class })
+ public WebApp war() {
+ return new WebApp()
+ .contextRoot("/demo")
+ .addServlet("jaxws", MeetingPlannerImpl.class.getName(), "/meeting-planner");
+ }
+
+ @Test
+ public void book() throws MalformedURLException {
+ final Service service = Service.create(
+ new URL("http://127.0.0.1:" + JAX_WS_PORT + "/demo/meeting-planner?wsdl"),
+ new QName("http://jaxws.example.superbiz.org/", "MeetingPlannerImplService"));
+ final MeetingPlanner planner = service.getPort(MeetingPlanner.class);
+ assertTrue(planner.book(new Date(System.currentTimeMillis() + 1000000)));
+ }
+}
Modified: tomee/tomee/trunk/examples/pom.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/pom.xml?rev=1606164&r1=1606163&r2=1606164&view=diff
==============================================================================
--- tomee/tomee/trunk/examples/pom.xml (original)
+++ tomee/tomee/trunk/examples/pom.xml Fri Jun 27 17:51:01 2014
@@ -34,6 +34,7 @@
<module>access-timeout</module>
<module>alternate-descriptors</module>
<module>application-composer</module>
+ <module>applicationcomposer-jaxws-cdi</module>
<module>applicationexception</module>
<module>async-methods</module>
<module>async-postconstruct</module>