tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andygumbre...@apache.org
Subject tomee git commit: #TOMEE-1799 - Comparison method violates its general contract
Date Thu, 05 May 2016 11:12:30 GMT
Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x b55658459 -> 4923fa0fd


#TOMEE-1799 - Comparison method violates its general contract

https://issues.apache.org/jira/browse/TOMEE-1799


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/4923fa0f
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/4923fa0f
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/4923fa0f

Branch: refs/heads/tomee-1.7.x
Commit: 4923fa0fd4ea22750609f2aecd9ce2f2d8a38419
Parents: b556584
Author: AndyGee <andy.is@gmx.de>
Authored: Thu May 5 13:12:04 2016 +0200
Committer: AndyGee <andy.is@gmx.de>
Committed: Thu May 5 13:12:04 2016 +0200

----------------------------------------------------------------------
 .../org/apache/openejb/config/AutoConfig.java   |  32 +-
 .../apache/openejb/config/AutoConfigTest.java   | 448 +++++++++++++++++++
 2 files changed, 476 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/4923fa0f/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
b/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
index c525b80..d850fa9 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
@@ -22,7 +22,30 @@ import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.assembler.classic.ContainerInfo;
 import org.apache.openejb.assembler.classic.ResourceInfo;
 import org.apache.openejb.config.sys.Resource;
-import org.apache.openejb.jee.*;
+import org.apache.openejb.jee.ActivationConfig;
+import org.apache.openejb.jee.ActivationConfigProperty;
+import org.apache.openejb.jee.AdminObject;
+import org.apache.openejb.jee.AssemblyDescriptor;
+import org.apache.openejb.jee.ConnectionDefinition;
+import org.apache.openejb.jee.Connector;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.EntityBean;
+import org.apache.openejb.jee.InboundResourceadapter;
+import org.apache.openejb.jee.InjectionTarget;
+import org.apache.openejb.jee.JndiConsumer;
+import org.apache.openejb.jee.JndiReference;
+import org.apache.openejb.jee.MessageDestination;
+import org.apache.openejb.jee.MessageDestinationRef;
+import org.apache.openejb.jee.MessageDrivenBean;
+import org.apache.openejb.jee.MessageListener;
+import org.apache.openejb.jee.OutboundResourceAdapter;
+import org.apache.openejb.jee.PersistenceContextRef;
+import org.apache.openejb.jee.PersistenceRef;
+import org.apache.openejb.jee.PersistenceType;
+import org.apache.openejb.jee.ResourceAdapter;
+import org.apache.openejb.jee.ResourceRef;
+import org.apache.openejb.jee.SessionBean;
+import org.apache.openejb.jee.SessionType;
 import org.apache.openejb.jee.jpa.unit.Persistence;
 import org.apache.openejb.jee.jpa.unit.PersistenceUnit;
 import org.apache.openejb.jee.jpa.unit.TransactionType;
@@ -1997,14 +2020,15 @@ public class AutoConfig implements DynamicDeployer, JndiConstants
{
         Collections.sort(resourceIds, new Comparator<String>() { // sort from webapp
to global resources
             @Override
             public int compare(final String o1, final String o2) { // don't change global
order, just put app scoped resource before others
-                if (o1.startsWith(prefix) && o2.startsWith(prefix)) {
+                  if (o1.startsWith(prefix) && o2.startsWith(prefix)) {
                     return resourceIds.indexOf(o1) - resourceIds.indexOf(o2);
                 } else if (o1.startsWith(prefix)) {
                     return -1;
                 } else if (o2.startsWith(prefix)) {
                     return 1;
+                } else {
+                    return resourceIds.indexOf(o2) - resourceIds.indexOf(o1);
                 }
-                return resourceIds.indexOf(o1) - resourceIds.indexOf(o2);
             }
         });
         String idd = null;
@@ -2195,7 +2219,7 @@ public class AutoConfig implements DynamicDeployer, JndiConstants {
         return null;
     }
 
-    private static class AppResources {
+    protected static class AppResources {
 
         private String appId;
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/4923fa0f/container/openejb-core/src/test/java/org/apache/openejb/config/AutoConfigTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/AutoConfigTest.java
b/container/openejb-core/src/test/java/org/apache/openejb/config/AutoConfigTest.java
new file mode 100644
index 0000000..55d4f9f
--- /dev/null
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/AutoConfigTest.java
@@ -0,0 +1,448 @@
+/*
+ * 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.config;
+
+import org.apache.openejb.config.sys.Resource;
+import org.apache.openejb.jee.EjbJar;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.lang.reflect.Method;
+import java.util.Properties;
+
+public class AutoConfigTest {
+
+    private final String[] list = new String[]{"def-monitor-internal/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "def-monitor-internal/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "def-monitor-internal/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "def-monitor-internal/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "def-monitor-internal/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "def-monitor-internal/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "def-monitor-internal/jdbc/email-jta",
+            "jdbc/email-jta",
+            "def-monitor-internal/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "def-monitor-internal/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "def-monitor-internal/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "def-monitor-internal/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "def-monitor-internal/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "def-monitor-internal/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "appmgr/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "appmgr/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "appmgr/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "appmgr/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "appmgr/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "appmgr/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "appmgr/jdbc/email-jta",
+            "jdbc/email-jta",
+            "appmgr/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "appmgr/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "appmgr/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "appmgr/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "appmgr/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "appmgr/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-catalog-opq-uvw-jkl-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-catapp-product-rest-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-catapp-product-rest-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-catapp-product-rest-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-catapp-product-rest-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-catapp-product-rest-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-catapp-product-rest-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-catapp-product-rest-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-catapp-product-rest-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-catapp-product-rest-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-catapp-product-rest-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-catapp-product-rest-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-catapp-product-rest-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-catapp-product-rest-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-checkout-uvw-jkl-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-clip-uvw-jkl-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-clip-uvw-jkl-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-clip-uvw-jkl-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-clip-uvw-jkl-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-clip-uvw-jkl-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-clip-uvw-jkl-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-clip-uvw-jkl-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-clip-uvw-jkl-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-clip-uvw-jkl-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-clip-uvw-jkl-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-clip-uvw-jkl-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-clip-uvw-jkl-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-clip-uvw-jkl-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-countrydata-uvw-jkl-external-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-ghi-uvw-jkl-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-hazmat-uvw-jkl-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-oc-download-uvw-jkl-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-xy-itemdetail-accessories-uvw-jkl-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-xy-itemdetail-header-uvw-jkl-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-resilience-hystrix-config-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-resilience-hystrix-config-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-resilience-hystrix-config-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-resilience-hystrix-config-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-resilience-hystrix-config-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-resilience-hystrix-config-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-resilience-hystrix-config-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-resilience-hystrix-config-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-resilience-hystrix-config-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-resilience-hystrix-config-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-resilience-hystrix-config-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-resilience-hystrix-config-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-resilience-hystrix-config-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-resilience-hystrix-monitoring-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/appmgr-jta",
+            "jdbc/appmgr-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/erp_global-jta",
+            "jdbc/erp_global-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/catalog-jta",
+            "jdbc/catalog-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/erp-jta",
+            "jdbc/erp-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/ghi-jta",
+            "jdbc/ghi-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/usr-jta",
+            "jdbc/usr-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/email-jta",
+            "jdbc/email-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/webcode-jta",
+            "jdbc/webcode-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/webcode-download-jta",
+            "jdbc/webcode-download-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/countrydata-jta",
+            "jdbc/countrydata-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/clipsafe-jta",
+            "jdbc/clipsafe-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/hazmat-jta",
+            "jdbc/hazmat-jta",
+            "abc-jkl-uvw-jkl-web/jdbc/waab-refapp-jta",
+            "jdbc/waab-refapp-jta"};
+
+    @Test
+    public void testFirstMatching() throws Exception {
+        final ConfigurationFactory cf = new ConfigurationFactory();
+        final AutoConfig ac = new AutoConfig(cf);
+
+        final AppModule appModule = new AppModule(new EjbModule(new EjbJar()));
+
+        for (final String s : list) {
+            appModule.getResources().add(new Resource(s, "DataSource"));
+        }
+
+        final AutoConfig.AppResources resources = new AutoConfig.AppResources(appModule);
+
+        final Method m = ac.getClass().getDeclaredMethod("firstMatching", String.class, String.class,
Properties.class, AutoConfig.AppResources.class);
+        m.setAccessible(true);
+
+        for (final String s : list) {
+            final String prefix = s.substring(0, s.indexOf('/'));
+            final String result = (String) m.invoke(ac, prefix, "DataSource", new Properties(),
resources);
+            Assert.assertTrue(result.startsWith(prefix));
+        }
+
+        String result = (String) m.invoke(ac, "abc-jkl-uvw-jkl-web", "DataSource", new Properties(),
resources);
+        Assert.assertEquals("abc-jkl-uvw-jkl-web/jdbc/appmgr-jta", result);
+
+        result = (String) m.invoke(ac, "jdbc", "DataSource", new Properties(), resources);
+        Assert.assertEquals("jdbc/appmgr-jta", result);
+    }
+}
\ No newline at end of file


Mime
View raw message