Author: kelvingoodson
Date: Wed Feb 20 03:52:22 2008
New Revision: 629430
URL: http://svn.apache.org/viewvc?rev=629430&view=rev
Log:
Reintroducing the dependency on the backport concurrent library that was
introduced in TUSCANY-1006 for java 1.4 support and inadvertantly removed in
commit r579414. Adding a test to ensure that we have a specific threadsafe
hashmap on the classpath, rather than letting ChangeSummaryImpl fall back on
Collections.synchronizedMap(new HashMap()). Have tested against maven 2.0.7
and a clean repo, which was the issue reported in the above referenced commit.
Added:
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ImplSpecificTestCase.java
(with props)
Modified:
incubator/tuscany/java/sdo/distribution/src/main/release/bin/LICENSE
incubator/tuscany/java/sdo/impl/pom.xml
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java
Modified: incubator/tuscany/java/sdo/distribution/src/main/release/bin/LICENSE
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/distribution/src/main/release/bin/LICENSE?rev=629430&r1=629429&r2=629430&view=diff
==============================================================================
--- incubator/tuscany/java/sdo/distribution/src/main/release/bin/LICENSE
(original)
+++ incubator/tuscany/java/sdo/distribution/src/main/release/bin/LICENSE Wed
Feb 20 03:52:22 2008
@@ -400,3 +400,21 @@
For the StAX components (stax-api-1.0.1.jar and wstx-asl-3.2.1.jar)
These components are covered by the Apache License Version 2.0, January 2004,
as above.
+
+========================================================================================================================
+
+For the backport-util-concurrent-3.0.jar library
+
+Creative Commons Public Domain Dedication
+
+Copyright-Only Dedication (based on United States law) or Public Domain
Certification
+
+The person or persons who have associated work with this document (the
"Dedicator" or "Certifier") hereby either (a) certifies that, to the best of
his knowledge, the work of authorship identified is in the public domain of the
country from which the work is published, or (b) hereby dedicates whatever
copyright the dedicators holds in the work of authorship identified below (the
"Work") to the public domain. A certifier, moreover, dedicates any copyright
interest he may have in the associated work, and for these purposes, is
described as a "dedicator" below.
+
+A certifier has taken reasonable steps to verify the copyright status of this
work. Certifier recognizes that his good faith efforts may not shield him from
liability if in fact the work certified is not in the public domain.
+
+Dedicator makes this dedication for the benefit of the public at large and to
the detriment of the Dedicator's heirs and successors. Dedicator intends this
dedication to be an overt act of relinquishment in perpetuity of all present
and future rights under copyright law, whether vested or contingent, in the
Work. Dedicator understands that such relinquishment of all rights includes the
relinquishment of all rights to enforce (by lawsuit or otherwise) those
copyrights in the Work.
+
+Dedicator recognizes that, once placed in the public domain, the Work may be
freely reproduced, distributed, transmitted, used, modified, built upon, or
otherwise exploited by anyone for any purpose, commercial or non-commercial,
and in any way, including by methods that have not yet been invented or
conceived.
+
+
Modified: incubator/tuscany/java/sdo/impl/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/pom.xml?rev=629430&r1=629429&r2=629430&view=diff
==============================================================================
--- incubator/tuscany/java/sdo/impl/pom.xml (original)
+++ incubator/tuscany/java/sdo/impl/pom.xml Wed Feb 20 03:52:22 2008
@@ -75,11 +75,11 @@
<scope>compile</scope>
</dependency>
- <!-- dependency>
+ <dependency>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
<version>3.0</version>
- </dependency -->
+ </dependency>
<!-- dependencies for optional code generation functions -->
<dependency>
Modified:
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java?rev=629430&r1=629429&r2=629430&view=diff
==============================================================================
---
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java
(original)
+++
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java
Wed Feb 20 03:52:22 2008
@@ -68,6 +68,7 @@
suite.addTestSuite(ExpectedExceptionsTestCase.class);
suite.addTestSuite(TypeHelperTestCase.class);
suite.addTestSuite(NotificationTestCase.class);
+ suite.addTestSuite(ImplSpecificTestCase.class);
return suite;
}
Added:
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ImplSpecificTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ImplSpecificTestCase.java?rev=629430&view=auto
==============================================================================
---
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ImplSpecificTestCase.java
(added)
+++
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ImplSpecificTestCase.java
Wed Feb 20 03:52:22 2008
@@ -0,0 +1,74 @@
+/**
+ *
+ * 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.tuscany.sdo.test;
+
+import junit.framework.TestCase;
+
+public class ImplSpecificTestCase extends TestCase {
+
+ public void testThreadSafeHashmapIsAvailable() {
+ // this will fail if using Java 1.4.x and the backport library has been
removed from the classpath.
+ // It is here because ChangeSummaryImpl contains the same logic for
finding a threadsafe hashmap implementation
+ // but it will fallback to a synchronized hashmap
+ // if no threadsafe hashmap is available, hence no test failure will
occur, but a performance hit
+ // will. This test is here top show a failure with java 1.4 to ensure
that no-one removes the backport
+ // dependency introduced for TUSCANY-1006.
+ assertNotNull(loadConcurrentHashMapClazz());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ }
+
+ private static String[] concurrentHashMapClazzNames = new String[] {
+ "java.util.concurrent.ConcurrentHashMap",
+ "edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap"};
+
+ private static Class loadConcurrentHashMapClazz()
+ {
+ Class mapClazz = null;
+ for (int i = 0; i < concurrentHashMapClazzNames.length; i++)
+ {
+ String concurrentHashMapClazzName = concurrentHashMapClazzNames[i];
+ try
+ {
+ mapClazz = Class.forName(concurrentHashMapClazzName, true,
Thread.currentThread().getContextClassLoader());
+ }
+ catch (Exception ignored) {}
+ if (mapClazz != null)
+ {
+ break;
+ }
+ try
+ {
+ mapClazz = Class.forName(concurrentHashMapClazzName);
+ }
+ catch (Exception ignored) {}
+ if (mapClazz != null)
+ {
+ break;
+ }
+ }
+ // System.out.println("threadsafe hashmap = " + mapClazz.getName());
+ return mapClazz;
+ }
+
+}
Propchange:
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ImplSpecificTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ImplSpecificTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]