openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1562379 - in /openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans: newtests/managed/specialized/ newtests/producer/ newtests/proxy/ newtests/specalization/multiple/ test/ test/component/intercept/webbeans/ test/component/lit...
Date Wed, 29 Jan 2014 08:51:36 GMT
Author: struberg
Date: Wed Jan 29 08:51:36 2014
New Revision: 1562379

URL: http://svn.apache.org/r1562379
Log:
OWB-763 migrate our last old tests 

Removed:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestListener.java
Modified:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/specialized/SpecializeDeactivationTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/NamedProducerTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureAndTransactionalInterceptor.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/TransactionalInterceptor.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/literals/InstanceTypeLiteralBean.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ScopeTypeExceptionComponentTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedInjectedComponentTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/named/NamedTests.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureAndTransactionalInterceptorTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/ShoppingCardInterceptorTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/WebBeansInterceptComponentTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/specializes/SpecializesProducer1Test.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/ScopeAdapterTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/SingletonComponentTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypeLiteralTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/specialized/SpecializeDeactivationTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/specialized/SpecializeDeactivationTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/specialized/SpecializeDeactivationTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/specialized/SpecializeDeactivationTest.java Wed Jan 29 08:51:36 2014
@@ -22,7 +22,6 @@ import org.apache.webbeans.newtests.Abst
 import org.junit.Before;
 import org.junit.Test;
 
-import javax.annotation.PostConstruct;
 import javax.enterprise.inject.Any;
 import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.Produces;

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/NamedProducerTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/NamedProducerTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/NamedProducerTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/NamedProducerTest.java Wed Jan 29 08:51:36 2014
@@ -26,7 +26,6 @@ import javax.enterprise.inject.spi.Bean;
 
 import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class NamedProducerTest extends AbstractUnitTest

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java Wed Jan 29 08:51:36 2014
@@ -21,8 +21,6 @@ package org.apache.webbeans.newtests.pro
 import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.junit.Test;
 
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
 import javax.interceptor.AroundInvoke;
 import javax.interceptor.Interceptor;
@@ -33,7 +31,6 @@ import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-import java.util.ArrayList;
 import java.util.Arrays;
 
 import static org.apache.webbeans.newtests.util.Serializations.deserialize;

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java Wed Jan 29 08:51:36 2014
@@ -23,7 +23,7 @@ import java.util.Collection;
 import junit.framework.Assert;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import javax.enterprise.inject.spi.DefinitionException;
-import org.apache.webbeans.exception.inject.InconsistentSpecializationException;
+
 import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.junit.Test;
 

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureAndTransactionalInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureAndTransactionalInterceptor.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureAndTransactionalInterceptor.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureAndTransactionalInterceptor.java Wed Jan 29 08:51:36 2014
@@ -25,10 +25,12 @@ import javax.interceptor.InvocationConte
 import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure2;
 import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
 
+import java.io.Serializable;
+
 @Interceptor
 @Secure2
 @Transactional
-public class SecureAndTransactionalInterceptor
+public class SecureAndTransactionalInterceptor implements Serializable
 {
 
     @AroundInvoke

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/TransactionalInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/TransactionalInterceptor.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/TransactionalInterceptor.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/TransactionalInterceptor.java Wed Jan 29 08:51:36 2014
@@ -24,9 +24,11 @@ import javax.interceptor.InvocationConte
 
 import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
 
+import java.io.Serializable;
+
 @Interceptor
 @Transactional
-public class TransactionalInterceptor
+public class TransactionalInterceptor implements Serializable
 {
 
     @AroundInvoke

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/literals/InstanceTypeLiteralBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/literals/InstanceTypeLiteralBean.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/literals/InstanceTypeLiteralBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/literals/InstanceTypeLiteralBean.java Wed Jan 29 08:51:36 2014
@@ -20,12 +20,14 @@ package org.apache.webbeans.test.compone
 
 import java.lang.annotation.Annotation;
 
+import javax.enterprise.context.Dependent;
 import javax.enterprise.inject.Instance;
 import javax.enterprise.util.TypeLiteral;
 import javax.inject.Inject;
 import javax.inject.Named;
 
 @Named("literalBean")
+@Dependent
 public class InstanceTypeLiteralBean
 {
     public static interface IOrder<T>{}

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java Wed Jan 29 08:51:36 2014
@@ -20,8 +20,9 @@ package org.apache.webbeans.test.compone
 
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.Specializes;
-import javax.inject.Named;
 
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
 import org.apache.webbeans.test.component.producer.specializes.superclazz.SpecializesProducer1SuperClazz;
 
 public class SpecializesProducer1 extends SpecializesProducer1SuperClazz
@@ -33,9 +34,9 @@ public class SpecializesProducer1 extend
     }
 
     @Produces
-    @Override
+    @Binding1
+    @Binding2
     @Specializes
-    @Named("specializedNumber")
     public int createMaxNumber()
     {
         return 10000;

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java Wed Jan 29 08:51:36 2014
@@ -25,7 +25,6 @@ import javax.enterprise.util.TypeLiteral
 
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.newtests.AbstractUnitTest;
-import org.apache.webbeans.test.TestContext;
 import org.apache.webbeans.test.annotation.binding.Binding1;
 import org.apache.webbeans.test.event.ITypeArgumentEventInterface;
 import org.apache.webbeans.test.event.LoggedInEvent;

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java Wed Jan 29 08:51:36 2014
@@ -21,13 +21,10 @@ package org.apache.webbeans.test.unittes
 import java.lang.annotation.Annotation;
 import java.lang.annotation.Documented;
 
-import javax.enterprise.context.NormalScope;
-import javax.enterprise.inject.spi.DefinitionException;
 import javax.enterprise.util.AnnotationLiteral;
 
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.newtests.AbstractUnitTest;
-import org.apache.webbeans.test.TestContext;
 import org.apache.webbeans.test.annotation.binding.Binding1;
 import org.apache.webbeans.test.event.LoggedInEvent;
 import org.apache.webbeans.test.event.LoggedInObserver;

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ScopeTypeExceptionComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ScopeTypeExceptionComponentTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ScopeTypeExceptionComponentTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ScopeTypeExceptionComponentTest.java Wed Jan 29 08:51:36 2014
@@ -26,7 +26,7 @@ import javax.enterprise.inject.spi.Bean;
 import junit.framework.Assert;
 
 import org.apache.webbeans.exception.WebBeansConfigurationException;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.test.component.exception.stero.ComponentDefaultScopeWithDifferentScopeSteros;
 import org.apache.webbeans.test.component.exception.stero.ComponentDefaultScopeWithNonScopeStero;
 import org.apache.webbeans.test.component.exception.stero.ComponentNonDefaultScopeWithDifferentScopeSteros;
@@ -35,30 +35,15 @@ import org.apache.webbeans.test.componen
 import org.apache.webbeans.test.component.exception.stero.ComponentWithNonScopeStero;
 import org.apache.webbeans.test.component.exception.stero.ComponentWithSameScopeSteros;
 import org.apache.webbeans.test.component.exception.stero.ComponentWithoutScopeStero;
-import org.junit.Before;
 import org.junit.Test;
 
-public class ScopeTypeExceptionComponentTest extends TestContext
+public class ScopeTypeExceptionComponentTest extends AbstractUnitTest
 {
-
-    public ScopeTypeExceptionComponentTest()
-    {
-        super(ScopeTypeExceptionComponentTest.class.getName());
-    }
-
-    @Override
-    @Before
-    public void init()
-    {
-        super.init();
-    }
-
     @Test
     public void testComponentWithNonScopeStero()
     {
-        clear();
-        defineManagedBean(ComponentWithNonScopeStero.class);
-        Bean<?> bean = getComponents().get(0);
+        startContainer(ComponentWithNonScopeStero.class);
+        Bean<?> bean = getBean(ComponentWithNonScopeStero.class);
 
         Assert.assertEquals(Dependent.class, bean.getScope());
     }
@@ -66,9 +51,8 @@ public class ScopeTypeExceptionComponent
     @Test
     public void testComponentDefaultScopeWithNonScopeStero()
     {
-        clear();
-        defineManagedBean(ComponentDefaultScopeWithNonScopeStero.class);
-        Bean<?> bean = getComponents().get(0);
+        startContainer(ComponentDefaultScopeWithNonScopeStero.class);
+        Bean<?> bean = getBean(ComponentDefaultScopeWithNonScopeStero.class);
 
         Assert.assertEquals(SessionScoped.class, bean.getScope());
     }
@@ -76,35 +60,23 @@ public class ScopeTypeExceptionComponent
     @Test
     public void testComponentWithDefaultScopeStero()
     {
-        clear();
-        defineManagedBean(ComponentWithDefaultScopeStero.class);
-        Bean<?> bean = getComponents().get(0);
+        startContainer(ComponentWithDefaultScopeStero.class);
+        Bean<?> bean = getBean(ComponentWithDefaultScopeStero.class);
 
         Assert.assertEquals(RequestScoped.class, bean.getScope());
     }
 
-    @Test
+    @Test(expected = WebBeansConfigurationException.class)
     public void testComponentWithDifferentScopeSteros()
     {
-        clear();
-        try
-        {
-            defineManagedBean(ComponentWithDifferentScopeSteros.class);
-        }
-        catch (WebBeansConfigurationException e)
-        {
-            System.out.println("got expected exception: " + e.getMessage());
-            return; // all ok!
-        }
-        Assert.fail("expecting an exception!");
+        startContainer(ComponentWithDifferentScopeSteros.class);
     }
 
     @Test
     public void testComponentWithoutScopeStero()
     {
-        clear();
-        defineManagedBean(ComponentWithoutScopeStero.class);
-        Bean<?> bean = getComponents().get(0);
+        startContainer(ComponentWithoutScopeStero.class);
+        Bean<?> bean = getBean(ComponentWithoutScopeStero.class);
 
         Assert.assertEquals(Dependent.class, bean.getScope());
     }
@@ -112,9 +84,8 @@ public class ScopeTypeExceptionComponent
     @Test
     public void testComponentWithSameScopeSteros()
     {
-        clear();
-        defineManagedBean(ComponentWithSameScopeSteros.class);
-        Bean<?> bean = getComponents().get(0);
+        startContainer(ComponentWithSameScopeSteros.class);
+        Bean<?> bean = getBean(ComponentWithSameScopeSteros.class);
 
         Assert.assertEquals(SessionScoped.class, bean.getScope());
     }
@@ -122,27 +93,16 @@ public class ScopeTypeExceptionComponent
     @Test
     public void testComponentDefaultScopeWithDifferentScopeSteros()
     {
-        clear();
-        defineManagedBean(ComponentDefaultScopeWithDifferentScopeSteros.class);
-        Bean<?> bean = getComponents().get(0);
+        startContainer(ComponentDefaultScopeWithDifferentScopeSteros.class);
+        Bean<?> bean = getBean(ComponentDefaultScopeWithDifferentScopeSteros.class);
 
         Assert.assertEquals(SessionScoped.class, bean.getScope());
     }
 
-    @Test
+    @Test(expected = WebBeansConfigurationException.class)
     public void testComponentNonDefaultScopeWithDifferentScopeSteros()
     {
-        clear();
-        try
-        {
-            defineManagedBean(ComponentNonDefaultScopeWithDifferentScopeSteros.class);
-        }
-        catch (WebBeansConfigurationException e)
-        {
-            System.out.println("got expected exception: " + e.getMessage());
-            return; // all ok!
-        }
-        Assert.fail("expecting an exception!");
+        startContainer(ComponentNonDefaultScopeWithDifferentScopeSteros.class);
     }
 
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java Wed Jan 29 08:51:36 2014
@@ -18,59 +18,34 @@
  */
 package org.apache.webbeans.test.unittests.inject;
 
-import java.lang.annotation.Annotation;
 import java.util.Set;
 
-import javax.enterprise.inject.Default;
 import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
 
 import junit.framework.Assert;
 
+import org.apache.webbeans.annotation.DefaultLiteral;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.InjectionResolver;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.test.component.service.ITyped;
 import org.apache.webbeans.test.component.service.TypedComponent;
-import org.junit.Before;
 import org.junit.Test;
 
-public class TypedComponentTest extends TestContext
+public class TypedComponentTest extends AbstractUnitTest
 {
-    BeanManager container = null;
-    ITyped<String> s = null;
-
-    public TypedComponentTest()
-    {
-        super(TypedComponentTest.class.getSimpleName());
-    }
-
-    @Override
-    @Before
-    public void init()
-    {
-        super.init();
-    }
+    private ITyped<String> s = null;
 
     @Test
     public void testTypedComponent() throws Throwable
     {
-        clear();
-        defineManagedBean(TypedComponent.class);
+        startContainer(TypedComponent.class);
 
         InjectionResolver injectionResolver = WebBeansContext.getInstance().getBeanManagerImpl().getInjectionResolver();
 
-        Set<Bean<?>> beans= injectionResolver.implResolveByType(false, TypedComponentTest.class.getDeclaredField("s").getGenericType(), new Default()
-        {
-
-            @Override
-            public Class<? extends Annotation> annotationType()
-            {
-
-                return Default.class;
-            }
-
-        });
+        Set<Bean<?>> beans
+                = injectionResolver.implResolveByType(false, TypedComponentTest.class.getDeclaredField("s").getGenericType(),
+                                                      DefaultLiteral.INSTANCE);
 
         Assert.assertTrue(beans.size() == 1 ? true : false);
     }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedInjectedComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedInjectedComponentTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedInjectedComponentTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedInjectedComponentTest.java Wed Jan 29 08:51:36 2014
@@ -18,108 +18,53 @@
  */
 package org.apache.webbeans.test.unittests.inject;
 
-import java.util.List;
-
-import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.util.AnnotationLiteral;
 
 import junit.framework.Assert;
 
-import org.apache.webbeans.component.AbstractOwbBean;
-import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.context.ContextFactory;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
 import org.apache.webbeans.test.component.service.ITyped2;
 import org.apache.webbeans.test.component.service.Typed2;
 import org.apache.webbeans.test.component.service.TypedInjection;
 import org.apache.webbeans.test.component.service.TypedInjectionWithoutArguments;
-import org.junit.Before;
 import org.junit.Test;
 
-public class TypedInjectedComponentTest extends TestContext
+public class TypedInjectedComponentTest extends AbstractUnitTest
 {
-    BeanManager container = null;
-
-    public TypedInjectedComponentTest()
-    {
-        super(TypedInjectedComponentTest.class.getSimpleName());
-    }
-
-    @Override
-    @Before
-    public void init()
-    {
-        super.init();
-        this.container = WebBeansContext.getInstance().getBeanManagerImpl();
-    }
-
     @Test
     public void testTypedComponent() throws Throwable
     {
-        clear();
-
-        defineManagedBean(Typed2.class);
-        defineManagedBean(TypedInjection.class);
-        List<AbstractOwbBean<?>> comps = getComponents();
-
-        Object session = getSession();
-
-        ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
-        contextFactory.initSessionContext(session);
-
-        Assert.assertEquals(2, comps.size());
-
-        getManager().getInstance(comps.get(0));
-
-        Object object = getManager().getInstance(comps.get(1));
-
-        Assert.assertTrue(object instanceof TypedInjection);
-
-        TypedInjection i = (TypedInjection) object;
+        startContainer(Typed2.class, TypedInjection.class);
+        TypedInjection i = getInstance(TypedInjection.class);
         Typed2 typed2 = (Typed2)i.getV();
         typed2.setValue(true);
 
 
         Assert.assertTrue(i.getV() instanceof ITyped2);
 
-        Typed2 obj2 = (Typed2)getManager().getInstance(comps.get(0));
+        Typed2 obj2 = getInstance(Typed2.class,
+                new AnnotationLiteral<Binding1>() {}, new AnnotationLiteral<Binding2>() {});
 
         Assert.assertSame(typed2.isValue(), obj2.isValue());
-
-        contextFactory.destroySessionContext(session);
     }
 
     @Test
     public void testTypedComponentWithoutArgument() throws Throwable
     {
-        clear();
-
-        defineManagedBean(Typed2.class);
-        defineManagedBean(TypedInjectionWithoutArguments.class);
-        List<AbstractOwbBean<?>> comps = getComponents();
+        startContainer(Typed2.class, TypedInjectionWithoutArguments.class);
+        TypedInjectionWithoutArguments i = getInstance(TypedInjectionWithoutArguments.class);
 
-        Object session = getSession();
-
-        ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
-        contextFactory.initSessionContext(session);
-
-        Assert.assertEquals(2, comps.size());
-
-        getManager().getInstance(comps.get(0));
-        Object object = getManager().getInstance(comps.get(1));
-
-        Assert.assertTrue(object instanceof TypedInjectionWithoutArguments);
-
-        TypedInjectionWithoutArguments i = (TypedInjectionWithoutArguments) object;
         Typed2 typed2 = (Typed2)i.getV();
         typed2.setValue(true);
 
         Assert.assertTrue(i.getV() instanceof ITyped2);
 
-        Typed2 obj2 = (Typed2)getManager().getInstance(comps.get(0));
+        Typed2 obj2 = getInstance(Typed2.class,
+                new AnnotationLiteral<Binding1>() {}, new AnnotationLiteral<Binding2>() {});
 
         Assert.assertSame(typed2.isValue(), obj2.isValue());
-
-        contextFactory.destroySessionContext(session);
     }
 
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/named/NamedTests.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/named/NamedTests.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/named/NamedTests.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/named/NamedTests.java Wed Jan 29 08:51:36 2014
@@ -20,11 +20,9 @@ package org.apache.webbeans.test.unittes
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
 import java.util.Set;
 
 import javax.enterprise.inject.spi.AnnotatedConstructor;
-import javax.enterprise.inject.spi.AnnotatedField;
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureAndTransactionalInterceptorTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureAndTransactionalInterceptorTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureAndTransactionalInterceptorTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureAndTransactionalInterceptorTest.java Wed Jan 29 08:51:36 2014
@@ -18,50 +18,29 @@
  */
 package org.apache.webbeans.test.unittests.intercept.webbeans;
 
-import javax.enterprise.inject.spi.Bean;
 
 import junit.framework.Assert;
 
-import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.context.ContextFactory;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.test.component.intercept.webbeans.SecureAndTransactionalComponent;
 import org.apache.webbeans.test.component.intercept.webbeans.SecureAndTransactionalInterceptor;
-import org.junit.Before;
 import org.junit.Test;
 
-public class SecureAndTransactionalInterceptorTest extends TestContext
+public class SecureAndTransactionalInterceptorTest extends AbstractUnitTest
 {
-    public SecureAndTransactionalInterceptorTest()
-    {
-        super(SecureAndTransactionalInterceptorTest.class.getName());
-    }
-    
-    @Override
-    @Before
-    public void init()
-    {
-        initDefaultStereoTypes();
-        initializeInterceptorType(SecureAndTransactionalInterceptor.class);
-    }
 
     @Test
     public void testSecureAndTransactionalInterceptor()
     {
-        ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
-        contextFactory.initSessionContext(null);
-        defineInterceptor(SecureAndTransactionalInterceptor.class);
-        
-        Bean<SecureAndTransactionalComponent> bean = defineManagedBean(SecureAndTransactionalComponent.class);
-        SecureAndTransactionalComponent payment = getManager().getInstance(bean);
+        addInterceptor(SecureAndTransactionalInterceptor.class);
+        startContainer(SecureAndTransactionalInterceptor.class, SecureAndTransactionalComponent.class);
+
+        SecureAndTransactionalComponent payment = getInstance(SecureAndTransactionalComponent.class);
         
         Assert.assertFalse(SecureAndTransactionalComponent.getCALL());
         
         payment.pay();
         
         Assert.assertTrue(SecureAndTransactionalComponent.getCALL());
-
-
-        contextFactory.destroySessionContext(null);
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/ShoppingCardInterceptorTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/ShoppingCardInterceptorTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/ShoppingCardInterceptorTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/ShoppingCardInterceptorTest.java Wed Jan 29 08:51:36 2014
@@ -18,48 +18,21 @@
  */
 package org.apache.webbeans.test.unittests.intercept.webbeans;
 
-import javax.enterprise.inject.spi.Bean;
-
 import junit.framework.Assert;
 
-import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.test.component.intercept.webbeans.ShoppingCard;
 import org.apache.webbeans.test.component.intercept.webbeans.TransactionalInterceptor;
-import org.junit.Before;
 import org.junit.Test;
 
-public class ShoppingCardInterceptorTest extends TestContext
+public class ShoppingCardInterceptorTest extends AbstractUnitTest
 {
-    public ShoppingCardInterceptorTest()
-    {
-        super(ShoppingCardInterceptorTest.class.getName());
-    }
-    
-    @Override
-    @Before
-    public void init()
-    {
-        initDefaultStereoTypes();
-        initializeInterceptorType(TransactionalInterceptor.class);
-        
-        super.init();
-        
-    }
-
     @Test
     public void testTransactionalInterceptor()
     {
-        WebBeansContext webBeansContext = WebBeansContext.getInstance();
-        webBeansContext.getContextFactory().initSessionContext(null);
-
-        // Interceptors must explicitly get enabled via XML. We fake this:
-        webBeansContext.getInterceptorsManager().addEnabledInterceptorClass(TransactionalInterceptor.class);
-        
-        defineInterceptor(TransactionalInterceptor.class);
-        
-        Bean<ShoppingCard> bean = defineManagedBean(ShoppingCard.class);
-        ShoppingCard card = getManager().getInstance(bean);
+        addInterceptor(TransactionalInterceptor.class);
+        startContainer(TransactionalInterceptor.class, ShoppingCard.class);
+        ShoppingCard card = getInstance(ShoppingCard.class);
         
         card.placeOrder();
         
@@ -68,7 +41,5 @@ public class ShoppingCardInterceptorTest
         card.placeOrder2();
         
         Assert.assertFalse(ShoppingCard.getCALLED());
-
-        webBeansContext.getContextFactory().destroySessionContext(null);
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/WebBeansInterceptComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/WebBeansInterceptComponentTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/WebBeansInterceptComponentTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/WebBeansInterceptComponentTest.java Wed Jan 29 08:51:36 2014
@@ -18,103 +18,43 @@
  */
 package org.apache.webbeans.test.unittests.intercept.webbeans;
 
-import java.util.List;
-
 import junit.framework.Assert;
 
-import org.apache.webbeans.component.AbstractOwbBean;
-import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.context.ContextFactory;
-import org.apache.webbeans.exception.WebBeansConfigurationException;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.test.component.intercept.webbeans.ActionInterceptor;
 import org.apache.webbeans.test.component.intercept.webbeans.TransactionalInterceptor2;
 import org.apache.webbeans.test.component.intercept.webbeans.WInterceptorComponent;
 import org.apache.webbeans.test.component.intercept.webbeans.WMetaInterceptorComponent;
-import org.junit.Before;
 import org.junit.Test;
 
-public class WebBeansInterceptComponentTest extends TestContext
+public class WebBeansInterceptComponentTest extends AbstractUnitTest
 {
-    boolean init = false;
-
-    public WebBeansInterceptComponentTest()
-    {
-        super(WebBeansInterceptComponentTest.class.getName());
-    }
-
-    @Override
-    @Before
-    public void init()
-    {
-        super.init();
-        initializeInterceptorType(TransactionalInterceptor2.class);
-        initializeInterceptorType(ActionInterceptor.class);
-    }
-
     @Test
     public void testInterceptedComponent()
     {
-        WebBeansConfigurationException exc = null;
-
-        try
-        {
-            defineInterceptor(TransactionalInterceptor2.class);
-            defineManagedBean(WInterceptorComponent.class);
-
-        }
-        catch (WebBeansConfigurationException e)
-        {
-            System.out.println(e.getMessage());
-            exc = e;
-
-        }
-
-        Assert.assertNull(exc);
+        addInterceptor(TransactionalInterceptor2.class);
+        startContainer(TransactionalInterceptor2.class, WInterceptorComponent.class);
     }
 
     @Test
     public void testInterceptorCalls()
     {
-        getComponents().clear();
-
-        defineInterceptor(TransactionalInterceptor2.class);
-        defineManagedBean(WInterceptorComponent.class);
+        addInterceptor(TransactionalInterceptor2.class);
+        startContainer(TransactionalInterceptor2.class, WInterceptorComponent.class);
 
-        ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
-        contextFactory.initRequestContext(null);
-        List<AbstractOwbBean<?>> comps = getComponents();
-
-        Object object = getManager().getInstance(comps.get(0));
-
-        Assert.assertTrue(object instanceof WInterceptorComponent);
-
-        WInterceptorComponent comp = (WInterceptorComponent) object;
+        WInterceptorComponent comp = getInstance(WInterceptorComponent.class);;
         int s = comp.hello();
 
         Assert.assertEquals(5, s);
-
-        contextFactory.destroyRequestContext(null);
     }
 
     @Test
     public void testMetaInterceptorCalls()
     {
-        getComponents().clear();
-
-        defineInterceptor(TransactionalInterceptor2.class);
-        defineInterceptor(ActionInterceptor.class);
-        defineManagedBean(WMetaInterceptorComponent.class);
-
-        ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
-        contextFactory.initRequestContext(null);
-        List<AbstractOwbBean<?>> comps = getComponents();
-
-        Object object = getManager().getInstance(comps.get(0));
-
-        Assert.assertTrue(object instanceof WMetaInterceptorComponent);
-
-        WMetaInterceptorComponent comp = (WMetaInterceptorComponent) object;
+        addInterceptor(TransactionalInterceptor2.class);
+        addInterceptor(ActionInterceptor.class);
+        startContainer(TransactionalInterceptor2.class, ActionInterceptor.class, WMetaInterceptorComponent.class);
+        WMetaInterceptorComponent comp = getInstance(WMetaInterceptorComponent.class);
         int s = comp.hello();
 
         Assert.assertEquals(5, s);
@@ -122,8 +62,5 @@ public class WebBeansInterceptComponentT
         s = comp.hello2();
 
         Assert.assertEquals(10, s);
-
-        contextFactory.destroyRequestContext(null);
     }
-
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java Wed Jan 29 08:51:36 2014
@@ -18,53 +18,20 @@
  */
 package org.apache.webbeans.test.unittests.producer;
 
-import java.lang.annotation.Annotation;
-
-import org.apache.webbeans.component.ProducerMethodBean;
-import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.test.component.producer.StaticProducer1;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 
-public class StaticProducerTest extends TestContext
+public class StaticProducerTest extends AbstractUnitTest
 {
 
-    public StaticProducerTest()
-    {
-        super(StaticProducerTest.class.getName());
-    }
-
-    @Override
-    @Before
-    public void init()
-    {
-        super.init();
-    }
-
     @Test
     public void testStaticProducer1()
     {
-        clear();
-
-        WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
-
-        defineManagedBean(StaticProducer1.class);
-
-        ProducerMethodBean<?> pc = (ProducerMethodBean<?>) getManager().resolveByName("weight").iterator().next();
-
-        Object obj = getManager().getInstance(pc);
-
-        Assert.assertTrue(obj instanceof Integer);
-        Assert.assertEquals(79, obj);
-
-        pc = (ProducerMethodBean<?>) getManager().resolveByType(int.class, new Annotation[] {}).iterator().next();
-
-        obj = getManager().getInstance(pc);
-
-        Assert.assertTrue(obj instanceof Integer);
-        Assert.assertEquals(79, obj);
+        startContainer(StaticProducer1.class);
 
+        Integer weight = getInstance("weight");
+        Assert.assertEquals(79, weight.intValue());
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/specializes/SpecializesProducer1Test.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/specializes/SpecializesProducer1Test.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/specializes/SpecializesProducer1Test.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/specializes/SpecializesProducer1Test.java Wed Jan 29 08:51:36 2014
@@ -22,35 +22,20 @@ import java.lang.annotation.Annotation;
 
 import javax.enterprise.util.AnnotationLiteral;
 
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.test.annotation.binding.Binding1;
 import org.apache.webbeans.test.annotation.binding.Binding2;
 import org.apache.webbeans.test.component.producer.specializes.SpecializesProducer1;
 import org.apache.webbeans.test.component.producer.specializes.superclazz.SpecializesProducer1SuperClazz;
-import org.junit.Before;
+import org.junit.Assert;
 import org.junit.Test;
 
-public class SpecializesProducer1Test extends TestContext
+public class SpecializesProducer1Test extends AbstractUnitTest
 {
-
-    public SpecializesProducer1Test()
-    {
-        super(SpecializesProducer1Test.class.getName());
-    }
-
-    @Override
-    @Before
-    public void init()
-    {
-    }
-
     @Test
     public void testSpecializedProducer1()
     {
-        clear();
-
-        defineManagedBean(SpecializesProducer1SuperClazz.class);
-        defineManagedBean(SpecializesProducer1.class);
+        startContainer(SpecializesProducer1SuperClazz.class, SpecializesProducer1.class);
 
         Annotation binding1 = new AnnotationLiteral<Binding1>()
         {
@@ -59,10 +44,7 @@ public class SpecializesProducer1Test ex
         {
         };
 
-        Object number = getManager().getInstanceByType(int.class, new Annotation[] { binding1, binding2 });
-        //This test is not valid since specialize configuration requires
-        //all producers at deployment step in container. See:
-        //org.apache.webbeans.newtests.producer.specializes.SpecializesProducer1Test
-        //Assert.assertEquals(10000, number);
+        Object number = getInstance(int.class, new Annotation[] { binding1, binding2 });
+        Assert.assertEquals(10000, number);
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/ScopeAdapterTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/ScopeAdapterTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/ScopeAdapterTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/ScopeAdapterTest.java Wed Jan 29 08:51:36 2014
@@ -18,63 +18,22 @@
  */
 package org.apache.webbeans.test.unittests.scopes;
 
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.apache.webbeans.component.AbstractOwbBean;
-import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.context.ContextFactory;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.test.component.CheckWithCheckPayment;
 import org.apache.webbeans.test.component.producer.ScopeAdaptorComponent;
 import org.apache.webbeans.test.component.producer.ScopeAdaptorInjectorComponent;
-import org.junit.Before;
 import org.junit.Test;
 
-public class ScopeAdapterTest extends TestContext
+public class ScopeAdapterTest extends AbstractUnitTest
 {
-    public ScopeAdapterTest()
-    {
-        super(ScopeAdapterTest.class.getName());
-    }
-
-    @Override
-    @Before
-    public void init()
-    {
-        super.init();
-
-    }
-
     @Test
     public void testDependent()
     {
-        clear();
-
-        defineManagedBean(CheckWithCheckPayment.class);
-        defineManagedBean(ScopeAdaptorComponent.class);
-        defineManagedBean(ScopeAdaptorInjectorComponent.class);
-
-        Object session = getSession();
-        ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
-        contextFactory.initRequestContext(null);
-        contextFactory.initSessionContext(session);
-        contextFactory.initApplicationContext(null);
-
-        List<AbstractOwbBean<?>> comps = getComponents();
-
-        Assert.assertEquals(4, getDeployedComponents());
-
-        getManager().getInstance(comps.get(0));
-        getManager().getInstance(comps.get(1));
-        getInstanceByName("scope");
-        getManager().getInstance(comps.get(2));
-
-        contextFactory.destroyApplicationContext(null);
-        contextFactory.destroySessionContext(session);
-        contextFactory.destroyRequestContext(null);
-
+        startContainer(CheckWithCheckPayment.class, ScopeAdaptorComponent.class, ScopeAdaptorInjectorComponent.class);
+        getInstance("checkWithCheckPayment");
+        getInstance(ScopeAdaptorComponent.class);
+        getInstance("scope");
+        getInstance(ScopeAdaptorInjectorComponent.class);
     }
 
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/SingletonComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/SingletonComponentTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/SingletonComponentTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/SingletonComponentTest.java Wed Jan 29 08:51:36 2014
@@ -18,62 +18,22 @@
  */
 package org.apache.webbeans.test.unittests.scopes;
 
-import java.util.List;
-
-import javax.enterprise.inject.spi.BeanManager;
 
 import junit.framework.Assert;
-
-import org.apache.webbeans.component.AbstractOwbBean;
-import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.context.ContextFactory;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.test.component.Singleton;
 import org.apache.webbeans.test.component.service.ITyped2;
 import org.apache.webbeans.test.component.service.Typed2;
-import org.junit.Before;
 import org.junit.Test;
 
-public class SingletonComponentTest extends TestContext
+public class SingletonComponentTest extends AbstractUnitTest
 {
-    BeanManager container = null;
-
-    public SingletonComponentTest()
-    {
-        super(SingletonComponentTest.class.getSimpleName());
-    }
-
-    @Override
-    @Before
-    public void init()
-    {
-        super.init();
-        this.container = WebBeansContext.getInstance().getBeanManagerImpl();
-    }
-
-    @SuppressWarnings("unchecked")
     @Test
     public void testTypedComponent() throws Throwable
     {
-        clear();
-
-        defineManagedBean(Typed2.class);
-        defineManagedBean(Singleton.class);
-        List<AbstractOwbBean<?>> comps = getComponents();
-
-        Object session = getSession();
-
-        ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
-        contextFactory.initSessionContext(session);
+        startContainer(Typed2.class, Singleton.class);
 
-        Assert.assertEquals(2, comps.size());
-
-        getManager().getInstance(comps.get(0));
-        Object object = getManager().getInstance(comps.get(1));
-
-        Assert.assertTrue(object instanceof Singleton);
-
-        Singleton single = (Singleton) object;
+        Singleton single = getInstance("singletonInstance");
 
         Assert.assertEquals("debug", single.logDebug());
         Assert.assertEquals("info", single.logInfoo());
@@ -81,8 +41,6 @@ public class SingletonComponentTest exte
         ITyped2 t = single.getType();
 
         Assert.assertNotNull(t);
-
-        contextFactory.destroySessionContext(session);
     }
 
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java Wed Jan 29 08:51:36 2014
@@ -18,43 +18,27 @@
  */
 package org.apache.webbeans.test.unittests.specializes;
 
-import javax.enterprise.inject.spi.Bean;
-
-import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.annotation.binding.Asynchronous;
 import org.apache.webbeans.test.component.specializes.AsynhrounousSpecalizesService;
 import org.apache.webbeans.test.component.specializes.SpecializesServiceInjectorComponent;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 
-public class SpecializationComponentTest extends TestContext
-{
-    public SpecializationComponentTest()
-    {
-        super(SpecializationComponentTest.class.getName());
-    }
+import javax.enterprise.util.AnnotationLiteral;
 
-    @Override
-    @Before
-    public void init()
-    {
-    }
-    
+public class SpecializationComponentTest extends AbstractUnitTest
+{
     @Test
     public void testMockService()
     {
-        clear();
-
-        WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
-
-        Bean<AsynhrounousSpecalizesService> bean2 = defineManagedBean(AsynhrounousSpecalizesService.class);
-        Bean<SpecializesServiceInjectorComponent> bean3 = defineManagedBean(SpecializesServiceInjectorComponent.class);
-        
-        AsynhrounousSpecalizesService instanceOther = getManager().getInstance(bean2);
+        startContainer(AsynhrounousSpecalizesService.class, SpecializesServiceInjectorComponent.class);
         
+        AsynhrounousSpecalizesService instanceOther
+                = getInstance(AsynhrounousSpecalizesService.class, new AnnotationLiteral<Asynchronous>() {});
         Assert.assertNotNull(instanceOther);
-        
-        SpecializesServiceInjectorComponent instance = getManager().getInstance(bean3);
+
+        SpecializesServiceInjectorComponent instance = getInstance(SpecializesServiceInjectorComponent.class);
+        Assert.assertNotNull(instance);
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypeLiteralTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypeLiteralTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypeLiteralTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypeLiteralTest.java Wed Jan 29 08:51:36 2014
@@ -22,34 +22,18 @@ import java.util.List;
 import java.util.Map;
 
 import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.util.TypeLiteral;
 
 import junit.framework.Assert;
 
-import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.test.component.literals.InstanceTypeLiteralBean;
 import org.apache.webbeans.test.component.literals.InstanceTypeLiteralBean.IntegerOrder;
 import org.apache.webbeans.test.component.literals.InstanceTypeLiteralBean.StringOrder;
-import org.junit.Before;
 import org.junit.Test;
 
-@SuppressWarnings("unchecked")
-public class TypeLiteralTest extends TestContext
+public class TypeLiteralTest extends AbstractUnitTest
 {
-    public TypeLiteralTest()
-    {
-        super(TypeLiteralTest.class.getName());
-    }
-    
-    @Override
-    @Before
-    public void init()
-    {
-        super.init();
-    }
-
     public static class Literal1 extends TypeLiteral<Map<String, String>>
     {
         
@@ -69,18 +53,9 @@ public class TypeLiteralTest extends Tes
     @Test
     public void testTypeLiteralInInstance()
     {
-        clear();
-
-        WebBeansContext webBeansContext = WebBeansContext.getInstance();
-        webBeansContext.getBeanManagerImpl().addInternalBean(webBeansContext.getWebBeansUtil().getInstanceBean());
-        
-        defineManagedBean(StringOrder.class);
-        defineManagedBean(IntegerOrder.class);
-        Bean<InstanceTypeLiteralBean> bean =  defineManagedBean(InstanceTypeLiteralBean.class);
+        startContainer(StringOrder.class, IntegerOrder.class, InstanceTypeLiteralBean.class);
         
-        Object object = getManager().getReference(bean, InstanceTypeLiteralBean.class,getManager().createCreationalContext(bean) );        
-        Assert.assertTrue(object instanceof InstanceTypeLiteralBean);
-        InstanceTypeLiteralBean beaninstance = (InstanceTypeLiteralBean)object;
+        InstanceTypeLiteralBean beaninstance = getInstance(InstanceTypeLiteralBean.class);
         Object produce = beaninstance.produce(0);
         Assert.assertTrue(produce instanceof Instance);
         

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java?rev=1562379&r1=1562378&r2=1562379&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java Wed Jan 29 08:51:36 2014
@@ -28,67 +28,33 @@ import javax.enterprise.util.TypeLiteral
 
 import junit.framework.Assert;
 
-import org.apache.webbeans.component.AbstractOwbBean;
 import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.context.ContextFactory;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.test.component.ITypeLiteralComponent;
 import org.apache.webbeans.test.component.InjectedTypeLiteralComponent;
 import org.apache.webbeans.test.component.TypeLiteralComponent;
-import org.junit.Before;
 import org.junit.Test;
 
-public class TypedLiteralComponentTest extends TestContext
+public class TypedLiteralComponentTest extends AbstractUnitTest
 {
-    public TypedLiteralComponentTest()
-    {
-        super(TypedLiteralComponentTest.class.getSimpleName());
-    }
-
-    @Override
-    @Before
-    public void init()
-    {
-        super.init();
-    }
-
     @Test
     public void testTypedComponent() throws Throwable
     {
-        clear();
-
-        defineManagedBean(TypeLiteralComponent.class);
-        defineManagedBean(InjectedTypeLiteralComponent.class);
-        List<AbstractOwbBean<?>> comps = getComponents();
+        startContainer(TypeLiteralComponent.class, InjectedTypeLiteralComponent.class);
 
-        ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
-        contextFactory.initRequestContext(null);
-
-        Assert.assertEquals(2, comps.size());
-
-        TypeLiteralComponent userComponent = (TypeLiteralComponent) getManager().getInstance(comps.get(0));
-        InjectedTypeLiteralComponent tc = (InjectedTypeLiteralComponent) getManager().getInstance(comps.get(1));
+        TypeLiteralComponent userComponent = getInstance(TypeLiteralComponent.class);
+        InjectedTypeLiteralComponent tc = getInstance(InjectedTypeLiteralComponent.class);
 
         Assert.assertNotNull(tc.getComponent());
         Assert.assertNotNull(userComponent);
 
         Assert.assertTrue(tc.getComponent() instanceof TypeLiteralComponent);
-
-        contextFactory.destroyRequestContext(null);
     }
 
     @Test
     public void testTypedLiteralComponent() throws Throwable
     {
-        clear();
-
-        defineManagedBean(TypeLiteralComponent.class);
-        List<AbstractOwbBean<?>> comps = getComponents();
-
-        ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
-        contextFactory.initRequestContext(null);
-
-        Assert.assertEquals(1, comps.size());
+        startContainer(TypeLiteralComponent.class);
 
         TypeLiteral<ITypeLiteralComponent<List<String>>> tl = new TypeLiteral<ITypeLiteralComponent<List<String>>>()
         {
@@ -102,8 +68,6 @@ public class TypedLiteralComponentTest e
 
         Bean<?> s = WebBeansContext.getInstance().getBeanManagerImpl().getBeans(tl.getType(), anns).iterator().next();
         Assert.assertNotNull(s);
-
-        contextFactory.destroyRequestContext(null);
     }
 
 }



Mime
View raw message