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:43:03 UTC
[28/33] tomee git commit: Align SNAPSHOT versions & reformat examples
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowLoggingInterceptor.java
----------------------------------------------------------------------
diff --git a/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowLoggingInterceptor.java b/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowLoggingInterceptor.java
index c467dc1..cc2cce3 100644
--- a/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowLoggingInterceptor.java
+++ b/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowLoggingInterceptor.java
@@ -1,58 +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.
- */
-/**
- * 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 org.superbiz.cdi.bookshow.tracker.InterceptionOrderTracker;
-
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.Interceptor;
-import javax.interceptor.InvocationContext;
-import java.io.Serializable;
-import java.util.logging.Logger;
-
-@Interceptor
-@Log
-public class BookForAShowLoggingInterceptor implements Serializable {
-
- private static final long serialVersionUID = 8139854519874743530L;
- private Logger logger = Logger.getLogger("BookForAShowApplicationLogger");
-
- @AroundInvoke
- public Object logMethodEntry(InvocationContext ctx) throws Exception {
- logger.info("Before entering method:" + ctx.getMethod().getName());
- InterceptionOrderTracker.getMethodsInterceptedList().add(ctx.getMethod().getName());
- InterceptionOrderTracker.getInterceptedByList().add(this.getClass().getSimpleName());
- 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 org.superbiz.cdi.bookshow.tracker.InterceptionOrderTracker;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+import java.io.Serializable;
+import java.util.logging.Logger;
+
+@Interceptor
+@Log
+public class BookForAShowLoggingInterceptor implements Serializable {
+
+ private static final long serialVersionUID = 8139854519874743530L;
+ private Logger logger = Logger.getLogger("BookForAShowApplicationLogger");
+
+ @AroundInvoke
+ public Object logMethodEntry(InvocationContext ctx) throws Exception {
+ logger.info("Before entering method:" + ctx.getMethod().getName());
+ InterceptionOrderTracker.getMethodsInterceptedList().add(ctx.getMethod().getName());
+ InterceptionOrderTracker.getInterceptedByList().add(this.getClass().getSimpleName());
+ return ctx.proceed();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/interceptors/TimeBasedRestrictingInterceptor.java
----------------------------------------------------------------------
diff --git a/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/interceptors/TimeBasedRestrictingInterceptor.java b/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/interceptors/TimeBasedRestrictingInterceptor.java
index cc64771..07695bb 100644
--- a/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/interceptors/TimeBasedRestrictingInterceptor.java
+++ b/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/interceptors/TimeBasedRestrictingInterceptor.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 org.superbiz.cdi.AccessDeniedException;
-import org.superbiz.cdi.bookshow.interceptorbinding.TimeRestricted;
-import org.superbiz.cdi.bookshow.tracker.InterceptionOrderTracker;
-
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.Interceptor;
-import javax.interceptor.InvocationContext;
-import java.io.Serializable;
-
-@Interceptor
-@TimeRestricted
-public class TimeBasedRestrictingInterceptor implements Serializable {
-
- private static final long serialVersionUID = 8139854519874743530L;
-
- @AroundInvoke
- public Object restrictAccessBasedOnTime(InvocationContext ctx) throws Exception {
- InterceptionOrderTracker.getMethodsInterceptedList().add(ctx.getMethod().getName());
- InterceptionOrderTracker.getInterceptedByList().add(this.getClass().getSimpleName());
- if (!isWorkingHours()) {
- throw new AccessDeniedException("You are not allowed to access the method at this time");
- }
- return ctx.proceed();
- }
-
- private boolean isWorkingHours() {
- /*
- * int hourOfDay = Calendar.getInstance().get(Calendar.HOUR_OF_DAY); if (hourOfDay >= 9 && hourOfDay <= 21) {
- * return true; } else { return false; }
- */
- return true; // Let's assume
- }
-}
+/**
+ * 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 org.superbiz.cdi.AccessDeniedException;
+import org.superbiz.cdi.bookshow.interceptorbinding.TimeRestricted;
+import org.superbiz.cdi.bookshow.tracker.InterceptionOrderTracker;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+import java.io.Serializable;
+
+@Interceptor
+@TimeRestricted
+public class TimeBasedRestrictingInterceptor implements Serializable {
+
+ private static final long serialVersionUID = 8139854519874743530L;
+
+ @AroundInvoke
+ public Object restrictAccessBasedOnTime(InvocationContext ctx) throws Exception {
+ InterceptionOrderTracker.getMethodsInterceptedList().add(ctx.getMethod().getName());
+ InterceptionOrderTracker.getInterceptedByList().add(this.getClass().getSimpleName());
+ if (!isWorkingHours()) {
+ throw new AccessDeniedException("You are not allowed to access the method at this time");
+ }
+ return ctx.proceed();
+ }
+
+ private boolean isWorkingHours() {
+ /*
+ * int hourOfDay = Calendar.getInstance().get(Calendar.HOUR_OF_DAY); if (hourOfDay >= 9 && hourOfDay <= 21) {
+ * return true; } else { return false; }
+ */
+ return true; // Let's assume
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/tracker/InterceptionOrderTracker.java
----------------------------------------------------------------------
diff --git a/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/tracker/InterceptionOrderTracker.java b/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/tracker/InterceptionOrderTracker.java
index 81fabb8..834c215 100644
--- a/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/tracker/InterceptionOrderTracker.java
+++ b/examples/cdi-interceptors/src/main/java/org/superbiz/cdi/bookshow/tracker/InterceptionOrderTracker.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.cdi.bookshow.tracker;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A helper class for the test.
- * Keeps track of methods intercepted during one testXXX run
- * Keeps track of interceptors applied during one textXXX run
- */
-public class InterceptionOrderTracker {
-
- /*
- * Contains method names that were intercepted by the interceptors
- */
- private static List<String> methodsInterceptedList = new ArrayList<String>();
- /*
- * Contains the name of the interceptor class that intercepted a method
- */
- private static List<String> interceptedByList = new ArrayList<String>();
-
- public static List<String> getInterceptedByList() {
- return interceptedByList;
- }
-
- public static void setInterceptedByList(List<String> interceptedByList) {
- InterceptionOrderTracker.interceptedByList = interceptedByList;
- }
-
- public static List<String> getMethodsInterceptedList() {
- return methodsInterceptedList;
- }
-}
+/**
+ * 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.tracker;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A helper class for the test.
+ * Keeps track of methods intercepted during one testXXX run
+ * Keeps track of interceptors applied during one textXXX run
+ */
+public class InterceptionOrderTracker {
+
+ /*
+ * Contains method names that were intercepted by the interceptors
+ */
+ private static List<String> methodsInterceptedList = new ArrayList<String>();
+ /*
+ * Contains the name of the interceptor class that intercepted a method
+ */
+ private static List<String> interceptedByList = new ArrayList<String>();
+
+ public static List<String> getInterceptedByList() {
+ return interceptedByList;
+ }
+
+ public static void setInterceptedByList(List<String> interceptedByList) {
+ InterceptionOrderTracker.interceptedByList = interceptedByList;
+ }
+
+ public static List<String> getMethodsInterceptedList() {
+ return methodsInterceptedList;
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowOldStyleInterceptorBindingTest.java
----------------------------------------------------------------------
diff --git a/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowOldStyleInterceptorBindingTest.java b/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowOldStyleInterceptorBindingTest.java
index 82f79c0..c86fa40 100644
--- a/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowOldStyleInterceptorBindingTest.java
+++ b/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowOldStyleInterceptorBindingTest.java
@@ -1,58 +1,58 @@
-/**
- * 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.BookForAShowOldStyleInterceptorBinding;
-import org.superbiz.cdi.bookshow.tracker.InterceptionOrderTracker;
-
-import javax.ejb.EJB;
-import javax.ejb.embeddable.EJBContainer;
-
-public class BookForAShowOldStyleInterceptorBindingTest extends TestCase {
-
- @EJB
- private BookForAShowOldStyleInterceptorBinding bookForAShowBean;
- EJBContainer ejbContainer;
-
- /**
- * Bootstrap the Embedded EJB Container
- *
- * @throws Exception
- */
- protected void setUp() throws Exception {
- ejbContainer = EJBContainer.createEJBContainer();
- ejbContainer.getContext().bind("inject", this);
- }
-
- /**
- * Test basic interception
- */
- public void testMethodShouldBeIntercepted() {
- // action
- bookForAShowBean.getMoviesList();
- // verify
- assertTrue(InterceptionOrderTracker.getMethodsInterceptedList().contains("getMoviesList"));
- }
-
- protected void tearDown() {
- // clear the lists after each test
- InterceptionOrderTracker.getInterceptedByList().clear();
- InterceptionOrderTracker.getMethodsInterceptedList().clear();
- ejbContainer.close();
- }
-}
+/**
+ * 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.BookForAShowOldStyleInterceptorBinding;
+import org.superbiz.cdi.bookshow.tracker.InterceptionOrderTracker;
+
+import javax.ejb.EJB;
+import javax.ejb.embeddable.EJBContainer;
+
+public class BookForAShowOldStyleInterceptorBindingTest extends TestCase {
+
+ @EJB
+ private BookForAShowOldStyleInterceptorBinding bookForAShowBean;
+ EJBContainer ejbContainer;
+
+ /**
+ * Bootstrap the Embedded EJB Container
+ *
+ * @throws Exception
+ */
+ protected void setUp() throws Exception {
+ ejbContainer = EJBContainer.createEJBContainer();
+ ejbContainer.getContext().bind("inject", this);
+ }
+
+ /**
+ * Test basic interception
+ */
+ public void testMethodShouldBeIntercepted() {
+ // action
+ bookForAShowBean.getMoviesList();
+ // verify
+ assertTrue(InterceptionOrderTracker.getMethodsInterceptedList().contains("getMoviesList"));
+ }
+
+ protected void tearDown() {
+ // clear the lists after each test
+ InterceptionOrderTracker.getInterceptedByList().clear();
+ InterceptionOrderTracker.getMethodsInterceptedList().clear();
+ ejbContainer.close();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowOneInterceptorAppliedTest.java
----------------------------------------------------------------------
diff --git a/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowOneInterceptorAppliedTest.java b/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowOneInterceptorAppliedTest.java
index 3d2319e..db40612 100644
--- a/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowOneInterceptorAppliedTest.java
+++ b/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowOneInterceptorAppliedTest.java
@@ -1,58 +1,58 @@
-/**
- * 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.BookForAShowOneInterceptorApplied;
-import org.superbiz.cdi.bookshow.tracker.InterceptionOrderTracker;
-
-import javax.ejb.EJB;
-import javax.ejb.embeddable.EJBContainer;
-
-public class BookForAShowOneInterceptorAppliedTest extends TestCase {
-
- @EJB
- private BookForAShowOneInterceptorApplied bookForAShowBean;
- EJBContainer ejbContainer;
-
- /**
- * Bootstrap the Embedded EJB Container
- *
- * @throws Exception
- */
- protected void setUp() throws Exception {
- ejbContainer = EJBContainer.createEJBContainer();
- ejbContainer.getContext().bind("inject", this);
- }
-
- /**
- * Test basic interception
- */
- public void testMethodShouldBeIntercepted() {
- // action
- bookForAShowBean.getMoviesList();
- // verify
- assertTrue(InterceptionOrderTracker.getMethodsInterceptedList().contains("getMoviesList"));
- }
-
- protected void tearDown() {
- // clear the list after each test
- InterceptionOrderTracker.getInterceptedByList().clear();
- InterceptionOrderTracker.getMethodsInterceptedList().clear();
- ejbContainer.close();
- }
-}
+/**
+ * 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.BookForAShowOneInterceptorApplied;
+import org.superbiz.cdi.bookshow.tracker.InterceptionOrderTracker;
+
+import javax.ejb.EJB;
+import javax.ejb.embeddable.EJBContainer;
+
+public class BookForAShowOneInterceptorAppliedTest extends TestCase {
+
+ @EJB
+ private BookForAShowOneInterceptorApplied bookForAShowBean;
+ EJBContainer ejbContainer;
+
+ /**
+ * Bootstrap the Embedded EJB Container
+ *
+ * @throws Exception
+ */
+ protected void setUp() throws Exception {
+ ejbContainer = EJBContainer.createEJBContainer();
+ ejbContainer.getContext().bind("inject", this);
+ }
+
+ /**
+ * Test basic interception
+ */
+ public void testMethodShouldBeIntercepted() {
+ // action
+ bookForAShowBean.getMoviesList();
+ // verify
+ assertTrue(InterceptionOrderTracker.getMethodsInterceptedList().contains("getMoviesList"));
+ }
+
+ protected void tearDown() {
+ // clear the list after each test
+ InterceptionOrderTracker.getInterceptedByList().clear();
+ InterceptionOrderTracker.getMethodsInterceptedList().clear();
+ ejbContainer.close();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowTwoInterceptorsAppiledTest.java
----------------------------------------------------------------------
diff --git a/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowTwoInterceptorsAppiledTest.java b/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowTwoInterceptorsAppiledTest.java
index 192e2bc..0c0093d 100644
--- a/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowTwoInterceptorsAppiledTest.java
+++ b/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookForAShowTwoInterceptorsAppiledTest.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.cdi.bookshow.interceptors;
-
-import junit.framework.TestCase;
-import org.superbiz.cdi.bookshow.beans.BookForAShowTwoInterceptorsApplied;
-import org.superbiz.cdi.bookshow.tracker.InterceptionOrderTracker;
-
-import javax.ejb.EJB;
-import javax.ejb.embeddable.EJBContainer;
-import java.util.List;
-
-public class BookForAShowTwoInterceptorsAppiledTest extends TestCase {
-
- @EJB
- private BookForAShowTwoInterceptorsApplied bookForAShowBean;
- EJBContainer ejbContainer;
-
- /**
- * Bootstrap the Embedded EJB Container
- *
- * @throws Exception
- */
- protected void setUp() throws Exception {
- ejbContainer = EJBContainer.createEJBContainer();
- ejbContainer.getContext().bind("inject", this);
- }
-
- /**
- * Interceptors should be applied in order as defined in beans.xml
- */
- public void testInterceptorsShouldBeAppliedInOrder() {
- // action
- bookForAShowBean.getDiscountedPrice(100);
- // verify
- List<String> interceptedByList = InterceptionOrderTracker.getInterceptedByList();
- int indexOfLogger = interceptedByList.indexOf("BookForAShowLoggingInterceptor");
- int indexOfTimeBasedRestrictor = interceptedByList.indexOf("TimeBasedRestrictingInterceptor");
- assertTrue(indexOfLogger < indexOfTimeBasedRestrictor);
- }
-
- public void testTwoInterceptorsWereInvoked() {
- // action
- bookForAShowBean.getDiscountedPrice(100);
- // verify
- List<String> interceptedByList = InterceptionOrderTracker.getInterceptedByList();
- assertTrue(interceptedByList.contains("BookForAShowLoggingInterceptor") && interceptedByList.contains("TimeBasedRestrictingInterceptor"));
- }
-
- protected void tearDown() {
- // clear the lists after each test
- InterceptionOrderTracker.getInterceptedByList().clear();
- InterceptionOrderTracker.getMethodsInterceptedList().clear();
- ejbContainer.close();
- }
-}
+/**
+ * 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.BookForAShowTwoInterceptorsApplied;
+import org.superbiz.cdi.bookshow.tracker.InterceptionOrderTracker;
+
+import javax.ejb.EJB;
+import javax.ejb.embeddable.EJBContainer;
+import java.util.List;
+
+public class BookForAShowTwoInterceptorsAppiledTest extends TestCase {
+
+ @EJB
+ private BookForAShowTwoInterceptorsApplied bookForAShowBean;
+ EJBContainer ejbContainer;
+
+ /**
+ * Bootstrap the Embedded EJB Container
+ *
+ * @throws Exception
+ */
+ protected void setUp() throws Exception {
+ ejbContainer = EJBContainer.createEJBContainer();
+ ejbContainer.getContext().bind("inject", this);
+ }
+
+ /**
+ * Interceptors should be applied in order as defined in beans.xml
+ */
+ public void testInterceptorsShouldBeAppliedInOrder() {
+ // action
+ bookForAShowBean.getDiscountedPrice(100);
+ // verify
+ List<String> interceptedByList = InterceptionOrderTracker.getInterceptedByList();
+ int indexOfLogger = interceptedByList.indexOf("BookForAShowLoggingInterceptor");
+ int indexOfTimeBasedRestrictor = interceptedByList.indexOf("TimeBasedRestrictingInterceptor");
+ assertTrue(indexOfLogger < indexOfTimeBasedRestrictor);
+ }
+
+ public void testTwoInterceptorsWereInvoked() {
+ // action
+ bookForAShowBean.getDiscountedPrice(100);
+ // verify
+ List<String> interceptedByList = InterceptionOrderTracker.getInterceptedByList();
+ assertTrue(interceptedByList.contains("BookForAShowLoggingInterceptor") && interceptedByList.contains("TimeBasedRestrictingInterceptor"));
+ }
+
+ protected void tearDown() {
+ // clear the lists after each test
+ InterceptionOrderTracker.getInterceptedByList().clear();
+ InterceptionOrderTracker.getMethodsInterceptedList().clear();
+ ejbContainer.close();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowInterceptorBindingInheritanceTest.java
----------------------------------------------------------------------
diff --git a/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowInterceptorBindingInheritanceTest.java b/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowInterceptorBindingInheritanceTest.java
index 20ca275..95b854a 100644
--- a/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowInterceptorBindingInheritanceTest.java
+++ b/examples/cdi-interceptors/src/test/java/org/superbiz/cdi/bookshow/interceptors/BookShowInterceptorBindingInheritanceTest.java
@@ -1,58 +1,58 @@
-/**
- * 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.BookShowInterceptorBindingInheritanceExplored;
-import org.superbiz.cdi.bookshow.tracker.InterceptionOrderTracker;
-
-import javax.ejb.EJB;
-import javax.ejb.embeddable.EJBContainer;
-import java.util.List;
-
-public class BookShowInterceptorBindingInheritanceTest extends TestCase {
-
- @EJB
- private BookShowInterceptorBindingInheritanceExplored bookForAShowBean;
- EJBContainer ejbContainer;
-
- /**
- * Bootstrap the Embedded EJB Container
- *
- * @throws Exception
- */
- protected void setUp() throws Exception {
- ejbContainer = EJBContainer.createEJBContainer();
- ejbContainer.getContext().bind("inject", this);
- }
-
- public void testInterceptorBindingCanInheritFromAnotherBinding() {
- // action
- bookForAShowBean.getDiscountedPrice(100);
- // verify both interceptors were invoked
- List<String> interceptedByList = InterceptionOrderTracker.getInterceptedByList();
- System.out.println("Intercepted by:" + interceptedByList);
- assertTrue(interceptedByList.contains("BookForAShowLoggingInterceptor") && interceptedByList.contains("TimeBasedRestrictingInterceptor"));
- }
-
- protected void tearDown() {
- // clear the list after each test
- InterceptionOrderTracker.getInterceptedByList().clear();
- InterceptionOrderTracker.getMethodsInterceptedList().clear();
- ejbContainer.close();
- }
-}
+/**
+ * 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.BookShowInterceptorBindingInheritanceExplored;
+import org.superbiz.cdi.bookshow.tracker.InterceptionOrderTracker;
+
+import javax.ejb.EJB;
+import javax.ejb.embeddable.EJBContainer;
+import java.util.List;
+
+public class BookShowInterceptorBindingInheritanceTest extends TestCase {
+
+ @EJB
+ private BookShowInterceptorBindingInheritanceExplored bookForAShowBean;
+ EJBContainer ejbContainer;
+
+ /**
+ * Bootstrap the Embedded EJB Container
+ *
+ * @throws Exception
+ */
+ protected void setUp() throws Exception {
+ ejbContainer = EJBContainer.createEJBContainer();
+ ejbContainer.getContext().bind("inject", this);
+ }
+
+ public void testInterceptorBindingCanInheritFromAnotherBinding() {
+ // action
+ bookForAShowBean.getDiscountedPrice(100);
+ // verify both interceptors were invoked
+ List<String> interceptedByList = InterceptionOrderTracker.getInterceptedByList();
+ System.out.println("Intercepted by:" + interceptedByList);
+ assertTrue(interceptedByList.contains("BookForAShowLoggingInterceptor") && interceptedByList.contains("TimeBasedRestrictingInterceptor"));
+ }
+
+ protected void tearDown() {
+ // clear the list after each test
+ InterceptionOrderTracker.getInterceptedByList().clear();
+ InterceptionOrderTracker.getMethodsInterceptedList().clear();
+ ejbContainer.close();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/ConsoleHandler.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/ConsoleHandler.java b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/ConsoleHandler.java
index 25d9231..d60ffe0 100644
--- a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/ConsoleHandler.java
+++ b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/ConsoleHandler.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.cdi.produces.disposes;
-
-public class ConsoleHandler implements LogHandler {
-
- private String name;
-
- public ConsoleHandler(String name) {
- this.name = name;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void writeLog(String s) {
- System.out.printf("##### Handler: %s, Writing to the console!\n", getName());
- }
-
-}
+/**
+ * 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.produces.disposes;
+
+public class ConsoleHandler implements LogHandler {
+
+ private String name;
+
+ public ConsoleHandler(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void writeLog(String s) {
+ System.out.printf("##### Handler: %s, Writing to the console!\n", getName());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/DatabaseHandler.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/DatabaseHandler.java b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/DatabaseHandler.java
index 790f216..4b3a12c 100644
--- a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/DatabaseHandler.java
+++ b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/DatabaseHandler.java
@@ -1,38 +1,38 @@
-/**
- * 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.produces.disposes;
-
-public class DatabaseHandler implements LogHandler {
-
- private String name;
-
- public DatabaseHandler(String name) {
- this.name = name;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void writeLog(String s) {
- System.out.printf("##### Handler: %s, Writing to the database!\n", getName());
- // Use connection to write log to database
- }
-
-}
+/**
+ * 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.produces.disposes;
+
+public class DatabaseHandler implements LogHandler {
+
+ private String name;
+
+ public DatabaseHandler(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void writeLog(String s) {
+ System.out.printf("##### Handler: %s, Writing to the database!\n", getName());
+ // Use connection to write log to database
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/FileHandler.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/FileHandler.java b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/FileHandler.java
index afd20b9..ba319c2 100644
--- a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/FileHandler.java
+++ b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/FileHandler.java
@@ -1,38 +1,38 @@
-/**
- * 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.produces.disposes;
-
-public class FileHandler implements LogHandler {
-
- private String name;
-
- public FileHandler(String name) {
- this.name = name;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void writeLog(String s) {
- System.out.printf("##### Handler: %s, Writing to the file!\n", getName());
- // Write to log file
- }
-
-}
+/**
+ * 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.produces.disposes;
+
+public class FileHandler implements LogHandler {
+
+ private String name;
+
+ public FileHandler(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void writeLog(String s) {
+ System.out.printf("##### Handler: %s, Writing to the file!\n", getName());
+ // Write to log file
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LogFactory.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LogFactory.java b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LogFactory.java
index 94b8f43..baf798c 100644
--- a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LogFactory.java
+++ b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LogFactory.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.cdi.produces.disposes;
-
-import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.Produces;
-
-public class LogFactory {
-
- private int type = 2;
-
- @Produces
- public LogHandler getLogHandler() {
- switch (type) {
- case 1:
- return new FileHandler("@Produces created FileHandler!");
- case 2:
- return new DatabaseHandler("@Produces created DatabaseHandler!");
- case 3:
- default:
- return new ConsoleHandler("@Produces created ConsoleHandler!");
- }
-
- }
-
- public void closeLogHandler(@Disposes LogHandler handler) {
- switch (type) {
- case 1:
- System.out.println("Closing File handler!");
- break;
- case 2:
- System.out.println("Closing DB handler!");
- break;
- case 3:
- default:
- System.out.println("Closing Console handler!");
- }
- }
-
-}
+/**
+ * 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.produces.disposes;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+public class LogFactory {
+
+ private int type = 2;
+
+ @Produces
+ public LogHandler getLogHandler() {
+ switch (type) {
+ case 1:
+ return new FileHandler("@Produces created FileHandler!");
+ case 2:
+ return new DatabaseHandler("@Produces created DatabaseHandler!");
+ case 3:
+ default:
+ return new ConsoleHandler("@Produces created ConsoleHandler!");
+ }
+
+ }
+
+ public void closeLogHandler(@Disposes LogHandler handler) {
+ switch (type) {
+ case 1:
+ System.out.println("Closing File handler!");
+ break;
+ case 2:
+ System.out.println("Closing DB handler!");
+ break;
+ case 3:
+ default:
+ System.out.println("Closing Console handler!");
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LogHandler.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LogHandler.java b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LogHandler.java
index 87faca5..adc22b7 100644
--- a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LogHandler.java
+++ b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LogHandler.java
@@ -1,25 +1,25 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.superbiz.cdi.produces.disposes;
-
-public interface LogHandler {
-
- public String getName();
-
- public void writeLog(String s);
-
-}
+/**
+ * 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.produces.disposes;
+
+public interface LogHandler {
+
+ public String getName();
+
+ public void writeLog(String s);
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/Logger.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/Logger.java b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/Logger.java
index a8f4193..b46975a 100644
--- a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/Logger.java
+++ b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/Logger.java
@@ -1,25 +1,25 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.superbiz.cdi.produces.disposes;
-
-public interface Logger {
-
- public void log(String s);
-
- public LogHandler getHandler();
-
-}
+/**
+ * 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.produces.disposes;
+
+public interface Logger {
+
+ public void log(String s);
+
+ public LogHandler getHandler();
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LoggerImpl.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LoggerImpl.java b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LoggerImpl.java
index 39a6045..69cc006 100644
--- a/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LoggerImpl.java
+++ b/examples/cdi-produces-disposes/src/main/java/org/superbiz/cdi/produces/disposes/LoggerImpl.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.cdi.produces.disposes;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-@Named("logger")
-public class LoggerImpl implements Logger {
-
- @Inject
- private LogHandler handler;
-
- @Override
- public void log(String s) {
- getHandler().writeLog(s);
- }
-
- public LogHandler getHandler() {
- return handler;
- }
-
-}
+/**
+ * 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.produces.disposes;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named("logger")
+public class LoggerImpl implements Logger {
+
+ @Inject
+ private LogHandler handler;
+
+ @Override
+ public void log(String s) {
+ getHandler().writeLog(s);
+ }
+
+ public LogHandler getHandler() {
+ return handler;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-disposes/src/test/java/org/superbiz/cdi/produces/disposes/LoggerTest.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-disposes/src/test/java/org/superbiz/cdi/produces/disposes/LoggerTest.java b/examples/cdi-produces-disposes/src/test/java/org/superbiz/cdi/produces/disposes/LoggerTest.java
index 10f24bf..4fcc086 100644
--- a/examples/cdi-produces-disposes/src/test/java/org/superbiz/cdi/produces/disposes/LoggerTest.java
+++ b/examples/cdi-produces-disposes/src/test/java/org/superbiz/cdi/produces/disposes/LoggerTest.java
@@ -1,67 +1,67 @@
-/**
- * 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.produces.disposes;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import javax.ejb.embeddable.EJBContainer;
-import javax.inject.Inject;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-public class LoggerTest {
-
- @Inject
- Logger logger;
-
- private EJBContainer container;
-
- @Before
- public void setUp() {
- try {
- container = EJBContainer.createEJBContainer();
- container.getContext().bind("inject", this);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @After
- public void cleanUp() {
- try {
- container.getContext().unbind("inject");
- container.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testLogHandler() {
- assertNotNull(logger);
- assertFalse("Handler should not be a ConsoleHandler", logger.getHandler() instanceof ConsoleHandler);
- assertFalse("Handler should not be a FileHandler", logger.getHandler() instanceof FileHandler);
- assertTrue("Handler should be a DatabaseHandler", logger.getHandler() instanceof DatabaseHandler);
- logger.log("##### Testing write\n");
- logger = 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.cdi.produces.disposes;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.inject.Inject;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class LoggerTest {
+
+ @Inject
+ Logger logger;
+
+ private EJBContainer container;
+
+ @Before
+ public void setUp() {
+ try {
+ container = EJBContainer.createEJBContainer();
+ container.getContext().bind("inject", this);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @After
+ public void cleanUp() {
+ try {
+ container.getContext().unbind("inject");
+ container.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testLogHandler() {
+ assertNotNull(logger);
+ assertFalse("Handler should not be a ConsoleHandler", logger.getHandler() instanceof ConsoleHandler);
+ assertFalse("Handler should not be a FileHandler", logger.getHandler() instanceof FileHandler);
+ assertTrue("Handler should be a DatabaseHandler", logger.getHandler() instanceof DatabaseHandler);
+ logger.log("##### Testing write\n");
+ logger = null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-field/README.md
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/README.md b/examples/cdi-produces-field/README.md
index 7deb6d5..c2f61d9 100644
--- a/examples/cdi-produces-field/README.md
+++ b/examples/cdi-produces-field/README.md
@@ -227,7 +227,7 @@ inject resources, such as persistence contexts. One caveat to using producer fie
INFO - OpenEJB http://tomee.apache.org/
INFO - Startup: Thu May 10 01:28:19 CDT 2012
INFO - Copyright 1999-2012 (C) Apache OpenEJB Project, All Rights Reserved.
- INFO - Version: 4.0.0-beta-3-SNAPSHOT
+ INFO - Version: 7.0.0-SNAPSHOT
INFO - Build date: 20120510
INFO - Build time: 04:06
INFO - ********************************************************************************
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/ConsoleHandler.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/ConsoleHandler.java b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/ConsoleHandler.java
index ad4bfc0..f8852e1 100644
--- a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/ConsoleHandler.java
+++ b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/ConsoleHandler.java
@@ -5,14 +5,14 @@
* 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.
+ * <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.produces.field;
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/DatabaseHandler.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/DatabaseHandler.java b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/DatabaseHandler.java
index e5ecd81..ef9a658 100644
--- a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/DatabaseHandler.java
+++ b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/DatabaseHandler.java
@@ -5,14 +5,14 @@
* 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.
+ * <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.produces.field;
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/FileHandler.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/FileHandler.java b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/FileHandler.java
index 5930293..3681058 100644
--- a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/FileHandler.java
+++ b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/FileHandler.java
@@ -5,14 +5,14 @@
* 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.
+ * <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.produces.field;
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogFactory.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogFactory.java b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogFactory.java
index 5926392..87e9410 100644
--- a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogFactory.java
+++ b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogFactory.java
@@ -5,14 +5,14 @@
* 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.
+ * <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.produces.field;
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogHandler.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogHandler.java b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogHandler.java
index a72b7f2..b0c892a 100644
--- a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogHandler.java
+++ b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogHandler.java
@@ -5,14 +5,14 @@
* 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.
+ * <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.produces.field;
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/Logger.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/Logger.java b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/Logger.java
index 85e625c..8dd628e 100644
--- a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/Logger.java
+++ b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/Logger.java
@@ -5,14 +5,14 @@
* 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.
+ * <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.produces.field;
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LoggerImpl.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LoggerImpl.java b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LoggerImpl.java
index 073b93f..ca039fe 100644
--- a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LoggerImpl.java
+++ b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LoggerImpl.java
@@ -5,14 +5,14 @@
* 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.
+ * <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.produces.field;
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-produces-field/src/test/java/org/superbiz/cdi/produces/field/LoggerTest.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/test/java/org/superbiz/cdi/produces/field/LoggerTest.java b/examples/cdi-produces-field/src/test/java/org/superbiz/cdi/produces/field/LoggerTest.java
index 8d1fc21..6a7b434 100644
--- a/examples/cdi-produces-field/src/test/java/org/superbiz/cdi/produces/field/LoggerTest.java
+++ b/examples/cdi-produces-field/src/test/java/org/superbiz/cdi/produces/field/LoggerTest.java
@@ -5,14 +5,14 @@
* 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.
+ * <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.produces.field;
@@ -23,8 +23,8 @@ import org.junit.Test;
import javax.ejb.embeddable.EJBContainer;
import javax.inject.Inject;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class LoggerTest {
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-realm/pom.xml
----------------------------------------------------------------------
diff --git a/examples/cdi-realm/pom.xml b/examples/cdi-realm/pom.xml
index fc3fae7..a05c411 100644
--- a/examples/cdi-realm/pom.xml
+++ b/examples/cdi-realm/pom.xml
@@ -23,7 +23,7 @@
<groupId>org.superbiz</groupId>
<artifactId>cdi-realm</artifactId>
<packaging>war</packaging>
- <version>1.1.1-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<name>OpenEJB :: Examples :: CDI Realm</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/cdi-realm/src/main/java/org/superbiz/AuthBean.java
----------------------------------------------------------------------
diff --git a/examples/cdi-realm/src/main/java/org/superbiz/AuthBean.java b/examples/cdi-realm/src/main/java/org/superbiz/AuthBean.java
index bee66b9..d74f34d 100644
--- a/examples/cdi-realm/src/main/java/org/superbiz/AuthBean.java
+++ b/examples/cdi-realm/src/main/java/org/superbiz/AuthBean.java
@@ -1,48 +1,48 @@
-/**
- * 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;
-
-import javax.enterprise.context.RequestScoped;
-import java.security.Principal;
-
-@RequestScoped // just to show we can be bound to the request but @ApplicationScoped is what makes sense
-public class AuthBean {
- public Principal authenticate(final String username, String password) {
- if (("userA".equals(username) || "userB".equals(username)) && "test".equals(password)) {
- return new Principal() {
- @Override
- public String getName() {
- return username;
- }
-
- @Override
- public String toString() {
- return username;
- }
- };
- }
- return null;
- }
-
- public boolean hasRole(final Principal principal, final String role) {
- return principal != null && (
- principal.getName().equals("userA") && (role.equals("admin")
- || role.equals("user"))
- || principal.getName().equals("userB") && (role.equals("user"))
- );
- }
-}
+/**
+ * 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;
+
+import javax.enterprise.context.RequestScoped;
+import java.security.Principal;
+
+@RequestScoped // just to show we can be bound to the request but @ApplicationScoped is what makes sense
+public class AuthBean {
+ public Principal authenticate(final String username, String password) {
+ if (("userA".equals(username) || "userB".equals(username)) && "test".equals(password)) {
+ return new Principal() {
+ @Override
+ public String getName() {
+ return username;
+ }
+
+ @Override
+ public String toString() {
+ return username;
+ }
+ };
+ }
+ return null;
+ }
+
+ public boolean hasRole(final Principal principal, final String role) {
+ return principal != null && (
+ principal.getName().equals("userA") && (role.equals("admin")
+ || role.equals("user"))
+ || principal.getName().equals("userB") && (role.equals("user"))
+ );
+ }
+}