[jboss-cvs] JBossAS SVN: r73437 - in projects/metadata/trunk/src/test/java/org/jboss/test/metadata: jbmeta42 and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri May 16 06:44:50 EDT 2008


Author: wolfc
Date: 2008-05-16 06:44:49 -0400 (Fri, 16 May 2008)
New Revision: 73437

Added:
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless21Local.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless21Remote.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessBean.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessLocal.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessLocalHome.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessRemote.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessRemoteHome.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/unit/
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/unit/DefaultNamingStrategyTestCase.java
Log:
JBMETA-42: unit test

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless.java	2008-05-16 10:44:49 UTC (rev 73437)
@@ -0,0 +1,31 @@
+/*
+ * 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.jbmeta42;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStateless
+{
+   String sayHi(String name);
+}


Property changes on: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless21Local.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless21Local.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless21Local.java	2008-05-16 10:44:49 UTC (rev 73437)
@@ -0,0 +1,33 @@
+/*
+ * 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.jbmeta42;
+
+import javax.ejb.EJBLocalObject;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStateless21Local extends EJBLocalObject, MyStateless
+{
+
+}


Property changes on: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless21Local.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless21Remote.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless21Remote.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless21Remote.java	2008-05-16 10:44:49 UTC (rev 73437)
@@ -0,0 +1,33 @@
+/*
+ * 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.jbmeta42;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStateless21Remote extends EJBObject, MyStateless
+{
+
+}


Property changes on: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStateless21Remote.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessBean.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessBean.java	2008-05-16 10:44:49 UTC (rev 73437)
@@ -0,0 +1,41 @@
+/*
+ * 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.jbmeta42;
+
+import javax.ejb.LocalHome;
+import javax.ejb.RemoteHome;
+import javax.ejb.Stateless;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at LocalHome(MyStatelessLocalHome.class)
+ at RemoteHome(MyStatelessRemoteHome.class)
+public class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote
+{
+   public String sayHi(String name)
+   {
+      return "Hi " + name;
+   }
+}


Property changes on: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessBean.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessLocal.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessLocal.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessLocal.java	2008-05-16 10:44:49 UTC (rev 73437)
@@ -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.jbmeta42;
+
+import javax.ejb.Local;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Local
+public interface MyStatelessLocal extends MyStateless
+{
+
+}


Property changes on: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessLocal.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessLocalHome.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessLocalHome.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessLocalHome.java	2008-05-16 10:44:49 UTC (rev 73437)
@@ -0,0 +1,33 @@
+/*
+ * 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.jbmeta42;
+
+import javax.ejb.EJBLocalHome;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStatelessLocalHome extends EJBLocalHome
+{
+   MyStateless21Local create();
+}


Property changes on: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessLocalHome.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessRemote.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessRemote.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessRemote.java	2008-05-16 10:44:49 UTC (rev 73437)
@@ -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.jbmeta42;
+
+import javax.ejb.Remote;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Remote
+public interface MyStatelessRemote extends MyStateless
+{
+
+}


Property changes on: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessRemote.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessRemoteHome.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessRemoteHome.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessRemoteHome.java	2008-05-16 10:44:49 UTC (rev 73437)
@@ -0,0 +1,33 @@
+/*
+ * 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.jbmeta42;
+
+import javax.ejb.EJBHome;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStatelessRemoteHome extends EJBHome
+{
+   MyStateless21Remote create();
+}


Property changes on: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/MyStatelessRemoteHome.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/unit/DefaultNamingStrategyTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/unit/DefaultNamingStrategyTestCase.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/unit/DefaultNamingStrategyTestCase.java	2008-05-16 10:44:49 UTC (rev 73437)
@@ -0,0 +1,106 @@
+/*
+ * 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.jbmeta42.unit;
+
+import java.lang.reflect.AnnotatedElement;
+import java.util.Collection;
+
+import org.jboss.metadata.annotation.creator.ejb.EjbJar30Creator;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.annotation.finder.DefaultAnnotationFinder;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.spec.EjbJar30MetaData;
+import org.jboss.test.metadata.common.PackageScanner;
+import org.jboss.test.metadata.common.ScanPackage;
+import org.jboss.test.metadata.jbmeta42.MyStatelessLocal;
+import org.jboss.test.metadata.jbmeta42.MyStatelessRemote;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class DefaultNamingStrategyTestCase extends TestCase
+{
+   private JBossSessionBeanMetaData sessionBeanMetaData;
+   
+   @Override
+   @ScanPackage("org.jboss.test.metadata.jbmeta42")
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      
+      AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+
+      Collection<Class<?>> classes = PackageScanner.loadClasses();
+      System.out.println("Processing classes: "+classes);
+      
+      EjbJar30Creator creator = new EjbJar30Creator(finder);
+
+      EjbJar30MetaData specMetaData = creator.create(classes);
+
+      JBossMetaData mergedMetaData = new JBossMetaData();
+      JBossMetaData metaData = null;
+      mergedMetaData.merge(metaData, specMetaData);
+      
+      sessionBeanMetaData = (JBossSessionBeanMetaData) mergedMetaData.getEnterpriseBean("MyStatelessBean");
+      assertNotNull(sessionBeanMetaData);
+   }
+   
+   public void testBusinessLocal()
+   {
+      String actual = sessionBeanMetaData.determineLocalJndiName();
+      assertEquals("MyStatelessBean/local", actual);
+   }
+   
+   public void testBusinessRemote()
+   {
+      String actual = sessionBeanMetaData.determineJndiName();
+      assertEquals("MyStatelessBean/remote", actual);      
+   }
+   
+   public void testLocalHome()
+   {
+      String actual = sessionBeanMetaData.determineResolvedJndiName(sessionBeanMetaData.getLocalHome());
+      assertEquals("MyStatelessBean/localHome", actual);
+   }
+   
+   public void testHome()
+   {
+      String actual = sessionBeanMetaData.determineResolvedJndiName(sessionBeanMetaData.getHome());
+      assertEquals("MyStatelessBean/home", actual);
+   }
+   
+   public void testSpecificLocalBusinessInterface()
+   {
+      String actual = sessionBeanMetaData.determineResolvedJndiName(MyStatelessLocal.class.getName());
+      assertEquals("MyStatelessBean/local-" + MyStatelessLocal.class.getName(), actual);
+   }
+   
+   public void testSpecificRemoteBusinessInterface()
+   {
+      String actual = sessionBeanMetaData.determineResolvedJndiName(MyStatelessRemote.class.getName());
+      assertEquals("MyStatelessBean/remote-" + MyStatelessRemote.class.getName(), actual);
+   }
+}


Property changes on: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta42/unit/DefaultNamingStrategyTestCase.java
___________________________________________________________________
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list