You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2015/11/25 10:58:20 UTC

karaf-cellar git commit: [KARAF-4144] Fix default hazelcast.xml to work with other XML transformer like Saxon

Repository: karaf-cellar
Updated Branches:
  refs/heads/master 0fdc767b7 -> 460072371


[KARAF-4144] Fix default hazelcast.xml to work with other XML transformer like Saxon


Project: http://git-wip-us.apache.org/repos/asf/karaf-cellar/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf-cellar/commit/46007237
Tree: http://git-wip-us.apache.org/repos/asf/karaf-cellar/tree/46007237
Diff: http://git-wip-us.apache.org/repos/asf/karaf-cellar/diff/46007237

Branch: refs/heads/master
Commit: 4600723716ff9e64a375bfc41339a25f365acd53
Parents: 0fdc767
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Wed Nov 25 10:57:38 2015 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Wed Nov 25 10:57:38 2015 +0100

----------------------------------------------------------------------
 assembly/src/main/resources/hazelcast.xml       | 192 +++++++++----------
 hazelcast/pom.xml                               |   6 +
 .../factory/HazelcastServiceFactoryTest.java    |  23 +++
 hazelcast/src/test/resources/etc/hazelcast.xml  |  24 +--
 4 files changed, 137 insertions(+), 108 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/46007237/assembly/src/main/resources/hazelcast.xml
----------------------------------------------------------------------
diff --git a/assembly/src/main/resources/hazelcast.xml b/assembly/src/main/resources/hazelcast.xml
index 9d42a94..f1b2fae 100644
--- a/assembly/src/main/resources/hazelcast.xml
+++ b/assembly/src/main/resources/hazelcast.xml
@@ -1,48 +1,48 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.2.xsd"
-           xmlns="http://www.hazelcast.com/schema/config"
+<hz:hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.5.xsd"
+           xmlns:hz="http://www.hazelcast.com/schema/config"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-    <group>
-        <name>cellar</name>
-        <password>pass</password>
-    </group>
-    <management-center enabled="false">http://localhost:8080/mancenter</management-center>
-    <network>
-        <port auto-increment="true" port-count="100">5701</port>
-        <outbound-ports>
+    <hz:group>
+        <hz:name>cellar</hz:name>
+        <hz:password>pass</hz:password>
+    </hz:group>
+    <hz:management-center enabled="false">http://localhost:8080/mancenter</hz:management-center>
+    <hz:network>
+        <hz:port auto-increment="true" port-count="100">5701</hz:port>
+        <hz:outbound-ports>
             <!--
                 Allowed port range when connecting to other nodes.
                 0 or * means use system provided port.
             -->
-            <ports>0</ports>
-        </outbound-ports>
-        <join>
-            <multicast enabled="true">
-                <multicast-group>224.2.2.3</multicast-group>
-                <multicast-port>54327</multicast-port>
-            </multicast>
-            <tcp-ip enabled="false">
-                <interface>127.0.0.1</interface>
-            </tcp-ip>
-            <aws enabled="false">
-                <access-key>my-access-key</access-key>
-                <secret-key>my-secret-key</secret-key>
+            <hz:ports>0</hz:ports>
+        </hz:outbound-ports>
+        <hz:join>
+            <hz:multicast enabled="true">
+                <hz:multicast-group>224.2.2.3</hz:multicast-group>
+                <hz:multicast-port>54327</hz:multicast-port>
+            </hz:multicast>
+            <hz:tcp-ip enabled="false">
+                <hz:interface>127.0.0.1</hz:interface>
+            </hz:tcp-ip>
+            <hz:aws enabled="false">
+                <hz:access-key>my-access-key</hz:access-key>
+                <hz:secret-key>my-secret-key</hz:secret-key>
                 <!--optional, default is us-east-1 -->
-                <region>us-west-1</region>
+                <hz:region>us-west-1</hz:region>
                 <!--optional, default is ec2.amazonaws.com. If set, region shouldn't be set as it will override this property -->
-                <host-header>ec2.amazonaws.com</host-header>
+                <hz:host-header>ec2.amazonaws.com</hz:host-header>
                 <!-- optional, only instances belonging to this group will be discovered, default will try all running instances -->
-                <security-group-name>hazelcast-sg</security-group-name>
-                <tag-key>type</tag-key>
-                <tag-value>hz-nodes</tag-value>
-            </aws>
-        </join>
-        <interfaces enabled="false">
-            <interface>10.10.1.*</interface>
-        </interfaces>
-        <ssl enabled="false"/>
-        <socket-interceptor enabled="false"/>
-        <symmetric-encryption enabled="false">
+                <hz:security-group-name>hazelcast-sg</hz:security-group-name>
+                <hz:tag-key>type</hz:tag-key>
+                <hz:tag-value>hz-nodes</hz:tag-value>
+            </hz:aws>
+        </hz:join>
+        <hz:interfaces enabled="false">
+            <hz:interface>10.10.1.*</hz:interface>
+        </hz:interfaces>
+        <hz:ssl enabled="false"/>
+        <hz:socket-interceptor enabled="false"/>
+        <hz:symmetric-encryption enabled="false">
             <!--
                encryption algorithm such as
                DES/ECB/PKCS5Padding,
@@ -51,22 +51,22 @@
                Blowfish,
                DESede
             -->
-            <algorithm>PBEWithMD5AndDES</algorithm>
+            <hz:algorithm>PBEWithMD5AndDES</hz:algorithm>
             <!-- salt value to use when generating the secret key -->
-            <salt>thesalt</salt>
+            <hz:salt>thesalt</hz:salt>
             <!-- pass phrase to use when generating the secret key -->
-            <password>thepass</password>
+            <hz:password>thepass</hz:password>
             <!-- iteration count to use when generating the secret key -->
-            <iteration-count>19</iteration-count>
-        </symmetric-encryption>
-    </network>
-    <partition-group enabled="false"/>
-    <executor-service>
-        <pool-size>16</pool-size>
+            <hz:iteration-count>19</hz:iteration-count>
+        </hz:symmetric-encryption>
+    </hz:network>
+    <hz:partition-group enabled="false"/>
+    <hz:executor-service>
+        <hz:pool-size>16</hz:pool-size>
         <!-- Queue capacity. 0 means Integer.MAX_VALUE -->
-        <queue-capacity>0</queue-capacity>
-    </executor-service>
-    <queue name="default">
+        <hz:queue-capacity>0</hz:queue-capacity>
+    </hz:executor-service>
+    <hz:queue name="default">
         <!--
             Maximum size of the queue. When a JVM's local queue size reaches the maximum,
             all put/offer operations will get blocked until the queue size
@@ -74,21 +74,21 @@
             Any integer between 0 and Integer.MAX_VALUE. 0 means
             Integer.MAX_VALUE. Default is 0.
         -->
-        <max-size>0</max-size>
+        <hz:max-size>0</hz:max-size>
         <!--
             Number of backups. If 1 is set as the backup-count for example,
             then all entries of the map will be copied to another JVM for
             fail-safety. 0 means no backup.
         -->
-        <backup-count>1</backup-count>
+        <hz:backup-count>1</hz:backup-count>
         <!--
             Number of async backups. 0 means no backup.
         -->
-        <async-backup-count>0</async-backup-count>
-        <empty-queue-ttl>-1</empty-queue-ttl>
-    </queue>
+        <hz:async-backup-count>0</hz:async-backup-count>
+        <hz:empty-queue-ttl>-1</hz:empty-queue-ttl>
+    </hz:queue>
 
-    <map name="default">
+    <hz:map name="default">
         <!--
             Data type that will be used for storing recordMap.
             Possible values:
@@ -96,31 +96,31 @@
                 OBJECT : values will be stored in their object forms
                 OFFHEAP : values will be stored in non-heap region of JVM
         -->
-        <in-memory-format>BINARY</in-memory-format>
+        <hz:in-memory-format>BINARY</hz:in-memory-format>
         <!--
             Number of backups. If 1 is set as the backup-count for example,
             then all entries of the map will be copied to another JVM for
             fail-safety. 0 means no backup.
         -->
-        <backup-count>1</backup-count>
+        <hz:backup-count>1</hz:backup-count>
         <!--
             Number of async backups. 0 means no backup.
         -->
-        <async-backup-count>0</async-backup-count>
+        <hz:async-backup-count>0</hz:async-backup-count>
         <!--
             Maximum number of seconds for each entry to stay in the map. Entries that are
             older than <time-to-live-seconds> and not updated for <time-to-live-seconds>
             will get automatically evicted from the map.
             Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
         -->
-        <time-to-live-seconds>0</time-to-live-seconds>
+        <hz:time-to-live-seconds>0</hz:time-to-live-seconds>
         <!--
             Maximum number of seconds for each entry to stay idle in the map. Entries that are
             idle(not touched) for more than <max-idle-seconds> will get
             automatically evicted from the map. Entry is touched if get, put or containsKey is called.
             Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
         -->
-        <max-idle-seconds>0</max-idle-seconds>
+        <hz:max-idle-seconds>0</hz:max-idle-seconds>
         <!--
             Valid values are:
             NONE (no eviction),
@@ -128,21 +128,21 @@
             LFU (Least Frequently Used).
             NONE is the default.
         -->
-        <eviction-policy>NONE</eviction-policy>
+        <hz:eviction-policy>NONE</hz:eviction-policy>
         <!--
             Maximum size of the map. When max size is reached,
             map is evicted based on the policy defined.
             Any integer between 0 and Integer.MAX_VALUE. 0 means
             Integer.MAX_VALUE. Default is 0.
         -->
-        <max-size policy="PER_NODE">0</max-size>
+        <hz:max-size policy="PER_NODE">0</hz:max-size>
         <!--
             When max. size is reached, specified percentage of
             the map will be evicted. Any integer between 0 and 100.
             If 25 is set for example, 25% of the entries will
             get evicted.
         -->
-        <eviction-percentage>25</eviction-percentage>
+        <hz:eviction-percentage>25</hz:eviction-percentage>
         <!--
             While recovering from split-brain (network partitioning),
             map entries in the small cluster will merge into the bigger cluster
@@ -158,46 +158,46 @@
             com.hazelcast.map.merge.HigherHitsMapMergePolicy ; entry with the higher hits wins.
             com.hazelcast.map.merge.LatestUpdateMapMergePolicy ; entry with the latest update wins.
         -->
-        <merge-policy>com.hazelcast.map.merge.PassThroughMergePolicy</merge-policy>
-    </map>
+        <hz:merge-policy>com.hazelcast.map.merge.PassThroughMergePolicy</hz:merge-policy>
+    </hz:map>
 
-    <multimap name="default">
-        <backup-count>1</backup-count>
-        <value-collection-type>SET</value-collection-type>
-    </multimap>
+    <hz:multimap name="default">
+        <hz:backup-count>1</hz:backup-count>
+        <hz:value-collection-type>SET</hz:value-collection-type>
+    </hz:multimap>
 
-    <multimap name="default">
-        <backup-count>1</backup-count>
-        <value-collection-type>SET</value-collection-type>
-    </multimap>
+    <hz:multimap name="default">
+        <hz:backup-count>1</hz:backup-count>
+        <hz:value-collection-type>SET</hz:value-collection-type>
+    </hz:multimap>
 
-    <list name="default">
-        <backup-count>1</backup-count>
-    </list>
+    <hz:list name="default">
+        <hz:backup-count>1</hz:backup-count>
+    </hz:list>
 
-    <set name="default">
-        <backup-count>1</backup-count>
-    </set>
+    <hz:set name="default">
+        <hz:backup-count>1</hz:backup-count>
+    </hz:set>
 
-    <jobtracker name="default">
-        <max-thread-size>0</max-thread-size>
+    <hz:jobtracker name="default">
+        <hz:max-thread-size>0</hz:max-thread-size>
         <!-- Queue size 0 means number of partitions * 2 -->
-        <queue-size>0</queue-size>
-        <retry-count>0</retry-count>
-        <chunk-size>1000</chunk-size>
-        <communicate-stats>true</communicate-stats>
-        <topology-changed-strategy>CANCEL_RUNNING_OPERATION</topology-changed-strategy>
-    </jobtracker>
+        <hz:queue-size>0</hz:queue-size>
+        <hz:retry-count>0</hz:retry-count>
+        <hz:chunk-size>1000</hz:chunk-size>
+        <hz:communicate-stats>true</hz:communicate-stats>
+        <hz:topology-changed-strategy>CANCEL_RUNNING_OPERATION</hz:topology-changed-strategy>
+    </hz:jobtracker>
 
-    <semaphore name="default">
-        <initial-permits>0</initial-permits>
-        <backup-count>1</backup-count>
-        <async-backup-count>0</async-backup-count>
-    </semaphore>
+    <hz:semaphore name="default">
+        <hz:initial-permits>0</hz:initial-permits>
+        <hz:backup-count>1</hz:backup-count>
+        <hz:async-backup-count>0</hz:async-backup-count>
+    </hz:semaphore>
 
-    <serialization>
-        <portable-version>0</portable-version>
-    </serialization>
+    <hz:serialization>
+        <hz:portable-version>0</hz:portable-version>
+    </hz:serialization>
 
-    <services enable-defaults="true" />
-</hazelcast>
\ No newline at end of file
+    <hz:services enable-defaults="true" />
+</hz:hazelcast>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/46007237/hazelcast/pom.xml
----------------------------------------------------------------------
diff --git a/hazelcast/pom.xml b/hazelcast/pom.xml
index e476429..7a7c1b4 100644
--- a/hazelcast/pom.xml
+++ b/hazelcast/pom.xml
@@ -78,6 +78,12 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>net.sf.saxon</groupId>
+            <artifactId>Saxon-HE</artifactId>
+            <version>9.6.0-7</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/46007237/hazelcast/src/test/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactoryTest.java
----------------------------------------------------------------------
diff --git a/hazelcast/src/test/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactoryTest.java b/hazelcast/src/test/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactoryTest.java
index 44243d8..93bde4e 100644
--- a/hazelcast/src/test/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactoryTest.java
+++ b/hazelcast/src/test/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactoryTest.java
@@ -32,14 +32,37 @@ public class HazelcastServiceFactoryTest {
         // networks where multicast is disabled. Use a custom hazelcast.xml
         // configuration that disables multicast and enables tcp on 127.0.0.1
         System.setProperty("karaf.etc", "src/test/resources/etc");
+        System.setProperty("javax.xml.transform.TransformerFactory", "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
         HazelcastServiceFactory factory = new HazelcastServiceFactory();
         factory.setConfigurationManager(new HazelcastConfigurationManager());
         factory.init();
         factory.getInstance();
+        HazelcastInstance factoryInstance = factory.getInstance();
+
         HazelcastInstance defaultInstance = Hazelcast.newHazelcastInstance(null);
 
+        Assert.assertEquals(true, factoryInstance.getCluster().getMembers().size() >= 2);
+
+        factoryInstance.shutdown();
+        defaultInstance.shutdown();
+    }
+
+    @Test
+    public void testDefaultInstanceWithSaxon() throws InterruptedException {
+        System.setProperty("karaf.etc", "src/test/resources/etc");
+        System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
+        HazelcastServiceFactory factory = new HazelcastServiceFactory();
+        factory.setConfigurationManager(new HazelcastConfigurationManager());
+        factory.init();
+        factory.getInstance();
         HazelcastInstance factoryInstance = factory.getInstance();
+
+        HazelcastInstance defaultInstance = Hazelcast.newHazelcastInstance(null);
+
         Assert.assertEquals(true, factoryInstance.getCluster().getMembers().size() >= 2);
+
+        factoryInstance.shutdown();
+        defaultInstance.shutdown();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/46007237/hazelcast/src/test/resources/etc/hazelcast.xml
----------------------------------------------------------------------
diff --git a/hazelcast/src/test/resources/etc/hazelcast.xml b/hazelcast/src/test/resources/etc/hazelcast.xml
index 2830893..9aaa40e 100644
--- a/hazelcast/src/test/resources/etc/hazelcast.xml
+++ b/hazelcast/src/test/resources/etc/hazelcast.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.2.xsd"
-           xmlns="http://www.hazelcast.com/schema/config"
+<hz:hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.5.xsd"
+           xmlns:hz="http://www.hazelcast.com/schema/config"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
-    <network>
-        <port auto-increment="true" port-count="100">5701</port>
-        <join>
-            <multicast enabled="false"/>
-            <tcp-ip enabled="true">
-                <interface>127.0.0.1</interface>
-            </tcp-ip>
-        </join>
-    </network>
+    <hz:network>
+        <hz:port auto-increment="true" port-count="100">5701</hz:port>
+        <hz:join>
+            <hz:multicast enabled="false"/>
+            <hz:tcp-ip enabled="true">
+                <hz:interface>127.0.0.1</hz:interface>
+            </hz:tcp-ip>
+        </hz:join>
+    </hz:network>
 
-</hazelcast>
\ No newline at end of file
+</hz:hazelcast>
\ No newline at end of file