ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [14/27] incubator-ignite git commit: # Fix javax.cache.configuration.ConfigurationTest tests.
Date Fri, 13 Feb 2015 06:24:49 GMT
# Fix javax.cache.configuration.ConfigurationTest tests.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/be23ac61
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/be23ac61
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/be23ac61

Branch: refs/heads/ignite-189
Commit: be23ac6189de38f54b6bb830f029beaeb9ea2937
Parents: ff788da
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Thu Feb 12 16:31:31 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Thu Feb 12 20:28:37 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/cache/CacheManager.java   | 30 ++++++++------------
 1 file changed, 12 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be23ac61/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java
index fc8c52e..5de7fd5 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java
@@ -104,23 +104,19 @@ public class CacheManager implements javax.cache.CacheManager {
         if (cacheName == null)
             throw new NullPointerException();
 
-        if (!(cacheCfg instanceof CompleteConfiguration))
-            throw new UnsupportedOperationException("Configuration is not supported: " +
cacheCfg);
+        CacheConfiguration igniteCacheCfg;
 
-        if (cacheCfg instanceof CacheConfiguration) {
-            String cfgCacheName = ((CacheConfiguration)cacheCfg).getName();
-
-            if (cfgCacheName != null) {
-                if (!cacheName.equals(cfgCacheName))
-                    throw new IllegalArgumentException();
-            }
-            else {
-                cacheCfg = (C)new CacheConfiguration((CompleteConfiguration)cacheCfg);
+        if (cacheCfg instanceof CompleteConfiguration)
+            igniteCacheCfg = new CacheConfiguration((CompleteConfiguration)cacheCfg);
+        else {
+            igniteCacheCfg = new CacheConfiguration();
 
-                ((CacheConfiguration)cacheCfg).setName(cacheName);
-            }
+            igniteCacheCfg.setTypes(cacheCfg.getKeyType(), cacheCfg.getValueType());
+            igniteCacheCfg.setStoreValueBytes(cacheCfg.isStoreByValue());
         }
 
+        igniteCacheCfg.setName(cacheName);
+
         IgniteCache<K, V> res;
 
         synchronized (igniteMap) {
@@ -133,9 +129,7 @@ public class CacheManager implements javax.cache.CacheManager {
                 IgniteConfiguration cfg = new IgniteConfiguration();
                 cfg.setGridName(mgrIdx.incrementAndGet() + "-grid-for-" + cacheName);
 
-                cfg.setCacheConfiguration(new CacheConfiguration((CompleteConfiguration)cacheCfg));
-
-                cfg.getCacheConfiguration()[0].setName(cacheName);
+                cfg.setCacheConfiguration(igniteCacheCfg);
 
                 try {
                     ignite = Ignition.start(cfg);
@@ -152,10 +146,10 @@ public class CacheManager implements javax.cache.CacheManager {
             igniteMap.put(cacheName, ignite);
         }
 
-        if (((CompleteConfiguration)cacheCfg).isManagementEnabled())
+        if (igniteCacheCfg.isManagementEnabled())
             enableManagement(cacheName, true);
 
-        if (((CompleteConfiguration)cacheCfg).isStatisticsEnabled())
+        if (igniteCacheCfg.isStatisticsEnabled())
             enableStatistics(cacheName, true);
 
         return res;


Mime
View raw message