directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject [directory-server] branch master updated: Fix OSGi issues with ehcache 3
Date Sun, 06 Jan 2019 02:08:50 GMT
This is an automated email from the ASF dual-hosted git repository.

seelmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b599ac  Fix OSGi issues with ehcache 3
5b599ac is described below

commit 5b599ac0908db317c1206724eb2608e019799768
Author: Stefan Seelmann <mail@stefan-seelmann.de>
AuthorDate: Sun Jan 6 03:08:16 2019 +0100

    Fix OSGi issues with ehcache 3
    
    * Downgrade to ehcache 3.5.3
    * Use bundle classloader when loading XML config
    * Add new OSGi test that starts a server
---
 core-api/pom.xml                                   | 11 ++---
 .../directory/server/core/api/CacheService.java    |  2 +-
 .../osgi/integ/ServerCoreAnnotationsOsgiTest.java  | 48 ++++++++++++++++++++++
 pom.xml                                            |  3 +-
 4 files changed, 55 insertions(+), 9 deletions(-)

diff --git a/core-api/pom.xml b/core-api/pom.xml
index b4752e6..8fe0cdd 100644
--- a/core-api/pom.xml
+++ b/core-api/pom.xml
@@ -111,7 +111,6 @@
       <groupId>org.ehcache</groupId>
       <artifactId>ehcache</artifactId>
     </dependency>
-
   </dependencies>
 
   <build>
@@ -158,10 +157,10 @@
             <Bundle-SymbolicName>${project.groupId}.core.api</Bundle-SymbolicName>
             <Export-Package>
                 org.ehcache;version=${ehcache.version},
-                org.ehcache.Cache;version=${ehcache.version},
                 org.ehcache.config;version=${ehcache.version},
                 org.ehcache.config.builders;version=${ehcache.version},
                 org.ehcache.xml;version=${ehcache.version},
+                org.ehcache.xml.model;version=${ehcache.version},
                 org.ehcache.xml.exceptions;version=${ehcache.version},
                 org.apache.directory.server.core.api;version=${project.version},
                 org.apache.directory.server.core.api.administrative;version=${project.version},
@@ -181,12 +180,10 @@
                 org.apache.directory.server.core.api.sp.java;version=${project.version},
                 org.apache.directory.server.core.api.subtree;version=${project.version}
             </Export-Package>
+            <Require-Bundle>
+                org.ehcache.ehcache;bundle-version=${ehcache.version}
+            </Require-Bundle>
             <Import-Package>
-                org.ehcache;version=${ehcache.version},
-                org.ehcache.Cache;version=${ehcache.version},
-                org.ehcache.config.builders;version=${ehcache.version},
-                org.ehcache.xml;version=${ehcache.version},
-                org.ehcache.xml.exceptions;version=${ehcache.version},
                 org.apache.commons.lang3;version=${commons.lang.version},
                 org.apache.directory.api.asn1.util;version=${org.apache.directory.api.version},
                 org.apache.directory.api.i18n;version=${org.apache.directory.api.version},
diff --git a/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
b/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
index f0335f8..0ef6331 100644
--- a/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
+++ b/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
@@ -138,7 +138,7 @@ public class CacheService
             {
                 LOG.info( "no custom cache configuration was set, loading the default cache
configuration" );
                 cc = new XmlConfiguration( getClass( ).getClassLoader( ).getResource(
-                    DIRECTORY_CACHESERVICE_XML ) );
+                    DIRECTORY_CACHESERVICE_XML ), getClass().getClassLoader() );
             }
             else
             {
diff --git a/osgi-integ/src/test/java/org/apache/directory/server/osgi/integ/ServerCoreAnnotationsOsgiTest.java
b/osgi-integ/src/test/java/org/apache/directory/server/osgi/integ/ServerCoreAnnotationsOsgiTest.java
new file mode 100644
index 0000000..818aad8
--- /dev/null
+++ b/osgi-integ/src/test/java/org/apache/directory/server/osgi/integ/ServerCoreAnnotationsOsgiTest.java
@@ -0,0 +1,48 @@
+/*
+ *   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.directory.server.osgi.integ;
+
+
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory;
+
+
+public class ServerCoreAnnotationsOsgiTest extends ServerOsgiTestBase
+{
+
+    @Override
+    protected String getBundleName()
+    {
+        return "org.apache.directory.server.core.annotations";
+    }
+
+
+    @Override
+    protected void useBundleClasses() throws Exception
+    {
+        DefaultDirectoryServiceFactory factory = new DefaultDirectoryServiceFactory();
+        factory.init( "foo" );
+        DirectoryService ds = factory.getDirectoryService();
+        assertNotNull( ds );
+    }
+
+}
diff --git a/pom.xml b/pom.xml
index 6d6407a..2af90d7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,7 +64,8 @@
     <commons.net.version>3.6</commons.net.version>
     <commons.pool.version>2.6.0</commons.pool.version>
     <dnsjava.version>2.1.8</dnsjava.version>
-    <ehcache.version>3.6.1</ehcache.version>
+    <!-- OSGi related issue in ehcache 3.6.x: https://github.com/ehcache/ehcache3/issues/2554
-->
+    <ehcache.version>3.5.3</ehcache.version>
     <findbugs.annotations.version>1.0.0</findbugs.annotations.version>
     <jetty.version>9.4.14.v20181114</jetty.version>
     <!-- The Jetty bundle exports are using version 9.4.5, not 9.4.5.v20170502... -->


Mime
View raw message