[jboss-cvs] JBossAS SVN: r73797 - in projects/metadata/trunk/src: main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 29 09:19:16 EDT 2008


Author: emuckenhuber
Date: 2008-05-29 09:19:16 -0400 (Thu, 29 May 2008)
New Revision: 73797

Added:
   projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/ImplicitLocalProcessor.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/AnotherStatelessBean.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/ExpectedLocalInterface.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyBean.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyOtherBean.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyStatelessBean.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/OtherInterface.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/RemoteBean.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/RemoteInterface.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/RemoteSuperBean.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/SuperBean.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/unit/
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/unit/ImplicitLocalIntefaceUnitTestCase.java
Modified:
   projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/AbstractSessionBeanProcessor.java
   projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DeploymentSummary.java
   projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/EjbDeploymentSummary.java
Log:
JBMETA-41: implicit local business interface;
serialize deploymentSummary

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/AbstractSessionBeanProcessor.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/AbstractSessionBeanProcessor.java	2008-05-29 13:13:24 UTC (rev 73796)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/AbstractSessionBeanProcessor.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -53,6 +53,7 @@
       addTypeProcessor(new LocalHomeProcessor(finder));
       addTypeProcessor(new RemoteProcessor(finder));
       addTypeProcessor(new RemoteHomeProcessor(finder));
+      addTypeProcessor(new ImplicitLocalProcessor(finder));
 
       addMethodProcessor(new InitProcessor(finder));
       addMethodProcessor(new TimeoutProcessor(finder));

Added: projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/ImplicitLocalProcessor.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/ImplicitLocalProcessor.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/ImplicitLocalProcessor.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -0,0 +1,115 @@
+/*
+ * 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.metadata.annotation.creator.ejb;
+
+import java.io.Externalizable;
+import java.io.Serializable;
+import java.lang.reflect.AnnotatedElement;
+
+import javax.ejb.Remote;
+
+import org.jboss.metadata.annotation.creator.AbstractFinderUser;
+import org.jboss.metadata.annotation.creator.Processor;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
+import org.jboss.metadata.ejb.spec.SessionBeanMetaData;
+
+/**
+ * Process the implicit local business interface (4.6.6)
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ImplicitLocalProcessor extends AbstractFinderUser implements Processor<SessionBeanMetaData, Class<?>>
+{
+
+   public ImplicitLocalProcessor(AnnotationFinder<AnnotatedElement> finder)
+   {
+      super(finder);
+   }
+
+   public void process(SessionBeanMetaData metaData, Class<?> type)
+   {
+      
+      // If there are already local business interfaces specified
+      if(metaData.getBusinessLocals() != null && metaData.getBusinessLocals().size() > 0)
+         return;
+      
+      // If there are already remote business interfaces specified
+      if(metaData.getBusinessRemotes() != null && metaData.getBusinessRemotes().size() > 0)
+         return;
+      
+      // Don't check super class
+      if(!metaData.getEjbClass().equals(type.getName()))
+         return;
+      
+      // Get the a single interface
+      Class<?> businessInterface = extractInterface(type.getInterfaces());
+      if(businessInterface == null)
+         return;
+      
+      // Check if the interface is a remote one      
+      Remote remote = finder.getAnnotation(businessInterface, Remote.class);
+      if(remote != null)
+         return;
+      
+      // Add this businessInterface as the local business interface
+      if(metaData.getBusinessLocals() == null)
+         metaData.setBusinessLocals(new BusinessLocalsMetaData());
+      
+      // Finally add local business interface
+      metaData.getBusinessLocals().add(businessInterface.getName());
+   }
+   
+   /**
+    * Extracts a single interface.
+    * 
+    * @param interfaces
+    * @return The extracted interface class. null if there are none or more interfaces
+    */
+   private static Class<?> extractInterface(Class<?>... interfaces)
+   {
+      Class<?> iFace = null;
+      for(Class<?> candidate : interfaces)
+      {
+         // Ignore specific interfaces
+         if(Serializable.class.equals(candidate))
+            continue;
+         else if (Externalizable.class.equals(candidate))
+            continue;
+         else if (candidate.getName().startsWith("javax.ejb"))
+            continue;
+         else if (candidate.getName().startsWith("org.jboss.aop"))
+            continue;
+         else
+         {
+            // Just allow one interface otherwise return null
+            if(iFace == null)
+               iFace = candidate;
+            else
+               return null;
+         }
+      }
+      return iFace;
+   }
+}
+

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DeploymentSummary.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DeploymentSummary.java	2008-05-29 13:13:24 UTC (rev 73796)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/DeploymentSummary.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -21,14 +21,19 @@
  */
 package org.jboss.metadata.ejb.jboss.jndipolicy.spi;
 
+import java.io.Serializable;
+
 /**
  * A base class for deployment scope information.
  * 
  * @author Scott.Stark at jboss.org
  * @version $Revision:$
  */
-public class DeploymentSummary
+public class DeploymentSummary implements Serializable
 {
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 5477340084507480445L;
+
    private String deploymentName;
 
    private String deploymentScopeBaseName;

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/EjbDeploymentSummary.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/EjbDeploymentSummary.java	2008-05-29 13:13:24 UTC (rev 73796)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/EjbDeploymentSummary.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -34,8 +34,10 @@
  */
 public class EjbDeploymentSummary extends DeploymentSummary
 {
+   /** The serialVersionUID. */
+   private static final long serialVersionUID = 2559283688891890756L;
+
    // Instance Members
-
    private String ejbName;
 
    private String beanClassName;

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/AnotherStatelessBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/AnotherStatelessBean.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/AnotherStatelessBean.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -0,0 +1,37 @@
+/*
+ * 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.jbmeta40;
+
+import java.io.Serializable;
+
+import javax.ejb.Stateless;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at Stateless
+public class AnotherStatelessBean extends SuperBean implements Serializable
+{
+
+}
+

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/ExpectedLocalInterface.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/ExpectedLocalInterface.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/ExpectedLocalInterface.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -0,0 +1,32 @@
+/*
+ * 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.jbmeta40;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ExpectedLocalInterface
+{
+
+}
+

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyBean.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyBean.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -0,0 +1,38 @@
+/*
+ * 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.jbmeta40;
+
+import java.io.Serializable;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at Stateless
+public class MyBean extends SuperBean implements ExpectedLocalInterface, Serializable
+{
+
+}
+

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyOtherBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyOtherBean.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyOtherBean.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -0,0 +1,37 @@
+/*
+ * 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.jbmeta40;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at Stateless
+ at Remote(OtherInterface.class)
+public class MyOtherBean implements OtherInterface
+{
+
+}
+

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyStatelessBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyStatelessBean.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/MyStatelessBean.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -0,0 +1,37 @@
+/*
+ * 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.jbmeta40;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at Stateless
+ at Local(ExpectedLocalInterface.class)
+public class MyStatelessBean extends RemoteSuperBean implements OtherInterface
+{
+
+}
+

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/OtherInterface.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/OtherInterface.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/OtherInterface.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -0,0 +1,32 @@
+/*
+ * 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.jbmeta40;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface OtherInterface
+{
+
+}
+

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/RemoteBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/RemoteBean.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/RemoteBean.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -0,0 +1,35 @@
+/*
+ * 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.jbmeta40;
+
+import javax.ejb.Stateless;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at Stateless
+public class RemoteBean implements RemoteInterface
+{
+
+}
+

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/RemoteInterface.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/RemoteInterface.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/RemoteInterface.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -0,0 +1,35 @@
+/*
+ * 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.jbmeta40;
+
+import javax.ejb.Remote;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at Remote
+public interface RemoteInterface
+{
+
+}
+

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/RemoteSuperBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/RemoteSuperBean.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/RemoteSuperBean.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -0,0 +1,32 @@
+/*
+ * 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.jbmeta40;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class RemoteSuperBean implements RemoteInterface
+{
+
+}
+

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/SuperBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/SuperBean.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/SuperBean.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -0,0 +1,32 @@
+/*
+ * 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.jbmeta40;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class SuperBean implements OtherInterface
+{
+
+}
+

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/unit/ImplicitLocalIntefaceUnitTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/unit/ImplicitLocalIntefaceUnitTestCase.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta40/unit/ImplicitLocalIntefaceUnitTestCase.java	2008-05-29 13:19:16 UTC (rev 73797)
@@ -0,0 +1,111 @@
+/*
+ * 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.jbmeta40.unit;
+
+import java.lang.reflect.AnnotatedElement;
+import java.util.Collection;
+
+import junit.framework.TestCase;
+
+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.jbmeta40.ExpectedLocalInterface;
+import org.jboss.test.metadata.jbmeta40.OtherInterface;
+import org.jboss.test.metadata.jbmeta40.RemoteInterface;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ImplicitLocalIntefaceUnitTestCase extends TestCase
+{
+
+   private JBossMetaData jbossMetaData;
+   
+   @Override
+   @ScanPackage("org.jboss.test.metadata.jbmeta40")
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      
+      AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+
+      Collection<Class<?>> classes = PackageScanner.loadClasses();
+      
+      EjbJar30Creator creator = new EjbJar30Creator(finder);
+      EjbJar30MetaData specMetaData = creator.create(classes);
+
+      jbossMetaData = new JBossMetaData();
+      JBossMetaData metaData = null;
+      jbossMetaData.merge(metaData, specMetaData);
+   }
+   
+   public void testExpectedLocal()
+   {
+      JBossSessionBeanMetaData sb = (JBossSessionBeanMetaData) jbossMetaData.getEnterpriseBean("MyBean");
+      assertNotNull(sb);
+      assertEquals(1, sb.getBusinessLocals().size());
+      assertTrue( sb.getBusinessLocals().contains(ExpectedLocalInterface.class.getName()));
+      assertNull(sb.getBusinessRemotes());
+   }
+   
+   public void testRemoteInterface()
+   {
+      JBossSessionBeanMetaData sb = (JBossSessionBeanMetaData) jbossMetaData.getEnterpriseBean("RemoteBean");
+      assertNotNull(sb);
+      assertNull(sb.getBusinessLocals());
+   }
+   
+   public void testAnotherStatelessBean()
+   {
+      JBossSessionBeanMetaData sb = (JBossSessionBeanMetaData) jbossMetaData.getEnterpriseBean("AnotherStatelessBean");
+      assertNotNull(sb);
+      assertNull(sb.getBusinessLocals());
+      assertNull(sb.getBusinessRemotes());
+   }
+   
+   public void testMyOtherBean()
+   {
+      JBossSessionBeanMetaData sb = (JBossSessionBeanMetaData) jbossMetaData.getEnterpriseBean("MyOtherBean");
+      assertNotNull(sb);
+      assertNull(sb.getBusinessLocals());
+      assertNotNull(sb.getBusinessRemotes());
+   }
+   
+   public void testMyStatelessBean()
+   {
+      JBossSessionBeanMetaData sb = (JBossSessionBeanMetaData) jbossMetaData.getEnterpriseBean("MyStatelessBean");
+      assertNotNull(sb);
+      assertNotNull(sb.getBusinessLocals());
+      assertTrue(sb.getBusinessLocals().contains(ExpectedLocalInterface.class.getName()));
+      assertFalse(sb.getBusinessLocals().contains(OtherInterface.class.getName()));
+      assertNotNull(sb.getBusinessRemotes());
+      assertTrue(sb.getBusinessRemotes().contains(RemoteInterface.class.getName()));
+   }
+}
+




More information about the jboss-cvs-commits mailing list