[jira] [Updated] (TOMEE-2101) org.apache.tomee.catalina.TomcatWebAppBuilder.afterStart() NullPointerException
[ https://issues.apache.org/jira/browse/TOMEE-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Georg Nepp updated TOMEE-2101: -- Description: NullPointerException possible at: contextInfo.module = null; solution: {{final ContextInfo contextInfo = getContextInfo(standardContext); if (contextInfo == null) { // openejb webapp loaded from the LoaderServlet return; } contextInfo.module = null; // shouldnt be there after startup (actually we shouldnt need it from info tree but our scanning does) if (contextInfo.appInfo == null) { return; }}} was: NullPointerException possible at: contextInfo.module = null; solution: final ContextInfo contextInfo = getContextInfo(standardContext); if (contextInfo == null) { // openejb webapp loaded from the LoaderServlet return; } contextInfo.module = null; // shouldnt be there after startup (actually we shouldnt need it from info tree but our scanning does) if (contextInfo.appInfo == null) { return; } > org.apache.tomee.catalina.TomcatWebAppBuilder.afterStart() > NullPointerException > --- > > Key: TOMEE-2101 > URL: https://issues.apache.org/jira/browse/TOMEE-2101 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.3 > Environment: any >Reporter: Georg Nepp > Fix For: 7.0.4 > > Original Estimate: 10m > Remaining Estimate: 10m > > NullPointerException possible at: > contextInfo.module = null; > solution: > {{final ContextInfo contextInfo = getContextInfo(standardContext); > if (contextInfo == null) { // openejb webapp loaded from the > LoaderServlet > return; > } > contextInfo.module = null; // shouldnt be there after startup > (actually we shouldnt need it from info tree but our scanning does) > if (contextInfo.appInfo == null) { > return; > }}} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Created] (TOMEE-2101) org.apache.tomee.catalina.TomcatWebAppBuilder.afterStart() NullPointerException
Georg Nepp created TOMEE-2101: - Summary: org.apache.tomee.catalina.TomcatWebAppBuilder.afterStart() NullPointerException Key: TOMEE-2101 URL: https://issues.apache.org/jira/browse/TOMEE-2101 Project: TomEE Issue Type: Bug Components: TomEE Core Server Affects Versions: 7.0.3 Environment: any Reporter: Georg Nepp Fix For: 7.0.4 NullPointerException possible at: contextInfo.module = null; solution: final ContextInfo contextInfo = getContextInfo(standardContext); if (contextInfo == null) { // openejb webapp loaded from the LoaderServlet return; } contextInfo.module = null; // shouldnt be there after startup (actually we shouldnt need it from info tree but our scanning does) if (contextInfo.appInfo == null) { return; } -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TOMEE-1974) Allow TomEE ejbd HTTP Servlet to be protected by basic auth
[ https://issues.apache.org/jira/browse/TOMEE-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093223#comment-16093223 ] ASF GitHub Bot commented on TOMEE-1974: --- Github user jgallimore closed the pull request at: https://github.com/apache/tomee/pull/85 > Allow TomEE ejbd HTTP Servlet to be protected by basic auth > --- > > Key: TOMEE-1974 > URL: https://issues.apache.org/jira/browse/TOMEE-1974 > Project: TomEE > Issue Type: New Feature > Components: TomEE Core Server >Affects Versions: 1.7.5 >Reporter: Jonathan S Fisher >Priority: Minor > > TomEE offers ejbd over http. This is great for a number of reasons, but it > could go further by protecting the endpoint with http basic auth. This would > harden the server, and it would have prevented the bug involving > deserialization unknown classes, because authentication would have to happen > before the underlying protocol was deserialized. > Pull request here: https://github.com/apache/tomee/pull/52 -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TOMEE-2100) Jax-RS Providers are ordered by ?hashcode? instead of priority
[ https://issues.apache.org/jira/browse/TOMEE-2100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093198#comment-16093198 ] TURPIN Michel commented on TOMEE-2100: -- Changed the name of this issue. On my project, it looked like the name was the criteria used for ordering but it's not. I suspect it may use some hashcode or similar mechanisms. > Jax-RS Providers are ordered by ?hashcode? instead of priority > -- > > Key: TOMEE-2100 > URL: https://issues.apache.org/jira/browse/TOMEE-2100 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.3 >Reporter: TURPIN Michel > Labels: features > Attachments: tomee-priority.zip > > > The attached zip contains a project with 5 body writers with differents > priorities. You may run it with the {{mvn clean package tomee:run}} command. > The {{FooResource}} class is then accessible through the > {{http://localhost:8080/tomee-priority/resources/foo/}} URL. It must show "B". > As I run it, it shows me "D", you might have different values. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (TOMEE-2100) Jax-RS Providers are ordered by name instead of priority
[ https://issues.apache.org/jira/browse/TOMEE-2100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] TURPIN Michel updated TOMEE-2100: - Docs Text: >From JaxRS 2.1 Specification : Application-supplied providers may be annotated with @Priority. If two or more providers are candidates for a certain task, the one with the highest priority is chosen: the highest priority is defined to be the one with the lowest value in this case. That is, @Priority(1) is higher than @Priority(10). If two or more providers are eligible and have identical priorities, one is chosen in an implementation dependent manner. The default priority for all providers is javax.ws.rs.Priorities.USER. was: >From JaxRS 2.1 Specification : {quote}Application-supplied providers may be annotated with @Priority. If two or more providers are candidates for a certain task, the one with the highest priority is chosen: the highest priority is defined to be the one with the lowest value in this case. That is, @Priority(1) is higher than @Priority(10). If two or more providers are eligible and have identical priorities, one is chosen in an implementation dependent manner. The default priority for all providers is javax.ws.rs.Priorities.USER.{quote} > Jax-RS Providers are ordered by name instead of priority > > > Key: TOMEE-2100 > URL: https://issues.apache.org/jira/browse/TOMEE-2100 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.3 >Reporter: TURPIN Michel > Labels: features > Attachments: tomee-priority.zip > > > The attached zip contains a project with 5 body writers with differents > priorities. You may run it with the {{mvn clean package tomee:run}} command. > The {{FooResource}} class is then accessible through the > {{http://localhost:8080/tomee-priority/resources/foo/}} URL. It must show "B". > As I run it, it shows me "D", you might have different values. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Created] (TOMEE-2100) Jax-RS Providers are ordered by name instead of priority
TURPIN Michel created TOMEE-2100: Summary: Jax-RS Providers are ordered by name instead of priority Key: TOMEE-2100 URL: https://issues.apache.org/jira/browse/TOMEE-2100 Project: TomEE Issue Type: Bug Components: TomEE Core Server Affects Versions: 7.0.3 Reporter: TURPIN Michel Attachments: tomee-priority.zip The attached zip contains a project with 5 body writers with differents priorities. You may run it with the {{mvn clean package tomee:run}} command. The {{FooResource}} class is then accessible through the {{http://localhost:8080/tomee-priority/resources/foo/}} URL. It must show "B". As I run it, it shows me "D", you might have different values. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Resolved] (TOMEE-2099) JAX-RS Application#getProperties is never called
[ https://issues.apache.org/jira/browse/TOMEE-2099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Romain Manni-Bucau resolved TOMEE-2099. --- Resolution: Fixed Fix Version/s: 7.0.4 > JAX-RS Application#getProperties is never called > > > Key: TOMEE-2099 > URL: https://issues.apache.org/jira/browse/TOMEE-2099 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.3 > Environment: $ mvn -version > Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; > 2014-08-11T22:58:10+02:00) > Maven home: D:\tools\apache-maven-3.2.3 > Java version: 1.8.0_111, vendor: Oracle Corporation > Java home: C:\Program Files\Java\jdk1.8.0_111\jre > Default locale: fr_FR, platform encoding: Cp1252 > OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos" > Running TomEE Plus through the tomee maven plugin >Reporter: TURPIN Michel >Assignee: Jonathan Gallimore > Labels: features > Fix For: 7.0.4 > > Attachments: tomee2099.zip > > > The {{Application#getProperties()}} method is never called / used. > As a consequence, it is impossible to configure a Feature or DynamicFeature > that would read properties from the context configuration from an Application > subclass. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
tomee git commit: TOMEE-2099 ensure properties are wired in jaxrs runtime
Repository: tomee Updated Branches: refs/heads/master bfaefb36e -> 5830c209a TOMEE-2099 ensure properties are wired in jaxrs runtime Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/5830c209 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/5830c209 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/5830c209 Branch: refs/heads/master Commit: 5830c209a0fc287933e3a4e61484011cef96d9f7 Parents: bfaefb3 Author: Romain Manni-BucauAuthored: Wed Jul 19 14:17:04 2017 +0200 Committer: Romain Manni-Bucau Committed: Wed Jul 19 14:17:04 2017 +0200 -- .../cxf/rs/AppPropertiesPropagationTest.java| 131 +++ .../server/rest/InternalApplication.java| 7 + 2 files changed, 138 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tomee/blob/5830c209/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/AppPropertiesPropagationTest.java -- diff --git a/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/AppPropertiesPropagationTest.java b/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/AppPropertiesPropagationTest.java new file mode 100644 index 000..3a345e2 --- /dev/null +++ b/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/AppPropertiesPropagationTest.java @@ -0,0 +1,131 @@ +/* + * 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.openejb.server.cxf.rs; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Feature; +import javax.ws.rs.core.FeatureContext; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.ws.rs.ext.Provider; + +import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.openejb.junit.ApplicationComposer; +import org.apache.openejb.testing.Classes; +import org.apache.openejb.testing.EnableServices; +import org.apache.openejb.testing.JaxrsProviders; +import org.apache.openejb.testing.RandomPort; +import org.junit.Test; +import org.junit.runner.RunWith; + +@EnableServices("jaxrs") +@JaxrsProviders(AppPropertiesPropagationTest.Registrator.class) +@RunWith(ApplicationComposer.class) +@Classes(innerClassesAsBean = true) +public class AppPropertiesPropagationTest { +@RandomPort("http") +private int port; + +@Test +public void checkStarIsNotAnIssue() { +assertEquals("yes", WebClient.create("http://localhost:; + port + "/openejb/") + .path("AppPropertiesPropagationTest/endpoint").get(String.class)); +assertEquals("yes", WebClient.create("http://localhost:; + port + "/openejb/") + .path("AppPropertiesPropagationTest/endpoint/2").get(String.class)); +} + +@Path("endpoint") +public static class MyEndpoint { +@GET +public String get(@Context final Application app) { +return String.valueOf(app.getProperties().get("AppPropertiesPropagationTest")); +} + +@GET +@Produces("AppPropertiesPropagationTest/1") +@Path("2") +public MyEndpoint provider(@Context final Application app) { +return this; +} +} + +@Provider +public static class Registrator implements Feature { +@Override +public boolean configure(final FeatureContext context) { +context.register(new
[jira] [Comment Edited] (TOMEE-2099) JAX-RS Application#getProperties is never called
[ https://issues.apache.org/jira/browse/TOMEE-2099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16092961#comment-16092961 ] TURPIN Michel edited comment on TOMEE-2099 at 7/19/17 11:41 AM: Hi Jonathan, I cannot access github from my working place so you will find a zip attached with a 6 classes maven project. You may launch the project with {{mvn package tomee:run}} and then test the jax rs resource at {{http://localhost:8080/tomee2099/resources/foo/}}. The expected behavior would be to find {{Hello world !}} but instead you will find {{Get off me world !}}. This is expressed with the different MessageBodyWriter implementations chosen by the NameFormatFeature class. was (Author: grimly): Hi Jonathan, I cannot access github from my working place so you will find a zip attached with a 5 classes maven project. You may launch the project with {{mvn package tomee:run}} and then test the jax rs resource at {{http://localhost:8080/tomee2099/resources/foo/}}. The expected behavior would be to find {{Hello world !}} but instead you will find {{Get off me world !}}. This is expressed with the different MessageBodyWriter implementations chosen by the NameFormatFeature class. > JAX-RS Application#getProperties is never called > > > Key: TOMEE-2099 > URL: https://issues.apache.org/jira/browse/TOMEE-2099 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.3 > Environment: $ mvn -version > Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; > 2014-08-11T22:58:10+02:00) > Maven home: D:\tools\apache-maven-3.2.3 > Java version: 1.8.0_111, vendor: Oracle Corporation > Java home: C:\Program Files\Java\jdk1.8.0_111\jre > Default locale: fr_FR, platform encoding: Cp1252 > OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos" > Running TomEE Plus through the tomee maven plugin >Reporter: TURPIN Michel >Assignee: Jonathan Gallimore > Labels: features > Attachments: tomee2099.zip > > > The {{Application#getProperties()}} method is never called / used. > As a consequence, it is impossible to configure a Feature or DynamicFeature > that would read properties from the context configuration from an Application > subclass. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (TOMEE-2099) JAX-RS Application#getProperties is never called
[ https://issues.apache.org/jira/browse/TOMEE-2099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] TURPIN Michel updated TOMEE-2099: - Attachment: tomee2099.zip Hi Jonathan, I cannot access github from my working place so you will find a zip attached with a 5 classes maven project. You may launch the project with {{mvn package tomee:run}} and then test the jax rs resource at {{http://localhost:8080/tomee2099/resources/foo/}}. The expected behavior would be to find {{Hello world !}} but instead you will find {{Get off me world !}}. This is expressed with the different MessageBodyWriter implementations chosen by the NameFormatFeature class. > JAX-RS Application#getProperties is never called > > > Key: TOMEE-2099 > URL: https://issues.apache.org/jira/browse/TOMEE-2099 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.3 > Environment: $ mvn -version > Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; > 2014-08-11T22:58:10+02:00) > Maven home: D:\tools\apache-maven-3.2.3 > Java version: 1.8.0_111, vendor: Oracle Corporation > Java home: C:\Program Files\Java\jdk1.8.0_111\jre > Default locale: fr_FR, platform encoding: Cp1252 > OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos" > Running TomEE Plus through the tomee maven plugin >Reporter: TURPIN Michel >Assignee: Jonathan Gallimore > Labels: features > Attachments: tomee2099.zip > > > The {{Application#getProperties()}} method is never called / used. > As a consequence, it is impossible to configure a Feature or DynamicFeature > that would read properties from the context configuration from an Application > subclass. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Assigned] (TOMEE-2099) JAX-RS Application#getProperties is never called
[ https://issues.apache.org/jira/browse/TOMEE-2099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jonathan Gallimore reassigned TOMEE-2099: - Assignee: Jonathan Gallimore > JAX-RS Application#getProperties is never called > > > Key: TOMEE-2099 > URL: https://issues.apache.org/jira/browse/TOMEE-2099 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.3 > Environment: $ mvn -version > Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; > 2014-08-11T22:58:10+02:00) > Maven home: D:\tools\apache-maven-3.2.3 > Java version: 1.8.0_111, vendor: Oracle Corporation > Java home: C:\Program Files\Java\jdk1.8.0_111\jre > Default locale: fr_FR, platform encoding: Cp1252 > OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos" > Running TomEE Plus through the tomee maven plugin >Reporter: TURPIN Michel >Assignee: Jonathan Gallimore > Labels: features > > The {{Application#getProperties()}} method is never called / used. > As a consequence, it is impossible to configure a Feature or DynamicFeature > that would read properties from the context configuration from an Application > subclass. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TOMEE-2099) JAX-RS Application#getProperties is never called
[ https://issues.apache.org/jira/browse/TOMEE-2099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16092940#comment-16092940 ] Jonathan Gallimore commented on TOMEE-2099: --- Hi Michel I'd be happy to take a look at that for you - do you by any chance have a quick code sample that you can share with us? Thanks Jon > JAX-RS Application#getProperties is never called > > > Key: TOMEE-2099 > URL: https://issues.apache.org/jira/browse/TOMEE-2099 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.3 > Environment: $ mvn -version > Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; > 2014-08-11T22:58:10+02:00) > Maven home: D:\tools\apache-maven-3.2.3 > Java version: 1.8.0_111, vendor: Oracle Corporation > Java home: C:\Program Files\Java\jdk1.8.0_111\jre > Default locale: fr_FR, platform encoding: Cp1252 > OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos" > Running TomEE Plus through the tomee maven plugin >Reporter: TURPIN Michel > Labels: features > > The {{Application#getProperties()}} method is never called / used. > As a consequence, it is impossible to configure a Feature or DynamicFeature > that would read properties from the context configuration from an Application > subclass. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TOMEE-2099) JAX-RS Application#getProperties is never called
[ https://issues.apache.org/jira/browse/TOMEE-2099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16092926#comment-16092926 ] TURPIN Michel commented on TOMEE-2099: -- I tried to work around this bug by injecting the Application instance with {{@Context}} annotation and call {{Application#getProperties()}} from here, but the injection fails. I can't tell if the injection failure is to be considered a bug or not. > JAX-RS Application#getProperties is never called > > > Key: TOMEE-2099 > URL: https://issues.apache.org/jira/browse/TOMEE-2099 > Project: TomEE > Issue Type: Bug > Components: TomEE Core Server >Affects Versions: 7.0.3 > Environment: $ mvn -version > Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; > 2014-08-11T22:58:10+02:00) > Maven home: D:\tools\apache-maven-3.2.3 > Java version: 1.8.0_111, vendor: Oracle Corporation > Java home: C:\Program Files\Java\jdk1.8.0_111\jre > Default locale: fr_FR, platform encoding: Cp1252 > OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos" > Running TomEE Plus through the tomee maven plugin >Reporter: TURPIN Michel > Labels: features > > The {{Application#getProperties()}} method is never called / used. > As a consequence, it is impossible to configure a Feature or DynamicFeature > that would read properties from the context configuration from an Application > subclass. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Created] (TOMEE-2099) JAX-RS Application#getProperties is never called
TURPIN Michel created TOMEE-2099: Summary: JAX-RS Application#getProperties is never called Key: TOMEE-2099 URL: https://issues.apache.org/jira/browse/TOMEE-2099 Project: TomEE Issue Type: Bug Components: TomEE Core Server Affects Versions: 7.0.3 Environment: $ mvn -version Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T22:58:10+02:00) Maven home: D:\tools\apache-maven-3.2.3 Java version: 1.8.0_111, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_111\jre Default locale: fr_FR, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos" Running TomEE Plus through the tomee maven plugin Reporter: TURPIN Michel The {{Application#getProperties()}} method is never called / used. As a consequence, it is impossible to configure a Feature or DynamicFeature that would read properties from the context configuration from an Application subclass. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Resolved] (TOMEE-2087) IvmContext.list() does not correctly list the context content
[ https://issues.apache.org/jira/browse/TOMEE-2087?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jean-Louis MONTEIRO resolved TOMEE-2087. Resolution: Fixed Fix Version/s: 7.0.4 Thanks for the PR > IvmContext.list() does not correctly list the context content > - > > Key: TOMEE-2087 > URL: https://issues.apache.org/jira/browse/TOMEE-2087 > Project: TomEE > Issue Type: Bug >Reporter: Svetlin Zarev >Priority: Critical > Fix For: 7.0.4 > > Attachments: sample.zip > > > MyNamingEnumeration.gatherNodes() adds the wrong federated context entries in > the result set (related to TOMEE-2086 - it was indeed a typo, but we "fixed" > it with the wrong NameNode). > Another issue is with MyNamingEnumeration.isMyChild() which considers entries > that are NOT children to the "parent" tree as such > One more issue is that the wrong parentNode is passed as argument to > gatherNodes in case we are listing the context for any "IvmContext != this" > To give an example: > Expected context content: > {code} > ### Context: /module > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.assembler.classic.JndiBuilder$ContextualEjbLookup > [looking up: TestEJB!org.example.TestEJB] [Value]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: TestEJB > Class=org.apache.openejb.assembler.classic.JndiBuilder$ContextualEjbLookup > [looking up: TestEJB] [Value]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: ModuleName Class=java.lang.String [looking up: ModuleName] > [Value]: > Name: env Class=org.apache.naming.NamingContext [looking up: env] > [Value]: org.apache.naming.NamingContext@1bb2d0a8 > ### Context: /module/env > Name: nameClass=java.lang.String [looking up: name] [Value]: > module-env > {code} > Actual context content: > {code} > ### Context: /module > Name: global Class=org.apache.openejb.core.ivm.naming.IvmContext > [looking up: global]> Failed to lookup: global > Name: dummy Class=java.lang.String [looking up: dummy] > Failed to > lookup: dummy > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB!org.example.TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: ModuleName Class=java.lang.String [looking up: ModuleName] > [Value]: > Name: env Class=org.apache.openejb.core.ivm.naming.IvmContext > [looking up: env] [Value]: IvmContext{mynode=} > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB!org.example.TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > ### Context: /module/env > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB!org.example.TestEJB] > Failed to lookup: > TestEJB!org.example.TestEJB > Name: TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB] > Failed to lookup: TestEJB > Name: nameClass=java.lang.String [looking up: name] [Value]: > module-env > {code} > Note the "failed too lookup..." messages - these are all objects that MUST > NOT be listed as part of that context. > I'm attaching an application that reproduces the issue. > Requesting it like "http://localhost:8080/?ejb; will print tomee's naming tree > Requesting it like "http://localhost:8080; will print tomcat's naming tree -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TOMEE-2087) IvmContext.list() does not correctly list the context content
[ https://issues.apache.org/jira/browse/TOMEE-2087?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16092795#comment-16092795 ] ASF GitHub Bot commented on TOMEE-2087: --- Github user asfgit closed the pull request at: https://github.com/apache/tomee/pull/88 > IvmContext.list() does not correctly list the context content > - > > Key: TOMEE-2087 > URL: https://issues.apache.org/jira/browse/TOMEE-2087 > Project: TomEE > Issue Type: Bug >Reporter: Svetlin Zarev >Priority: Critical > Attachments: sample.zip > > > MyNamingEnumeration.gatherNodes() adds the wrong federated context entries in > the result set (related to TOMEE-2086 - it was indeed a typo, but we "fixed" > it with the wrong NameNode). > Another issue is with MyNamingEnumeration.isMyChild() which considers entries > that are NOT children to the "parent" tree as such > One more issue is that the wrong parentNode is passed as argument to > gatherNodes in case we are listing the context for any "IvmContext != this" > To give an example: > Expected context content: > {code} > ### Context: /module > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.assembler.classic.JndiBuilder$ContextualEjbLookup > [looking up: TestEJB!org.example.TestEJB] [Value]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: TestEJB > Class=org.apache.openejb.assembler.classic.JndiBuilder$ContextualEjbLookup > [looking up: TestEJB] [Value]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: ModuleName Class=java.lang.String [looking up: ModuleName] > [Value]: > Name: env Class=org.apache.naming.NamingContext [looking up: env] > [Value]: org.apache.naming.NamingContext@1bb2d0a8 > ### Context: /module/env > Name: nameClass=java.lang.String [looking up: name] [Value]: > module-env > {code} > Actual context content: > {code} > ### Context: /module > Name: global Class=org.apache.openejb.core.ivm.naming.IvmContext > [looking up: global]> Failed to lookup: global > Name: dummy Class=java.lang.String [looking up: dummy] > Failed to > lookup: dummy > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB!org.example.TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: ModuleName Class=java.lang.String [looking up: ModuleName] > [Value]: > Name: env Class=org.apache.openejb.core.ivm.naming.IvmContext > [looking up: env] [Value]: IvmContext{mynode=} > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB!org.example.TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > ### Context: /module/env > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB!org.example.TestEJB] > Failed to lookup: > TestEJB!org.example.TestEJB > Name: TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB] > Failed to lookup: TestEJB > Name: nameClass=java.lang.String [looking up: name] [Value]: > module-env > {code} > Note the "failed too lookup..." messages - these are all objects that MUST > NOT be listed as part of that context. > I'm attaching an application that reproduces the issue. > Requesting it like "http://localhost:8080/?ejb; will print tomee's naming tree > Requesting it like "http://localhost:8080; will print tomcat's naming tree -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[2/9] tomee git commit: Implement basic test which verifies if the listed entries can be looked up
Implement basic test which verifies if the listed entries can be looked up Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/52c72b62 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/52c72b62 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/52c72b62 Branch: refs/heads/master Commit: 52c72b628d9a8985f213222824cc391c7d7db2f8 Parents: f575f1c Author: Svetlin ZarevAuthored: Mon Jul 10 12:37:16 2017 +0300 Committer: Svetlin Zarev Committed: Mon Jul 10 12:55:37 2017 +0300 -- .../tests/naming/IvmContextServlet.java | 55 ++ .../arquillian/tests/naming/IvmContextTest.java | 104 +++ .../arquillian/tests/naming/NamingBean.java | 95 + .../tests/naming/list-context-ejbjar.xml| 38 +++ 4 files changed, 292 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tomee/blob/52c72b62/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextServlet.java -- diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextServlet.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextServlet.java new file mode 100644 index 000..d4db5c8 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextServlet.java @@ -0,0 +1,55 @@ +/* + * 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.openejb.arquillian.tests.naming; + + +import javax.ejb.EJB; +import javax.naming.NamingException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +public class IvmContextServlet extends HttpServlet { +@EJB +NamingBean namingBean; + +@Override +protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { +final PrintWriter writer = resp.getWriter(); +final String testToExecute = req.getParameter("test"); + +try { +final Method method = this.getClass().getDeclaredMethod(testToExecute, PrintWriter.class); +method.invoke(this, writer); +writer.println(testToExecute + "=true"); +} catch (Exception ex) { +final Throwable rootCause = ex instanceof InvocationTargetException ? ex.getCause() : ex; +writer.println(testToExecute + "=false"); +rootCause.printStackTrace(writer); +} +} + +public void testListContextTree(PrintWriter printWriter) throws NamingException { +namingBean.verifyListContext(printWriter); +} +} http://git-wip-us.apache.org/repos/asf/tomee/blob/52c72b62/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java -- diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java new file mode 100644 index 000..5459ac5 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java @@ -0,0 +1,104 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one
[7/9] tomee git commit: Address Otavio's comments
Address Otavio's comments Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/30244c97 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/30244c97 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/30244c97 Branch: refs/heads/master Commit: 30244c976a20c2a76b3717734362fd16fd74cb3b Parents: 663e4bf Author: Svetlin ZarevAuthored: Fri Jul 14 16:45:23 2017 +0300 Committer: Svetlin Zarev Committed: Fri Jul 14 16:45:23 2017 +0300 -- .../apache/openejb/arquillian/tests/naming/IvmContextTest.java| 2 +- .../org/apache/openejb/arquillian/tests/naming/NamingBean.java| 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tomee/blob/30244c97/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java -- diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java index a3eef2c..43da010 100644 --- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java @@ -41,7 +41,7 @@ public class IvmContextTest { private static final String CONTENT_LOCATION_EJB_JAR_XML = "org/apache/openejb/arquillian/tests/naming/list-context-ejbjar.xml"; @EJB -NamingBean namingBean; +private NamingBean namingBean; @Deployment(testable = false) public static WebArchive createDeployment() { http://git-wip-us.apache.org/repos/asf/tomee/blob/30244c97/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/NamingBean.java -- diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/NamingBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/NamingBean.java index 575a512..5d169ec 100644 --- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/NamingBean.java +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/NamingBean.java @@ -17,7 +17,6 @@ package org.apache.openejb.arquillian.tests.naming; -import org.apache.openejb.core.interceptor.Interceptor; import org.apache.openejb.core.ivm.naming.SystemComponentReference; import javax.ejb.LocalBean; @@ -70,7 +69,7 @@ public class NamingBean { private String getPrintedJndiTree(ByteArrayOutputStream buffer) { try { -return buffer.toString("utf-8"); +return buffer.toString(StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { return null; //should never happen }
[5/9] tomee git commit: Add junit test that verifies the behaviour IvmContext.list()
Add junit test that verifies the behaviour IvmContext.list() Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/97afaeb0 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/97afaeb0 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/97afaeb0 Branch: refs/heads/master Commit: 97afaeb01f454ecbccb21c09f8a87fc9f2caa141 Parents: 6379457 Author: Svetlin ZarevAuthored: Tue Jul 11 12:39:40 2017 +0300 Committer: Svetlin Zarev Committed: Tue Jul 11 13:36:15 2017 +0300 -- .../openejb/ivm/naming/IvmContextTest.java | 184 ++- 1 file changed, 178 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tomee/blob/97afaeb0/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java -- diff --git a/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java b/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java index 47cef26..e694791 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java @@ -21,13 +21,14 @@ import org.apache.openejb.core.ivm.naming.NameNode; import org.apache.openejb.util.Contexts; import org.junit.Test; -import javax.naming.Context; -import javax.naming.NamingException; +import javax.naming.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintWriter; import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; public class IvmContextTest { @Test @@ -105,7 +106,7 @@ public class IvmContextTest { try { ((Context) ((Context) context.lookup("global")).lookup("foo")) -.lookup("Bar"); +.lookup("Bar"); fail(); } catch (final NamingException ne) { // ok @@ -161,4 +162,175 @@ public class IvmContextTest { throw new AssertionError(); } } + +/* + * verify that list() will return only the subcontexts + */ +@Test +public void testContextList_rootContexts() throws NamingException { +final Map expected = new HashMap<>(); +expected.put("global", "global"); +expected.put("app", "app"); +expected.put("module", "module"); + +verifyListedContent(expected, ""); +} + +/* + * verify that list() will return the properties from + * both the normal and federated contexts + */ +@Test +public void testContextList_moduleEnvProperties() throws NamingException { +final Map expected = new HashMap<>(); +expected.put("federated-prop-1", "federated-prop-1"); +expected.put("federated-prop-2", "federated-prop-2"); +expected.put("federated-prop-3", "federated-prop-3"); +expected.put("prop-1", "prop-1"); +expected.put("prop-2", "prop-2"); +expected.put("prop-3", "prop-3"); + +verifyListedContent(expected, "module/env/properties"); +} + +/* + * verify that list() will return the correct number of contexts and properties + * Some of the contexts appear twice -> i.e there is a federated and ordinary "configurations" + */ +@Test +public void testContextList_moduleEnv() throws NamingException { +final Map expected = new HashMap<>(); +expected.put("properties", "properties"); +expected.put("configurations", "configurations"); +expected.put("env-1", "env-1"); +expected.put("env-2", "env-2"); +expected.put("env-3", "env-3"); + +verifyListedContent(expected, "module/env"); +} + +public void verifyListedContent(Map expected, String address) throws NamingException { +final IvmContext root = createTestIvmContext(); +final NamingEnumeration resultSet = root.list(address); + +int numberOfListedItems = 0; +while (resultSet.hasMoreElements()) { +final NameClassPair nameClassPair = resultSet.nextElement(); +final String name = nameClassPair.getName(); +final Object expectedObject = expected.get(name); +assertNotNull("The expected set does not contain object with name: " + name, expectedObject); + +//Intentionally use the whole address and lookup from the root node: TOMEE-2087 +final Object actualObject = root.lookup(address + "/" +
[3/9] tomee git commit: Simplify the test and add test case for listBindings()
Simplify the test and add test case for listBindings() Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/da488afb Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/da488afb Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/da488afb Branch: refs/heads/master Commit: da488afbd93489a65b483ce1ac35052728f2a9d6 Parents: 52c72b6 Author: Svetlin ZarevAuthored: Tue Jul 11 10:20:08 2017 +0300 Committer: Svetlin Zarev Committed: Tue Jul 11 10:20:08 2017 +0300 -- .../tests/naming/IvmContextServlet.java | 55 --- .../arquillian/tests/naming/IvmContextTest.java | 55 +++ .../arquillian/tests/naming/NamingBean.java | 58 +--- 3 files changed, 59 insertions(+), 109 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tomee/blob/da488afb/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextServlet.java -- diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextServlet.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextServlet.java deleted file mode 100644 index d4db5c8..000 --- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextServlet.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.openejb.arquillian.tests.naming; - - -import javax.ejb.EJB; -import javax.naming.NamingException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -public class IvmContextServlet extends HttpServlet { -@EJB -NamingBean namingBean; - -@Override -protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { -final PrintWriter writer = resp.getWriter(); -final String testToExecute = req.getParameter("test"); - -try { -final Method method = this.getClass().getDeclaredMethod(testToExecute, PrintWriter.class); -method.invoke(this, writer); -writer.println(testToExecute + "=true"); -} catch (Exception ex) { -final Throwable rootCause = ex instanceof InvocationTargetException ? ex.getCause() : ex; -writer.println(testToExecute + "=false"); -rootCause.printStackTrace(writer); -} -} - -public void testListContextTree(PrintWriter printWriter) throws NamingException { -namingBean.verifyListContext(printWriter); -} -} http://git-wip-us.apache.org/repos/asf/tomee/blob/da488afb/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java -- diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java index 5459ac5..a3eef2c 100644 --- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/IvmContextTest.java @@ -21,22
[6/9] tomee git commit: Fix typos, add clarifications
Fix typos, add clarifications Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/663e4bf0 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/663e4bf0 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/663e4bf0 Branch: refs/heads/master Commit: 663e4bf0aaf131b010df1c6173f7fdeb0227f4d9 Parents: 97afaeb Author: Svetlin ZarevAuthored: Tue Jul 11 13:45:38 2017 +0300 Committer: Svetlin Zarev Committed: Tue Jul 11 13:45:38 2017 +0300 -- .../java/org/apache/openejb/ivm/naming/IvmContextTest.java | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tomee/blob/663e4bf0/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java -- diff --git a/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java b/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java index e694791..a0c629a 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/ivm/naming/IvmContextTest.java @@ -195,7 +195,8 @@ public class IvmContextTest { /* * verify that list() will return the correct number of contexts and properties - * Some of the contexts appear twice -> i.e there is a federated and ordinary "configurations" + * Some of the contexts have two internal instances -> i.e there is a federated + * and ordinary "configurations" */ @Test public void testContextList_moduleEnv() throws NamingException { @@ -232,7 +233,7 @@ public class IvmContextTest { } if (numberOfListedItems != expected.size()) { -fail("IvmContext.list() returned fifferent number of elements than expected. " + +fail("IvmContext.list() returned different number of elements than expected. " + "Expected=" + expected.size() + "\tActual=" + numberOfListedItems); } } @@ -308,6 +309,7 @@ public class IvmContextTest { writer.print("\t[looking up: " + (ctxName + "/" + name) + "]"); try { +//Intentionally lookup from the "current" context object using the relative name: TOMEE-2087 final Object object = context.lookup(name); if (object instanceof Context) { subContexts.put((Context) object, ctxName + "/" + name);
[8/9] tomee git commit: Merging PR from SvetlinZarev. Thank you very much.
Merging PR from SvetlinZarev. Thank you very much. Merge remote-tracking branch 'github/pr/88' Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/22643f97 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/22643f97 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/22643f97 Branch: refs/heads/master Commit: 22643f970d3db8215985c7ca4de6321e160e3f57 Parents: be253de 30244c9 Author: Jean-Louis MonteiroAuthored: Wed Jul 19 10:39:21 2017 +0200 Committer: Jean-Louis Monteiro Committed: Wed Jul 19 10:39:21 2017 +0200 -- .../arquillian/tests/naming/IvmContextTest.java | 67 +++ .../arquillian/tests/naming/NamingBean.java | 135 ++ .../tests/naming/list-context-ejbjar.xml| 38 .../openejb/core/ivm/naming/IvmContext.java | 22 +-- .../openejb/ivm/naming/IvmContextTest.java | 186 ++- 5 files changed, 430 insertions(+), 18 deletions(-) --
[4/9] tomee git commit: Fix typos in comments
Fix typos in comments Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/63794572 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/63794572 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/63794572 Branch: refs/heads/master Commit: 63794572b059a0131dc32c443d537dde49f03e70 Parents: da488af Author: Svetlin ZarevAuthored: Tue Jul 11 11:41:02 2017 +0300 Committer: Svetlin Zarev Committed: Tue Jul 11 11:41:02 2017 +0300 -- .../apache/openejb/arquillian/tests/naming/NamingBean.java | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tomee/blob/63794572/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/NamingBean.java -- diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/NamingBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/NamingBean.java index abf2d8d..575a512 100644 --- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/NamingBean.java +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/naming/NamingBean.java @@ -79,8 +79,8 @@ public class NamingBean { /* * Verifies TOMEE-2087: context.list()/listBindings() * returns more entries than it should. The false positives -* cannot be looked up, so try to execute the context and look -* up every name-class pair. If the lookup fails, then execute() +* cannot be looked up, so try to list the context and look +* up every name-class pair. If the lookup fails, then list() * returns incorrect results. */ private static boolean listContext(Context context, String ctxName, ListOperation listOperation, PrintWriter writer) throws javax.naming.NamingException { @@ -102,8 +102,8 @@ public class NamingBean { /* * Skip the SystemComponentReference because they might internally - * throw NameNotFoundException althoug being correctly bound to the - * provided name. + * throw NameNotFoundException although being correctly bound to + * the provided name. */ if (!SystemComponentReference.class.getName().equals(className)) { try { @@ -133,5 +133,4 @@ public class NamingBean { return hasErrors; } - }
[1/9] tomee git commit: Fix TOMEE-2087 - Correctly list the IvmContext content
Repository: tomee Updated Branches: refs/heads/master 8ed192c8e -> bfaefb36e Fix TOMEE-2087 - Correctly list the IvmContext content Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/f575f1c4 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/f575f1c4 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/f575f1c4 Branch: refs/heads/master Commit: f575f1c4bd227cc2d3f54fe4d779319fb1bc40b8 Parents: 04ab19b Author: Svetlin ZarevAuthored: Sun Jul 9 17:23:51 2017 +0300 Committer: Svetlin Zarev Committed: Sun Jul 9 20:47:05 2017 +0300 -- .../openejb/core/ivm/naming/IvmContext.java | 22 +--- 1 file changed, 10 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tomee/blob/f575f1c4/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java -- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java index e172743..4396df5 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java @@ -571,7 +571,7 @@ public class IvmContext implements Context, Serializable { vect.addElement(node); } -gatherNodes(mynode, node, vect); +gatherNodes(parentNode, node, vect); buildEnumeration(vect); } @@ -582,8 +582,9 @@ public class IvmContext implements Context, Serializable { addInListIfNeeded(initiallyRequestedNode, node.getLessTree(), vect); addInListIfNeeded(initiallyRequestedNode, node.getGrtrTree(), vect); addInListIfNeeded(initiallyRequestedNode, node.getSubTree(), vect); -if (NameNode.Federation.class.isInstance(node.getObject())) { // tomcat mainly -for (final Context c : NameNode.Federation.class.cast(node.getObject())) { + +if (NameNode.Federation.class.isInstance(initiallyRequestedNode.getObject())) { // tomcat mainly +for (final Context c : NameNode.Federation.class.cast(initiallyRequestedNode.getObject())) { if (c == IvmContext.this || !IvmContext.class.isInstance(c)) { continue; } @@ -612,17 +613,14 @@ public class IvmContext implements Context, Serializable { if (node.getParent() == parent) { return true; } -if (node.getParentTree() == node.getParent()) { // no need to browse the tree -return false; -} -NameNode current = node.getParentTree(); -while (current != null) { -if (current == parent) { -return true; -} -current = current.getParentTree(); +/* + * Handle the special case of the top-level contexts like global, module, app, etc + */ +if (null == node.getParent() && null == parent.getParentTree()) { +return true; } + return false; }
[jira] [Commented] (TOMEE-2087) IvmContext.list() does not correctly list the context content
[ https://issues.apache.org/jira/browse/TOMEE-2087?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16092791#comment-16092791 ] ASF GitHub Bot commented on TOMEE-2087: --- Github user jeanouii commented on the issue: https://github.com/apache/tomee/pull/88 Hi, As discussed and agreed on the mailing list, I'll be merging this PR on master. Thanks you very much for you contribution, code wise, but also on the mailing list. JLouis > IvmContext.list() does not correctly list the context content > - > > Key: TOMEE-2087 > URL: https://issues.apache.org/jira/browse/TOMEE-2087 > Project: TomEE > Issue Type: Bug >Reporter: Svetlin Zarev >Priority: Critical > Attachments: sample.zip > > > MyNamingEnumeration.gatherNodes() adds the wrong federated context entries in > the result set (related to TOMEE-2086 - it was indeed a typo, but we "fixed" > it with the wrong NameNode). > Another issue is with MyNamingEnumeration.isMyChild() which considers entries > that are NOT children to the "parent" tree as such > One more issue is that the wrong parentNode is passed as argument to > gatherNodes in case we are listing the context for any "IvmContext != this" > To give an example: > Expected context content: > {code} > ### Context: /module > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.assembler.classic.JndiBuilder$ContextualEjbLookup > [looking up: TestEJB!org.example.TestEJB] [Value]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: TestEJB > Class=org.apache.openejb.assembler.classic.JndiBuilder$ContextualEjbLookup > [looking up: TestEJB] [Value]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: ModuleName Class=java.lang.String [looking up: ModuleName] > [Value]: > Name: env Class=org.apache.naming.NamingContext [looking up: env] > [Value]: org.apache.naming.NamingContext@1bb2d0a8 > ### Context: /module/env > Name: nameClass=java.lang.String [looking up: name] [Value]: > module-env > {code} > Actual context content: > {code} > ### Context: /module > Name: global Class=org.apache.openejb.core.ivm.naming.IvmContext > [looking up: global]> Failed to lookup: global > Name: dummy Class=java.lang.String [looking up: dummy] > Failed to > lookup: dummy > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB!org.example.TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: ModuleName Class=java.lang.String [looking up: ModuleName] > [Value]: > Name: env Class=org.apache.openejb.core.ivm.naming.IvmContext > [looking up: env] [Value]: IvmContext{mynode=} > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB!org.example.TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > Name: TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB] [Reference]: > proxy=org.example.TestEJB;deployment=ROOT//TestEJB;pk=null > ### Context: /module/env > Name: TestEJB!org.example.TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB!org.example.TestEJB] > Failed to lookup: > TestEJB!org.example.TestEJB > Name: TestEJB > Class=org.apache.openejb.core.ivm.naming.BusinessLocalBeanReference > [looking up: TestEJB] > Failed to lookup: TestEJB > Name: nameClass=java.lang.String [looking up: name] [Value]: > module-env > {code} > Note the "failed too lookup..." messages - these are all objects that MUST > NOT be listed as part of that context. > I'm attaching an application that reproduces the issue. > Requesting it like "http://localhost:8080/?ejb; will print tomee's naming tree > Requesting it like "http://localhost:8080; will print tomcat's naming tree -- This message was sent by Atlassian JIRA (v6.4.14#64029)