[jboss-cvs] JBossAS SVN: r76857 - in projects/metadata/trunk/src: test/java/org/jboss/test/metadata/ejb and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Aug 9 14:59:52 EDT 2008
Author: ALRubinger
Date: 2008-08-09 14:59:52 -0400 (Sat, 09 Aug 2008)
New Revision: 76857
Modified:
projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/JBossSessionPolicyDecorator.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/ResolveJndiNameDecoratorUnitTestCase.java
Log:
[JBMETA-91] JBossSessionPolicyDecorator is too anxious to ask JNDI Policy, first look to delegate for explicit definition
Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/JBossSessionPolicyDecorator.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/JBossSessionPolicyDecorator.java 2008-08-09 18:04:16 UTC (rev 76856)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/jndipolicy/plugins/JBossSessionPolicyDecorator.java 2008-08-09 18:59:52 UTC (rev 76857)
@@ -217,16 +217,33 @@
*/
public String determineResolvedJndiName(String iface)
{
- // Obtain the JNDI Policy
- DefaultJndiBindingPolicy policy = this.getJndiPolicy();
-
+ // Initialize
+ String resolvedJndiName = null;
+
// Classify the interface
KnownInterfaceType ifaceType = classifyInterface(iface);
- // Have the policy generate the actual name
- String resolvedJndiName = policy.getJndiName(getEjbDeploymentSummary(), iface, ifaceType);
- log.debug("Resolved JNDI Name for Interface " + iface + " of type " + ifaceType + " is " + resolvedJndiName);
-
+ // Take appropriate handling depending upon the interface
+ if (ifaceType.equals(KnownInterfaceType.REMOTE_HOME))
+ {
+ resolvedJndiName = this.determineResolvedRemoteHomeJndiName();
+ }
+ if (ifaceType.equals(KnownInterfaceType.LOCAL_HOME))
+ {
+ resolvedJndiName = this.determineResolvedLocalHomeJndiName();
+ }
+ if (ifaceType.equals(KnownInterfaceType.BUSINESS_REMOTE) || ifaceType.equals(KnownInterfaceType.BUSINESS_LOCAL))
+ {
+ // Obtain the JNDI Policy
+ DefaultJndiBindingPolicy policy = this.getJndiPolicy();
+ // Revert to defaults; have the policy generate the actual name
+ resolvedJndiName = policy.getJndiName(getEjbDeploymentSummary(), iface, ifaceType);
+ log.debug("Resolved JNDI Name for Interface " + iface + " of type " + ifaceType + " is " + resolvedJndiName);
+ }
+
+ // Ensure found
+ assert resolvedJndiName != null : "The target JNDI Name has not been properly resolved";
+
// Return
return resolvedJndiName;
}
@@ -281,8 +298,15 @@
*
* @return
*/
- public String determineResolvedLocalHomeJndiName(){
- return getJndiPolicy().getJndiName(getEjbDeploymentSummary(), KnownInterfaces.LOCAL_HOME, KnownInterfaceType.LOCAL_HOME);
+ public String determineResolvedLocalHomeJndiName(){
+ // Check first for explicitly-defined Local Home JNDI Name
+ String localHomeJndiName = this.delegate.getLocalHomeJndiName();
+ if (localHomeJndiName != null)
+ return localHomeJndiName;
+
+ // Default to JNDI Policy
+ return getJndiPolicy().getJndiName(getEjbDeploymentSummary(), KnownInterfaces.LOCAL_HOME,
+ KnownInterfaceType.LOCAL_HOME);
}
/**
Modified: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/ResolveJndiNameDecoratorUnitTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/ResolveJndiNameDecoratorUnitTestCase.java 2008-08-09 18:04:16 UTC (rev 76856)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/ResolveJndiNameDecoratorUnitTestCase.java 2008-08-09 18:59:52 UTC (rev 76857)
@@ -163,23 +163,32 @@
// Obtain MD
JBossSessionBeanMetaData beanMD = getDecoratedEjbMetaData();
- String overrideJndiName = "overrideJndiName";
+ // Set some override names
+ String overrideJndiNameRemote = "overrideJndiNameRemote";
+ String overrideJndiNameLocal = "overrideJndiNameLocal";
// Override
- beanMD.setHomeJndiName(overrideJndiName);
- beanMD.setMappedName(overrideJndiName);
+ beanMD.setHomeJndiName(overrideJndiNameRemote);
+ beanMD.setLocalHomeJndiName(overrideJndiNameLocal);
+ beanMD.setMappedName(overrideJndiNameRemote);
- String expected = overrideJndiName;
+ // Set the expected values
+ String expectedRemote = overrideJndiNameRemote;
+ String expectedLocal = overrideJndiNameLocal;
// Resolve
- String resolved = beanMD.getHomeJndiName();
+ String resolvedRemote = beanMD.getHomeJndiName();
+ String resolvedLocal = beanMD.getLocalHomeJndiName();
// Test
- assertEquals(expected, resolved);
+ assertEquals(expectedRemote, resolvedRemote);
+ assertEquals(expectedLocal, resolvedLocal);
// Test Deprecated, backwards-compat behavior (may be removed when these methods no longer exist, JBMETA-68)
- String resolvedDeprecated = beanMD.determineResolvedJndiName(KnownInterfaces.HOME, null);
- assertEquals(expected, resolvedDeprecated);
+ String resolvedDeprecatedRemote = beanMD.determineResolvedJndiName(KnownInterfaces.HOME, null);
+ assertEquals(expectedRemote, resolvedDeprecatedRemote);
+ String resolvedDeprecatedLocal = beanMD.determineResolvedJndiName(KnownInterfaces.LOCAL_HOME, null);
+ assertEquals(expectedLocal, resolvedDeprecatedLocal);
}
/**
More information about the jboss-cvs-commits
mailing list