You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by francois wauquier <fr...@external.thalesgroup.com> on 2012/04/05 19:41:30 UTC
Re: OpenEjb and cobertura
This test can help you to detect your configuration errors and get your
coverage report.
It uses Reflections http://code.google.com/p/reflections/
import static org.junit.Assert.assertTrue;
import javax.ejb.Local;
import javax.ejb.LocalBean;
import javax.ejb.MessageDriven;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.jms.MessageListener;
import org.junit.Test;
import org.reflections.Reflections;
public class OpenejbTest
{
@Test
public void testOpenejbCoberturaConfWithReflections() throws Exception
{
for (Class ejbClazz : new
Reflections("your.package").getTypesAnnotatedWith(Stateless.class))
{
assertTrue(
ejbClazz.getName() + "is misconfigured",
ejbClazz.getAnnotation(LocalBean.class) != null ||
ejbClazz.getInterfaces()[0].getAnnotation(Local.class) != null
|| ejbClazz.getInterfaces()[0].getAnnotation(Remote.class) != null);
}
for (Class mdbClazz : new
Reflections("your.package").getTypesAnnotatedWith(MessageDriven.class))
{
assertTrue(
mdbClazz.getName() + "is misconfigured",
((MessageDriven)
mdbClazz.getAnnotation(MessageDriven.class)).messageListenerInterface().equals(MessageListener.class));
}
}
}
--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEjb-and-cobertura-tp4493096p4535543.html
Sent from the OpenEJB User mailing list archive at Nabble.com.