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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 17 10:38:59 EDT 2008


Author: wolfc
Date: 2008-06-17 10:38:59 -0400 (Tue, 17 Jun 2008)
New Revision: 74694

Added:
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta58/
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta58/MyDefaultJndiBindingPolicy.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta58/unit/
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta58/unit/DeploymentSummaryTestCase.java
Log:
JBMETA-58: unit test

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta58/MyDefaultJndiBindingPolicy.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta58/MyDefaultJndiBindingPolicy.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta58/MyDefaultJndiBindingPolicy.java	2008-06-17 14:38:59 UTC (rev 74694)
@@ -0,0 +1,64 @@
+/*
+ * 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.jbmeta58;
+
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.EjbDeploymentSummary;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.KnownInterfaces.KnownInterfaceType;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MyDefaultJndiBindingPolicy implements DefaultJndiBindingPolicy
+{
+
+   public String getDefaultLocalHomeJndiName(EjbDeploymentSummary summary)
+   {
+      return getJndiName(summary, "localHome", KnownInterfaceType.UNKNOWN);
+   }
+
+   public String getDefaultLocalJndiName(EjbDeploymentSummary summary)
+   {
+      return getJndiName(summary, "local", KnownInterfaceType.UNKNOWN);
+   }
+
+   public String getDefaultRemoteHomeJndiName(EjbDeploymentSummary summary)
+   {
+      return getJndiName(summary, "home", KnownInterfaceType.UNKNOWN);
+   }
+
+   public String getDefaultRemoteJndiName(EjbDeploymentSummary summary)
+   {
+      return getJndiName(summary, "remote", KnownInterfaceType.UNKNOWN);
+   }
+
+   public String getJndiName(EjbDeploymentSummary summary)
+   {
+      return getJndiName(summary, "default", KnownInterfaceType.UNKNOWN);
+   }
+
+   public String getJndiName(EjbDeploymentSummary summary, String iface, KnownInterfaceType ifaceType)
+   {
+      return summary.getDeploymentScopeBaseName() + "/" + summary.getDeploymentName() + "/" + summary.getEjbName() + "/" + iface;
+   }
+}

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta58/unit/DeploymentSummaryTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta58/unit/DeploymentSummaryTestCase.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbmeta58/unit/DeploymentSummaryTestCase.java	2008-06-17 14:38:59 UTC (rev 74694)
@@ -0,0 +1,64 @@
+/*
+ * 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.jbmeta58.unit;
+
+import junit.framework.TestCase;
+
+import org.jboss.metadata.ejb.jboss.ContainerConfigurationsMetaData;
+import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaDataWrapper;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.DeploymentSummary;
+import org.jboss.test.metadata.jbmeta58.MyDefaultJndiBindingPolicy;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class DeploymentSummaryTestCase extends TestCase
+{
+   public void test1()
+   {
+      JBossSessionBeanMetaData enterpriseBeanMetaData = new JBossSessionBeanMetaData();
+      enterpriseBeanMetaData.setEjbName("MyBean");
+      JBossEnterpriseBeansMetaData enterpriseBeans = new JBossEnterpriseBeansMetaData();
+      enterpriseBeans.add(enterpriseBeanMetaData);
+      JBossMetaData primary = new JBoss50MetaData();
+      primary.setEnterpriseBeans(enterpriseBeans);
+      
+      JBossMetaData defaults = new JBoss50MetaData();
+      defaults.setContainerConfigurations(new ContainerConfigurationsMetaData());
+      
+      DeploymentSummary deploymentSummary = new DeploymentSummary();
+      deploymentSummary.setDeploymentName("someModule");
+      deploymentSummary.setDeploymentScopeBaseName("someEar");
+      JBossMetaDataWrapper wrapper = new JBossMetaDataWrapper(primary, defaults);
+      wrapper.setDeploymentSummary(deploymentSummary);
+      
+      DefaultJndiBindingPolicy policy = new MyDefaultJndiBindingPolicy();
+      String jndiName = wrapper.getEnterpriseBean("MyBean").determineResolvedJndiName("testInterface", policy);
+      assertEquals("someEar/someModule/MyBean/testInterface", jndiName);
+   }
+}




More information about the jboss-cvs-commits mailing list