[jboss-cvs] JBossAS SVN: r78917 - in projects/metadata/trunk/src/test/java/org/jboss/test/metadata: jbmeta109 and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 29 05:37:51 EDT 2008
Author: wolfc
Date: 2008-09-29 05:37:51 -0400 (Mon, 29 Sep 2008)
New Revision: 78917
Added:
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/MyConsumerBean.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/MyProducer.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/unit/
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/unit/ProducerProcessorTestCase.java
Log:
JBMETA-109: unit test
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/MyConsumerBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/MyConsumerBean.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/MyConsumerBean.java 2008-09-29 09:37:51 UTC (rev 78917)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.metadata.jbmeta109;
+
+import org.jboss.ejb3.annotation.Consumer;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Consumer
+public class MyConsumerBean implements MyProducer
+{
+
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/MyProducer.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/MyProducer.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/MyProducer.java 2008-09-29 09:37:51 UTC (rev 78917)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.metadata.jbmeta109;
+
+import org.jboss.ejb3.annotation.Producer;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Producer
+public interface MyProducer
+{
+
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/unit/ProducerProcessorTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/unit/ProducerProcessorTestCase.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta109/unit/ProducerProcessorTestCase.java 2008-09-29 09:37:51 UTC (rev 78917)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.metadata.jbmeta109.unit;
+
+import java.lang.reflect.AnnotatedElement;
+import java.util.Collection;
+
+import org.jboss.metadata.annotation.creator.ejb.jboss.JBoss50Creator;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.annotation.finder.DefaultAnnotationFinder;
+import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossConsumerBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.test.metadata.common.PackageScanner;
+import org.jboss.test.metadata.javaee.AbstractJavaEEMetaDataTest;
+import org.jboss.test.metadata.jbmeta109.MyProducer;
+
+/**
+ * Make sure that a Producer annotation on an interface results
+ * in ProducerMetaData with that interface being set.
+ *
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ProducerProcessorTestCase extends AbstractJavaEEMetaDataTest
+{
+ public ProducerProcessorTestCase(String name)
+ {
+ super(name);
+ }
+
+ private static String getParentPackageName()
+ {
+ String packageName = ProducerProcessorTestCase.class.getPackage().getName();
+ int i = packageName.lastIndexOf('.');
+ return packageName.substring(0, i);
+ }
+
+ public void test1()
+ {
+ Collection<Class<?>> classes = PackageScanner.loadClasses(getParentPackageName());
+
+ AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+ JBoss50Creator creator = new JBoss50Creator(finder);
+
+ JBoss50MetaData annotatedMetaData = creator.create(classes);
+
+ JBossEnterpriseBeanMetaData beanMetaData = annotatedMetaData.getEnterpriseBean("MyConsumerBean");
+ assertNotNull(beanMetaData);
+ assertTrue(beanMetaData instanceof JBossConsumerBeanMetaData);
+
+ JBossConsumerBeanMetaData consumer = (JBossConsumerBeanMetaData) beanMetaData;
+ assertEquals(MyProducer.class.getName(), consumer.getProducers().get(0).getClassName());
+ }
+}
More information about the jboss-cvs-commits
mailing list