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 2012/01/10 09:41:59 UTC
svn commit: r1229485 - in
/openejb/trunk/openejb/examples/simple-webservice-without-interface: ./
src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/superbiz/ src/main/java/org/superbiz/calculator/
src/main/resources/ src/main/resources...
Author: rmannibucau
Date: Tue Jan 10 08:41:59 2012
New Revision: 1229485
URL: http://svn.apache.org/viewvc?rev=1229485&view=rev
Log:
adding simple-webservice-without-interface example
Added:
openejb/trunk/openejb/examples/simple-webservice-without-interface/
openejb/trunk/openejb/examples/simple-webservice-without-interface/pom.xml
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/java/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/java/org/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/java/org/superbiz/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/java/org/superbiz/calculator/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/java/org/superbiz/calculator/Calculator.java
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/resources/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/resources/META-INF/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/resources/META-INF/ejb-jar.xml
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/java/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/java/org/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/java/org/superbiz/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/java/org/superbiz/calculator/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/java/org/superbiz/calculator/CalculatorTest.java
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/resources/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/resources/META-INF/
openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/resources/META-INF/ejb-jar.xml
Added: openejb/trunk/openejb/examples/simple-webservice-without-interface/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-webservice-without-interface/pom.xml?rev=1229485&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-webservice-without-interface/pom.xml (added)
+++ openejb/trunk/openejb/examples/simple-webservice-without-interface/pom.xml Tue Jan 10 08:41:59 2012
@@ -0,0 +1,109 @@
+<?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: 1178411 $ $Date: 2011-10-03 15:35:26 +0200 (lun. 03 oct. 2011) $ -->
+
+<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>simple-webservice-without-interface</artifactId>
+ <packaging>jar</packaging>
+ <version>1.1-SNAPSHOT</version>
+ <name>OpenEJB :: Examples :: Simple Webservice Without Interface</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>2.3.2</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-3-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.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>4.0.0-beta-2-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- This is required on IBM JDKs (and potentially others) because saaj-impl depends
+ on Sun's internal copy of Xerces. See OPENEJB-1126. -->
+ <dependency>
+ <groupId>com.sun.xml.parsers</groupId>
+ <artifactId>jaxp-ri</artifactId>
+ <version>1.4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- simply to get the wsdl in tests -->
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.0.1</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>
\ No newline at end of file
Added: openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/java/org/superbiz/calculator/Calculator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/java/org/superbiz/calculator/Calculator.java?rev=1229485&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/java/org/superbiz/calculator/Calculator.java (added)
+++ openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/java/org/superbiz/calculator/Calculator.java Tue Jan 10 08:41:59 2012
@@ -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.calculator;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+@Stateless
+@WebService(
+ portName = "CalculatorPort",
+ serviceName = "CalculatorWsService",
+ targetNamespace = "http://superbiz.org/wsdl")
+public class Calculator {
+ public int sum(int add1, int add2) {
+ return add1 + add2;
+ }
+
+ public int multiply(int mul1, int mul2) {
+ return mul1 * mul2;
+ }
+}
Added: openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/resources/META-INF/ejb-jar.xml?rev=1229485&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/resources/META-INF/ejb-jar.xml (added)
+++ openejb/trunk/openejb/examples/simple-webservice-without-interface/src/main/resources/META-INF/ejb-jar.xml Tue Jan 10 08:41:59 2012
@@ -0,0 +1 @@
+<ejb-jar/>
\ No newline at end of file
Added: openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/java/org/superbiz/calculator/CalculatorTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/java/org/superbiz/calculator/CalculatorTest.java?rev=1229485&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/java/org/superbiz/calculator/CalculatorTest.java (added)
+++ openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/java/org/superbiz/calculator/CalculatorTest.java Tue Jan 10 08:41:59 2012
@@ -0,0 +1,63 @@
+/**
+ * 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.calculator;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.NamingException;
+import java.net.URL;
+import java.util.Properties;
+
+import static org.junit.Assert.assertTrue;
+
+public class CalculatorTest {
+ private static EJBContainer container;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ final Properties properties = new Properties();
+ properties.setProperty("openejb.embedded.remotable", "true");
+
+ container = EJBContainer.createEJBContainer(properties);
+ }
+
+ @Before
+ public void inject() throws NamingException {
+ if (container != null) {
+ container.getContext().bind("inject", this);
+ }
+ }
+
+ @AfterClass
+ public static void close() {
+ if (container != null) {
+ container.close();
+ }
+ }
+
+ @Test
+ public void wsdlExists() throws Exception {
+ final URL url = new URL("http://127.0.0.1:4204/Calculator?wsdl");
+ assertTrue(IOUtils.readLines(url.openStream()).size() > 0);
+ assertTrue(IOUtils.readLines(url.openStream()).toString().contains("CalculatorWsService"));
+ }
+}
Added: openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/resources/META-INF/ejb-jar.xml?rev=1229485&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/resources/META-INF/ejb-jar.xml (added)
+++ openejb/trunk/openejb/examples/simple-webservice-without-interface/src/test/resources/META-INF/ejb-jar.xml Tue Jan 10 08:41:59 2012
@@ -0,0 +1 @@
+<ejb-jar/>
\ No newline at end of file