001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.openejb.test.stateless;
017:
018: import java.util.ArrayList;
019: import java.util.Map;
020:
021: // import javax.ejb.EJB;
022:
023: /**
024: *
025: * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
026: * @author <a href="mailto:goyathlay.geronimo@gmail.com">Prasad Kashyap</a>
027: */
028: // public class StatelessInterceptorTests extends AnnotatedFieldInjectionStatelessLocalTestClient {
029: public class StatelessDefaultInterceptorTests extends
030: BasicStatelessLocalTestClient {
031:
032: /*
033: * @EJB(name="StatelessInterceptedBusinessRemote", beanInterface = BasicStatelessInterceptedRemote.class)
034: */
035: private BasicStatelessInterceptedRemote firstBean;
036: private BasicStatelessInterceptedRemote secondBean;
037: private BasicStatelessInterceptedRemote thirdBean;
038:
039: public StatelessDefaultInterceptorTests() {
040: super ("BasicStatelessIntercepted.");
041: }
042:
043: public void testNothing() {
044: }
045:
046: //
047: // TODO lookups are broken
048: //
049: // protected void setUp() throws Exception {
050: // super.setUp();
051: // Object obj = initialContext.lookup("StatelessInterceptedBusinessRemote");
052: // assertNotNull("The StatelessInterceptedBusinessRemote object is null", obj);
053: // firstBean = (BasicStatelessInterceptedRemote) javax.rmi.PortableRemoteObject.narrow(obj,
054: // BasicStatelessInterceptedRemote.class);
055: // assertNotNull("StatelessInterceptedBean is null", firstBean);
056: //
057: // obj = initialContext.lookup("SecondStatelessInterceptedBusinessRemote");
058: // assertNotNull("The StatelessInterceptedBusinessRemote object is null", obj);
059: // secondBean = (BasicStatelessInterceptedRemote) javax.rmi.PortableRemoteObject.narrow(obj,
060: // BasicStatelessInterceptedRemote.class);
061: // assertNotNull("SecondStatelessInterceptedBean is null", secondBean);
062: //
063: // obj = initialContext.lookup("ThirdStatelessInterceptedBusinessRemote");
064: // assertNotNull("The StatelessInterceptedBusinessRemote object is null", obj);
065: // thirdBean = (BasicStatelessInterceptedRemote) javax.rmi.PortableRemoteObject.narrow(obj,
066: // BasicStatelessInterceptedRemote.class);
067: // assertNotNull("ThirdStatelessInterceptedBean is null", thirdBean);
068: // }
069: //
070: // /**
071: // * Tears down the fixture, for example, close a network connection. This method is called after a test is executed.
072: // */
073: // protected void tearDown() throws Exception {
074: // super.tearDown();
075: // }
076: //
077: //
078: //
079: // /**
080: // * Invokes a business method which is annotated to be excluded from interception.
081: // * <code>getContextData()</code> has been annotated with <code>@ExcludesDefaultInterceptors</code>
082: // */
083: // public void test01_excludeDefaultInterceptorsOnMethod() {
084: // Map contextData = firstBean.getContextData();
085: // // verifying that inBeanInterceptor indeed intercepted this method. This cannot be excluded at all.
086: // assertNotNull(contextData.containsKey("getContextData"));
087: //
088: // Map innerMap = (Map) contextData.get("getContextData");
089: // ArrayList interceptorsList = (ArrayList) innerMap.get("INTERCEPTORS");
090: // // verifying @ExcludeClassInterceptors annotated method was not intercepted
091: // assertFalse("getContextData() should not have been intercepted by classInterceptor()", interceptorsList.contains("defaultInterceptor"));
092: // }
093: //
094: // /**
095: // * Invokes a business method which is annotated to be excluded from interception.
096: // * <code>getContextData()</code> has been defined with <code>excludes-default-interceptors</code>
097: // */
098: // public void test02_excludeDefaultInterceptorsOnMethod() {
099: // Map contextData = secondBean.getContextData();
100: // // verifying that inBeanInterceptor indeed intercepted this method. This cannot be excluded at all.
101: // assertNotNull(contextData.containsKey("getContextData"));
102: //
103: // Map innerMap = (Map) contextData.get("getContextData");
104: // ArrayList interceptorsList = (ArrayList) innerMap.get("INTERCEPTORS");
105: // // verifying @ExcludeClassInterceptors annotated method was not intercepted
106: // assertFalse("getContextData() should not have been intercepted by classInterceptor()", interceptorsList.contains("defaultInterceptor"));
107: // }
108: //
109: // /**
110: // * Invokes a business method which is annotated to be excluded from interception.
111: // * <code>getContextData()</code> has been defined with <code>excludes-default-interceptors</code>
112: // */
113: // public void test03_excludeDefaultInterceptorsOnMethod() {
114: // Map contextData = thirdBean.getContextData();
115: // // verifying that inBeanInterceptor indeed intercepted this method. This cannot be excluded at all.
116: // assertNotNull(contextData.containsKey("getContextData"));
117: //
118: // Map innerMap = (Map) contextData.get("getContextData");
119: // ArrayList interceptorsList = (ArrayList) innerMap.get("INTERCEPTORS");
120: // // verifying @ExcludeClassInterceptors annotated method was not intercepted
121: // assertFalse("getContextData() should not have been intercepted by classInterceptor()", interceptorsList.contains("defaultInterceptor"));
122: // }
123: }
|