This is an automated email from the ASF dual-hosted git repository. jgallimore pushed a commit to branch tomee-1.7.x in repository https://gitbox.apache.org/repos/asf/tomee.git
commit d676a1de27ccbbb7932891a509d8a797143130c5 Author: Jonathan Gallimore <[email protected]> AuthorDate: Wed Jul 8 21:09:14 2020 +0100 Fix backport issues --- .../java/org/apache/openejb/util/URISupport.java | 4 +++- .../org/apache/openejb/activemq/ServerUrlTest.java | 23 +++++++++++++++------- .../org/apache/openejb/util/URISupportTest.java | 10 +++++----- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/URISupport.java b/container/openejb-core/src/main/java/org/apache/openejb/util/URISupport.java index 8e197ba..a39b0b7 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/util/URISupport.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/util/URISupport.java @@ -23,8 +23,10 @@ import java.net.URISyntaxException; import java.net.URLDecoder; import java.net.URLEncoder; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; +import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -391,7 +393,7 @@ public class URISupport { return uri; } - final Map<String, String> parameters = new HashMap<>(parseParamters(uri)); + final Map<String, String> parameters = new HashMap<String, String>(parseParamters(uri)); final Set<String> keys = newParameters.keySet(); for (final String key : keys) { diff --git a/container/openejb-core/src/test/java/org/apache/openejb/activemq/ServerUrlTest.java b/container/openejb-core/src/test/java/org/apache/openejb/activemq/ServerUrlTest.java index 906bcfb..17588bc 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/activemq/ServerUrlTest.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/activemq/ServerUrlTest.java @@ -16,9 +16,10 @@ */ package org.apache.openejb.activemq; +import org.apache.openejb.jee.StatelessBean; import org.apache.openejb.junit.ApplicationComposer; -import org.apache.openejb.testing.Classes; import org.apache.openejb.testing.Configuration; +import org.apache.openejb.testing.Module; import org.apache.openejb.testing.SimpleLog; import org.apache.openejb.testng.PropertiesBuilder; import org.junit.Assert; @@ -27,20 +28,18 @@ import org.junit.runner.RunWith; import javax.annotation.Resource; import javax.ejb.EJB; -import javax.ejb.Singleton; +import javax.ejb.Stateless; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; -import javax.resource.ResourceException; import java.util.Properties; @SimpleLog @RunWith(ApplicationComposer.class) -@Classes(cdi = true, innerClassesAsBean = true) public class ServerUrlTest { @EJB - private ConnectionTestBean testBean; + private ConnectionTest testBean; @Configuration public Properties config() { @@ -54,6 +53,11 @@ public class ServerUrlTest { .build(); } + @Module + public StatelessBean jar() { + return new StatelessBean(ConnectionTestBean.class); + } + @Test public void test() throws Exception { try { @@ -64,8 +68,13 @@ public class ServerUrlTest { } } - @Singleton - public static class ConnectionTestBean { + public interface ConnectionTest { + void testConnection() throws Exception; + } + + + @Stateless + public static class ConnectionTestBean implements ConnectionTest { @Resource private ConnectionFactory cf; diff --git a/container/openejb-core/src/test/java/org/apache/openejb/util/URISupportTest.java b/container/openejb-core/src/test/java/org/apache/openejb/util/URISupportTest.java index 0e784a6..fce4919 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/util/URISupportTest.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/util/URISupportTest.java @@ -52,7 +52,7 @@ public class URISupportTest extends TestCase { } public void testAddNewParameters() throws Exception { - final Map<String, String> parameters = new HashMap<>(); + final Map<String, String> parameters = new HashMap<String, String>(); parameters.put("create", "false"); final URI uri = URISupport.addParameters(URLs.uri("vm://broker"), parameters); @@ -60,7 +60,7 @@ public class URISupportTest extends TestCase { } public void testDoNotReplaceAnExistingParameters() throws Exception { - final Map<String, String> parameters = new HashMap<>(); + final Map<String, String> parameters = new HashMap<String, String>(); parameters.put("create", "false"); final URI uri = URISupport.addParameters(URLs.uri("vm://broker?create=true"), parameters); @@ -68,7 +68,7 @@ public class URISupportTest extends TestCase { } public void testAddToSetOfAlreadyExistingParameters() throws Exception { - final Map<String, String> parameters = new HashMap<>(); + final Map<String, String> parameters = new HashMap<String, String>(); parameters.put("create", "false"); final URI uri = URISupport.addParameters(URLs.uri("vm://broker?foo=bar&boo=baz&welcome=helloworld"), parameters); @@ -82,7 +82,7 @@ public class URISupportTest extends TestCase { } public void testAddToSetOfAlreadyExistingParametersButDontOverwriteExistingParameter() throws Exception { - final Map<String, String> parameters = new HashMap<>(); + final Map<String, String> parameters = new HashMap<String, String>(); parameters.put("create", "false"); final URI uri = URISupport.addParameters(URLs.uri("vm://broker?foo=bar&boo=baz&welcome=helloworld&create=true"), parameters); @@ -104,7 +104,7 @@ public class URISupportTest extends TestCase { public void testEmptyParameters() throws Exception { final URI initial = URLs.uri("vm://broker?foo=bar&boo=baz&welcome=helloworld&create=true"); - final URI uri = URISupport.addParameters(initial, Collections.emptyMap()); + final URI uri = URISupport.addParameters(initial, Collections.<String, String>emptyMap()); assertEquals(initial, uri); }
