[jboss-cvs] JBossAS SVN: r66137 - in projects/metadata/trunk/src/test: resources/org/jboss/test/metadata/ejb and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 15 14:25:19 EDT 2007
Author: ALRubinger
Date: 2007-10-15 14:25:19 -0400 (Mon, 15 Oct 2007)
New Revision: 66137
Added:
projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/EjbJar3x_testMultipleBusinessInterfaces.xml
Modified:
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/EjbJar3xUnitTestCase.java
Log:
Added test for parsing of multiple business interfaces to aid in debugging of EJBTHREE-1066
Modified: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/EjbJar3xUnitTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/EjbJar3xUnitTestCase.java 2007-10-15 17:49:39 UTC (rev 66136)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/EjbJar3xUnitTestCase.java 2007-10-15 18:25:19 UTC (rev 66137)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.metadata.ejb;
-
import java.util.Iterator;
import java.util.Set;
@@ -29,19 +28,21 @@
import junit.framework.Test;
+import org.jboss.annotation.javaee.Description;
+import org.jboss.annotation.javaee.Descriptions;
+import org.jboss.annotation.javaee.DisplayName;
+import org.jboss.annotation.javaee.DisplayNames;
+import org.jboss.annotation.javaee.Icon;
+import org.jboss.annotation.javaee.Icons;
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.BeanMetaData;
-import org.jboss.metadata.ejb.spec.EjbJar2xMetaData;
+import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
+import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
import org.jboss.metadata.ejb.spec.EjbJar30MetaData;
import org.jboss.metadata.ejb.spec.EjbJar3xMetaData;
import org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData;
import org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData;
-import org.jboss.annotation.javaee.Description;
-import org.jboss.annotation.javaee.Descriptions;
-import org.jboss.annotation.javaee.DisplayName;
-import org.jboss.annotation.javaee.DisplayNames;
-import org.jboss.annotation.javaee.Icon;
-import org.jboss.annotation.javaee.Icons;
+import org.jboss.metadata.ejb.spec.SessionBeanMetaData;
import org.jboss.metadata.javaee.spec.DescriptionGroupMetaData;
import org.jboss.metadata.javaee.spec.DescriptionImpl;
import org.jboss.metadata.javaee.spec.DisplayNameImpl;
@@ -65,18 +66,18 @@
{
return suite(EjbJar3xUnitTestCase.class);
}
-
+
public static SchemaBindingResolver initResolver()
{
return schemaResolverForClass(EjbJar30MetaData.class);
//return AbstractJavaEEMetaDataTest.initResolverJavaEE(EjbJar30MetaData.class);
}
-
+
public EjbJar3xUnitTestCase(String name)
{
super(name);
}
-
+
protected EjbJar3xMetaData unmarshal() throws Exception
{
return unmarshal(EjbJar30MetaData.class);
@@ -87,7 +88,7 @@
EjbJar3xMetaData result = unmarshal();
assertEquals("ejb-jar-test-id", result.getId());
}
-
+
public void testVersion() throws Exception
{
EjbJar3xMetaData result = unmarshal();
@@ -96,14 +97,14 @@
assertFalse(result.isEJB2x());
assertFalse(result.isEJB21());
assertTrue(result.isEJB3x());
-
+
ApplicationMetaData old = new ApplicationMetaData(result);
assertFalse(old.isEJB1x());
assertFalse(old.isEJB2x());
assertFalse(old.isEJB21());
assertTrue(old.isEJB3x());
}
-
+
public void testDescriptionDefaultLanguage() throws Exception
{
EjbJar3xMetaData result = unmarshal();
@@ -111,12 +112,13 @@
assertNotNull(group);
Descriptions descriptions = group.getDescriptions();
assertNotNull(descriptions);
-
+
DescriptionImpl hello = new DescriptionImpl();
hello.setDescription("Hello");
- assertEquals(new Description[] { hello }, descriptions.value());
+ assertEquals(new Description[]
+ {hello}, descriptions.value());
}
-
+
public void testDisplayNameDefaultLanguage() throws Exception
{
EjbJar3xMetaData result = unmarshal();
@@ -124,12 +126,13 @@
assertNotNull(group);
DisplayNames displayNames = group.getDisplayNames();
assertNotNull(displayNames);
-
+
DisplayNameImpl hello = new DisplayNameImpl();
hello.setDisplayName("Hello");
- assertEquals(new DisplayName[] { hello }, displayNames.value());
+ assertEquals(new DisplayName[]
+ {hello}, displayNames.value());
}
-
+
public void testIconDefaultLanguage() throws Exception
{
EjbJar3xMetaData result = unmarshal();
@@ -137,29 +140,30 @@
assertNotNull(group);
Icons icons = group.getIcons();
assertNotNull(icons);
-
+
IconImpl icon = new IconImpl();
icon.setSmallIcon("small");
icon.setLargeIcon("large");
- assertEquals(new Icon[] { icon }, icons.value());
+ assertEquals(new Icon[]
+ {icon}, icons.value());
}
-
+
public void testEjbClientJar() throws Exception
{
EjbJar3xMetaData result = unmarshal();
assertEquals("some/path/client.jar", result.getEjbClientJar());
}
-
+
public void testEnterpriseBeans() throws Exception
{
EjbJar3xMetaData result = unmarshal();
EnterpriseBeansMetaData beans = result.getEnterpriseBeans();
assertNotNull(beans);
-
+
assertEquals(1, beans.size());
EnterpriseBeanMetaData bean = beans.iterator().next();
assertEquals("TestBean", bean.getEjbName());
-
+
ApplicationMetaData old = new ApplicationMetaData(result);
Iterator<BeanMetaData> iterator = old.getEnterpriseBeans();
assertTrue(iterator.hasNext());
@@ -172,8 +176,7 @@
* Simple session/env-entry test
* @throws Exception
*/
- public void testEnvEntry()
- throws Exception
+ public void testEnvEntry() throws Exception
{
EjbJar3xMetaData result = unmarshal();
EnterpriseBeansMetaData beans = result.getEnterpriseBeans();
@@ -191,12 +194,12 @@
assertEquals("session1.entry1.target", target.getInjectionTargetClass());
assertEquals("session1_entry1_injection_target_name", target.getInjectionTargetName());
}
+
/**
* Test session/service-ref
* @throws Exception
*/
- public void testServiceRefs()
- throws Exception
+ public void testServiceRefs() throws Exception
{
//enableTrace("org.jboss.xb");
EjbJar3xMetaData result = unmarshal();
@@ -214,7 +217,27 @@
assertEquals("META-INF/jaxrpc-mapping.xml", srmd.getJaxrpcMappingFile());
QName sqname = new QName("http://www.jboss.org", "Session1Qname");
assertEquals(sqname, srmd.getServiceQname());
+
+ }
+
+ /**
+ * Tests parsing of multiple "enterprise-beans/session/business-remote" and
+ * "enterprise-beans/session/business-local" nodes
+ */
+ public void testMultipleBusinessInterfaces() throws Exception
+ {
+ // Obtain Metadata
+ EjbJar3xMetaData result = unmarshal();
+
+ // Get metadata for our bean
+ SessionBeanMetaData metaData = (SessionBeanMetaData) result.getEnterpriseBeans().get(
+ "MultipleBusinessInterfacesBean");
+ BusinessRemotesMetaData businessRemotesMetaData = metaData.getBusinessRemotes();
+ BusinessLocalsMetaData businessLocalsMetaData = metaData.getBusinessLocals();
+ // Ensure 2 business interfaces are defined for each local and remote
+ assertTrue(businessRemotesMetaData.size()==2);
+ assertTrue(businessLocalsMetaData.size()==2);
}
}
Added: projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/EjbJar3x_testMultipleBusinessInterfaces.xml
===================================================================
--- projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/EjbJar3x_testMultipleBusinessInterfaces.xml (rev 0)
+++ projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/EjbJar3x_testMultipleBusinessInterfaces.xml 2007-10-15 18:25:19 UTC (rev 66137)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0" id="ejb-jar-multiple-business-interfaces">
+ <enterprise-beans>
+ <session>
+ <ejb-name>MultipleBusinessInterfacesBean</ejb-name>
+ <business-local>
+ org.jboss.test.InterfaceLocal1
+ </business-local>
+ <business-local>
+ org.jboss.test.InterfaceLocal2
+ </business-local>
+ <business-remote>
+ org.jboss.test.InterfaceRemote1
+ </business-remote>
+ <business-remote>
+ org.jboss.test.InterfaceRemote2
+ </business-remote>
+ <ejb-class>
+ org.jboss.ejb3.test.MultipleBusinessInterfacesBean
+ </ejb-class>
+ <session-type>Stateless</session-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Property changes on: projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/EjbJar3x_testMultipleBusinessInterfaces.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jboss-cvs-commits
mailing list