ASF Bugzilla – Attachment 26096 Details for
Bug 50019
Adding JNDI "lookup-name" support In XML and Resource Annotations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Test for the lookup
patch_lookup_test.txt (text/plain), 8.97 KB, created by
Gurkan Erdogdu
on 2010-09-28 10:40:12 UTC
(
hide
)
Description:
Test for the lookup
Filename:
MIME Type:
Creator:
Gurkan Erdogdu
Created:
2010-09-28 10:40:12 UTC
Size:
8.97 KB
patch
obsolete
>Index: org/apache/naming/resources/TestJndiLookupName.java >=================================================================== >--- org/apache/naming/resources/TestJndiLookupName.java (revision 0) >+++ org/apache/naming/resources/TestJndiLookupName.java (revision 0) >@@ -0,0 +1,238 @@ >+/* >+ * Licensed to the Apache Software Foundation (ASF) under one or more >+ * contributor license agreements. See the NOTICE file distributed with >+ * this work for additional information regarding copyright ownership. >+ * The ASF licenses this file to You under the Apache License, Version 2.0 >+ * (the "License"); you may not use this file except in compliance with >+ * the License. You may obtain a copy of the License at >+ * >+ * http://www.apache.org/licenses/LICENSE-2.0 >+ * >+ * Unless required by applicable law or agreed to in writing, software >+ * distributed under the License is distributed on an "AS IS" BASIS, >+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >+ * See the License for the specific language governing permissions and >+ * limitations under the License. >+ */ >+package org.apache.naming.resources; >+ >+import java.io.StringReader; >+ >+import org.apache.catalina.deploy.ContextEjb; >+import org.apache.catalina.deploy.ContextEnvironment; >+import org.apache.catalina.deploy.ContextLocalEjb; >+import org.apache.catalina.deploy.ContextResource; >+import org.apache.catalina.deploy.ContextResourceEnvRef; >+import org.apache.catalina.deploy.ContextService; >+import org.apache.catalina.deploy.MessageDestination; >+import org.apache.catalina.deploy.MessageDestinationRef; >+import org.apache.catalina.deploy.WebXml; >+import org.apache.catalina.startup.DigesterFactory; >+import org.apache.catalina.startup.TomcatBaseTest; >+import org.apache.catalina.startup.WebRuleSet; >+import org.apache.tomcat.util.digester.Digester; >+ >+/** >+ * Unit test for testing lookup name. >+ * @author Gurkan Erdogdu >+ * @version $Revision: $ >+ */ >+public class TestJndiLookupName extends TomcatBaseTest { >+ >+ private Digester digester; >+ >+ public void setUp() throws Exception{ >+ super.setUp(); >+ this.digester = DigesterFactory.newDigester(false,false,new WebRuleSet(false)); >+ } >+ >+ /** >+ * Context Environment >+ */ >+ public void testLookupNameForContextEnvironment() throws Exception { >+ >+ WebXml webXml = new WebXml(); >+ webXml.setPublicId("web-app_3_0.xsd"); >+ >+ ContextEnvironment env = new ContextEnvironment(); >+ env.setDescription("My Context Desc"); >+ env.setName("jndiName"); >+ env.setLookupName("java:/my/injection"); >+ >+ webXml.addEnvEntry(env); >+ >+ WebXml parsed = new WebXml(); >+ this.digester.push(parsed); >+ //Lets do revers >+ this.digester.parse(new StringReader(webXml.toXml())); >+ >+ ContextEnvironment contextEnv = parsed.getEnvEntries().get("jndiName"); >+ assertEquals("java:/my/injection", contextEnv.getLookupName()); >+ } >+ >+ /** >+ * Context Ejb >+ */ >+ public void testLookupNameForContextEjb() throws Exception { >+ >+ WebXml webXml = new WebXml(); >+ webXml.setPublicId("web-app_3_0.xsd"); >+ >+ ContextEjb ejbRef = new ContextEjb(); >+ ejbRef.setDescription("My Context Desc"); >+ ejbRef.setName("jndiName"); >+ ejbRef.setLookupName("java:/my/injection"); >+ >+ webXml.addEjbRef(ejbRef); >+ >+ WebXml parsed = new WebXml(); >+ this.digester.push(parsed); >+ //Lets do revers >+ this.digester.parse(new StringReader(webXml.toXml())); >+ >+ ContextEjb parsedEjb = parsed.getEjbRefs().get("jndiName"); >+ assertEquals("java:/my/injection", parsedEjb.getLookupName()); >+ } >+ >+ /** >+ * Context Local Ejb >+ */ >+ public void testLookupNameForContextLocalEjb() throws Exception { >+ >+ WebXml webXml = new WebXml(); >+ webXml.setPublicId("web-app_3_0.xsd"); >+ >+ ContextLocalEjb ejbRef = new ContextLocalEjb(); >+ ejbRef.setDescription("My Context Desc"); >+ ejbRef.setName("jndiName"); >+ ejbRef.setLookupName("java:/my/injection"); >+ >+ webXml.addEjbLocalRef(ejbRef); >+ >+ WebXml parsed = new WebXml(); >+ this.digester.push(parsed); >+ //Lets do revers >+ this.digester.parse(new StringReader(webXml.toXml())); >+ >+ ContextLocalEjb parsedEjb = parsed.getEjbLocalRefs().get("jndiName"); >+ assertEquals("java:/my/injection", parsedEjb.getLookupName()); >+ } >+ >+ /** >+ * Context Service >+ */ >+ public void testLookupNameForContextService() throws Exception { >+ >+ WebXml webXml = new WebXml(); >+ webXml.setPublicId("web-app_3_0.xsd"); >+ >+ ContextService serviceRef = new ContextService(); >+ serviceRef.setDescription("My Context Desc"); >+ serviceRef.setName("jndiName"); >+ serviceRef.setLookupName("java:/my/injection"); >+ >+ webXml.addServiceRef(serviceRef); >+ >+ WebXml parsed = new WebXml(); >+ this.digester.push(parsed); >+ //Lets do revers >+ this.digester.parse(new StringReader(webXml.toXml())); >+ >+ ContextService parsedRef = parsed.getServiceRefs().get("jndiName"); >+ assertEquals("java:/my/injection", parsedRef.getLookupName()); >+ } >+ >+ /** >+ * Context Resource >+ */ >+ public void testLookupNameForContextResource() throws Exception { >+ >+ WebXml webXml = new WebXml(); >+ webXml.setPublicId("web-app_3_0.xsd"); >+ >+ ContextResource serviceRef = new ContextResource(); >+ serviceRef.setDescription("My Context Desc"); >+ serviceRef.setName("jndiName"); >+ serviceRef.setLookupName("java:/my/injection"); >+ >+ webXml.addResourceRef(serviceRef); >+ WebXml parsed = new WebXml(); >+ this.digester.push(parsed); >+ //Lets do revers >+ this.digester.parse(new StringReader(webXml.toXml())); >+ >+ ContextResource parsedRef = parsed.getResourceRefs().get("jndiName"); >+ assertEquals("java:/my/injection", parsedRef.getLookupName()); >+ } >+ >+ /** >+ * Context Resource Env >+ */ >+ public void testLookupNameForContextResourceEnv() throws Exception { >+ >+ WebXml webXml = new WebXml(); >+ webXml.setPublicId("web-app_3_0.xsd"); >+ >+ ContextResourceEnvRef serviceRef = new ContextResourceEnvRef(); >+ serviceRef.setDescription("My Context Desc"); >+ serviceRef.setName("jndiName"); >+ serviceRef.setLookupName("java:/my/injection"); >+ >+ webXml.addResourceEnvRef(serviceRef); >+ WebXml parsed = new WebXml(); >+ this.digester.push(parsed); >+ //Lets do revers >+ this.digester.parse(new StringReader(webXml.toXml())); >+ >+ ContextResourceEnvRef parsedRef = parsed.getResourceEnvRefs().get("jndiName"); >+ assertEquals("java:/my/injection", parsedRef.getLookupName()); >+ } >+ >+ /** >+ * Message Destination Ref >+ */ >+ public void testLookupNameForMessageDestinationRef() throws Exception { >+ >+ WebXml webXml = new WebXml(); >+ webXml.setPublicId("web-app_3_0.xsd"); >+ >+ MessageDestinationRef serviceRef = new MessageDestinationRef(); >+ serviceRef.setDescription("My Context Desc"); >+ serviceRef.setName("jndiName"); >+ serviceRef.setLookupName("java:/my/injection"); >+ >+ webXml.addMessageDestinationRef(serviceRef); >+ WebXml parsed = new WebXml(); >+ this.digester.push(parsed); >+ //Lets do revers >+ this.digester.parse(new StringReader(webXml.toXml())); >+ >+ MessageDestinationRef parsedRef = parsed.getMessageDestinationRefs().get("jndiName"); >+ assertEquals("java:/my/injection", parsedRef.getLookupName()); >+ } >+ >+ /** >+ * Message Destination >+ */ >+ public void testLookupNameForMessageDestination() throws Exception { >+ >+ WebXml webXml = new WebXml(); >+ webXml.setPublicId("web-app_3_0.xsd"); >+ >+ MessageDestination serviceRef = new MessageDestination(); >+ serviceRef.setDescription("My Context Desc"); >+ serviceRef.setName("jndiName"); >+ serviceRef.setLookupName("java:/my/injection"); >+ >+ webXml.addMessageDestination(serviceRef); >+ WebXml parsed = new WebXml(); >+ this.digester.push(parsed); >+ //Lets do revers >+ this.digester.parse(new StringReader(webXml.toXml())); >+ >+ MessageDestination parsedRef = parsed.getMessageDestinations().get("jndiName"); >+ assertEquals("java:/my/injection", parsedRef.getLookupName()); >+ } >+ >+ >+} > >Property changes on: org/apache/naming/resources/TestJndiLookupName.java >___________________________________________________________________ >Added: svn:eol-style > + native >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 50019
:
26095
| 26096