openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1179581 - in /openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation: ./ DefaultXyBean.java SpecializedXyBean.java SpecializesPassivationTest.java
Date Thu, 06 Oct 2011 11:41:35 GMT
Author: struberg
Date: Thu Oct  6 11:41:35 2011
New Revision: 1179581

URL: http://svn.apache.org/viewvc?rev=1179581&view=rev
Log:
OWB-620 unit test which shows the problem

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/DefaultXyBean.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializedXyBean.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializesPassivationTest.java
      - copied, changed from r1178945, openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/DefaultXyBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/DefaultXyBean.java?rev=1179581&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/DefaultXyBean.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/DefaultXyBean.java
Thu Oct  6 11:41:35 2011
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.specalization.passivation;
+
+import javax.enterprise.context.SessionScoped;
+import java.io.Serializable;
+
+/**
+ * This bean will later get specialized.
+ * It's important for our test that this bean has a passivating scope
+ */
+@SessionScoped
+public class DefaultXyBean implements Serializable
+{
+    public int getFoo()
+    {
+        return 42;
+    }
+
+}

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializedXyBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializedXyBean.java?rev=1179581&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializedXyBean.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializedXyBean.java
Thu Oct  6 11:41:35 2011
@@ -0,0 +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.apache.webbeans.newtests.specalization.passivation;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Specializes;
+import java.io.Serializable;
+
+/**
+ * This bean specializes DefaultXyBean which is therefor disabled.
+ * It's important for our test that this bean has a passivating scope
+ */
+@SessionScoped
+@Specializes
+public class SpecializedXyBean extends DefaultXyBean implements Serializable
+{
+    public int getFoo()
+    {
+        return 42;
+    }
+
+}

Copied: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializesPassivationTest.java
(from r1178945, openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java)
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializesPassivationTest.java?p2=openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializesPassivationTest.java&p1=openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java&r1=1178945&r2=1179581&rev=1179581&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializesPassivationTest.java
Thu Oct  6 11:41:35 2011
@@ -16,55 +16,30 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.webbeans.newtests.specalization;
-
-import java.lang.annotation.Annotation;
-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 javax.enterprise.util.AnnotationLiteral;
-
-import junit.framework.Assert;
+package org.apache.webbeans.newtests.specalization.passivation;
 
 import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.specalization.Pen;
 import org.junit.Test;
 
-public class AlternativeSpecializesProducerTest extends AbstractUnitTest
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class SpecializesPassivationTest extends AbstractUnitTest
 {
 
-    private static final String PACKAGE_NAME = AlternativeSpecializesProducerTest.class.getPackage().getName();
+    private static final String PACKAGE_NAME = SpecializesPassivationTest.class.getPackage().getName();
 
     @Test
     @SuppressWarnings("unchecked")
-    public void testAlternativeSpecializeBean()
+    public void testSpecializePassivatingBean()
     {
-        Collection<String> beanXmls = new ArrayList<String>();
-        beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeSpecializesProducer"));
-        
         Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
         beanClasses.add(Pen.class);
-        beanClasses.add(DefaultPenProducer.class);
-        beanClasses.add(AdvancedPenProducer.class);
-        beanClasses.add(PremiumPenProducer.class);
-
-        startContainer(beanClasses, beanXmls);        
-
-        Annotation[] anns = new Annotation[1];
-        anns[0] = new AnnotationLiteral<QualifierSpecialized>()
-        {
-        };
-
-
-        Set<Bean<?>> beans = getBeanManager().getBeans(IPen.class, anns);
-        Assert.assertTrue(beans.size() == 1);
-        Bean<IPen> bean = (Bean<IPen>)beans.iterator().next();
-        CreationalContext<IPen> cc = getBeanManager().createCreationalContext(bean);
-        IPen pen = (IPen) getBeanManager().getReference(bean, IPen.class, cc);
-        Assert.assertTrue(pen.getID().contains("premium"));
-        
+        beanClasses.add(DefaultXyBean.class);
+        beanClasses.add(SpecializedXyBean.class);
+
+        startContainer(beanClasses, null);
         shutDownContainer();
     }
 



Mime
View raw message