ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/2] ignite git commit: ignite-2407
Date Wed, 03 Feb 2016 10:21:11 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-2407 ba722d10f -> 21e181395


ignite-2407


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

Branch: refs/heads/ignite-2407
Commit: 61cfe1d3fadd4664d003cfeb4630de01b794fc8f
Parents: ba722d1
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Feb 3 12:21:59 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Feb 3 12:21:59 2016 +0300

----------------------------------------------------------------------
 .../IgniteCachePrimarySyncTxsTest.java          | 128 +++++++++++++++++++
 1 file changed, 128 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/61cfe1d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTxsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTxsTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTxsTest.java
new file mode 100644
index 0000000..61bf8a5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTxsTest.java
@@ -0,0 +1,128 @@
+/*
+ * 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.ignite.internal.processors.cache.distributed;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
+
+/**
+ *
+ */
+public class IgniteCachePrimarySyncTxsTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final int SRVS = 4;
+
+    /** */
+    private static final int NODES = SRVS + 1;
+
+    /** */
+    private boolean clientMode;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+        cfg.setClientMode(clientMode);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        startGrids(SRVS);
+
+        clientMode = true;
+
+        Ignite client = startGrid(SRVS);
+
+        assertTrue(client.configuration().isClientMode());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTxSyncMode() throws Exception {
+        Ignite ignite = ignite(0);
+
+        List<IgniteCache<Object, Object>> caches = new ArrayList<>();
+
+        try {
+            caches.add(ignite.createCache(cacheConfiguration("fullSync1", FULL_SYNC, 1)));
+            caches.add(ignite.createCache(cacheConfiguration("fullSync2", FULL_SYNC, 1)));
+            caches.add(ignite.createCache(cacheConfiguration("fullAsync1", FULL_ASYNC, 1)));
+            caches.add(ignite.createCache(cacheConfiguration("fullAsync2", FULL_ASYNC, 1)));
+            caches.add(ignite.createCache(cacheConfiguration("primarySync1", PRIMARY_SYNC,
1)));
+            caches.add(ignite.createCache(cacheConfiguration("primarySync2", PRIMARY_SYNC,
1)));
+
+            for (int i = 0; i < NODES; i++)
+                checkTxSyncMode(ignite(i));
+        }
+        finally {
+            for (IgniteCache<Object, Object> cache : caches)
+                ignite.destroyCache(cache.getName());
+        }
+    }
+
+    private void checkTxSyncMode(Ignite ignite) {
+
+    }
+
+    /**
+     * @param name Cache name.
+     * @param syncMode Write synchronization mode.
+     * @param backups Number of backups.
+     * @return Cache configuration.
+     */
+    private CacheConfiguration<Object, Object> cacheConfiguration(String name,
+        CacheWriteSynchronizationMode syncMode,
+        int backups) {
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+
+        ccfg.setName(name);
+        ccfg.setAtomicityMode(TRANSACTIONAL);
+        ccfg.setWriteSynchronizationMode(syncMode);
+        ccfg.setBackups(backups);
+
+        return ccfg;
+    }
+
+    public void testPrimarySyncMessages() throws Exception {
+
+    }
+}


Mime
View raw message