Skip to content

Commit

Permalink
fix tests so they run incontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed Oct 29, 2009
1 parent d299a4d commit 9f1605d
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 44 deletions.
Expand Up @@ -5,20 +5,17 @@
import java.util.Set;

import javax.enterprise.inject.Stereotype;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.inject.Qualifier;

import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.introspector.jlr.WeldClassImpl;
import org.jboss.weld.metadata.TypeStore;
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;

@Artifact(addCurrentPackage = false)
@Classes({Animal.class, Antelope.class, Kangaroo.class, Order.class, Random.class})
@Artifact
public class ClassAnnotatedItemTest extends AbstractWeldTest
{

Expand Down Expand Up @@ -53,12 +50,5 @@ public void testEmpty()
WeldClass<Antelope> classWithNoAnnotations = WeldClassImpl.of(Antelope.class, transformer);
assert classWithNoAnnotations.getAnnotations().size() == 0;
}

@Test(groups = "broken")
public void testNonStaticInnerClassWithGenericTypes()
{
AnnotatedType at = WeldClassImpl.of(new Kangaroo().procreate().getClass(), transformer);
WeldClassImpl.of(at, transformer);
}

}
@@ -1,4 +1,4 @@
package org.jboss.weld.test.unit.implementation.annotatedItem;
package org.jboss.weld.test.unit.implementation.annotatedItem.anonymous;

abstract class ChoiceParent<T>
{
Expand Down
@@ -0,0 +1,25 @@
package org.jboss.weld.test.unit.implementation.annotatedItem.anonymous;

import javax.enterprise.inject.spi.AnnotatedType;

import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.weld.introspector.jlr.WeldClassImpl;
import org.jboss.weld.metadata.TypeStore;
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;

@Artifact
public class ClassAnnotatedItemTest extends AbstractWeldTest
{

private final ClassTransformer transformer = new ClassTransformer(new TypeStore());

@Test(groups = "broken")
public void testNonStaticInnerClassWithGenericTypes()
{
AnnotatedType at = WeldClassImpl.of(new Kangaroo().procreate().getClass(), transformer);
WeldClassImpl.of(at, transformer);
}

}
@@ -1,4 +1,4 @@
package org.jboss.weld.test.unit.implementation.annotatedItem;
package org.jboss.weld.test.unit.implementation.annotatedItem.anonymous;


class Kangaroo
Expand Down
Expand Up @@ -19,6 +19,7 @@

import javax.ejb.Stateless;
import javax.ejb.Timeout;
import javax.ejb.Timer;

/**
* @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
Expand All @@ -37,7 +38,7 @@ public void pass()
}

@Timeout
public void finishGame()
public void finishGame(Timer timer)
{

}
Expand Down
@@ -1,10 +1,11 @@
package org.jboss.weld.test.unit.interceptor.ejb;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.List;


import javax.ejb.Timer;
import javax.enterprise.inject.spi.InterceptionType;

import org.jboss.testharness.impl.packaging.Artifact;
Expand All @@ -13,9 +14,8 @@
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
import org.jboss.weld.bean.SessionBean;
import org.jboss.weld.bean.interceptor.InterceptorBindingsAdapter;
import org.jboss.weld.test.AbstractWeldTest;
import org.jboss.weld.ejb.spi.InterceptorBindings;

import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;

@Artifact
Expand Down Expand Up @@ -47,9 +47,10 @@ public void testEnterpriseBeanInterceptionMetadataAdded() throws Exception
assert interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, ballSessionBean.getType().getMethod("pass")).size() == 1;
assert interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, ballSessionBean.getType().getMethod("pass")).get(0).getBeanClass().equals(Defender.class);

assert interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, ballSessionBean.getType().getMethod("finishGame")).size() == 0;
assert interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_TIMEOUT, ballSessionBean.getType().getMethod("finishGame")).size() == 1;
assert interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_TIMEOUT, ballSessionBean.getType().getMethod("finishGame")).get(0).getBeanClass().equals(Referee.class);
Method finishGameMethod = ballSessionBean.getType().getMethod("finishGame", Timer.class);
assert interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, finishGameMethod).size() == 0;
assert interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_TIMEOUT, finishGameMethod).size() == 1;
assert interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_TIMEOUT, finishGameMethod).get(0).getBeanClass().equals(Referee.class);

}

Expand Down
Expand Up @@ -17,12 +17,9 @@

package org.jboss.weld.test.unit.interceptor.ejb3model;

import javax.interceptor.Interceptor;
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;

import org.jboss.weld.test.unit.interceptor.ejb.Pass;

/**
* @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
*/
Expand Down
Expand Up @@ -17,15 +17,13 @@

package org.jboss.weld.test.unit.interceptor.ejb3model;

import javax.enterprise.inject.spi.Bean;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;

import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.weld.test.AbstractWeldTest;

import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;


/**
Expand Down
Expand Up @@ -16,10 +16,8 @@
*/
package org.jboss.weld.test.unit.interceptor.ejb3model;

import org.jboss.weld.test.unit.interceptor.ejb.TimeBound;

import javax.interceptor.Interceptor;
import javax.interceptor.AroundTimeout;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;

/**
Expand Down
@@ -0,0 +1,37 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
* contributors by the @authors tag. See the copyright.txt in the
* distribution for a full listing of individual contributors.
*
* Licensed 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.jboss.weld.test.unit.interceptor.ejb3model;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.annotation.ElementType;
import java.lang.annotation.Documented;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import javax.interceptor.InterceptorBinding;

/**
* @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
*/
@InterceptorBinding
@Retention(RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
@Documented
public @interface TimeBound
{
}
Expand Up @@ -19,13 +19,10 @@

import java.io.Serializable;

import javax.interceptor.Interceptor;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;

import org.jboss.weld.test.unit.interceptor.ejb.*;
import org.jboss.weld.test.unit.interceptor.ejb.Pass;

/**
* @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
*/
Expand Down
Expand Up @@ -19,13 +19,10 @@

import java.io.Serializable;

import javax.interceptor.Interceptor;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;

import org.jboss.weld.test.unit.interceptor.ejb.*;
import org.jboss.weld.test.unit.interceptor.ejb.Shot;

/**
* @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
*/
Expand Down
Expand Up @@ -17,18 +17,17 @@

package org.jboss.weld.test.unit.interceptor.passivation;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.ByteArrayInputStream;
import java.io.ObjectOutputStream;

import javax.enterprise.inject.spi.Bean;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;

import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
import org.jboss.weld.test.AbstractWeldTest;

import org.testng.annotations.Test;

/**
Expand All @@ -39,7 +38,7 @@
public class PassivationActivationTest extends AbstractWeldTest
{

@Test
@Test(groups = "incontainer-broken")
public void testPassivationAndActivation() throws Exception
{
Bean bean = getCurrentManager().getBeans(Ball.class).iterator().next();
Expand Down

0 comments on commit 9f1605d

Please sign in to comment.