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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 14 03:26:13 EDT 2008


Author: ALRubinger
Date: 2008-07-14 03:26:12 -0400 (Mon, 14 Jul 2008)
New Revision: 75757

Added:
   projects/metadata/trunk/src/test/java/org/jboss/metadata/test/ejb3/legacy0_1_7/
   projects/metadata/trunk/src/test/java/org/jboss/metadata/test/ejb3/legacy0_1_7/EjbDeploymentSummaryTestCase.java
Modified:
   projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/EjbDeploymentSummary.java
Log:
[JBMETA-68] Replaced backwards-compatible sources and tests, to be reverted later when appropriate

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-07-14 06:14:12 UTC (rev 75756)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/spi/EjbDeploymentSummary.java	2008-07-14 07:26:12 UTC (rev 75757)
@@ -21,7 +21,6 @@
  */
 package org.jboss.metadata.ejb.jboss.jndipolicy.spi;
 
-import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
 
@@ -38,152 +37,116 @@
    /** The serialVersionUID. */
    private static final long serialVersionUID = 2559283688891890756L;
 
-   private static final Logger log = Logger.getLogger(EjbDeploymentSummary.class);
+   // Instance Members
+   private String ejbName;
 
-   @Deprecated
-   private static final String DEPRECATION_MESSAGE_ACCESSOR = "Deprecated, use "
-         + EjbDeploymentSummary.class.getSimpleName() + " metadata to access state";
+   private String beanClassName;
 
-   @Deprecated
-   private static final String DEPRECATION_MESSAGE_MUTATOR = DEPRECATION_MESSAGE_ACCESSOR
-         + "; mutation here will have no effect";
-   
-   @Deprecated
-   private static final String DEPRECATION_MESSAGE_CONSTRUCTOR = "Use EjbDeploymentSummary(JBossEnterpriseBeanMetaData beanMD, DeploymentSummary dsummary)";
+   private boolean isLocal;
 
-   // Instance Members
+   private boolean isStateful;
+
+   private boolean isHome;
+
+   private boolean isService;
    private JBossEnterpriseBeanMetaData beanMD;
 
-   @Deprecated
    public EjbDeploymentSummary()
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_CONSTRUCTOR);
+      
    }
-
    public EjbDeploymentSummary(JBossEnterpriseBeanMetaData beanMD, DeploymentSummary dsummary)
    {
       super(dsummary);
+      // 
+      this.setBeanClassName(beanMD.getEjbClass());
+      this.setEjbName(beanMD.getEjbName());
+      this.setService(beanMD.isService());
       
-      assert beanMD != null : JBossEnterpriseBeanMetaData.class.getSimpleName() + " instance is a required argument";
-
+      if(beanMD instanceof JBossSessionBeanMetaData)
+      {
+         JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) beanMD;
+         this.setStateful(sbeanMD.isStateful());
+         if(sbeanMD.getHome() != null && sbeanMD.getHome().length() > 0)
+            this.setHome(true);
+         if(sbeanMD.getLocal() != null && sbeanMD.getLocal().length() > 0)
+            this.setLocal(true);
+         // Is a local-home also a home?
+      }
       this.beanMD = beanMD;
    }
 
    // Accessors / Mutators
 
-   public JBossEnterpriseBeanMetaData getBeanMD()
-   {
-      return beanMD;
-   }
-
-   public void setBeanMD(JBossEnterpriseBeanMetaData beanMD)
-   {
-      this.beanMD = beanMD;
-   }
-
-   /*
-    * 
-    * Deprecated below this marker
-    * 
-    */
-
-   @Deprecated
    public String getEjbName()
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_ACCESSOR);
-      return this.getBeanMD().getEjbName();
+      return ejbName;
    }
 
-   @Deprecated
    public void setEjbName(String ejbName)
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_MUTATOR);
+      this.ejbName = ejbName;
    }
 
-   @Deprecated
    public boolean isLocal()
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_ACCESSOR);
-
-      JBossEnterpriseBeanMetaData md = this.getBeanMD();
-      if (md.isSession())
-      {
-         JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData) md;
-         return smd.getLocal() != null && smd.getLocal().trim().length() > 0;
-      }
-      return false;
+      return isLocal;
    }
 
-   @Deprecated
    public void setLocal(boolean isLocal)
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_MUTATOR);
+      this.isLocal = isLocal;
    }
 
-   @Deprecated
    public boolean isStateful()
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_ACCESSOR);
-
-      JBossEnterpriseBeanMetaData md = this.getBeanMD();
-      if (md.isService())
-      {
-         JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData) md;
-         return smd.isStateful();
-      }
-      return false;
+      return isStateful;
    }
 
-   @Deprecated
    public void setStateful(boolean isStateful)
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_MUTATOR);
+      this.isStateful = isStateful;
    }
 
-   @Deprecated
    public boolean isHome()
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_ACCESSOR);
-
-      JBossEnterpriseBeanMetaData md = this.getBeanMD();
-      if (md.isSession())
-      {
-         JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData) md;
-         return smd.getHome() != null && smd.getHome().trim().length() > 0;
-      }
-      return false;
+      return isHome;
    }
 
-   @Deprecated
    public void setHome(boolean isHome)
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_MUTATOR);
+      this.isHome = isHome;
    }
 
-   @Deprecated
    public boolean isService()
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_ACCESSOR);
-      return this.getBeanMD().isService();
+      return isService;
    }
 
-   @Deprecated
    public void setService(boolean isService)
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_MUTATOR);
+      this.isService = isService;
    }
 
-   @Deprecated
+
    public String getBeanClassName()
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_ACCESSOR);
-      return this.getBeanMD().getEjbClass();
+      return beanClassName;
    }
 
-   @Deprecated
    public void setBeanClassName(String beanClassName)
    {
-      log.warn(EjbDeploymentSummary.DEPRECATION_MESSAGE_MUTATOR);
+      this.beanClassName = beanClassName;
    }
 
+   
+   public JBossEnterpriseBeanMetaData getBeanMD()
+   {
+      return beanMD;
+   }
+   public void setBeanMD(JBossEnterpriseBeanMetaData beanMD)
+   {
+      this.beanMD = beanMD;
+   }
+
 }

Added: projects/metadata/trunk/src/test/java/org/jboss/metadata/test/ejb3/legacy0_1_7/EjbDeploymentSummaryTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/metadata/test/ejb3/legacy0_1_7/EjbDeploymentSummaryTestCase.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/metadata/test/ejb3/legacy0_1_7/EjbDeploymentSummaryTestCase.java	2008-07-14 07:26:12 UTC (rev 75757)
@@ -0,0 +1,56 @@
+/*
+ * 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.test.ejb3.legacy0_1_7;
+
+import junit.framework.TestCase;
+
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
+
+/**
+ * Emulate the ejb3-core 0.1.7 behavior with regards to EjbDeploymentSummary.
+ * See ProxyFactoryHelper#getDeploymentSummaryFromContainer.
+ * 
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EjbDeploymentSummaryTestCase extends TestCase
+{
+   @SuppressWarnings("deprecation")
+   public void test1()
+   {
+      // Construct Deployment Summary
+      EjbDeploymentSummary summary = new EjbDeploymentSummary();
+      summary.setEjbName("EjbName");
+      summary.setService(true);
+      summary.setStateful(true);
+      summary.setDeploymentName("DeploymentName");
+      summary.setBeanClassName("BeanClassName");
+      summary.setDeploymentScopeBaseName("ScopeName");
+
+      assertEquals("EjbName", summary.getEjbName());
+      assertEquals(true, summary.isService());
+      assertEquals(true, summary.isStateful());
+      assertEquals("DeploymentName", summary.getDeploymentName());
+      assertEquals("BeanClassName", summary.getBeanClassName());
+      assertEquals("ScopeName", summary.getDeploymentScopeBaseName());
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list