You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2009/12/23 10:38:07 UTC
svn commit: r893449 - in /openejb/trunk/openejb3/examples: ./
webservice-inheritance/ webservice-inheritance/src/
webservice-inheritance/src/main/ webservice-inheritance/src/main/java/
webservice-inheritance/src/main/java/org/ webservice-inheritance/sr...
Author: jlmonteiro
Date: Wed Dec 23 09:38:04 2009
New Revision: 893449
URL: http://svn.apache.org/viewvc?rev=893449&view=rev
Log:
OPENEJB-1122: openejb sample to illustrate SEI inheritance.
Added:
openejb/trunk/openejb3/examples/webservice-inheritance/
openejb/trunk/openejb3/examples/webservice-inheritance/pom.xml
openejb/trunk/openejb3/examples/webservice-inheritance/src/
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Item.java
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Tower.java
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeRiderImpl.java
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeRiderWs.java
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Wakeboard.java
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeboardBinding.java
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Wearable.java
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/resources/
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/resources/META-INF/
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/resources/META-INF/ejb-jar.xml
openejb/trunk/openejb3/examples/webservice-inheritance/src/main/resources/META-INF/persistence.xml
openejb/trunk/openejb3/examples/webservice-inheritance/src/test/
openejb/trunk/openejb3/examples/webservice-inheritance/src/test/java/
openejb/trunk/openejb3/examples/webservice-inheritance/src/test/java/org/
openejb/trunk/openejb3/examples/webservice-inheritance/src/test/java/org/superbiz/
openejb/trunk/openejb3/examples/webservice-inheritance/src/test/java/org/superbiz/inheritance/
openejb/trunk/openejb3/examples/webservice-inheritance/src/test/java/org/superbiz/inheritance/InheritanceTest.java
openejb/trunk/openejb3/examples/webservice-inheritance/src/test/resources/
Modified:
openejb/trunk/openejb3/examples/pom.xml
Modified: openejb/trunk/openejb3/examples/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/pom.xml?rev=893449&r1=893448&r2=893449&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/pom.xml (original)
+++ openejb/trunk/openejb3/examples/pom.xml Wed Dec 23 09:38:04 2009
@@ -64,6 +64,7 @@
<module>webapps</module>
<module>webservice-security</module>
<module>webservice-ws-security</module>
+ <module>webservice-inheritance</module>
</modules>
<profiles>
Added: openejb/trunk/openejb3/examples/webservice-inheritance/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-inheritance/pom.xml?rev=893449&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-inheritance/pom.xml (added)
+++ openejb/trunk/openejb3/examples/webservice-inheritance/pom.xml Wed Dec 23 09:38:04 2009
@@ -0,0 +1,91 @@
+<?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.
+-->
+
+<!-- $Rev: 751189 $ $Date: 2009-03-07 04:37:34 +0100 (sam., 07 mars 2009) $ -->
+
+<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>webservice-inheritance</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>OpenEJB :: Examples :: Webservice Inheritance</name>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</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>5.0-2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!--
+ The <scope>test</scope> guarantees that non of your runtime
+ code is dependent on any OpenEJB classes.
+ -->
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-cxf</artifactId>
+ <version>3.1.3-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: openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Item.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Item.java?rev=893449&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Item.java (added)
+++ openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Item.java Wed Dec 23 09:38:04 2009
@@ -0,0 +1,69 @@
+/**
+ * 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.inheritance;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+
+@Entity
+@Inheritance(strategy = InheritanceType.JOINED)
+public class Item implements Serializable {
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long id;
+ private String brand;
+ private String itemName;
+ private double price;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getBrand() {
+ return brand;
+ }
+
+ public void setBrand(String brand) {
+ this.brand = brand;
+ }
+
+ public String getItemName() {
+ return itemName;
+ }
+
+ public void setItemName(String itemName) {
+ this.itemName = itemName;
+ }
+
+ public double getPrice() {
+ return price;
+ }
+
+ public void setPrice(double price) {
+ this.price = price;
+ }
+}
Added: openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Tower.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Tower.java?rev=893449&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Tower.java (added)
+++ openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Tower.java Wed Dec 23 09:38:04 2009
@@ -0,0 +1,45 @@
+/**
+ * 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.inheritance;
+
+import javax.persistence.Entity;
+
+@Entity
+public class Tower extends Item {
+ private Fit fit;
+ private String tubing;
+
+ public static enum Fit {
+ Custom, Exact, Universal
+ }
+
+ public Fit getFit() {
+ return fit;
+ }
+
+ public void setFit(Fit fit) {
+ this.fit = fit;
+ }
+
+ public String getTubing() {
+ return tubing;
+ }
+
+ public void setTubing(String tubing) {
+ this.tubing = tubing;
+ };
+}
\ No newline at end of file
Added: openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeRiderImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeRiderImpl.java?rev=893449&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeRiderImpl.java (added)
+++ openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeRiderImpl.java Wed Dec 23 09:38:04 2009
@@ -0,0 +1,57 @@
+/**
+ * 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.inheritance;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
+
+/**
+ * This is an EJB 3 style pojo stateless session bean Every stateless session
+ * bean implementation must be annotated using the annotation @Stateless This
+ * EJB has a single interface: {@link WakeRiderWs} a webservice interface.
+ */
+@Stateless
+@WebService(
+ portName = "InheritancePort",
+ serviceName = "InheritanceWsService",
+ targetNamespace = "http://superbiz.org/wsdl",
+ endpointInterface = "org.superbiz.inheritance.WakeRiderWs")
+public class WakeRiderImpl implements WakeRiderWs {
+
+ @PersistenceContext(unitName = "wakeboard-unit", type = PersistenceContextType.TRANSACTION)
+ private EntityManager entityManager;
+
+ public void addItem(Item item) throws Exception {
+ entityManager.persist(item);
+ }
+
+ public void deleteMovie(Item item) throws Exception {
+ entityManager.remove(item);
+ }
+
+ public List<Item> getItems() throws Exception {
+ Query query = entityManager.createQuery("SELECT i FROM Item i");
+ List<Item> items = query.getResultList();
+ return items;
+ }
+}
Added: openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeRiderWs.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeRiderWs.java?rev=893449&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeRiderWs.java (added)
+++ openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeRiderWs.java Wed Dec 23 09:38:04 2009
@@ -0,0 +1,35 @@
+/**
+ * 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.inheritance;
+
+import java.util.List;
+
+import javax.jws.WebService;
+import javax.xml.bind.annotation.XmlSeeAlso;
+
+/**
+ * This is an EJB 3 webservice interface that uses inheritance.
+ */
+@WebService(targetNamespace = "http://superbiz.org/wsdl")
+@XmlSeeAlso( { Wakeboard.class, WakeboardBinding.class, Tower.class })
+public interface WakeRiderWs {
+ public void addItem(Item item) throws Exception;
+
+ public void deleteMovie(Item item) throws Exception;
+
+ public List<Item> getItems() throws Exception;
+}
Added: openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Wakeboard.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Wakeboard.java?rev=893449&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Wakeboard.java (added)
+++ openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Wakeboard.java Wed Dec 23 09:38:04 2009
@@ -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.inheritance;
+
+import javax.persistence.Entity;
+
+@Entity
+public class Wakeboard extends Wearable {
+}
Added: openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeboardBinding.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeboardBinding.java?rev=893449&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeboardBinding.java (added)
+++ openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/WakeboardBinding.java Wed Dec 23 09:38:04 2009
@@ -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.inheritance;
+
+import javax.persistence.Entity;
+
+@Entity
+public class WakeboardBinding extends Wearable {
+}
Added: openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Wearable.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Wearable.java?rev=893449&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Wearable.java (added)
+++ openejb/trunk/openejb3/examples/webservice-inheritance/src/main/java/org/superbiz/inheritance/Wearable.java Wed Dec 23 09:38:04 2009
@@ -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.inheritance;
+
+import javax.persistence.MappedSuperclass;
+
+@MappedSuperclass
+public abstract class Wearable extends Item {
+ protected String size;
+
+ public String getSize() {
+ return size;
+ }
+
+ public void setSize(String size) {
+ this.size = size;
+ }
+}
Added: openejb/trunk/openejb3/examples/webservice-inheritance/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-inheritance/src/main/resources/META-INF/ejb-jar.xml?rev=893449&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-inheritance/src/main/resources/META-INF/ejb-jar.xml (added)
+++ openejb/trunk/openejb3/examples/webservice-inheritance/src/main/resources/META-INF/ejb-jar.xml Wed Dec 23 09:38:04 2009
@@ -0,0 +1 @@
+<ejb-jar/>
Added: openejb/trunk/openejb3/examples/webservice-inheritance/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-inheritance/src/main/resources/META-INF/persistence.xml?rev=893449&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-inheritance/src/main/resources/META-INF/persistence.xml (added)
+++ openejb/trunk/openejb3/examples/webservice-inheritance/src/main/resources/META-INF/persistence.xml Wed Dec 23 09:38:04 2009
@@ -0,0 +1,35 @@
+<?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.
+ -->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+
+ <persistence-unit name="wakeboard-unit">
+
+ <jta-data-source>wakeBoardDatabase</jta-data-source>
+ <non-jta-data-source>wakeBoardDatabaseUnmanaged</non-jta-data-source>
+
+ <class>org.superbiz.inheritance.Item</class>
+ <class>org.superbiz.inheritance.Tower</class>
+ <class>org.superbiz.inheritance.Wakeboard</class>
+ <class>org.superbiz.inheritance.WakeboardBinding</class>
+ <class>org.superbiz.inheritance.Wearable</class>
+
+ <properties>
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" />
+ </properties>
+
+ </persistence-unit>
+</persistence>
\ No newline at end of file
Added: openejb/trunk/openejb3/examples/webservice-inheritance/src/test/java/org/superbiz/inheritance/InheritanceTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-inheritance/src/test/java/org/superbiz/inheritance/InheritanceTest.java?rev=893449&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-inheritance/src/test/java/org/superbiz/inheritance/InheritanceTest.java (added)
+++ openejb/trunk/openejb3/examples/webservice-inheritance/src/test/java/org/superbiz/inheritance/InheritanceTest.java Wed Dec 23 09:38:04 2009
@@ -0,0 +1,154 @@
+/**
+ * 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.inheritance;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.superbiz.inheritance.Tower.Fit;
+
+import junit.framework.TestCase;
+
+public class InheritanceTest extends TestCase {
+
+ //START SNIPPET: setup
+ private InitialContext initialContext;
+
+ protected void setUp() throws Exception {
+
+ Properties p = new Properties();
+ p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
+ p.put("wakeBoardDatabase", "new://Resource?type=DataSource");
+ p.put("wakeBoardDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
+ p.put("wakeBoardDatabase.JdbcUrl", "jdbc:hsqldb:mem:wakeBoarddb");
+
+ p.put("wakeBoardDatabaseUnmanaged", "new://Resource?type=DataSource");
+ p.put("wakeBoardDatabaseUnmanaged.JdbcDriver", "org.hsqldb.jdbcDriver");
+ p.put("wakeBoardDatabaseUnmanaged.JdbcUrl", "jdbc:hsqldb:mem:wakeBoarddb");
+ p.put("wakeBoardDatabaseUnmanaged.JtaManaged", "false");
+
+ p.put("openejb.embedded.remotable", "true");
+
+ initialContext = new InitialContext(p);
+ }
+ //END SNIPPET: setup
+
+ /**
+ * Create a webservice client using wsdl url
+ *
+ * @throws Exception
+ */
+ //START SNIPPET: webservice
+ public void testInheritanceViaWsInterface() throws Exception {
+ Service service = Service.create(
+ new URL("http://127.0.0.1:4204/WakeRiderImpl?wsdl"),
+ new QName("http://superbiz.org/wsdl", "InheritanceWsService"));
+ assertNotNull(service);
+
+ WakeRiderWs ws = service.getPort(WakeRiderWs.class);
+
+ Tower tower = createTower();
+ Item item = createItem();
+ Wakeboard wakeBoard = createWakeBoard();
+ WakeboardBinding wakeBoardbinding = createWakeboardBinding();
+
+ ws.addItem(tower);
+ ws.addItem(item);
+ ws.addItem(wakeBoard);
+ ws.addItem(wakeBoardbinding);
+
+
+ List<Item> returnedItems = ws.getItems();
+
+ assertEquals("testInheritanceViaWsInterface, nb Items", 4, returnedItems.size());
+
+ //check tower
+ assertEquals("testInheritanceViaWsInterface, first Item", returnedItems.get(0).getClass(), Tower.class);
+ tower = (Tower)returnedItems.get(0);
+ assertEquals("testInheritanceViaWsInterface, first Item", tower.getBrand(), "Tower brand");
+ assertEquals("testInheritanceViaWsInterface, first Item", tower.getFit().ordinal(), Fit.Custom.ordinal());
+ assertEquals("testInheritanceViaWsInterface, first Item", tower.getItemName(), "Tower item name");
+ assertEquals("testInheritanceViaWsInterface, first Item", tower.getPrice(), 1.0d);
+ assertEquals("testInheritanceViaWsInterface, first Item", tower.getTubing(), "Tower tubing");
+
+ //check item
+ assertEquals("testInheritanceViaWsInterface, second Item", returnedItems.get(1).getClass(), Item.class);
+ item = (Item)returnedItems.get(1);
+ assertEquals("testInheritanceViaWsInterface, second Item", item.getBrand(), "Item brand");
+ assertEquals("testInheritanceViaWsInterface, second Item", item.getItemName(), "Item name");
+ assertEquals("testInheritanceViaWsInterface, second Item", item.getPrice(), 2.0d);
+
+ //check wakeboard
+ assertEquals("testInheritanceViaWsInterface, third Item", returnedItems.get(2).getClass(), Wakeboard.class);
+ wakeBoard = (Wakeboard)returnedItems.get(2);
+ assertEquals("testInheritanceViaWsInterface, third Item", wakeBoard.getBrand(), "Wakeboard brand");
+ assertEquals("testInheritanceViaWsInterface, third Item", wakeBoard.getItemName(), "Wakeboard item name");
+ assertEquals("testInheritanceViaWsInterface, third Item", wakeBoard.getPrice(), 3.0d);
+ assertEquals("testInheritanceViaWsInterface, third Item", wakeBoard.getSize(), "WakeBoard size");
+
+ //check wakeboardbinding
+ assertEquals("testInheritanceViaWsInterface, fourth Item", returnedItems.get(3).getClass(), WakeboardBinding.class);
+ wakeBoardbinding = (WakeboardBinding)returnedItems.get(3);
+ assertEquals("testInheritanceViaWsInterface, fourth Item", wakeBoardbinding.getBrand(), "Wakeboardbinding brand");
+ assertEquals("testInheritanceViaWsInterface, fourth Item", wakeBoardbinding.getItemName(), "Wakeboardbinding item name");
+ assertEquals("testInheritanceViaWsInterface, fourth Item", wakeBoardbinding.getPrice(), 4.0d);
+ assertEquals("testInheritanceViaWsInterface, fourth Item", wakeBoardbinding.getSize(), "WakeBoardbinding size");
+ }
+ //END SNIPPET: webservice
+
+ private Tower createTower() {
+ Tower tower = new Tower();
+ tower.setBrand("Tower brand");
+ tower.setFit(Fit.Custom);
+ tower.setItemName("Tower item name");
+ tower.setPrice(1.0f);
+ tower.setTubing("Tower tubing");
+ return tower;
+ }
+
+ private Item createItem() {
+ Item item = new Item();
+ item.setBrand("Item brand");
+ item.setItemName("Item name");
+ item.setPrice(2.0f);
+ return item;
+ }
+
+ private Wakeboard createWakeBoard() {
+ Wakeboard wakeBoard = new Wakeboard();
+ wakeBoard.setBrand("Wakeboard brand");
+ wakeBoard.setItemName("Wakeboard item name");
+ wakeBoard.setPrice(3.0f);
+ wakeBoard.setSize("WakeBoard size");
+ return wakeBoard;
+ }
+
+ private WakeboardBinding createWakeboardBinding() {
+ WakeboardBinding wakeBoardBinding = new WakeboardBinding();
+ wakeBoardBinding.setBrand("Wakeboardbinding brand");
+ wakeBoardBinding.setItemName("Wakeboardbinding item name");
+ wakeBoardBinding.setPrice(4.0f);
+ wakeBoardBinding.setSize("WakeBoardbinding size");
+ return wakeBoardBinding;
+ }
+}