Skip to content

Commit

Permalink
WBRI-216
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@2318 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Apr 6, 2009
1 parent 4284b1b commit bba493a
Show file tree
Hide file tree
Showing 37 changed files with 130 additions and 119 deletions.
14 changes: 10 additions & 4 deletions tests/pom.xml
Expand Up @@ -6,7 +6,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-core-tests</artifactId>
<artifactId>webbeans-core-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Web Beans Core Tests</name>
<dependencies>
Expand All @@ -15,11 +15,15 @@
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-core</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-spi</artifactId>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
<classifier>jdk15</classifier>
<exclusions>
<exclusion>
Expand All @@ -32,7 +36,6 @@
<dependency>
<groupId>org.jboss.test-harness</groupId>
<artifactId>jboss-test-harness</artifactId>
<scope>test</scope>
</dependency>

<dependency>
Expand All @@ -44,16 +47,19 @@
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-ri</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-api</artifactId>
<scope>test</scope>
<optional>true</optional>
<exclusions>
<exclusion>
Expand Down
@@ -1,4 +1,4 @@
package org.jboss.webbeans.test.unit;
package org.jboss.webbeans.test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -58,7 +58,7 @@ public final void run() throws Exception

protected static final int BUILT_IN_BEANS = 3;

protected ManagerImpl manager;
private ManagerImpl manager;

public static boolean visited = false;

Expand All @@ -83,7 +83,7 @@ public void before() throws Exception
@AfterMethod
public void after() throws Exception
{
manager = null;
this.manager = null;
}


Expand Down Expand Up @@ -131,5 +131,10 @@ protected Object deserialize(byte[] bytes) throws IOException, ClassNotFoundExce
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
return in.readObject();
}

protected ManagerImpl getCurrentManager()
{
return manager;
}

}
@@ -1,4 +1,4 @@
package org.jboss.webbeans.test.unit;
package org.jboss.webbeans.test;

import java.net.URL;

Expand Down
2 changes: 2 additions & 0 deletions tests/src/main/resources/META-INF/web-beans-tck.properties
@@ -0,0 +1,2 @@
org.jboss.testharness.spi.StandaloneContainers=org.jboss.webbeans.test.StandaloneContainersImpl
org.jboss.testharness.api.TestLauncher=org.jboss.testharness.impl.runner.servlet.ServletTestLauncher
@@ -1,7 +1,7 @@
package org.jboss.webbeans.test.examples;

import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand All @@ -16,12 +16,12 @@ public void testGameGenerator() throws Exception {
@Override
protected void execute() throws Exception
{
Game game1 = manager.getInstanceByType(Game.class);
Game game2 = manager.getInstanceByType(Game.class);
Game game1 = getCurrentManager().getInstanceByType(Game.class);
Game game2 = getCurrentManager().getInstanceByType(Game.class);
assert game1!=game2;
assert game1.getNumber()!=game2.getNumber();
Generator gen1 = manager.getInstanceByType(Generator.class);
Generator gen2 = manager.getInstanceByType(Generator.class);
Generator gen1 = getCurrentManager().getInstanceByType(Generator.class);
Generator gen2 = getCurrentManager().getInstanceByType(Generator.class);
assert gen1.getRandom()!=null;
assert gen1.getRandom()==gen2.getRandom();
}
Expand All @@ -38,7 +38,7 @@ public void testSentenceTranslator() throws Exception {
@Override
protected void execute() throws Exception
{
TextTranslator tt1 = manager.getInstanceByType(TextTranslator.class);
TextTranslator tt1 = getCurrentManager().getInstanceByType(TextTranslator.class);
try
{
tt1.translate("hello world");
Expand Down
Expand Up @@ -2,7 +2,7 @@

import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand All @@ -20,7 +20,7 @@ public void testMockSentenceTranslator() throws Exception
@Override
protected void execute() throws Exception
{
TextTranslator tt2 = manager.getInstanceByType(TextTranslator.class);
TextTranslator tt2 = getCurrentManager().getInstanceByType(TextTranslator.class);
assert "Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.".equals( tt2.translate("Hello world. How's tricks?") );
}

Expand Down
Expand Up @@ -3,7 +3,7 @@
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Packaging;
import org.jboss.testharness.impl.packaging.PackagingType;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand Down
Expand Up @@ -8,7 +8,7 @@
import org.jboss.testharness.impl.packaging.PackagingType;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
import org.jboss.webbeans.WebBean;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand All @@ -20,11 +20,11 @@ public class XmlBootstrapTest extends AbstractWebBeansTest
@Test
public void testDeploymentTypesLoadedFromBeansXml()
{
assert manager.getEnabledDeploymentTypes().size() == 4;
assert manager.getEnabledDeploymentTypes().get(0).equals(Standard.class);
assert manager.getEnabledDeploymentTypes().get(1).equals(WebBean.class);
assert manager.getEnabledDeploymentTypes().get(2).equals(Production.class);
assert manager.getEnabledDeploymentTypes().get(3).equals(AnotherDeploymentType.class);
assert getCurrentManager().getEnabledDeploymentTypes().size() == 4;
assert getCurrentManager().getEnabledDeploymentTypes().get(0).equals(Standard.class);
assert getCurrentManager().getEnabledDeploymentTypes().get(1).equals(WebBean.class);
assert getCurrentManager().getEnabledDeploymentTypes().get(2).equals(Production.class);
assert getCurrentManager().getEnabledDeploymentTypes().get(3).equals(AnotherDeploymentType.class);
}

}
Expand Up @@ -11,7 +11,7 @@
import org.jboss.testharness.impl.packaging.PackagingType;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand All @@ -22,7 +22,7 @@ public class BootstrapTest extends AbstractWebBeansTest
@Test(groups="bootstrap")
public void testMultipleEnterpriseBean()
{
List<Bean<?>> beans = manager.getBeans();
List<Bean<?>> beans = getCurrentManager().getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
Expand Down
Expand Up @@ -12,7 +12,7 @@
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand All @@ -23,7 +23,7 @@ public class BootstrapTest extends AbstractWebBeansTest
@Test(groups="bootstrap")
public void testMultipleEnterpriseAndSimpleBean()
{
List<Bean<?>> beans = manager.getBeans();
List<Bean<?>> beans = getCurrentManager().getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
Expand Down
Expand Up @@ -9,7 +9,7 @@
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand All @@ -19,7 +19,7 @@ public class BootstrapTest extends AbstractWebBeansTest
@Test(groups="bootstrap")
public void testMultipleSimpleBean()
{
List<Bean<?>> beans = manager.getBeans();
List<Bean<?>> beans = getCurrentManager().getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
Expand Down
Expand Up @@ -10,7 +10,7 @@
import org.jboss.testharness.impl.packaging.Packaging;
import org.jboss.testharness.impl.packaging.PackagingType;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand All @@ -21,7 +21,7 @@ public class BootstrapTest extends AbstractWebBeansTest
@Test(groups="bootstrap")
public void testSingleEnterpriseBean()
{
List<Bean<?>> beans = manager.getBeans();
List<Bean<?>> beans = getCurrentManager().getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
Expand Down
Expand Up @@ -12,7 +12,7 @@
import org.jboss.webbeans.bean.ProducerMethodBean;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand All @@ -24,7 +24,7 @@ public class BootstrapTest extends AbstractWebBeansTest
public void testProducerMethodBean()
{
//deployBeans(TarantulaProducer.class);
List<Bean<?>> beans = manager.getBeans();
List<Bean<?>> beans = getCurrentManager().getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
Expand Down
Expand Up @@ -8,7 +8,7 @@

import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand All @@ -18,7 +18,7 @@ public class BootstrapTest extends AbstractWebBeansTest
@Test(groups="bootstrap")
public void testSingleSimpleBean()
{
List<Bean<?>> beans = manager.getBeans();
List<Bean<?>> beans = getCurrentManager().getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
Expand Down
Expand Up @@ -3,7 +3,7 @@
import java.util.concurrent.CountDownLatch;

import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand All @@ -22,7 +22,7 @@ public void run()
{
try
{
manager.getInstanceByType(ApplictionScopedObject.class).increment();
getCurrentManager().getInstanceByType(ApplictionScopedObject.class).increment();
}
finally
{
Expand All @@ -32,7 +32,7 @@ public void run()
}).start();
}
latch.await();
int value = manager.getInstanceByType(ApplictionScopedObject.class).getValue();
int value = getCurrentManager().getInstanceByType(ApplictionScopedObject.class).getValue();
System.out.println(value);
assert value == 10;
}
Expand Down
Expand Up @@ -2,7 +2,7 @@

import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.IntegrationTest;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand Down
Expand Up @@ -5,7 +5,7 @@
import javax.inject.TypeLiteral;

import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;

@Artifact
Expand All @@ -15,7 +15,7 @@ public class ParameterizedTypeScopedTest extends AbstractWebBeansTest
@Test
public void testStringList()
{
List<String> str = manager.getInstanceByType(new TypeLiteral<List<String>>()
List<String> str = getCurrentManager().getInstanceByType(new TypeLiteral<List<String>>()
{
});

Expand Down
Expand Up @@ -10,7 +10,7 @@
import org.testng.annotations.Test;

@Artifact
public class PassivatingContextTest extends org.jboss.webbeans.test.unit.AbstractWebBeansTest
public class PassivatingContextTest extends org.jboss.webbeans.test.AbstractWebBeansTest
{

/**
Expand All @@ -20,7 +20,7 @@ public class PassivatingContextTest extends org.jboss.webbeans.test.unit.Abstrac
@Test(groups = { "contexts", "passivation" })
public void testIsSessionScopePassivating()
{
assert manager.getServices().get(MetaDataCache.class).getScopeModel(SessionScoped.class).isPassivating();
assert getCurrentManager().getServices().get(MetaDataCache.class).getScopeModel(SessionScoped.class).isPassivating();
}

/**
Expand All @@ -30,7 +30,7 @@ public void testIsSessionScopePassivating()
@Test(groups = { "contexts", "passivation" })
public void testIsConversationScopePassivating()
{
assert manager.getServices().get(MetaDataCache.class).getScopeModel(ConversationScoped.class).isPassivating();
assert getCurrentManager().getServices().get(MetaDataCache.class).getScopeModel(ConversationScoped.class).isPassivating();
}

/**
Expand All @@ -40,7 +40,7 @@ public void testIsConversationScopePassivating()
@Test(groups = { "contexts", "passivation" })
public void testIsApplicationScopeNonPassivating()
{
assert !manager.getServices().get(MetaDataCache.class).getScopeModel(ApplicationScoped.class).isPassivating();
assert !getCurrentManager().getServices().get(MetaDataCache.class).getScopeModel(ApplicationScoped.class).isPassivating();
}

/**
Expand All @@ -50,7 +50,7 @@ public void testIsApplicationScopeNonPassivating()
@Test(groups = { "contexts", "passivation" })
public void testIsRequestScopeNonPassivating()
{
assert !manager.getServices().get(MetaDataCache.class).getScopeModel(RequestScoped.class).isPassivating();
assert !getCurrentManager().getServices().get(MetaDataCache.class).getScopeModel(RequestScoped.class).isPassivating();
}

}

0 comments on commit bba493a

Please sign in to comment.