ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [35/50] [abbrv] incubator-ignite git commit: # sprint-2 added test
Date Thu, 12 Mar 2015 09:30:38 GMT
# sprint-2 added test


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

Branch: refs/heads/ignite-release-test-no-mod
Commit: 1eb870e630c6490795f463a42669ab2c75944480
Parents: b820035
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Mar 11 15:10:12 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Mar 11 15:10:12 2015 +0300

----------------------------------------------------------------------
 .../GridCacheOnCopyFlagAbstractSelfTest.java    |   2 +
 .../GridCacheOnCopyFlagAtomicSelfTest.java      |   3 +-
 .../cache/GridCacheOnCopyFlagLocalSelfTest.java |   3 +-
 .../GridCacheOnCopyFlagReplicatedSelfTest.java  |   3 +-
 ...ridCacheOnCopyFlagTxPartitionedSelfTest.java |   3 +-
 ...IgniteCacheAtomicCopyOnReadDisabledTest.java |  32 +++++
 ...niteCacheCopyOnReadDisabledAbstractTest.java | 123 +++++++++++++++++++
 .../IgniteCacheTxCopyOnReadDisabledTest.java    |  32 +++++
 .../ignite/testsuites/IgniteCacheTestSuite.java |   2 +
 9 files changed, 195 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1eb870e6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
index 5657d9b..ea846dd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
@@ -104,6 +104,8 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
     @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception
{
         CacheConfiguration ccfg = super.cacheConfiguration(gridName);
 
+        assertTrue(ccfg.isCopyOnRead());
+
         assertNotNull(interceptor);
 
         ccfg.setInterceptor(interceptor);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1eb870e6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAtomicSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAtomicSelfTest.java
index bc9eb1b..d5b61ad 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAtomicSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAtomicSelfTest.java
@@ -25,8 +25,7 @@ import static org.apache.ignite.cache.CacheMode.*;
 /**
  * Tests {@link org.apache.ignite.cache.CacheInterceptor}.
  */
-public class GridCacheOnCopyFlagAtomicSelfTest extends
-    GridCacheOnCopyFlagAbstractSelfTest {
+public class GridCacheOnCopyFlagAtomicSelfTest extends GridCacheOnCopyFlagAbstractSelfTest
{
     /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return PARTITIONED;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1eb870e6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagLocalSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagLocalSelfTest.java
index 1da5d0e..c487f05 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagLocalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagLocalSelfTest.java
@@ -25,8 +25,7 @@ import static org.apache.ignite.cache.CacheMode.*;
 /**
  * Tests {@link org.apache.ignite.cache.CacheInterceptor}.
  */
-public class GridCacheOnCopyFlagLocalSelfTest extends
-    GridCacheOnCopyFlagAbstractSelfTest {
+public class GridCacheOnCopyFlagLocalSelfTest extends GridCacheOnCopyFlagAbstractSelfTest
{
     /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return LOCAL;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1eb870e6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagReplicatedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagReplicatedSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagReplicatedSelfTest.java
index 72a4dc5..18ae80c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagReplicatedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagReplicatedSelfTest.java
@@ -25,8 +25,7 @@ import static org.apache.ignite.cache.CacheMode.*;
 /**
  * Tests {@link org.apache.ignite.cache.CacheInterceptor}.
  */
-public class GridCacheOnCopyFlagReplicatedSelfTest extends
-    GridCacheOnCopyFlagAbstractSelfTest {
+public class GridCacheOnCopyFlagReplicatedSelfTest extends GridCacheOnCopyFlagAbstractSelfTest
{
     /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return REPLICATED;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1eb870e6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagTxPartitionedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagTxPartitionedSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagTxPartitionedSelfTest.java
index 7a24b3b..750c781 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagTxPartitionedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagTxPartitionedSelfTest.java
@@ -25,8 +25,7 @@ import static org.apache.ignite.cache.CacheMode.*;
 /**
  * Tests {@link org.apache.ignite.cache.CacheInterceptor}.
  */
-public class GridCacheOnCopyFlagTxPartitionedSelfTest extends
-    GridCacheOnCopyFlagAbstractSelfTest {
+public class GridCacheOnCopyFlagTxPartitionedSelfTest extends GridCacheOnCopyFlagAbstractSelfTest
{
     /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return PARTITIONED;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1eb870e6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicCopyOnReadDisabledTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicCopyOnReadDisabledTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicCopyOnReadDisabledTest.java
new file mode 100644
index 0000000..f5ee2bb
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicCopyOnReadDisabledTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+import org.apache.ignite.cache.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ *
+ */
+public class IgniteCacheAtomicCopyOnReadDisabledTest extends IgniteCacheCopyOnReadDisabledAbstractTest
{
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1eb870e6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
new file mode 100644
index 0000000..4a0f991
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
@@ -0,0 +1,123 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+
+import javax.cache.processor.*;
+import java.io.*;
+
+/**
+ *
+ */
+public abstract class IgniteCacheCopyOnReadDisabledAbstractTest extends GridCacheAbstractSelfTest
{
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception
{
+        CacheConfiguration ccfg = super.cacheConfiguration(gridName);
+
+        assertTrue(ccfg.isCopyOnRead());
+
+        ccfg.setCopyOnRead(false);
+
+        return ccfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCopyOnReadDisabled() throws Exception {
+        IgniteCache<TestKey, TestValue> cache = ignite(0).jcache(null);
+
+        for (int i = 0; i < 100; i++) {
+            TestKey key = new TestKey(i);
+            TestValue val = new TestValue(i);
+
+            cache.put(key, val);
+
+            TestValue val0 = cache.get(key);
+
+            assertNotSame(val, val0); // Original user value is always copied.
+
+            assertSame(val0, cache.localPeek(key));
+        }
+
+        TestKey key = new TestKey(0);
+
+        TestValue val0 = cache.get(key);
+
+        TestValue invokeVal = cache.invoke(key, new EntryProcessor<TestKey, TestValue,
TestValue>() {
+            @Override public TestValue process(MutableEntry<TestKey, TestValue> entry,
Object... args) {
+                return entry.getValue();
+            }
+        });
+
+        assertSame(val0, invokeVal);
+    }
+
+    /**
+     *
+     */
+    public static class TestKey implements Serializable {
+        /** */
+        private int key;
+
+        /**
+         * @param key Key.
+         */
+        public TestKey(int key) {
+            this.key = key;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (!(o instanceof TestKey))
+                return false;
+
+            TestKey testKey = (TestKey)o;
+
+            return key == testKey.key;
+
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return key;
+        }
+    }
+
+    /**
+     *
+     */
+    static class TestValue implements Serializable {
+        /** */
+        private int val;
+
+        /**
+         * @param val Value.
+         */
+        public TestValue(int val) {
+            this.val = val;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1eb870e6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java
new file mode 100644
index 0000000..19d1b52
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+import org.apache.ignite.cache.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ *
+ */
+public class IgniteCacheTxCopyOnReadDisabledTest extends IgniteCacheCopyOnReadDisabledAbstractTest
{
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return TRANSACTIONAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1eb870e6/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 3290827..4f37982 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -397,6 +397,8 @@ public class IgniteCacheTestSuite extends TestSuite {
         // suite.addTestSuite(GridCacheVersionMultinodeTest.class);
 
         suite.addTestSuite(IgniteCacheNearReadCommittedTest.class);
+        suite.addTestSuite(IgniteCacheAtomicCopyOnReadDisabledTest.class);
+        suite.addTestSuite(IgniteCacheTxCopyOnReadDisabledTest.class);
 
         return suite;
     }


Mime
View raw message