You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2015/09/25 12:42:42 UTC
[07/33] tomee git commit: Align SNAPSHOT versions & reformat examples
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/CallbackCounter.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/CallbackCounter.java b/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/CallbackCounter.java
index 8c8b53d..0e4cd56 100644
--- a/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/CallbackCounter.java
+++ b/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/CallbackCounter.java
@@ -1,73 +1,73 @@
-/**
- * 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.counter;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
-import javax.ejb.Stateful;
-import javax.ejb.StatefulTimeout;
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.InvocationContext;
-import java.io.Serializable;
-import java.util.concurrent.TimeUnit;
-
-@Stateful
-@StatefulTimeout(value = 1, unit = TimeUnit.SECONDS)
-public class CallbackCounter implements Serializable {
-
- private int count = 0;
-
- @PrePassivate
- public void prePassivate() {
- ExecutionChannel.getInstance().notifyObservers("prePassivate");
- }
-
- @PostActivate
- public void postActivate() {
- ExecutionChannel.getInstance().notifyObservers("postActivate");
- }
-
- @PostConstruct
- public void postConstruct() {
- ExecutionChannel.getInstance().notifyObservers("postConstruct");
- }
-
- @PreDestroy
- public void preDestroy() {
- ExecutionChannel.getInstance().notifyObservers("preDestroy");
- }
-
- @AroundInvoke
- public Object intercept(InvocationContext ctx) throws Exception {
- ExecutionChannel.getInstance().notifyObservers(ctx.getMethod().getName());
- return ctx.proceed();
- }
-
- public int count() {
- return count;
- }
-
- public int increment() {
- return ++count;
- }
-
- public int reset() {
- return (count = 0);
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.counter;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+import javax.ejb.Stateful;
+import javax.ejb.StatefulTimeout;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+import java.io.Serializable;
+import java.util.concurrent.TimeUnit;
+
+@Stateful
+@StatefulTimeout(value = 1, unit = TimeUnit.SECONDS)
+public class CallbackCounter implements Serializable {
+
+ private int count = 0;
+
+ @PrePassivate
+ public void prePassivate() {
+ ExecutionChannel.getInstance().notifyObservers("prePassivate");
+ }
+
+ @PostActivate
+ public void postActivate() {
+ ExecutionChannel.getInstance().notifyObservers("postActivate");
+ }
+
+ @PostConstruct
+ public void postConstruct() {
+ ExecutionChannel.getInstance().notifyObservers("postConstruct");
+ }
+
+ @PreDestroy
+ public void preDestroy() {
+ ExecutionChannel.getInstance().notifyObservers("preDestroy");
+ }
+
+ @AroundInvoke
+ public Object intercept(InvocationContext ctx) throws Exception {
+ ExecutionChannel.getInstance().notifyObservers(ctx.getMethod().getName());
+ return ctx.proceed();
+ }
+
+ public int count() {
+ return count;
+ }
+
+ public int increment() {
+ return ++count;
+ }
+
+ public int reset() {
+ return (count = 0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/ExecutionChannel.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/ExecutionChannel.java b/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/ExecutionChannel.java
index 601ccab..eb04530 100644
--- a/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/ExecutionChannel.java
+++ b/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/ExecutionChannel.java
@@ -1,41 +1,41 @@
-/**
- * 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.counter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ExecutionChannel {
-
- private static final ExecutionChannel INSTANCE = new ExecutionChannel();
-
- private final List<ExecutionObserver> observers = new ArrayList<ExecutionObserver>();
-
- public static ExecutionChannel getInstance() {
- return INSTANCE;
- }
-
- public void addObserver(ExecutionObserver observer) {
- this.observers.add(observer);
- }
-
- public void notifyObservers(Object value) {
- for (ExecutionObserver observer : this.observers) {
- observer.onExecution(value);
- }
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.counter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ExecutionChannel {
+
+ private static final ExecutionChannel INSTANCE = new ExecutionChannel();
+
+ private final List<ExecutionObserver> observers = new ArrayList<ExecutionObserver>();
+
+ public static ExecutionChannel getInstance() {
+ return INSTANCE;
+ }
+
+ public void addObserver(ExecutionObserver observer) {
+ this.observers.add(observer);
+ }
+
+ public void notifyObservers(Object value) {
+ for (ExecutionObserver observer : this.observers) {
+ observer.onExecution(value);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/ExecutionObserver.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/ExecutionObserver.java b/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/ExecutionObserver.java
index e4a6614..920a74e 100644
--- a/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/ExecutionObserver.java
+++ b/examples/simple-stateful-callbacks/src/main/java/org/superbiz/counter/ExecutionObserver.java
@@ -1,23 +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.counter;
-
-public interface ExecutionObserver {
-
- void onExecution(Object value);
-
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.counter;
+
+public interface ExecutionObserver {
+
+ void onExecution(Object value);
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateful-callbacks/src/test/java/org/superbiz/counter/CounterCallbacksTest.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateful-callbacks/src/test/java/org/superbiz/counter/CounterCallbacksTest.java b/examples/simple-stateful-callbacks/src/test/java/org/superbiz/counter/CounterCallbacksTest.java
index 1701a52..c5d24bc 100644
--- a/examples/simple-stateful-callbacks/src/test/java/org/superbiz/counter/CounterCallbacksTest.java
+++ b/examples/simple-stateful-callbacks/src/test/java/org/superbiz/counter/CounterCallbacksTest.java
@@ -1,125 +1,125 @@
-/**
- * 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.counter;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import javax.ejb.embeddable.EJBContainer;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-public class CounterCallbacksTest implements ExecutionObserver {
-
- private List<Object> received = new ArrayList<Object>();
-
- public Context getContext() throws NamingException {
- final Properties p = new Properties();
- p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
- return new InitialContext(p);
-
- }
-
- @Test
- public void test() throws Exception {
- final Map<String, Object> p = new HashMap<String, Object>();
- p.put("MySTATEFUL", "new://Container?type=STATEFUL");
- p.put("MySTATEFUL.Capacity", "2"); //How many instances of Stateful beans can our server hold in memory?
- p.put("MySTATEFUL.Frequency", "1"); //Interval in seconds between checks
- p.put("MySTATEFUL.BulkPassivate", "0"); //No bulkPassivate - just passivate entities whenever it is needed
- final EJBContainer container = EJBContainer.createEJBContainer(p);
-
- //this is going to track the execution
- ExecutionChannel.getInstance().addObserver(this);
-
- {
- final Context context = getContext();
-
- CallbackCounter counterA = (CallbackCounter) context.lookup("java:global/simple-stateful-callbacks/CallbackCounter");
- Assert.assertNotNull(counterA);
- Assert.assertEquals("postConstruct", this.received.remove(0));
-
- Assert.assertEquals(0, counterA.count());
- Assert.assertEquals("count", this.received.remove(0));
-
- Assert.assertEquals(1, counterA.increment());
- Assert.assertEquals("increment", this.received.remove(0));
-
- Assert.assertEquals(0, counterA.reset());
- Assert.assertEquals("reset", this.received.remove(0));
-
- Assert.assertEquals(1, counterA.increment());
- Assert.assertEquals("increment", this.received.remove(0));
-
- System.out.println("Waiting 2 seconds...");
- Thread.sleep(2000);
-
- Assert.assertEquals("preDestroy", this.received.remove(0));
-
- try {
- counterA.increment();
- Assert.fail("The ejb is not supposed to be there.");
- } catch (javax.ejb.NoSuchEJBException e) {
- //excepted
- }
-
- context.close();
- }
-
- {
- final Context context = getContext();
-
- CallbackCounter counterA = (CallbackCounter) context.lookup("java:global/simple-stateful-callbacks/CallbackCounter");
- Assert.assertEquals("postConstruct", this.received.remove(0));
-
- Assert.assertEquals(1, counterA.increment());
- Assert.assertEquals("increment", this.received.remove(0));
-
- ((CallbackCounter) context.lookup("java:global/simple-stateful-callbacks/CallbackCounter")).count();
- Assert.assertEquals("postConstruct", this.received.remove(0));
- Assert.assertEquals("count", this.received.remove(0));
-
- ((CallbackCounter) context.lookup("java:global/simple-stateful-callbacks/CallbackCounter")).count();
- Assert.assertEquals("postConstruct", this.received.remove(0));
- Assert.assertEquals("count", this.received.remove(0));
-
- System.out.println("Waiting 2 seconds...");
- Thread.sleep(2000);
- Assert.assertEquals("prePassivate", this.received.remove(0));
-
- context.close();
- }
- container.close();
-
- Assert.assertEquals("preDestroy", this.received.remove(0));
- Assert.assertEquals("preDestroy", this.received.remove(0));
-
- Assert.assertTrue(this.received.toString(), this.received.isEmpty());
- }
-
- @Override
- public void onExecution(Object value) {
- System.out.println("Test step -> " + value);
- this.received.add(value);
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.counter;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+public class CounterCallbacksTest implements ExecutionObserver {
+
+ private List<Object> received = new ArrayList<Object>();
+
+ public Context getContext() throws NamingException {
+ final Properties p = new Properties();
+ p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
+ return new InitialContext(p);
+
+ }
+
+ @Test
+ public void test() throws Exception {
+ final Map<String, Object> p = new HashMap<String, Object>();
+ p.put("MySTATEFUL", "new://Container?type=STATEFUL");
+ p.put("MySTATEFUL.Capacity", "2"); //How many instances of Stateful beans can our server hold in memory?
+ p.put("MySTATEFUL.Frequency", "1"); //Interval in seconds between checks
+ p.put("MySTATEFUL.BulkPassivate", "0"); //No bulkPassivate - just passivate entities whenever it is needed
+ final EJBContainer container = EJBContainer.createEJBContainer(p);
+
+ //this is going to track the execution
+ ExecutionChannel.getInstance().addObserver(this);
+
+ {
+ final Context context = getContext();
+
+ CallbackCounter counterA = (CallbackCounter) context.lookup("java:global/simple-stateful-callbacks/CallbackCounter");
+ Assert.assertNotNull(counterA);
+ Assert.assertEquals("postConstruct", this.received.remove(0));
+
+ Assert.assertEquals(0, counterA.count());
+ Assert.assertEquals("count", this.received.remove(0));
+
+ Assert.assertEquals(1, counterA.increment());
+ Assert.assertEquals("increment", this.received.remove(0));
+
+ Assert.assertEquals(0, counterA.reset());
+ Assert.assertEquals("reset", this.received.remove(0));
+
+ Assert.assertEquals(1, counterA.increment());
+ Assert.assertEquals("increment", this.received.remove(0));
+
+ System.out.println("Waiting 2 seconds...");
+ Thread.sleep(2000);
+
+ Assert.assertEquals("preDestroy", this.received.remove(0));
+
+ try {
+ counterA.increment();
+ Assert.fail("The ejb is not supposed to be there.");
+ } catch (javax.ejb.NoSuchEJBException e) {
+ //excepted
+ }
+
+ context.close();
+ }
+
+ {
+ final Context context = getContext();
+
+ CallbackCounter counterA = (CallbackCounter) context.lookup("java:global/simple-stateful-callbacks/CallbackCounter");
+ Assert.assertEquals("postConstruct", this.received.remove(0));
+
+ Assert.assertEquals(1, counterA.increment());
+ Assert.assertEquals("increment", this.received.remove(0));
+
+ ((CallbackCounter) context.lookup("java:global/simple-stateful-callbacks/CallbackCounter")).count();
+ Assert.assertEquals("postConstruct", this.received.remove(0));
+ Assert.assertEquals("count", this.received.remove(0));
+
+ ((CallbackCounter) context.lookup("java:global/simple-stateful-callbacks/CallbackCounter")).count();
+ Assert.assertEquals("postConstruct", this.received.remove(0));
+ Assert.assertEquals("count", this.received.remove(0));
+
+ System.out.println("Waiting 2 seconds...");
+ Thread.sleep(2000);
+ Assert.assertEquals("prePassivate", this.received.remove(0));
+
+ context.close();
+ }
+ container.close();
+
+ Assert.assertEquals("preDestroy", this.received.remove(0));
+ Assert.assertEquals("preDestroy", this.received.remove(0));
+
+ Assert.assertTrue(this.received.toString(), this.received.isEmpty());
+ }
+
+ @Override
+ public void onExecution(Object value) {
+ System.out.println("Test step -> " + value);
+ this.received.add(value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateful/src/main/java/org/superbiz/counter/Counter.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateful/src/main/java/org/superbiz/counter/Counter.java b/examples/simple-stateful/src/main/java/org/superbiz/counter/Counter.java
index cee4fe0..9d7fc42 100644
--- a/examples/simple-stateful/src/main/java/org/superbiz/counter/Counter.java
+++ b/examples/simple-stateful/src/main/java/org/superbiz/counter/Counter.java
@@ -1,54 +1,54 @@
-/**
- * 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.counter;
-
-import javax.ejb.Stateful;
-
-/**
- * This is an EJB 3 style pojo stateful session bean
- * Every stateful session bean implementation must be annotated
- * using the annotation @Stateful
- * This EJB has 2 business interfaces: CounterRemote, a remote business
- * interface, and CounterLocal, a local business interface
- * <p/>
- * Per EJB3 rules when the @Remote or @Local annotation isn't present
- * in the bean class (this class), all interfaces are considered
- * local unless explicitly annotated otherwise. If you look
- * in the CounterRemote interface, you'll notice it uses the @Remote
- * annotation while the CounterLocal interface is not annotated relying
- * on the EJB3 default rules to make it a local interface.
- */
-//START SNIPPET: code
-@Stateful
-public class Counter {
-
- private int count = 0;
-
- public int count() {
- return count;
- }
-
- public int increment() {
- return ++count;
- }
-
- public int reset() {
- return (count = 0);
- }
-
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.counter;
+
+import javax.ejb.Stateful;
+
+/**
+ * This is an EJB 3 style pojo stateful session bean
+ * Every stateful session bean implementation must be annotated
+ * using the annotation @Stateful
+ * This EJB has 2 business interfaces: CounterRemote, a remote business
+ * interface, and CounterLocal, a local business interface
+ * <p/>
+ * Per EJB3 rules when the @Remote or @Local annotation isn't present
+ * in the bean class (this class), all interfaces are considered
+ * local unless explicitly annotated otherwise. If you look
+ * in the CounterRemote interface, you'll notice it uses the @Remote
+ * annotation while the CounterLocal interface is not annotated relying
+ * on the EJB3 default rules to make it a local interface.
+ */
+//START SNIPPET: code
+@Stateful
+public class Counter {
+
+ private int count = 0;
+
+ public int count() {
+ return count;
+ }
+
+ public int increment() {
+ return ++count;
+ }
+
+ public int reset() {
+ return (count = 0);
+ }
+
+}
+//END SNIPPET: code
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateful/src/test/java/org/superbiz/counter/CounterTest.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateful/src/test/java/org/superbiz/counter/CounterTest.java b/examples/simple-stateful/src/test/java/org/superbiz/counter/CounterTest.java
index 6511821..00706d1 100644
--- a/examples/simple-stateful/src/test/java/org/superbiz/counter/CounterTest.java
+++ b/examples/simple-stateful/src/test/java/org/superbiz/counter/CounterTest.java
@@ -1,54 +1,54 @@
-/**
- * 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.counter;
-
-import junit.framework.TestCase;
-
-import javax.ejb.embeddable.EJBContainer;
-import javax.naming.Context;
-
-public class CounterTest extends TestCase {
-
- //START SNIPPET: local
- public void test() throws Exception {
-
- final Context context = EJBContainer.createEJBContainer().getContext();
-
- Counter counterA = (Counter) context.lookup("java:global/simple-stateful/Counter");
-
- assertEquals(0, counterA.count());
- assertEquals(0, counterA.reset());
- assertEquals(1, counterA.increment());
- assertEquals(2, counterA.increment());
- assertEquals(0, counterA.reset());
-
- counterA.increment();
- counterA.increment();
- counterA.increment();
- counterA.increment();
-
- assertEquals(4, counterA.count());
-
- // Get a new counter
- Counter counterB = (Counter) context.lookup("java:global/simple-stateful/Counter");
-
- // The new bean instance starts out at 0
- assertEquals(0, counterB.count());
- }
- //END SNIPPET: local
-
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.counter;
+
+import junit.framework.TestCase;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+
+public class CounterTest extends TestCase {
+
+ //START SNIPPET: local
+ public void test() throws Exception {
+
+ final Context context = EJBContainer.createEJBContainer().getContext();
+
+ Counter counterA = (Counter) context.lookup("java:global/simple-stateful/Counter");
+
+ assertEquals(0, counterA.count());
+ assertEquals(0, counterA.reset());
+ assertEquals(1, counterA.increment());
+ assertEquals(2, counterA.increment());
+ assertEquals(0, counterA.reset());
+
+ counterA.increment();
+ counterA.increment();
+ counterA.increment();
+ counterA.increment();
+
+ assertEquals(4, counterA.count());
+
+ // Get a new counter
+ Counter counterB = (Counter) context.lookup("java:global/simple-stateful/Counter");
+
+ // The new bean instance starts out at 0
+ assertEquals(0, counterB.count());
+ }
+ //END SNIPPET: local
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/CalculatorBean.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/CalculatorBean.java b/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/CalculatorBean.java
index cc85fdb..d425840 100644
--- a/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/CalculatorBean.java
+++ b/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/CalculatorBean.java
@@ -1,64 +1,64 @@
-/**
- * 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.stateless.basic;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.ejb.Stateless;
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.InvocationContext;
-
-@Stateless
-public class CalculatorBean {
-
- @PostConstruct
- public void postConstruct() {
- ExecutionChannel.getInstance().notifyObservers("postConstruct");
- }
-
- @PreDestroy
- public void preDestroy() {
- ExecutionChannel.getInstance().notifyObservers("preDestroy");
- }
-
- @AroundInvoke
- public Object intercept(InvocationContext ctx) throws Exception {
- ExecutionChannel.getInstance().notifyObservers(ctx.getMethod().getName());
- return ctx.proceed();
- }
-
- public int add(int a, int b) {
- return a + b;
- }
-
- public int subtract(int a, int b) {
- return a - b;
- }
-
- public int multiply(int a, int b) {
- return a * b;
- }
-
- public int divide(int a, int b) {
- return a / b;
- }
-
- public int remainder(int a, int b) {
- return a % b;
- }
-
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.stateless.basic;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.Stateless;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+@Stateless
+public class CalculatorBean {
+
+ @PostConstruct
+ public void postConstruct() {
+ ExecutionChannel.getInstance().notifyObservers("postConstruct");
+ }
+
+ @PreDestroy
+ public void preDestroy() {
+ ExecutionChannel.getInstance().notifyObservers("preDestroy");
+ }
+
+ @AroundInvoke
+ public Object intercept(InvocationContext ctx) throws Exception {
+ ExecutionChannel.getInstance().notifyObservers(ctx.getMethod().getName());
+ return ctx.proceed();
+ }
+
+ public int add(int a, int b) {
+ return a + b;
+ }
+
+ public int subtract(int a, int b) {
+ return a - b;
+ }
+
+ public int multiply(int a, int b) {
+ return a * b;
+ }
+
+ public int divide(int a, int b) {
+ return a / b;
+ }
+
+ public int remainder(int a, int b) {
+ return a % b;
+ }
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/ExecutionChannel.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/ExecutionChannel.java b/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/ExecutionChannel.java
index 5c078cf..a0520ed 100644
--- a/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/ExecutionChannel.java
+++ b/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/ExecutionChannel.java
@@ -1,41 +1,41 @@
-/**
- * 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.stateless.basic;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ExecutionChannel {
-
- private static final ExecutionChannel INSTANCE = new ExecutionChannel();
-
- private final List<ExecutionObserver> observers = new ArrayList<ExecutionObserver>();
-
- public static ExecutionChannel getInstance() {
- return INSTANCE;
- }
-
- public void addObserver(ExecutionObserver observer) {
- this.observers.add(observer);
- }
-
- public void notifyObservers(Object value) {
- for (ExecutionObserver observer : this.observers) {
- observer.onExecution(value);
- }
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.stateless.basic;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ExecutionChannel {
+
+ private static final ExecutionChannel INSTANCE = new ExecutionChannel();
+
+ private final List<ExecutionObserver> observers = new ArrayList<ExecutionObserver>();
+
+ public static ExecutionChannel getInstance() {
+ return INSTANCE;
+ }
+
+ public void addObserver(ExecutionObserver observer) {
+ this.observers.add(observer);
+ }
+
+ public void notifyObservers(Object value) {
+ for (ExecutionObserver observer : this.observers) {
+ observer.onExecution(value);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/ExecutionObserver.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/ExecutionObserver.java b/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/ExecutionObserver.java
index ee2a644..5fbf890 100644
--- a/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/ExecutionObserver.java
+++ b/examples/simple-stateless-callbacks/src/main/java/org/superbiz/stateless/basic/ExecutionObserver.java
@@ -1,23 +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.stateless.basic;
-
-public interface ExecutionObserver {
-
- void onExecution(Object value);
-
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.stateless.basic;
+
+public interface ExecutionObserver {
+
+ void onExecution(Object value);
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateless-callbacks/src/test/java/org/superbiz/stateless/basic/CalculatorTest.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateless-callbacks/src/test/java/org/superbiz/stateless/basic/CalculatorTest.java b/examples/simple-stateless-callbacks/src/test/java/org/superbiz/stateless/basic/CalculatorTest.java
index a42fe8e..1f17559 100644
--- a/examples/simple-stateless-callbacks/src/test/java/org/superbiz/stateless/basic/CalculatorTest.java
+++ b/examples/simple-stateless-callbacks/src/test/java/org/superbiz/stateless/basic/CalculatorTest.java
@@ -1,89 +1,89 @@
-/**
- * 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.stateless.basic;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import javax.ejb.embeddable.EJBContainer;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-public class CalculatorTest implements ExecutionObserver {
-
- private static final String JNDI = "java:global/simple-stateless-callbacks/CalculatorBean";
-
- private List<Object> received = new ArrayList<Object>();
-
- public Context getContext() throws NamingException {
- final Properties p = new Properties();
- p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
- return new InitialContext(p);
-
- }
-
- @Test
- public void test() throws Exception {
- ExecutionChannel.getInstance().addObserver(this);
-
- final EJBContainer container = EJBContainer.createEJBContainer();
-
- {
- final CalculatorBean calculator = (CalculatorBean) getContext().lookup(JNDI);
-
- Assert.assertEquals(10, calculator.add(4, 6));
-
- //the bean is constructed only when it is used for the first time
- Assert.assertEquals("postConstruct", this.received.remove(0));
- Assert.assertEquals("add", this.received.remove(0));
-
- Assert.assertEquals(-2, calculator.subtract(4, 6));
- Assert.assertEquals("subtract", this.received.remove(0));
-
- Assert.assertEquals(24, calculator.multiply(4, 6));
- Assert.assertEquals("multiply", this.received.remove(0));
-
- Assert.assertEquals(2, calculator.divide(12, 6));
- Assert.assertEquals("divide", this.received.remove(0));
-
- Assert.assertEquals(4, calculator.remainder(46, 6));
- Assert.assertEquals("remainder", this.received.remove(0));
- }
-
- {
- final CalculatorBean calculator = (CalculatorBean) getContext().lookup(JNDI);
-
- Assert.assertEquals(10, calculator.add(4, 6));
- Assert.assertEquals("add", this.received.remove(0));
-
- }
-
- container.close();
- Assert.assertEquals("preDestroy", this.received.remove(0));
- Assert.assertTrue(this.received.isEmpty());
- }
-
- @Override
- public void onExecution(Object value) {
- System.out.println("Test step -> " + value);
- this.received.add(value);
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.stateless.basic;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+public class CalculatorTest implements ExecutionObserver {
+
+ private static final String JNDI = "java:global/simple-stateless-callbacks/CalculatorBean";
+
+ private List<Object> received = new ArrayList<Object>();
+
+ public Context getContext() throws NamingException {
+ final Properties p = new Properties();
+ p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
+ return new InitialContext(p);
+
+ }
+
+ @Test
+ public void test() throws Exception {
+ ExecutionChannel.getInstance().addObserver(this);
+
+ final EJBContainer container = EJBContainer.createEJBContainer();
+
+ {
+ final CalculatorBean calculator = (CalculatorBean) getContext().lookup(JNDI);
+
+ Assert.assertEquals(10, calculator.add(4, 6));
+
+ //the bean is constructed only when it is used for the first time
+ Assert.assertEquals("postConstruct", this.received.remove(0));
+ Assert.assertEquals("add", this.received.remove(0));
+
+ Assert.assertEquals(-2, calculator.subtract(4, 6));
+ Assert.assertEquals("subtract", this.received.remove(0));
+
+ Assert.assertEquals(24, calculator.multiply(4, 6));
+ Assert.assertEquals("multiply", this.received.remove(0));
+
+ Assert.assertEquals(2, calculator.divide(12, 6));
+ Assert.assertEquals("divide", this.received.remove(0));
+
+ Assert.assertEquals(4, calculator.remainder(46, 6));
+ Assert.assertEquals("remainder", this.received.remove(0));
+ }
+
+ {
+ final CalculatorBean calculator = (CalculatorBean) getContext().lookup(JNDI);
+
+ Assert.assertEquals(10, calculator.add(4, 6));
+ Assert.assertEquals("add", this.received.remove(0));
+
+ }
+
+ container.close();
+ Assert.assertEquals("preDestroy", this.received.remove(0));
+ Assert.assertTrue(this.received.isEmpty());
+ }
+
+ @Override
+ public void onExecution(Object value) {
+ System.out.println("Test step -> " + value);
+ this.received.add(value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorImpl.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorImpl.java b/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorImpl.java
index 347b460..12a862b 100644
--- a/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorImpl.java
+++ b/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorImpl.java
@@ -1,37 +1,37 @@
-/**
- * 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;
-
-/**
- * This is an EJB 3 stateless session bean, configured using an EJB 3
- * deployment descriptor as opposed to using annotations.
- * This EJB has 2 business interfaces: CalculatorRemote, a remote business
- * interface, and CalculatorLocal, a local business interface
- */
-//START SNIPPET: code
-public class CalculatorImpl implements CalculatorRemote, CalculatorLocal {
-
- public int sum(int add1, int add2) {
- return add1 + add2;
- }
-
- public int multiply(int mul1, int mul2) {
- return mul1 * mul2;
- }
-
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+/**
+ * This is an EJB 3 stateless session bean, configured using an EJB 3
+ * deployment descriptor as opposed to using annotations.
+ * This EJB has 2 business interfaces: CalculatorRemote, a remote business
+ * interface, and CalculatorLocal, a local business interface
+ */
+//START SNIPPET: code
+public class CalculatorImpl implements CalculatorRemote, CalculatorLocal {
+
+ public int sum(int add1, int add2) {
+ return add1 + add2;
+ }
+
+ public int multiply(int mul1, int mul2) {
+ return mul1 * mul2;
+ }
+
+}
+//END SNIPPET: code
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorLocal.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorLocal.java b/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorLocal.java
index ed64e88..b9a58f9 100644
--- a/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorLocal.java
+++ b/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorLocal.java
@@ -1,30 +1,30 @@
-/**
- * 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;
-
-/**
- * This is an EJB 3 local business interface
- * This interface is specified using the business-local tag in the deployment descriptor
- */
-//START SNIPPET: code
-public interface CalculatorLocal {
-
- public int sum(int add1, int add2);
-
- public int multiply(int mul1, int mul2);
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+/**
+ * This is an EJB 3 local business interface
+ * This interface is specified using the business-local tag in the deployment descriptor
+ */
+//START SNIPPET: code
+public interface CalculatorLocal {
+
+ public int sum(int add1, int add2);
+
+ public int multiply(int mul1, int mul2);
+}
+//END SNIPPET: code
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorRemote.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorRemote.java b/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorRemote.java
index 2e61a11..4a3f6a4 100644
--- a/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorRemote.java
+++ b/examples/simple-stateless-with-descriptor/src/main/java/org/superbiz/calculator/CalculatorRemote.java
@@ -1,31 +1,31 @@
-/**
- * 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;
-
-/**
- * This is an EJB 3 remote business interface
- * This interface is specified using the business-local tag in the deployment descriptor
- */
-//START SNIPPET: code
-public interface CalculatorRemote {
-
- public int sum(int add1, int add2);
-
- public int multiply(int mul1, int mul2);
-
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+/**
+ * This is an EJB 3 remote business interface
+ * This interface is specified using the business-local tag in the deployment descriptor
+ */
+//START SNIPPET: code
+public interface CalculatorRemote {
+
+ public int sum(int add1, int add2);
+
+ public int multiply(int mul1, int mul2);
+
+}
+//END SNIPPET: code
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateless-with-descriptor/src/test/java/org/superbiz/calculator/CalculatorTest.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateless-with-descriptor/src/test/java/org/superbiz/calculator/CalculatorTest.java b/examples/simple-stateless-with-descriptor/src/test/java/org/superbiz/calculator/CalculatorTest.java
index ab24ac4..9c6bd7f 100644
--- a/examples/simple-stateless-with-descriptor/src/test/java/org/superbiz/calculator/CalculatorTest.java
+++ b/examples/simple-stateless-with-descriptor/src/test/java/org/superbiz/calculator/CalculatorTest.java
@@ -1,72 +1,72 @@
-/**
- * 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 junit.framework.TestCase;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import java.util.Properties;
-
-public class CalculatorTest extends TestCase {
-
- //START SNIPPET: setup
- private InitialContext initialContext;
-
- protected void setUp() throws Exception {
- Properties properties = new Properties();
- properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
-
- initialContext = new InitialContext(properties);
- }
- //END SNIPPET: setup
-
- /**
- * Lookup the Calculator bean via its remote home interface
- *
- * @throws Exception
- */
- //START SNIPPET: remote
- public void testCalculatorViaRemoteInterface() throws Exception {
- Object object = initialContext.lookup("CalculatorImplRemote");
-
- assertNotNull(object);
- assertTrue(object instanceof CalculatorRemote);
- CalculatorRemote calc = (CalculatorRemote) object;
- assertEquals(10, calc.sum(4, 6));
- assertEquals(12, calc.multiply(3, 4));
- }
- //END SNIPPET: remote
-
- /**
- * Lookup the Calculator bean via its local home interface
- *
- * @throws Exception
- */
- //START SNIPPET: local
- public void testCalculatorViaLocalInterface() throws Exception {
- Object object = initialContext.lookup("CalculatorImplLocal");
-
- assertNotNull(object);
- assertTrue(object instanceof CalculatorLocal);
- CalculatorLocal calc = (CalculatorLocal) object;
- assertEquals(10, calc.sum(4, 6));
- assertEquals(12, calc.multiply(3, 4));
- }
- //END SNIPPET: local
-
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 junit.framework.TestCase;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.Properties;
+
+public class CalculatorTest extends TestCase {
+
+ //START SNIPPET: setup
+ private InitialContext initialContext;
+
+ protected void setUp() throws Exception {
+ Properties properties = new Properties();
+ properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
+
+ initialContext = new InitialContext(properties);
+ }
+ //END SNIPPET: setup
+
+ /**
+ * Lookup the Calculator bean via its remote home interface
+ *
+ * @throws Exception
+ */
+ //START SNIPPET: remote
+ public void testCalculatorViaRemoteInterface() throws Exception {
+ Object object = initialContext.lookup("CalculatorImplRemote");
+
+ assertNotNull(object);
+ assertTrue(object instanceof CalculatorRemote);
+ CalculatorRemote calc = (CalculatorRemote) object;
+ assertEquals(10, calc.sum(4, 6));
+ assertEquals(12, calc.multiply(3, 4));
+ }
+ //END SNIPPET: remote
+
+ /**
+ * Lookup the Calculator bean via its local home interface
+ *
+ * @throws Exception
+ */
+ //START SNIPPET: local
+ public void testCalculatorViaLocalInterface() throws Exception {
+ Object object = initialContext.lookup("CalculatorImplLocal");
+
+ assertNotNull(object);
+ assertTrue(object instanceof CalculatorLocal);
+ CalculatorLocal calc = (CalculatorLocal) object;
+ assertEquals(10, calc.sum(4, 6));
+ assertEquals(12, calc.multiply(3, 4));
+ }
+ //END SNIPPET: local
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateless/src/main/java/org/superbiz/stateless/basic/CalculatorBean.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateless/src/main/java/org/superbiz/stateless/basic/CalculatorBean.java b/examples/simple-stateless/src/main/java/org/superbiz/stateless/basic/CalculatorBean.java
index dd3f471..0acc0e4 100644
--- a/examples/simple-stateless/src/main/java/org/superbiz/stateless/basic/CalculatorBean.java
+++ b/examples/simple-stateless/src/main/java/org/superbiz/stateless/basic/CalculatorBean.java
@@ -1,49 +1,49 @@
-/**
- * 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.stateless.basic;
-
-import javax.ejb.Stateless;
-
-/**
- * This is an EJB 3.1 style pojo Stateless session bean
- */
-//START SNIPPET: code
-@Stateless
-public class CalculatorBean {
-
- public int add(int a, int b) {
- return a + b;
- }
-
- public int subtract(int a, int b) {
- return a - b;
- }
-
- public int multiply(int a, int b) {
- return a * b;
- }
-
- public int divide(int a, int b) {
- return a / b;
- }
-
- public int remainder(int a, int b) {
- return a % b;
- }
-
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.stateless.basic;
+
+import javax.ejb.Stateless;
+
+/**
+ * This is an EJB 3.1 style pojo Stateless session bean
+ */
+//START SNIPPET: code
+@Stateless
+public class CalculatorBean {
+
+ public int add(int a, int b) {
+ return a + b;
+ }
+
+ public int subtract(int a, int b) {
+ return a - b;
+ }
+
+ public int multiply(int a, int b) {
+ return a * b;
+ }
+
+ public int divide(int a, int b) {
+ return a / b;
+ }
+
+ public int remainder(int a, int b) {
+ return a % b;
+ }
+
+}
//END SNIPPET: code
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-stateless/src/test/java/org/superbiz/stateless/basic/CalculatorTest.java
----------------------------------------------------------------------
diff --git a/examples/simple-stateless/src/test/java/org/superbiz/stateless/basic/CalculatorTest.java b/examples/simple-stateless/src/test/java/org/superbiz/stateless/basic/CalculatorTest.java
index 8425883..6972326 100644
--- a/examples/simple-stateless/src/test/java/org/superbiz/stateless/basic/CalculatorTest.java
+++ b/examples/simple-stateless/src/test/java/org/superbiz/stateless/basic/CalculatorTest.java
@@ -1,107 +1,107 @@
-/**
- * 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.stateless.basic;
-
-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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class CalculatorTest {
-
- private static EJBContainer ejbContainer;
-
- private CalculatorBean calculator;
-
- @BeforeClass
- public static void startTheContainer() {
- ejbContainer = EJBContainer.createEJBContainer();
- }
-
- @Before
- public void lookupABean() throws NamingException {
- Object object = ejbContainer.getContext().lookup("java:global/simple-stateless/CalculatorBean");
-
- assertTrue(object instanceof CalculatorBean);
-
- calculator = (CalculatorBean) object;
- }
-
- @AfterClass
- public static void stopTheContainer() {
- if (ejbContainer != null) {
- ejbContainer.close();
- }
- }
-
- /**
- * Test Add method
- */
- @Test
- public void testAdd() {
-
- assertEquals(10, calculator.add(4, 6));
-
- }
-
- /**
- * Test Subtract method
- */
- @Test
- public void testSubtract() {
-
- assertEquals(-2, calculator.subtract(4, 6));
-
- }
-
- /**
- * Test Multiply method
- */
- @Test
- public void testMultiply() {
-
- assertEquals(24, calculator.multiply(4, 6));
-
- }
-
- /**
- * Test Divide method
- */
- @Test
- public void testDivide() {
-
- assertEquals(2, calculator.divide(12, 6));
-
- }
-
- /**
- * Test Remainder method
- */
- @Test
- public void testRemainder() {
-
- assertEquals(4, calculator.remainder(46, 6));
-
- }
-
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.stateless.basic;
+
+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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class CalculatorTest {
+
+ private static EJBContainer ejbContainer;
+
+ private CalculatorBean calculator;
+
+ @BeforeClass
+ public static void startTheContainer() {
+ ejbContainer = EJBContainer.createEJBContainer();
+ }
+
+ @Before
+ public void lookupABean() throws NamingException {
+ Object object = ejbContainer.getContext().lookup("java:global/simple-stateless/CalculatorBean");
+
+ assertTrue(object instanceof CalculatorBean);
+
+ calculator = (CalculatorBean) object;
+ }
+
+ @AfterClass
+ public static void stopTheContainer() {
+ if (ejbContainer != null) {
+ ejbContainer.close();
+ }
+ }
+
+ /**
+ * Test Add method
+ */
+ @Test
+ public void testAdd() {
+
+ assertEquals(10, calculator.add(4, 6));
+
+ }
+
+ /**
+ * Test Subtract method
+ */
+ @Test
+ public void testSubtract() {
+
+ assertEquals(-2, calculator.subtract(4, 6));
+
+ }
+
+ /**
+ * Test Multiply method
+ */
+ @Test
+ public void testMultiply() {
+
+ assertEquals(24, calculator.multiply(4, 6));
+
+ }
+
+ /**
+ * Test Divide method
+ */
+ @Test
+ public void testDivide() {
+
+ assertEquals(2, calculator.divide(12, 6));
+
+ }
+
+ /**
+ * Test Remainder method
+ */
+ @Test
+ public void testRemainder() {
+
+ assertEquals(4, calculator.remainder(46, 6));
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-webservice-without-interface/src/main/java/org/superbiz/calculator/Calculator.java
----------------------------------------------------------------------
diff --git a/examples/simple-webservice-without-interface/src/main/java/org/superbiz/calculator/Calculator.java b/examples/simple-webservice-without-interface/src/main/java/org/superbiz/calculator/Calculator.java
index b90e992..25c2cc8 100644
--- a/examples/simple-webservice-without-interface/src/main/java/org/superbiz/calculator/Calculator.java
+++ b/examples/simple-webservice-without-interface/src/main/java/org/superbiz/calculator/Calculator.java
@@ -1,36 +1,36 @@
-/**
- * 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;
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-webservice-without-interface/src/test/java/org/superbiz/calculator/CalculatorTest.java
----------------------------------------------------------------------
diff --git a/examples/simple-webservice-without-interface/src/test/java/org/superbiz/calculator/CalculatorTest.java b/examples/simple-webservice-without-interface/src/test/java/org/superbiz/calculator/CalculatorTest.java
index a4acd24..0b7c89c 100644
--- a/examples/simple-webservice-without-interface/src/test/java/org/superbiz/calculator/CalculatorTest.java
+++ b/examples/simple-webservice-without-interface/src/test/java/org/superbiz/calculator/CalculatorTest.java
@@ -1,70 +1,70 @@
-/**
- * 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;
-
- //Random port to avoid test conflicts
- private static final int port = Integer.parseInt(System.getProperty("httpejbd.port", "" + org.apache.openejb.util.NetworkUtil.getNextAvailablePort()));
-
- @BeforeClass
- public static void setUp() throws Exception {
- final Properties properties = new Properties();
- properties.setProperty("openejb.embedded.remotable", "true");
-
- //Just for this test we change the default port from 4204 to avoid conflicts
- properties.setProperty("httpejbd.port", "" + port);
-
- 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://localhost:" + port + "/simple-webservice-without-interface/Calculator?wsdl");
- assertTrue(IOUtils.readLines(url.openStream()).size() > 0);
- assertTrue(IOUtils.readLines(url.openStream()).toString().contains("CalculatorWsService"));
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+ //Random port to avoid test conflicts
+ private static final int port = Integer.parseInt(System.getProperty("httpejbd.port", "" + org.apache.openejb.util.NetworkUtil.getNextAvailablePort()));
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ final Properties properties = new Properties();
+ properties.setProperty("openejb.embedded.remotable", "true");
+
+ //Just for this test we change the default port from 4204 to avoid conflicts
+ properties.setProperty("httpejbd.port", "" + port);
+
+ 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://localhost:" + port + "/simple-webservice-without-interface/Calculator?wsdl");
+ assertTrue(IOUtils.readLines(url.openStream()).size() > 0);
+ assertTrue(IOUtils.readLines(url.openStream()).toString().contains("CalculatorWsService"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-webservice/src/main/java/org/superbiz/calculator/ws/Calculator.java
----------------------------------------------------------------------
diff --git a/examples/simple-webservice/src/main/java/org/superbiz/calculator/ws/Calculator.java b/examples/simple-webservice/src/main/java/org/superbiz/calculator/ws/Calculator.java
index 8e683a2..e916956 100644
--- a/examples/simple-webservice/src/main/java/org/superbiz/calculator/ws/Calculator.java
+++ b/examples/simple-webservice/src/main/java/org/superbiz/calculator/ws/Calculator.java
@@ -1,37 +1,37 @@
-/**
- * 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.ws;
-
-import javax.ejb.Stateless;
-import javax.jws.WebService;
-
-@Stateless
-@WebService(
- portName = "CalculatorPort",
- serviceName = "CalculatorService",
- targetNamespace = "http://superbiz.org/wsdl",
- endpointInterface = "org.superbiz.calculator.ws.CalculatorWs")
-public class Calculator implements CalculatorWs {
-
- public int sum(int add1, int add2) {
- return add1 + add2;
- }
-
- public int multiply(int mul1, int mul2) {
- return mul1 * mul2;
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ws;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+@Stateless
+@WebService(
+ portName = "CalculatorPort",
+ serviceName = "CalculatorService",
+ targetNamespace = "http://superbiz.org/wsdl",
+ endpointInterface = "org.superbiz.calculator.ws.CalculatorWs")
+public class Calculator implements CalculatorWs {
+
+ public int sum(int add1, int add2) {
+ return add1 + add2;
+ }
+
+ public int multiply(int mul1, int mul2) {
+ return mul1 * mul2;
+ }
+}