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:44 UTC
[09/33] tomee git commit: Align SNAPSHOT versions & reformat examples
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Hourly.java
----------------------------------------------------------------------
diff --git a/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Hourly.java b/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Hourly.java
index 91d663b..c8c82b6 100644
--- a/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Hourly.java
+++ b/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Hourly.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.corn.meta.api;
-
-import javax.ejb.Schedule;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Metatype
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-
-public @interface Hourly {
-
- public static interface $ {
-
- @Hourly
- @Schedule(second = "0", minute = "0", hour = "*")
- public void method();
- }
+/**
+ * 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.corn.meta.api;
+
+import javax.ejb.Schedule;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface Hourly {
+
+ public static interface $ {
+
+ @Hourly
+ @Schedule(second = "0", minute = "0", hour = "*")
+ public void method();
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Metatype.java
----------------------------------------------------------------------
diff --git a/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Metatype.java b/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Metatype.java
index edac298..5f7f2cd 100644
--- a/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Metatype.java
+++ b/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Metatype.java
@@ -1,29 +1,29 @@
-/**
- * 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.corn.meta.api;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Metatype
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Metatype {
-
-}
+/**
+ * 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.corn.meta.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.ANNOTATION_TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Metatype {
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/PlantingTime.java
----------------------------------------------------------------------
diff --git a/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/PlantingTime.java b/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/PlantingTime.java
index e90f6b2..ded755a 100644
--- a/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/PlantingTime.java
+++ b/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/PlantingTime.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.corn.meta.api;
-
-import javax.ejb.Schedule;
-import javax.ejb.Schedules;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Metatype
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-
-public @interface PlantingTime {
-
- public static interface $ {
-
- @PlantingTime
- @Schedules({
- @Schedule(month = "5", dayOfMonth = "20-Last", minute = "0", hour = "8"),
- @Schedule(month = "6", dayOfMonth = "1-10", minute = "0", hour = "8")
- })
- public void method();
- }
-}
+/**
+ * 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.corn.meta.api;
+
+import javax.ejb.Schedule;
+import javax.ejb.Schedules;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface PlantingTime {
+
+ public static interface $ {
+
+ @PlantingTime
+ @Schedules({
+ @Schedule(month = "5", dayOfMonth = "20-Last", minute = "0", hour = "8"),
+ @Schedule(month = "6", dayOfMonth = "1-10", minute = "0", hour = "8")
+ })
+ public void method();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Secondly.java
----------------------------------------------------------------------
diff --git a/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Secondly.java b/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Secondly.java
index 2c29c8b..320e8cc 100644
--- a/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Secondly.java
+++ b/examples/schedule-methods-meta/src/main/java/org/superbiz/corn/meta/api/Secondly.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.corn.meta.api;
-
-import javax.ejb.Schedule;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Metatype
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-
-public @interface Secondly {
-
- public static interface $ {
-
- @Secondly
- @Schedule(second = "*", minute = "*", hour = "*")
- public void method();
- }
+/**
+ * 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.corn.meta.api;
+
+import javax.ejb.Schedule;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface Secondly {
+
+ public static interface $ {
+
+ @Secondly
+ @Schedule(second = "*", minute = "*", hour = "*")
+ public void method();
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/schedule-methods-meta/src/test/java/org/superbiz/corn/meta/FarmerBrownTest.java
----------------------------------------------------------------------
diff --git a/examples/schedule-methods-meta/src/test/java/org/superbiz/corn/meta/FarmerBrownTest.java b/examples/schedule-methods-meta/src/test/java/org/superbiz/corn/meta/FarmerBrownTest.java
index 7cc531a..446e2a9 100644
--- a/examples/schedule-methods-meta/src/test/java/org/superbiz/corn/meta/FarmerBrownTest.java
+++ b/examples/schedule-methods-meta/src/test/java/org/superbiz/corn/meta/FarmerBrownTest.java
@@ -1,42 +1,42 @@
-/**
- * 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.corn.meta;
-
-import junit.framework.TestCase;
-
-import javax.ejb.embeddable.EJBContainer;
-import javax.naming.Context;
-
-import static java.util.concurrent.TimeUnit.SECONDS;
-
-/**
- * @version $Revision$ $Date$
- */
-public class FarmerBrownTest extends TestCase {
-
- public void test() throws Exception {
-
- final Context context = EJBContainer.createEJBContainer().getContext();
-
- final FarmerBrown farmerBrown = (FarmerBrown) context.lookup("java:global/schedule-methods-meta/FarmerBrown");
-
- // Give Farmer brown a chance to do some work
- Thread.sleep(SECONDS.toMillis(5));
-
- assertTrue(farmerBrown.getChecks() > 4);
- }
-}
+/**
+ * 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.corn.meta;
+
+import junit.framework.TestCase;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class FarmerBrownTest extends TestCase {
+
+ public void test() throws Exception {
+
+ final Context context = EJBContainer.createEJBContainer().getContext();
+
+ final FarmerBrown farmerBrown = (FarmerBrown) context.lookup("java:global/schedule-methods-meta/FarmerBrown");
+
+ // Give Farmer brown a chance to do some work
+ Thread.sleep(SECONDS.toMillis(5));
+
+ assertTrue(farmerBrown.getChecks() > 4);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/schedule-methods/src/main/java/org/superbiz/corn/FarmerBrown.java
----------------------------------------------------------------------
diff --git a/examples/schedule-methods/src/main/java/org/superbiz/corn/FarmerBrown.java b/examples/schedule-methods/src/main/java/org/superbiz/corn/FarmerBrown.java
index 20a2de6..6c036e3 100644
--- a/examples/schedule-methods/src/main/java/org/superbiz/corn/FarmerBrown.java
+++ b/examples/schedule-methods/src/main/java/org/superbiz/corn/FarmerBrown.java
@@ -1,61 +1,61 @@
-/**
- * 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.corn;
-
-import javax.ejb.Lock;
-import javax.ejb.LockType;
-import javax.ejb.Schedule;
-import javax.ejb.Schedules;
-import javax.ejb.Singleton;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * This is where we schedule all of Farmer Brown's corn jobs
- *
- * @version $Revision$ $Date$
- */
-@Singleton
-@Lock(LockType.READ) // allows timers to execute in parallel
-public class FarmerBrown {
-
- private final AtomicInteger checks = new AtomicInteger();
-
- @Schedules({
- @Schedule(month = "5", dayOfMonth = "20-Last", minute = "0", hour = "8"),
- @Schedule(month = "6", dayOfMonth = "1-10", minute = "0", hour = "8")
- })
- private void plantTheCorn() {
- // Dig out the planter!!!
- }
-
- @Schedules({
- @Schedule(month = "9", dayOfMonth = "20-Last", minute = "0", hour = "8"),
- @Schedule(month = "10", dayOfMonth = "1-10", minute = "0", hour = "8")
- })
- private void harvestTheCorn() {
- // Dig out the combine!!!
- }
-
- @Schedule(second = "*", minute = "*", hour = "*")
- private void checkOnTheDaughters() {
- checks.incrementAndGet();
- }
-
- public int getChecks() {
- return checks.get();
- }
-}
+/**
+ * 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.corn;
+
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Schedule;
+import javax.ejb.Schedules;
+import javax.ejb.Singleton;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * This is where we schedule all of Farmer Brown's corn jobs
+ *
+ * @version $Revision$ $Date$
+ */
+@Singleton
+@Lock(LockType.READ) // allows timers to execute in parallel
+public class FarmerBrown {
+
+ private final AtomicInteger checks = new AtomicInteger();
+
+ @Schedules({
+ @Schedule(month = "5", dayOfMonth = "20-Last", minute = "0", hour = "8"),
+ @Schedule(month = "6", dayOfMonth = "1-10", minute = "0", hour = "8")
+ })
+ private void plantTheCorn() {
+ // Dig out the planter!!!
+ }
+
+ @Schedules({
+ @Schedule(month = "9", dayOfMonth = "20-Last", minute = "0", hour = "8"),
+ @Schedule(month = "10", dayOfMonth = "1-10", minute = "0", hour = "8")
+ })
+ private void harvestTheCorn() {
+ // Dig out the combine!!!
+ }
+
+ @Schedule(second = "*", minute = "*", hour = "*")
+ private void checkOnTheDaughters() {
+ checks.incrementAndGet();
+ }
+
+ public int getChecks() {
+ return checks.get();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/schedule-methods/src/test/java/org/superbiz/corn/FarmerBrownTest.java
----------------------------------------------------------------------
diff --git a/examples/schedule-methods/src/test/java/org/superbiz/corn/FarmerBrownTest.java b/examples/schedule-methods/src/test/java/org/superbiz/corn/FarmerBrownTest.java
index 76d8ca4..0f0dcff 100644
--- a/examples/schedule-methods/src/test/java/org/superbiz/corn/FarmerBrownTest.java
+++ b/examples/schedule-methods/src/test/java/org/superbiz/corn/FarmerBrownTest.java
@@ -1,42 +1,42 @@
-/**
- * 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.corn;
-
-import junit.framework.TestCase;
-
-import javax.ejb.embeddable.EJBContainer;
-import javax.naming.Context;
-
-import static java.util.concurrent.TimeUnit.SECONDS;
-
-/**
- * @version $Revision$ $Date$
- */
-public class FarmerBrownTest extends TestCase {
-
- public void test() throws Exception {
-
- final Context context = EJBContainer.createEJBContainer().getContext();
-
- final FarmerBrown farmerBrown = (FarmerBrown) context.lookup("java:global/schedule-methods/FarmerBrown");
-
- // Give Farmer brown a chance to do some work
- Thread.sleep(SECONDS.toMillis(5));
-
- assertTrue(farmerBrown.getChecks() > 4);
- }
-}
+/**
+ * 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.corn;
+
+import junit.framework.TestCase;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class FarmerBrownTest extends TestCase {
+
+ public void test() throws Exception {
+
+ final Context context = EJBContainer.createEJBContainer().getContext();
+
+ final FarmerBrown farmerBrown = (FarmerBrown) context.lookup("java:global/schedule-methods/FarmerBrown");
+
+ // Give Farmer brown a chance to do some work
+ Thread.sleep(SECONDS.toMillis(5));
+
+ assertTrue(farmerBrown.getChecks() > 4);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/server-events/src/test/java/org/superbiz/event/ListenerTest.java
----------------------------------------------------------------------
diff --git a/examples/server-events/src/test/java/org/superbiz/event/ListenerTest.java b/examples/server-events/src/test/java/org/superbiz/event/ListenerTest.java
index 4ec1eb9..c94bfc9 100644
--- a/examples/server-events/src/test/java/org/superbiz/event/ListenerTest.java
+++ b/examples/server-events/src/test/java/org/superbiz/event/ListenerTest.java
@@ -1,46 +1,46 @@
-/*
- * 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.event;
-
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-@RunWith(Arquillian.class)
-public class ListenerTest {
-
- @Deployment
- public static JavaArchive jar() {
- return ShrinkWrap.create(JavaArchive.class, "listener-test.jar")
- .addClasses(MyListener.class, AutoDiscoveredListener.class)
- .addAsManifestResource(new StringAsset(AutoDiscoveredListener.class.getName()), ArchivePaths.create("org.apache.openejb.extension"));
- }
-
- @Test
- public void check() {
- assertEquals("listener-test", AutoDiscoveredListener.getAppName());
- assertTrue(MyListener.isLogAllEvent());
- }
-}
+/*
+ * 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.event;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class ListenerTest {
+
+ @Deployment
+ public static JavaArchive jar() {
+ return ShrinkWrap.create(JavaArchive.class, "listener-test.jar")
+ .addClasses(MyListener.class, AutoDiscoveredListener.class)
+ .addAsManifestResource(new StringAsset(AutoDiscoveredListener.class.getName()), ArchivePaths.create("org.apache.openejb.extension"));
+ }
+
+ @Test
+ public void check() {
+ assertEquals("listener-test", AutoDiscoveredListener.getAppName());
+ assertTrue(MyListener.isLogAllEvent());
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/beans/BookShow.java
----------------------------------------------------------------------
diff --git a/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/beans/BookShow.java b/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/beans/BookShow.java
index 464075d..e1864d3 100755
--- a/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/beans/BookShow.java
+++ b/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/beans/BookShow.java
@@ -1,43 +1,43 @@
-/**
- * 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.cdi.bookshow.beans;
-
-import org.superbiz.cdi.bookshow.interceptorbinding.Log;
-
-import javax.ejb.Stateful;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-@Log
-@Stateful
-public class BookShow implements Serializable {
-
- private static final long serialVersionUID = 6350400892234496909L;
-
- public List<String> getMoviesList() {
- List<String> moviesAvailable = new ArrayList<String>();
- moviesAvailable.add("12 Angry Men");
- moviesAvailable.add("Kings speech");
- return moviesAvailable;
- }
-
- public Integer getDiscountedPrice(int ticketPrice) {
- return ticketPrice - 50;
- }
- // assume more methods are present
-}
+/**
+ * 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.cdi.bookshow.beans;
+
+import org.superbiz.cdi.bookshow.interceptorbinding.Log;
+
+import javax.ejb.Stateful;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+@Log
+@Stateful
+public class BookShow implements Serializable {
+
+ private static final long serialVersionUID = 6350400892234496909L;
+
+ public List<String> getMoviesList() {
+ List<String> moviesAvailable = new ArrayList<String>();
+ moviesAvailable.add("12 Angry Men");
+ moviesAvailable.add("Kings speech");
+ return moviesAvailable;
+ }
+
+ public Integer getDiscountedPrice(int ticketPrice) {
+ return ticketPrice - 50;
+ }
+ // assume more methods are present
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptorbinding/Log.java
----------------------------------------------------------------------
diff --git a/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptorbinding/Log.java b/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptorbinding/Log.java
index 6516dbc..cdaf8d7 100755
--- a/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptorbinding/Log.java
+++ b/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptorbinding/Log.java
@@ -1,32 +1,32 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.superbiz.cdi.bookshow.interceptorbinding;
-
-import javax.interceptor.InterceptorBinding;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-@InterceptorBinding
-@Target({TYPE, METHOD})
-@Retention(RUNTIME)
-public @interface Log {
-
-}
+/**
+ * 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.cdi.bookshow.interceptorbinding;
+
+import javax.interceptor.InterceptorBinding;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@InterceptorBinding
+@Target({TYPE, METHOD})
+@Retention(RUNTIME)
+public @interface Log {
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptors/LoggingInterceptor.java
----------------------------------------------------------------------
diff --git a/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptors/LoggingInterceptor.java b/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptors/LoggingInterceptor.java
index cbafcc3..af9aa79 100755
--- a/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptors/LoggingInterceptor.java
+++ b/examples/simple-cdi-interceptor/src/main/java/org/superbiz/cdi/bookshow/interceptors/LoggingInterceptor.java
@@ -1,53 +1,68 @@
-/**
- * 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.
- */
-/**
- * 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.cdi.bookshow.interceptors;
-
-import org.superbiz.cdi.bookshow.interceptorbinding.Log;
-
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.Interceptor;
-import javax.interceptor.InvocationContext;
-import java.io.Serializable;
-
-@Interceptor
-@Log
-public class LoggingInterceptor implements Serializable {
-
- private static final long serialVersionUID = 8139854519874743530L;
-
- @AroundInvoke
- public Object logMethodEntry(InvocationContext ctx) throws Exception {
- System.out.println("Entering method: " + ctx.getMethod().getName());
- return ctx.proceed();
- }
-}
+/**
+ * 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.
+ * <p/>
+ * 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.
+ */
+/**
+ * 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.cdi.bookshow.interceptors;
+
+import org.superbiz.cdi.bookshow.interceptorbinding.Log;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+import java.io.Serializable;
+
+@Interceptor
+@Log
+public class LoggingInterceptor implements Serializable {
+
+ private static final long serialVersionUID = 8139854519874743530L;
+
+ @AroundInvoke
+ public Object logMethodEntry(InvocationContext ctx) throws Exception {
+ System.out.println("Entering method: " + ctx.getMethod().getName());
+ return ctx.proceed();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-cdi-interceptor/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowTest.java
----------------------------------------------------------------------
diff --git a/examples/simple-cdi-interceptor/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowTest.java b/examples/simple-cdi-interceptor/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowTest.java
index 77af133..1b19ef8 100755
--- a/examples/simple-cdi-interceptor/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowTest.java
+++ b/examples/simple-cdi-interceptor/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowTest.java
@@ -1,51 +1,51 @@
-/**
- * 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.cdi.bookshow.interceptors;
-
-import junit.framework.TestCase;
-import org.superbiz.cdi.bookshow.beans.BookShow;
-
-import javax.ejb.EJB;
-import javax.ejb.embeddable.EJBContainer;
-
-public class BookShowTest extends TestCase {
-
- @EJB
- private BookShow bookForAShowBean;
- EJBContainer ejbContainer;
-
- /**
- * Bootstrap the Embedded EJB Container
- *
- * @throws Exception
- */
- @Override
- protected void setUp() throws Exception {
- ejbContainer = EJBContainer.createEJBContainer();
- ejbContainer.getContext().bind("inject", this);
- }
-
- /**
- * Test basic interception
- */
- public void testMethodShouldBeIntercepted() {
-
- bookForAShowBean.getMoviesList();
-
- }
-
-}
+/**
+ * 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.cdi.bookshow.interceptors;
+
+import junit.framework.TestCase;
+import org.superbiz.cdi.bookshow.beans.BookShow;
+
+import javax.ejb.EJB;
+import javax.ejb.embeddable.EJBContainer;
+
+public class BookShowTest extends TestCase {
+
+ @EJB
+ private BookShow bookForAShowBean;
+ EJBContainer ejbContainer;
+
+ /**
+ * Bootstrap the Embedded EJB Container
+ *
+ * @throws Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ ejbContainer = EJBContainer.createEJBContainer();
+ ejbContainer.getContext().bind("inject", this);
+ }
+
+ /**
+ * Test basic interception
+ */
+ public void testMethodShouldBeIntercepted() {
+
+ bookForAShowBean.getMoviesList();
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/Movie.java
----------------------------------------------------------------------
diff --git a/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/Movie.java b/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/Movie.java
index a79d4a3..f172bc0 100644
--- a/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/Movie.java
+++ b/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/Movie.java
@@ -1,39 +1,39 @@
-/**
- * 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.cmp2;
-
-/**
- * @version $Revision$ $Date$
- */
-public interface Movie extends javax.ejb.EJBLocalObject {
-
- java.lang.Integer getId();
-
- void setId(java.lang.Integer id);
-
- String getDirector();
-
- void setDirector(String director);
-
- String getTitle();
-
- void setTitle(String title);
-
- int getYear();
-
- void setYear(int year);
-}
+/**
+ * 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.cmp2;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public interface Movie extends javax.ejb.EJBLocalObject {
+
+ java.lang.Integer getId();
+
+ void setId(java.lang.Integer id);
+
+ String getDirector();
+
+ void setDirector(String director);
+
+ String getTitle();
+
+ void setTitle(String title);
+
+ int getYear();
+
+ void setYear(int year);
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/MovieBean.java
----------------------------------------------------------------------
diff --git a/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/MovieBean.java b/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/MovieBean.java
index 0597fb1..8c743e7 100644
--- a/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/MovieBean.java
+++ b/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/MovieBean.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.cmp2;
-
-import javax.ejb.EntityBean;
-
-public abstract class MovieBean implements EntityBean {
-
- public MovieBean() {
- }
-
- public Integer ejbCreate(final String director, String title, final int year) {
- this.setDirector(director);
- this.setTitle(title);
- this.setYear(year);
- return null;
- }
-
- public abstract java.lang.Integer getId();
-
- public abstract void setId(java.lang.Integer id);
-
- public abstract String getDirector();
-
- public abstract void setDirector(String director);
-
- public abstract String getTitle();
-
- public abstract void setTitle(String title);
-
- public abstract int getYear();
-
- public abstract void setYear(int year);
-
-}
+/**
+ * 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.cmp2;
+
+import javax.ejb.EntityBean;
+
+public abstract class MovieBean implements EntityBean {
+
+ public MovieBean() {
+ }
+
+ public Integer ejbCreate(final String director, String title, final int year) {
+ this.setDirector(director);
+ this.setTitle(title);
+ this.setYear(year);
+ return null;
+ }
+
+ public abstract java.lang.Integer getId();
+
+ public abstract void setId(java.lang.Integer id);
+
+ public abstract String getDirector();
+
+ public abstract void setDirector(String director);
+
+ public abstract String getTitle();
+
+ public abstract void setTitle(String title);
+
+ public abstract int getYear();
+
+ public abstract void setYear(int year);
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/Movies.java
----------------------------------------------------------------------
diff --git a/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/Movies.java b/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/Movies.java
index 8877449..2229322 100644
--- a/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/Movies.java
+++ b/examples/simple-cmp2/src/main/java/org/superbiz/cmp2/Movies.java
@@ -1,35 +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.cmp2;
-
-import javax.ejb.CreateException;
-import javax.ejb.FinderException;
-import java.util.Collection;
-
-/**
- * @version $Revision$ $Date$
- */
-interface Movies extends javax.ejb.EJBLocalHome {
-
- Movie create(String director, String title, int year) throws CreateException;
-
- Movie findByPrimaryKey(Integer primarykey) throws FinderException;
-
- Collection<Movie> findAll() throws FinderException;
-
- Collection<Movie> findByDirector(String director) throws FinderException;
-}
+/**
+ * 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.cmp2;
+
+import javax.ejb.CreateException;
+import javax.ejb.FinderException;
+import java.util.Collection;
+
+/**
+ * @version $Revision$ $Date$
+ */
+interface Movies extends javax.ejb.EJBLocalHome {
+
+ Movie create(String director, String title, int year) throws CreateException;
+
+ Movie findByPrimaryKey(Integer primarykey) throws FinderException;
+
+ Collection<Movie> findAll() throws FinderException;
+
+ Collection<Movie> findByDirector(String director) throws FinderException;
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-cmp2/src/test/java/org/superbiz/cmp2/MoviesTest.java
----------------------------------------------------------------------
diff --git a/examples/simple-cmp2/src/test/java/org/superbiz/cmp2/MoviesTest.java b/examples/simple-cmp2/src/test/java/org/superbiz/cmp2/MoviesTest.java
index 04333dc..cbbc711 100644
--- a/examples/simple-cmp2/src/test/java/org/superbiz/cmp2/MoviesTest.java
+++ b/examples/simple-cmp2/src/test/java/org/superbiz/cmp2/MoviesTest.java
@@ -1,60 +1,60 @@
-/**
- * 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.cmp2;
-
-import junit.framework.TestCase;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import java.util.Collection;
-import java.util.Properties;
-
-/**
- * @version $Revision: 607077 $ $Date: 2007-12-27 06:55:23 -0800 (Thu, 27 Dec 2007) $
- */
-public class MoviesTest extends TestCase {
-
- public void test() throws Exception {
- Properties p = new Properties();
- p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
- p.put("movieDatabase", "new://Resource?type=DataSource");
- p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
- p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
-
- p.put("movieDatabaseUnmanaged", "new://Resource?type=DataSource");
- p.put("movieDatabaseUnmanaged.JdbcDriver", "org.hsqldb.jdbcDriver");
- p.put("movieDatabaseUnmanaged.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
- p.put("movieDatabaseUnmanaged.JtaManaged", "false");
-
- Context context = new InitialContext(p);
-
- Movies movies = (Movies) context.lookup("MovieBeanLocalHome");
-
- movies.create("Quentin Tarantino", "Reservoir Dogs", 1992);
- movies.create("Joel Coen", "Fargo", 1996);
- movies.create("Joel Coen", "The Big Lebowski", 1998);
-
- Collection<Movie> list = movies.findAll();
- assertEquals("Collection.size()", 3, list.size());
-
- for (Movie movie : list) {
- movies.remove(movie.getPrimaryKey());
- }
-
- assertEquals("Movies.findAll()", 0, movies.findAll().size());
- }
-}
+/**
+ * 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.cmp2;
+
+import junit.framework.TestCase;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.Collection;
+import java.util.Properties;
+
+/**
+ * @version $Revision: 607077 $ $Date: 2007-12-27 06:55:23 -0800 (Thu, 27 Dec 2007) $
+ */
+public class MoviesTest extends TestCase {
+
+ public void test() throws Exception {
+ Properties p = new Properties();
+ p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
+ p.put("movieDatabase", "new://Resource?type=DataSource");
+ p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
+ p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
+
+ p.put("movieDatabaseUnmanaged", "new://Resource?type=DataSource");
+ p.put("movieDatabaseUnmanaged.JdbcDriver", "org.hsqldb.jdbcDriver");
+ p.put("movieDatabaseUnmanaged.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
+ p.put("movieDatabaseUnmanaged.JtaManaged", "false");
+
+ Context context = new InitialContext(p);
+
+ Movies movies = (Movies) context.lookup("MovieBeanLocalHome");
+
+ movies.create("Quentin Tarantino", "Reservoir Dogs", 1992);
+ movies.create("Joel Coen", "Fargo", 1996);
+ movies.create("Joel Coen", "The Big Lebowski", 1998);
+
+ Collection<Movie> list = movies.findAll();
+ assertEquals("Collection.size()", 3, list.size());
+
+ for (Movie movie : list) {
+ movies.remove(movie.getPrimaryKey());
+ }
+
+ assertEquals("Movies.findAll()", 0, movies.findAll().size());
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-mdb-and-cdi/src/main/java/org/superbiz/mdb/ChatBean.java
----------------------------------------------------------------------
diff --git a/examples/simple-mdb-and-cdi/src/main/java/org/superbiz/mdb/ChatBean.java b/examples/simple-mdb-and-cdi/src/main/java/org/superbiz/mdb/ChatBean.java
index e4b3ee1..9bac2ea 100644
--- a/examples/simple-mdb-and-cdi/src/main/java/org/superbiz/mdb/ChatBean.java
+++ b/examples/simple-mdb-and-cdi/src/main/java/org/superbiz/mdb/ChatBean.java
@@ -1,93 +1,93 @@
-/**
- * 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.
- */
-//START SNIPPET: code
-package org.superbiz.mdb;
-
-import javax.annotation.Resource;
-import javax.ejb.MessageDriven;
-import javax.inject.Inject;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-@MessageDriven
-public class ChatBean implements MessageListener {
-
- @Resource
- private ConnectionFactory connectionFactory;
-
- @Resource(name = "AnswerQueue")
- private Queue answerQueue;
-
- @Inject
- private ChatRespondCreator responder;
-
- public void onMessage(Message message) {
- try {
-
- final TextMessage textMessage = (TextMessage) message;
- final String question = textMessage.getText();
- final String response = responder.respond(question);
-
- if (response != null) {
- respond(response);
- }
- } catch (JMSException e) {
- throw new IllegalStateException(e);
- }
- }
-
- private void respond(String text) throws JMSException {
-
- Connection connection = null;
- Session session = null;
-
- try {
- connection = connectionFactory.createConnection();
- connection.start();
-
- // Create a Session
- session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Create a MessageProducer from the Session to the Topic or Queue
- MessageProducer producer = session.createProducer(answerQueue);
- producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-
- // Create a message
- TextMessage message = session.createTextMessage(text);
-
- // Tell the producer to send the message
- producer.send(message);
- } finally {
- // Clean up
- if (session != null) {
- session.close();
- }
- if (connection != null) {
- connection.close();
- }
- }
- }
-}
-//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.
+ */
+//START SNIPPET: code
+package org.superbiz.mdb;
+
+import javax.annotation.Resource;
+import javax.ejb.MessageDriven;
+import javax.inject.Inject;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+@MessageDriven
+public class ChatBean implements MessageListener {
+
+ @Resource
+ private ConnectionFactory connectionFactory;
+
+ @Resource(name = "AnswerQueue")
+ private Queue answerQueue;
+
+ @Inject
+ private ChatRespondCreator responder;
+
+ public void onMessage(Message message) {
+ try {
+
+ final TextMessage textMessage = (TextMessage) message;
+ final String question = textMessage.getText();
+ final String response = responder.respond(question);
+
+ if (response != null) {
+ respond(response);
+ }
+ } catch (JMSException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ private void respond(String text) throws JMSException {
+
+ Connection connection = null;
+ Session session = null;
+
+ try {
+ connection = connectionFactory.createConnection();
+ connection.start();
+
+ // Create a Session
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ // Create a MessageProducer from the Session to the Topic or Queue
+ MessageProducer producer = session.createProducer(answerQueue);
+ producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+ // Create a message
+ TextMessage message = session.createTextMessage(text);
+
+ // Tell the producer to send the message
+ producer.send(message);
+ } finally {
+ // Clean up
+ if (session != null) {
+ session.close();
+ }
+ if (connection != null) {
+ connection.close();
+ }
+ }
+ }
+}
+//END SNIPPET: code
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-mdb-and-cdi/src/main/java/org/superbiz/mdb/ChatRespondCreator.java
----------------------------------------------------------------------
diff --git a/examples/simple-mdb-and-cdi/src/main/java/org/superbiz/mdb/ChatRespondCreator.java b/examples/simple-mdb-and-cdi/src/main/java/org/superbiz/mdb/ChatRespondCreator.java
index 739d0cd..9507fab 100644
--- a/examples/simple-mdb-and-cdi/src/main/java/org/superbiz/mdb/ChatRespondCreator.java
+++ b/examples/simple-mdb-and-cdi/src/main/java/org/superbiz/mdb/ChatRespondCreator.java
@@ -1,32 +1,32 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.superbiz.mdb;
-
-public class ChatRespondCreator {
-
- public String respond(String question) {
- if ("Hello World!".equals(question)) {
- return "Hello, Test Case!";
- } else if ("How are you?".equals(question)) {
- return "I'm doing well.";
- } else if ("Still spinning?".equals(question)) {
- return "Once every day, as usual.";
- }
- return null;
- }
-}
+/**
+ * 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.mdb;
+
+public class ChatRespondCreator {
+
+ public String respond(String question) {
+ if ("Hello World!".equals(question)) {
+ return "Hello, Test Case!";
+ } else if ("How are you?".equals(question)) {
+ return "I'm doing well.";
+ } else if ("Still spinning?".equals(question)) {
+ return "Once every day, as usual.";
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-mdb-and-cdi/src/test/java/org/superbiz/mdb/ChatBeanTest.java
----------------------------------------------------------------------
diff --git a/examples/simple-mdb-and-cdi/src/test/java/org/superbiz/mdb/ChatBeanTest.java b/examples/simple-mdb-and-cdi/src/test/java/org/superbiz/mdb/ChatBeanTest.java
index a360d10..700cc96 100644
--- a/examples/simple-mdb-and-cdi/src/test/java/org/superbiz/mdb/ChatBeanTest.java
+++ b/examples/simple-mdb-and-cdi/src/test/java/org/superbiz/mdb/ChatBeanTest.java
@@ -1,84 +1,84 @@
-/**
- * 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.
- */
-//START SNIPPET: code
-package org.superbiz.mdb;
-
-import junit.framework.TestCase;
-
-import javax.annotation.Resource;
-import javax.ejb.embeddable.EJBContainer;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-public class ChatBeanTest extends TestCase {
-
- @Resource
- private ConnectionFactory connectionFactory;
-
- @Resource(name = "ChatBean")
- private Queue questionQueue;
-
- @Resource(name = "AnswerQueue")
- private Queue answerQueue;
-
- public void test() throws Exception {
- EJBContainer.createEJBContainer().getContext().bind("inject", this);
-
- final Connection connection = connectionFactory.createConnection();
-
- connection.start();
-
- final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- final MessageProducer questions = session.createProducer(questionQueue);
-
- final MessageConsumer answers = session.createConsumer(answerQueue);
-
- sendText("Hello World!", questions, session);
-
- assertEquals("Hello, Test Case!", receiveText(answers));
-
- sendText("How are you?", questions, session);
-
- assertEquals("I'm doing well.", receiveText(answers));
-
- sendText("Still spinning?", questions, session);
-
- assertEquals("Once every day, as usual.", receiveText(answers));
-
- }
-
- private void sendText(String text, MessageProducer questions, Session session) throws JMSException {
-
- questions.send(session.createTextMessage(text));
-
- }
-
- private String receiveText(MessageConsumer answers) throws JMSException {
-
- return ((TextMessage) answers.receive(1000)).getText();
-
- }
-
-}
-//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.
+ */
+//START SNIPPET: code
+package org.superbiz.mdb;
+
+import junit.framework.TestCase;
+
+import javax.annotation.Resource;
+import javax.ejb.embeddable.EJBContainer;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+public class ChatBeanTest extends TestCase {
+
+ @Resource
+ private ConnectionFactory connectionFactory;
+
+ @Resource(name = "ChatBean")
+ private Queue questionQueue;
+
+ @Resource(name = "AnswerQueue")
+ private Queue answerQueue;
+
+ public void test() throws Exception {
+ EJBContainer.createEJBContainer().getContext().bind("inject", this);
+
+ final Connection connection = connectionFactory.createConnection();
+
+ connection.start();
+
+ final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ final MessageProducer questions = session.createProducer(questionQueue);
+
+ final MessageConsumer answers = session.createConsumer(answerQueue);
+
+ sendText("Hello World!", questions, session);
+
+ assertEquals("Hello, Test Case!", receiveText(answers));
+
+ sendText("How are you?", questions, session);
+
+ assertEquals("I'm doing well.", receiveText(answers));
+
+ sendText("Still spinning?", questions, session);
+
+ assertEquals("Once every day, as usual.", receiveText(answers));
+
+ }
+
+ private void sendText(String text, MessageProducer questions, Session session) throws JMSException {
+
+ questions.send(session.createTextMessage(text));
+
+ }
+
+ private String receiveText(MessageConsumer answers) throws JMSException {
+
+ return ((TextMessage) answers.receive(1000)).getText();
+
+ }
+
+}
+//END SNIPPET: code
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-mdb-with-descriptor/src/main/java/org/superbiz/mdbdesc/ChatBean.java
----------------------------------------------------------------------
diff --git a/examples/simple-mdb-with-descriptor/src/main/java/org/superbiz/mdbdesc/ChatBean.java b/examples/simple-mdb-with-descriptor/src/main/java/org/superbiz/mdbdesc/ChatBean.java
index 138c35f..3c481ca 100644
--- a/examples/simple-mdb-with-descriptor/src/main/java/org/superbiz/mdbdesc/ChatBean.java
+++ b/examples/simple-mdb-with-descriptor/src/main/java/org/superbiz/mdbdesc/ChatBean.java
@@ -1,93 +1,93 @@
-/**
- * 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.
- */
-//START SNIPPET: code
-package org.superbiz.mdbdesc;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-public class ChatBean implements MessageListener {
-
- private ConnectionFactory connectionFactory;
-
- private Queue answerQueue;
-
- public void onMessage(Message message) {
- try {
-
- final TextMessage textMessage = (TextMessage) message;
- final String question = textMessage.getText();
-
- if ("Hello World!".equals(question)) {
-
- respond("Hello, Test Case!");
-
- } else if ("How are you?".equals(question)) {
-
- respond("I'm doing well.");
-
- } else if ("Still spinning?".equals(question)) {
-
- respond("Once every day, as usual.");
-
- }
- } catch (JMSException e) {
- throw new IllegalStateException(e);
- }
- }
-
- private void respond(String text) throws JMSException {
-
- Connection connection = null;
- Session session = null;
-
- try {
- connection = connectionFactory.createConnection();
- connection.start();
-
- // Create a Session
- session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Create a MessageProducer from the Session to the Topic or Queue
- MessageProducer producer = session.createProducer(answerQueue);
- producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-
- // Create a message
- TextMessage message = session.createTextMessage(text);
-
- // Tell the producer to send the message
- producer.send(message);
- } finally {
- // Clean up
- if (session != null) {
- session.close();
- }
- if (connection != null) {
- connection.close();
- }
- }
- }
-}
-//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.
+ */
+//START SNIPPET: code
+package org.superbiz.mdbdesc;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+public class ChatBean implements MessageListener {
+
+ private ConnectionFactory connectionFactory;
+
+ private Queue answerQueue;
+
+ public void onMessage(Message message) {
+ try {
+
+ final TextMessage textMessage = (TextMessage) message;
+ final String question = textMessage.getText();
+
+ if ("Hello World!".equals(question)) {
+
+ respond("Hello, Test Case!");
+
+ } else if ("How are you?".equals(question)) {
+
+ respond("I'm doing well.");
+
+ } else if ("Still spinning?".equals(question)) {
+
+ respond("Once every day, as usual.");
+
+ }
+ } catch (JMSException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ private void respond(String text) throws JMSException {
+
+ Connection connection = null;
+ Session session = null;
+
+ try {
+ connection = connectionFactory.createConnection();
+ connection.start();
+
+ // Create a Session
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ // Create a MessageProducer from the Session to the Topic or Queue
+ MessageProducer producer = session.createProducer(answerQueue);
+ producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+ // Create a message
+ TextMessage message = session.createTextMessage(text);
+
+ // Tell the producer to send the message
+ producer.send(message);
+ } finally {
+ // Clean up
+ if (session != null) {
+ session.close();
+ }
+ if (connection != null) {
+ connection.close();
+ }
+ }
+ }
+}
+//END SNIPPET: code