openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r924462 [2/2] - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/ main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/context/ main/java/org/apache/webbeans/context/creational/ main/java/org/...
Date Wed, 17 Mar 2010 20:17:46 GMT
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptorTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptorTest.java?rev=924462&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptorTest.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptorTest.java
Wed Mar 17 20:17:45 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.apache.webbeans.newtests.interceptors.ejb;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.beans.ApplicationScopedBean;
+import org.apache.webbeans.newtests.interceptors.beans.RequestScopedBean;
+import org.junit.Test;
+
+public class EjbInterceptorTest extends AbstractUnitTest
+{
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void testEjbInterceptor()
+    {
+        Collection<URL> beanXmls = new ArrayList<URL>();
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(RequestScopedBean.class);
+        beanClasses.add(ManagedBeanWithEjbInterceptor.class);
+        beanClasses.add(ApplicationScopedBean.class);
+        beanClasses.add(EjbInterceptor.class);
+        
+        startContainer(beanClasses, beanXmls);        
+        
+        Set<Bean<?>> beans = getBeanManager().getBeans("org.apache.webbeans.newtests.interceptors.ejb.ManagedBeanWithEjbInterceptor");
+        Assert.assertNotNull(beans);        
+        Bean<ManagedBeanWithEjbInterceptor> bean = (Bean<ManagedBeanWithEjbInterceptor>)beans.iterator().next();
+        
+        CreationalContext<ManagedBeanWithEjbInterceptor> ctx = getBeanManager().createCreationalContext(bean);
+        
+        ManagedBeanWithEjbInterceptor reference = (ManagedBeanWithEjbInterceptor)getBeanManager().getReference(bean,
ManagedBeanWithEjbInterceptor.class, ctx);
+        Assert.assertNotNull(reference);
+        
+        reference.sayHello();
+        
+        shutDownContainer();
+    }
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithEjbInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithEjbInterceptor.java?rev=924462&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithEjbInterceptor.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithEjbInterceptor.java
Wed Mar 17 20:17:45 2010
@@ -0,0 +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.apache.webbeans.newtests.interceptors.ejb;
+
+import javax.inject.Named;
+import javax.interceptor.Interceptors;
+
+@Interceptors(value={EjbInterceptor.class})
+@Named("org.apache.webbeans.newtests.interceptors.ejb.ManagedBeanWithEjbInterceptor")
+public class ManagedBeanWithEjbInterceptor
+{        
+    public void sayHello()
+    {
+        
+    }
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithEjbInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message