http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java index cc0f66c..2fc7db0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapAbstractSelfTest.java @@ -23,7 +23,7 @@ import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.offheap.unsafe.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.junits.common.*; import org.jdk8.backport.*; import java.util.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapPerformanceAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapPerformanceAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapPerformanceAbstractTest.java index 53ba9b7..750296e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapPerformanceAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapMapPerformanceAbstractTest.java @@ -18,7 +18,7 @@ package org.apache.ignite.internal.util.offheap; import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.junits.common.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java index cc2555e..e89835f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java @@ -22,7 +22,7 @@ import org.apache.ignite.cache.affinity.*; import org.apache.ignite.cache.affinity.consistenthash.*; import org.apache.ignite.lang.*; import org.apache.ignite.internal.util.lang.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.junits.common.*; import org.jdk8.backport.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapPerformanceAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapPerformanceAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapPerformanceAbstractTest.java index 21a30a5..014aba4 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapPerformanceAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapPerformanceAbstractTest.java @@ -22,7 +22,7 @@ import org.apache.ignite.cache.affinity.consistenthash.*; import org.apache.ignite.lang.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.junits.common.*; import org.jdk8.backport.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridOffheapSnapTreeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridOffheapSnapTreeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridOffheapSnapTreeSelfTest.java index 8f1c38a..8bb8f54 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridOffheapSnapTreeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridOffheapSnapTreeSelfTest.java @@ -19,7 +19,7 @@ package org.apache.ignite.internal.util.offheap.unsafe; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.junits.common.*; import java.util.*; import java.util.concurrent.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMemorySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMemorySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMemorySelfTest.java index fe92623..1f23c9b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMemorySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMemorySelfTest.java @@ -20,7 +20,7 @@ package org.apache.ignite.internal.util.offheap.unsafe; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.internal.util.typedef.X; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.junits.common.*; import org.jdk8.backport.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeStripedLruSefTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeStripedLruSefTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeStripedLruSefTest.java index 0b5467e..376d0ca 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeStripedLruSefTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeStripedLruSefTest.java @@ -17,7 +17,7 @@ package org.apache.ignite.internal.util.offheap.unsafe; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.junits.common.*; import java.util.*; import java.util.concurrent.atomic.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java index 9adbf47..77f587a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java @@ -19,7 +19,7 @@ package org.apache.ignite.internal.util.tostring; import org.apache.ignite.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.junits.common.*; import java.util.*; import java.util.concurrent.locks.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/jvmtest/BlockingQueueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/jvmtest/BlockingQueueTest.java b/modules/core/src/test/java/org/apache/ignite/jvmtest/BlockingQueueTest.java new file mode 100644 index 0000000..e9f626a --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/jvmtest/BlockingQueueTest.java @@ -0,0 +1,144 @@ +/* + * 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.jvmtest; + +import org.apache.ignite.internal.util.*; +import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.testframework.*; +import org.jdk8.backport.*; + +import java.util.concurrent.*; + +/** + * Blocking queue performance benchmark. + */ +public class BlockingQueueTest { + /** Number of retries. */ + private static final int RETRIES = 3; + + /** Number of attempts. */ + private static final int CNT = 1000000; + + /** Number of threads. */ + private static final int THREAD_CNT = Runtime.getRuntime().availableProcessors(); + + /** + * Main method. + * + * @param args Parameters. + * @throws Exception If failed. + */ + public static void main(String[] args) throws Exception { + for (int i = 0; i < RETRIES; i++) { + X.println(">>>"); + X.println(">>> Executing single threaded attempt: " + i); + X.println(">>>"); + + testBlockingQueue("single-threaded-linked-queue", new LinkedBlockingQueue<>()); + testBlockingQueue("single-threaded-linked-deque", new LinkedBlockingDeque<>()); + testBlockingQueue("single-threaded-array-queue", new ArrayBlockingQueue<>(CNT + 10)); + } + + for (int i = 0; i < RETRIES; i++) { + X.println(">>>"); + X.println(">>> Executing multi-threaded attempt: " + i); + X.println(">>>"); + + testBlockingQueueMultithreaded("multi-threaded-linked-queue", new LinkedBlockingQueue<>()); + testBlockingQueueMultithreaded("multi-threaded-linked-deque", new LinkedBlockingDeque<>()); + testBlockingQueueMultithreaded("multi-threaded-array-queue", new ArrayBlockingQueue<>( + THREAD_CNT * CNT + 100)); + } + } + + /** + * @throws InterruptedException If interrupted. + */ + private static void waitGc() throws InterruptedException { + System.gc(); + System.gc(); + + X.println(">>> Waiting for GC to complete..."); + + Thread.sleep(1000); + } + + /** + * @param testName Test name. + * @param q Queue to test. + * @throws InterruptedException If interrupted. + */ + private static void testBlockingQueue(String testName, BlockingQueue<Object> q) throws InterruptedException { + waitGc(); + + X.println(">>> Starting test for: " + testName); + + long dur = testBlockingQueue(q); + + X.println(">>> Tested queue [testName=" + testName + ", dur=" + dur + "ms]"); + + assert q.isEmpty(); + } + + /** + * @param testName Test name. + * @param q Queue. + * @throws Exception If failed. + */ + private static void testBlockingQueueMultithreaded(String testName, final BlockingQueue<Object> q) + throws Exception { + waitGc(); + + X.println(">>> Starting test for: " + testName); + + final LongAdder adder = new LongAdder(); + + GridTestUtils.runMultiThreaded(new Callable<Object>() { + @Override public Object call() throws Exception { + adder.add(testBlockingQueue(q)); + + return null; + } + }, THREAD_CNT, "queue-test-worker"); + + X.println(">>> Tested queue [testName=" + testName + ", dur=" + adder.sum() + "ms]"); + + assert q.isEmpty(); + } + + /** + * @param q Queue to test. + * @throws InterruptedException If interrupted. + */ + private static long testBlockingQueue(BlockingQueue<Object> q) throws InterruptedException { + GridTimer timer = new GridTimer("blocking-queue"); + + for (int i = 0; i < CNT; i++) + q.put(new Object()); + + for (int i = 0; i < CNT; i++) { + Object o = q.take(); + + assert o != null; + } + + timer.stop(); + + return timer.duration(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/jvmtest/ConcurrentMapTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/jvmtest/ConcurrentMapTest.java b/modules/core/src/test/java/org/apache/ignite/jvmtest/ConcurrentMapTest.java new file mode 100644 index 0000000..368dd72 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/jvmtest/ConcurrentMapTest.java @@ -0,0 +1,193 @@ +/* + * 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.jvmtest; + +import org.apache.ignite.internal.util.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.internal.util.lang.*; +import org.apache.ignite.testframework.*; +import org.jdk8.backport.*; + +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; + +/** + * + */ +public class ConcurrentMapTest { + /** */ + private static Random rnd = new Random(); + + /** + * + */ + private ConcurrentMapTest() { + // No-op. + } + + /** + * @param args Args. + * @throws Exception If failed. + */ + public static void main(String args[]) throws Exception { + Thread.sleep(5000); + + Collection<IgnitePair<Integer>> ress = new LinkedList<>(); + + for (int lvl = 16; lvl <= 16384; lvl *= 2) { + System.gc(); + + X.println("Testing map with concurrency level: " + lvl); + + int writes = testMap(100000, GridConcurrentFactory.<String, Integer>newMap(256, lvl)); + + ress.add(F.pair(lvl, writes)); + } + + X.println("Test summary."); + + for (IgnitePair<Integer> p : ress) + X.println("Performance [lvl=" + p.get1() + ", writes=" + p.get2() + ']'); + + testPut(); + + testOpsSpeed(); + + testCreationTime(); + } + + /** + * @param keyRange Key range. + * @param map Map. + * @return Writes count. + * @throws Exception If failed. + */ + public static int testMap(final int keyRange, final ConcurrentMap<String, Integer> map) throws Exception { + final AtomicBoolean done = new AtomicBoolean(); + + final AtomicInteger writes = new AtomicInteger(); + + IgniteFuture fut1 = GridTestUtils.runMultiThreadedAsync( + new Runnable() { + @Override public void run() { + while (!done.get()) { + map.put(rnd.nextInt(keyRange) + "very.long.string.for.key", 1); + + writes.incrementAndGet(); + } + } + }, + 40, + "thread" + ); + + long duration = 20 * 1000; + + for (long time = 0; time < duration;) { + Thread.sleep(5000); + + time += 5000; + + X.println(">>> Stats [duration=" + time + ", writes=" + writes.get() + ']'); + } + + done.set(true); + + fut1.get(); + + X.println(">>> Test finished [duration=" + duration + ", writes=" + writes.get() + ']'); + + return writes.get(); + } + + /** + * @throws Exception If failed. + */ + public static void testPut() throws Exception { + Map<Integer, Integer> map = new ConcurrentHashMap8<>(); + + map.put(0, 0); + map.put(0, 0); + } + + /** + * @throws Exception If failed. + */ + public static void testOpsSpeed() throws Exception { + for (int i = 0; i < 4; i++) { + X.println("New map ops time: " + runOps(new ConcurrentHashMap8<Integer, Integer>(), 1000000, 100)); + + X.println("Jdk6 map ops time: " + runOps(new ConcurrentHashMap<Integer, Integer>(), 1000000, 100)); + } + } + + /** + * @param iterCnt Iterations count. + * @param threadCnt Threads count. + * @return Time taken. + */ + private static long runOps(final Map<Integer,Integer> map, final int iterCnt, int threadCnt) throws Exception { + long start = System.currentTimeMillis(); + + GridTestUtils.runMultiThreaded(new Callable<Object>() { + @Override public Object call() throws Exception { + ThreadLocalRandom8 rnd = ThreadLocalRandom8.current(); + + for (int i = 0; i < iterCnt; i++) { + // Put random. + map.put(rnd.nextInt(0, 10000), 0); + + // Read random. + map.get(rnd.nextInt(0, 10000)); + + // Remove random. + map.remove(rnd.nextInt(0, 10000)); + } + + return null; + } + }, threadCnt, "thread"); + + return System.currentTimeMillis() - start; + } + + /** + * @throws Exception If failed. + */ + @SuppressWarnings("ResultOfObjectAllocationIgnored") + public static void testCreationTime() throws Exception { + for (int i = 0; i < 5; i++) { + long now = System.currentTimeMillis(); + + for (int j = 0; j < 1000000; j++) + new ConcurrentHashMap8<Integer, Integer>(); + + X.println("New map creation time: " + (System.currentTimeMillis() - now)); + + now = System.currentTimeMillis(); + + for (int j = 0; j < 1000000; j++) + new ConcurrentHashMap<Integer, Integer>(); + + X.println("Jdk6 map creation time: " + (System.currentTimeMillis() - now)); + } + } + +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/jvmtest/FileIOTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/jvmtest/FileIOTest.java b/modules/core/src/test/java/org/apache/ignite/jvmtest/FileIOTest.java new file mode 100644 index 0000000..452cb0b --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/jvmtest/FileIOTest.java @@ -0,0 +1,138 @@ +/* + * 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.jvmtest; + +import junit.framework.*; +import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.internal.util.typedef.internal.*; + +import java.io.*; +import java.util.*; + +/** + * Java file IO test. + */ +public class FileIOTest extends TestCase { + /** File path. */ + private static final String FILE_PATH = "/test-java-file.tmp"; + + /** Temp dir. */ + private static final String TMP_DIR = System.getProperty("java.io.tmpdir"); + + /** + * @throws Exception If failed. + */ + public void testReadLineFromBinaryFile() throws Exception { + File file = new File(FILE_PATH); + + file.deleteOnExit(); + + RandomAccessFile raf = new RandomAccessFile(file, "rw"); + + byte[] b = new byte[100]; + + Arrays.fill(b, (byte)10); + + raf.write(b); + + raf.writeBytes("swap-spaces/space1/b53b3a3d6ab90ce0268229151c9bde11|" + + "b53b3a3d6ab90ce0268229151c9bde11|1315392441288" + U.nl()); + + raf.writeBytes("swap-spaces/space1/b53b3a3d6ab90ce0268229151c9bde11|" + + "b53b3a3d6ab90ce0268229151c9bde11|1315392441288" + U.nl()); + + raf.write(b); + + raf.writeBytes("test" + U.nl()); + + raf.getFD().sync(); + + raf.seek(0); + + while (raf.getFilePointer() < raf.length()) { + String s = raf.readLine(); + + X.println("String: " + s + ";"); + + X.println("String length: " + s.length()); + + X.println("File pointer: " + raf.getFilePointer()); + } + } + + /** + * @throws Exception If failed. + */ + public void testMultipleFilesCreation() throws Exception { + File parent = new File(TMP_DIR, "testMultipleFilesCreation"); + + U.delete(parent); + + U.mkdirs(parent); + + int childCnt = 4; + int subChildCnt = 4; + + for (int i = 0; i < childCnt; i++) { + File f = new File(parent, String.valueOf(i)); + + U.mkdirs(f); + + for (int j = 0; j < subChildCnt; j++) + U.mkdirs(new File(f, String.valueOf(j))); + } + + X.println("Parent: " + parent.getAbsolutePath()); + X.println("Test started: " + U.format(System.currentTimeMillis())); + + long start = System.currentTimeMillis(); + + byte[] data = new byte[4096]; + + for (int i = 0; i < 50000; i++) { + int idx1 = i % childCnt; + int idx2 = (i / childCnt) % subChildCnt; + + RandomAccessFile f = null; + + try { + f = new RandomAccessFile(new File(parent, idx1 + File.separator + idx2 + File.separatorChar + i), "rw"); + + f.write(data); + } + finally { + U.closeQuiet(f); + } + } + + X.println("Test time: " + (System.currentTimeMillis() - start)); + } + + /** + * + */ + public void testGetAbsolutePath() { + for (int i = 0; i < 1000000; i++) { + new File("/" + UUID.randomUUID().toString()).getAbsolutePath(); + + new File(UUID.randomUUID().toString()).getAbsolutePath(); + + new File("/Users").getAbsolutePath(); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/jvmtest/FileLocksTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/jvmtest/FileLocksTest.java b/modules/core/src/test/java/org/apache/ignite/jvmtest/FileLocksTest.java new file mode 100644 index 0000000..cecde13 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/jvmtest/FileLocksTest.java @@ -0,0 +1,121 @@ +/* + * 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.jvmtest; + +import junit.framework.*; + +import javax.swing.*; +import java.io.*; +import java.nio.channels.*; + +/** + * Java file locks test. + */ +public class FileLocksTest extends TestCase { + /** File path (on Windows file will be created under the root directory of the current drive). */ + private static final String LOCK_FILE_PATH = "/test-java-file-lock-tmp.bin"; + + /** + * @throws Exception If failed. + */ + public void testWriteLocks() throws Exception { + final File file = new File(LOCK_FILE_PATH); + + file.createNewFile(); + + RandomAccessFile raf = new RandomAccessFile(file, "rw"); + + System.out.println("Getting lock..."); + + FileLock lock = raf.getChannel().lock(); + + System.out.println("Obtained lock: " + lock); + + Thread thread = new Thread(new Runnable() { + @Override public void run() { + try { + RandomAccessFile raf = new RandomAccessFile(file, "rw"); + + System.out.println("Getting lock (parallel thread)..."); + + FileLock lock = raf.getChannel().lock(); + + System.out.println("Obtained lock (parallel tread): " + lock); + + lock.release(); + } + catch (Throwable e) { + e.printStackTrace(); + } + } + }); + + thread.start(); + + JOptionPane.showMessageDialog(null, "Press OK to release lock."); + + lock.release(); + + thread.join(); + } + + /** + * @throws Exception If failed. + */ + public void testReadLocks() throws Exception { + final File file = new File(LOCK_FILE_PATH); + + file.createNewFile(); + + RandomAccessFile raf = new RandomAccessFile(file, "r"); + + System.out.println("Getting lock..."); + + FileLock lock = raf.getChannel().lock(0, Long.MAX_VALUE, true); + + System.out.println("Obtained lock: " + lock); + + Thread thread = new Thread(new Runnable() { + @Override public void run() { + try { + RandomAccessFile raf = new RandomAccessFile(file, "r"); + + System.out.println("Getting lock (parallel thread)..."); + + FileLock lock = raf.getChannel().lock(0, Long.MAX_VALUE, true); + + System.out.println("Obtained lock (parallel thread): " + lock); + + lock.release(); + + } + catch (Throwable e) { + e.printStackTrace(); + } + } + }); + + thread.start(); + + JOptionPane.showMessageDialog(null, "Press OK to release lock."); + + lock.release(); + + thread.join(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/jvmtest/LinkedHashMapTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/jvmtest/LinkedHashMapTest.java b/modules/core/src/test/java/org/apache/ignite/jvmtest/LinkedHashMapTest.java new file mode 100644 index 0000000..9020f2d --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/jvmtest/LinkedHashMapTest.java @@ -0,0 +1,87 @@ +/* + * 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.jvmtest; + +import junit.framework.*; +import org.apache.ignite.internal.util.typedef.*; + +import java.util.*; + +/** + * Test for {@link LinkedHashMap}. + */ +public class LinkedHashMapTest extends TestCase { + /** @throws Exception If failed. */ + public void testAccessOrder1() throws Exception { + X.println(">>> testAccessOrder1 <<<"); + + Map<String, String> map = new LinkedHashMap<>(3, 0.75f, true); + + for (int i = 1; i <= 3; i++) + map.put("k" + i, "v" + i); + + X.println("Initial state: " + map); + + int i = 0; + + for (Map.Entry<String, String> entry : map.entrySet()) { + X.println("Entry: " + entry); + + if (i > 1) + break; + + i++; + } + + X.println("State after loop: " + map); + } + + /** @throws Exception If failed. */ + public void testAccessOrder2() throws Exception { + X.println(">>> testAccessOrder2 <<<"); + + Map<String, String> map = new LinkedHashMap<>(3, 0.75f, true); + + for (int i = 1; i <= 3; i++) + map.put("k" + i, "v" + i); + + X.println("Initial state: " + map); + + // Accessing second entry. + map.get("k2"); + + X.println("State after get: " + map); + } + + /** @throws Exception If failed. */ + public void testAccessOrder3() throws Exception { + X.println(">>> testAccessOrder3 <<<"); + + Map<String, String> map = new LinkedHashMap<>(3, 0.75f, true); + + map.put("k1", "v1"); + map.put("k2", "v2"); + + X.println("Initial state: " + map); + + // Accessing first entry. + map.get("k1"); + + X.println("State after get: " + map); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/jvmtest/MultipleFileIOTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/jvmtest/MultipleFileIOTest.java b/modules/core/src/test/java/org/apache/ignite/jvmtest/MultipleFileIOTest.java new file mode 100644 index 0000000..ba2cbbd --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/jvmtest/MultipleFileIOTest.java @@ -0,0 +1,134 @@ +/* + * 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.jvmtest; + +import org.apache.ignite.internal.util.typedef.F; + +import java.io.*; +import java.util.*; + +/** + * + */ +public class MultipleFileIOTest { + /** Temp dir. */ + private static final String TMP_DIR = System.getProperty("java.io.tmpdir"); + + /** + * + */ + private MultipleFileIOTest() { + // No-op. + } + + /** + * @param args Args. + * @throws Exception If failed. + */ + @SuppressWarnings({"TooBroadScope"}) + public static void main(String args[]) throws Exception { + File parent = new File(TMP_DIR, "testMultipleFilesCreation"); + + System.out.println("Deleting: " + new Date()); + + delete(parent); + parent.mkdirs(); + + int childCnt = 10; + int subChildCnt = 10; + boolean useRaf = true; + + if (args.length > 0) { + childCnt = Integer.parseInt(args[0]); + subChildCnt = Integer.parseInt(args[1]); + } + + if (args.length > 3) + useRaf = Boolean.parseBoolean(args[2]); + + for (int i = 0; i < childCnt; i++) { + File f = new File(parent, String.valueOf(i)); + + f.mkdirs(); + + for (int j = 0; j < subChildCnt; j++) + new File(f, String.valueOf(j)).mkdirs(); + } + + System.out.println("Test started: " + new Date()); + System.out.println("Parent: " + parent.getAbsolutePath()); + + long start = System.currentTimeMillis(); + + byte[] data = new byte[4096]; + + for (int i = 0; i < 50000; i++) { + int idx1 = i % childCnt; + int idx2 = (i / childCnt) % subChildCnt; + + File f = new File(parent, idx1 + File.separator + idx2 + File.separatorChar + i); + + if (useRaf) { + RandomAccessFile raf = null; + + try { + raf = new RandomAccessFile(f, "rw"); + + raf.write(data); + } + finally { + if (raf != null) + raf.close(); + } + } + else { + FileOutputStream fos = null; + + try { + fos = new FileOutputStream(f); + + fos.write(data); + } + finally { + if (fos != null) + fos.close(); + } + } + } + + System.out.println("Test time: " + (System.currentTimeMillis() - start)); + } + + /** + * @param f File to delete. + */ + private static void delete(File f) { + assert f != null; + + if (f.isDirectory()) { + File[] files = f.listFiles(); + + if (!F.isEmpty(files)) { + for (File f0 : files) + delete(f0); + } + } + + f.delete(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/jvmtest/NetworkFailureTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/jvmtest/NetworkFailureTest.java b/modules/core/src/test/java/org/apache/ignite/jvmtest/NetworkFailureTest.java new file mode 100644 index 0000000..8aa9081 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/jvmtest/NetworkFailureTest.java @@ -0,0 +1,370 @@ +/* + * 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.jvmtest; + +import junit.framework.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.testframework.*; +import org.jetbrains.annotations.*; + +import javax.swing.*; +import java.io.*; +import java.net.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; + +/** + * + */ +public class NetworkFailureTest extends TestCase { + /** + * @throws Exception If failed. + */ + public void testNetworkFailure() throws Exception { + final AtomicBoolean done = new AtomicBoolean(); + + final InetAddress addr = InetAddress.getByName("192.168.0.100"); + + IgniteFuture<?> fut1 = GridTestUtils.runMultiThreadedAsync( + new Callable<Object>() { + @Nullable @Override public Object call() throws Exception { + ServerSocket srvSock = null; + Socket sock = null; + + try { + srvSock = new ServerSocket(60000, 0, addr); + + sock = srvSock.accept(); + + X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + ']'); + + sock.setKeepAlive(true); + + sock.setSoTimeout(2000); + + sock.setSendBufferSize(256 * 1024); + + X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + + ", sndBuf=" + sock.getSendBufferSize() + ", rcvBuf=" + sock.getReceiveBufferSize() + ']'); + + while (!done.get()) + X.println("Read from socket: " + sock.getInputStream().read()); + + return null; + } + finally { + U.closeQuiet(srvSock); + U.closeQuiet(sock); + } + } + }, + 1, + "server" + ); + + IgniteFuture<?> fut2 = GridTestUtils.runMultiThreadedAsync( + new Callable<Object>() { + @Nullable @Override public Object call() throws Exception { + Socket sock = null; + + try { + sock = new Socket(addr, 60000); + + X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + ']'); + + sock.setKeepAlive(true); + + sock.setSoTimeout(2000); + + sock.setSendBufferSize(256 * 1024); + + X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + ']'); + + int i = 0; + + while (!done.get()) { + sock.getOutputStream().write(++i); + + sock.getOutputStream().flush(); + + X.println("Wrote to socket: " + i); + + X.println("Socket connected: " + sock.isConnected()); + X.println("Socket keep alive: " + sock.getKeepAlive()); + + U.sleep(1000); + } + + return null; + } + finally { + U.closeQuiet(sock); + } + } + }, + 1, + "client" + ); + + JOptionPane.showMessageDialog(null, "Unplug network cable." + U.nl() + + "Press OK to finish."); + + done.set(true); + + fut1.get(); + fut2.get(); + } + + /** + * @throws Exception If failed. + */ + public void testReadTimeout() throws Exception { + final InetAddress addr = InetAddress.getByName("192.168.3.10"); + + IgniteFuture<?> fut1 = GridTestUtils.runMultiThreadedAsync( + new Callable<Object>() { + @Nullable @Override public Object call() throws Exception { + ServerSocket srvSock = null; + Socket sock = null; + + try { + srvSock = new ServerSocket(60000, 0, addr); + + sock = srvSock.accept(); + + X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + + ", NODELAY=" + sock.getTcpNoDelay() + ']'); + + sock.setSoTimeout(2000); + sock.setTcpNoDelay(true); + + X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + + ", NODELAY=" + sock.getTcpNoDelay() + ']'); + + sock.getInputStream().read(); + } + catch (IOException e) { + X.println("Caught expected exception: " + e); + + e.printStackTrace(); + } + finally { + U.closeQuiet(srvSock); + U.closeQuiet(sock); + } + + return null; + } + }, + 1, + "server" + ); + + IgniteFuture<?> fut2 = GridTestUtils.runMultiThreadedAsync( + new Callable<Object>() { + @Nullable @Override public Object call() throws Exception { + Socket sock = null; + + try { + sock = new Socket(addr, 60000); + + X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + + ", NODELAY=" + sock.getTcpNoDelay() + ']'); + + sock.setTcpNoDelay(true); + + X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + + ", NODELAY=" + sock.getTcpNoDelay() + ']'); + + Thread.sleep(10000); + + return null; + } + finally { + U.closeQuiet(sock); + } + } + }, + 1, + "client" + ); + + fut1.get(); + fut2.get(); + } + + /** + * @throws Exception If failed. + */ + public void testSocketCloseOnTimeout() throws Exception { + final AtomicBoolean done = new AtomicBoolean(); + + final InetAddress addr = InetAddress.getByName("192.168.0.100"); + + IgniteFuture<?> fut1 = GridTestUtils.runMultiThreadedAsync( + new Callable<Object>() { + @Nullable @Override public Object call() throws Exception { + ServerSocket srvSock = null; + Socket sock = null; + + try { + srvSock = new ServerSocket(60000, 0, addr); + + sock = srvSock.accept(); + + while (!done.get()) + U.sleep(1000); + + return null; + } + finally { + U.closeQuiet(srvSock); + U.closeQuiet(sock); + } + } + }, + 1, + "server" + ); + + final AtomicReference<Socket> sockRef = new AtomicReference<>(); + + IgniteFuture<?> fut2 = GridTestUtils.runMultiThreadedAsync( + new Callable<Object>() { + @Nullable @Override public Object call() throws Exception { + Socket sock = null; + + try { + sock = new Socket(addr, 60000); + + X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + ']'); + + sockRef.set(sock); + + sock.getOutputStream().write( + new byte[(sock.getSendBufferSize() + sock.getReceiveBufferSize()) * 2]); + + assert false : "Message has been written."; + } + catch (IOException e) { + X.println("Caught expected exception: " + e); + + e.printStackTrace(); + } + finally { + U.closeQuiet(sock); + } + + return null; + } + }, + 1, + "client" + ); + + IgniteFuture<?> fut3 = GridTestUtils.runMultiThreadedAsync( + new Callable<Object>() { + @Nullable @Override public Object call() throws Exception { + while (true) { + U.sleep(1000); + + Socket sock = sockRef.get(); + + if (sock != null) { + U.sleep(1000); + + U.closeQuiet(sock); + + return null; + } + } + } + }, + 1, + "client" + ); + + fut2.get(); + fut3.get(); + + done.set(true); + + fut1.get(); + } + + /** + * @throws Exception If failed. + */ + public void testConnectionTime() throws Exception { + X.println("Unexistent host."); + checkConnection(InetAddress.getByName("192.168.0.222")); + + X.println("Unlistened port."); + checkConnection(InetAddress.getByName("192.168.0.1")); + } + + /** + * @param addr Address to check connection to. + */ + private void checkConnection(InetAddress addr) { + long start = System.currentTimeMillis(); + + Socket sock = null; + + try { + sock = openSocket(addr, 80); + } + catch (Exception e) { + X.println("Caught exception: " + e.getClass().getSimpleName() + " - " + e.getMessage()); + } + finally { + X.println("Time taken: " + (System.currentTimeMillis() - start)); + + U.closeQuiet(sock); + } + } + + /** + * @param addr Remote address. + * @param port Remote port. + * @return Opened socket. + * @throws IOException If failed. + */ + private Socket openSocket(InetAddress addr, int port) throws IOException { + Socket sock = new Socket(); + + sock.bind(new InetSocketAddress(InetAddress.getByName("192.168.0.100"), 0)); + + sock.connect(new InetSocketAddress(addr, port), 1); + + X.println("Socket [timeout=" + sock.getSoTimeout() + ", linger=" + sock.getSoLinger() + + ", sndBuf=" + sock.getSendBufferSize() + ", sndBuf=" + sock.getSendBufferSize() + ']'); + + return sock; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/jvmtest/QueueSizeCounterMultiThreadedTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/jvmtest/QueueSizeCounterMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/jvmtest/QueueSizeCounterMultiThreadedTest.java new file mode 100644 index 0000000..ecbcdb5 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/jvmtest/QueueSizeCounterMultiThreadedTest.java @@ -0,0 +1,102 @@ +/* + * 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.jvmtest; + +import junit.framework.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.testframework.*; +import org.jetbrains.annotations.*; + +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; +import java.util.concurrent.locks.*; + +/** + * Test to check strange assertion in eviction manager. + */ +public class QueueSizeCounterMultiThreadedTest extends TestCase { + /** + * @throws Exception If failed. + */ + @SuppressWarnings({"LockAcquiredButNotSafelyReleased"}) + public void testQueueSizeCounter() throws Exception { + final ConcurrentLinkedQueue<Integer> q = new ConcurrentLinkedQueue<>(); + + final AtomicInteger sizeCnt = new AtomicInteger(); + + final AtomicBoolean done = new AtomicBoolean(); + + final AtomicBoolean guard = new AtomicBoolean(); + + final ReadWriteLock lock = new ReentrantReadWriteLock(); + + IgniteFuture fut1 = GridTestUtils.runMultiThreadedAsync( + new Callable<Object>() { + @SuppressWarnings( {"BusyWait"}) + @Nullable @Override public Object call() throws Exception { + int cleanUps = 0; + + while (!done.get()) { + lock.readLock().lock(); + + try { + q.add(1); + + sizeCnt.incrementAndGet(); + } + finally { + lock.readLock().unlock(); + } + + if (sizeCnt.get() > 100 && guard.compareAndSet(false, true)) { + lock.writeLock().lock(); + + try { + for (Integer i = q.poll(); i != null; i = q.poll()) + sizeCnt.decrementAndGet(); + + cleanUps++; + + assert sizeCnt.get() == 0 : "Invalid count [cnt=" + sizeCnt.get() + + ", size=" + q.size() + ", entries=" + q + ']'; + } + finally { + lock.writeLock().unlock(); + + guard.set(false); + } + } + } + + X.println("Cleanups count (per thread): " + cleanUps); + + return null; + } + }, + 100, + "test-thread" + ); + + Thread.sleep(3 * 60 * 1000); + + done.set(true); + + fut1.get(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/jvmtest/ReadWriteLockMultiThreadedTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/jvmtest/ReadWriteLockMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/jvmtest/ReadWriteLockMultiThreadedTest.java new file mode 100644 index 0000000..416f040 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/jvmtest/ReadWriteLockMultiThreadedTest.java @@ -0,0 +1,207 @@ +/* + * 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.jvmtest; + +import junit.framework.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.testframework.*; +import org.jetbrains.annotations.*; + +import java.util.concurrent.*; +import java.util.concurrent.locks.*; + +/** + * JDK read write lock test. + */ +public class ReadWriteLockMultiThreadedTest extends TestCase { + /** + * @throws Exception If failed. + */ + @SuppressWarnings({"LockAcquiredButNotSafelyReleased"}) + public void testReadThenWriteLockAcquire() throws Exception { + ReadWriteLock lock = new ReentrantReadWriteLock(); + + lock.readLock().lock(); + + lock.writeLock().lock(); + } + + /** + * + */ + public void testNotOwnedLockRelease() { + ReadWriteLock lock = new ReentrantReadWriteLock(); + + lock.readLock().unlock(); + } + + /** + * @throws Exception If failed. + */ + @SuppressWarnings({"LockAcquiredButNotSafelyReleased"}) + public void testWriteLockAcquire() throws Exception { + final ReadWriteLock lock = new ReentrantReadWriteLock(); + + lock.readLock().lock(); + + X.println("Read lock acquired."); + + IgniteFuture fut1 = GridTestUtils.runMultiThreadedAsync( + new Callable<Object>() { + @Nullable @Override public Object call() throws Exception { + X.println("Attempting to acquire write lock: " + lock); + + lock.writeLock().lock(); + + try { + X.println("Write lock acquired: " + lock); + + return null; + } + finally { + lock.writeLock().unlock(); + } + } + }, + 1, + "write-lock" + ); + + Thread.sleep(2000); + + IgniteFuture fut2 = GridTestUtils.runMultiThreadedAsync( + new Callable<Object>() { + @Nullable @Override public Object call() throws Exception { + X.println("Attempting to acquire read lock: " + lock); + + lock.readLock().lock(); + + try { + X.println("Read lock acquired: " + lock); + + return null; + } + finally { + lock.readLock().unlock(); + } + } + }, + 1, + "read-lock" + ); + + Thread.sleep(2000); + + X.println(">>> Dump threads now! <<<"); + + Thread.sleep(15 * 1000); + + X.println("Read lock released: " + lock); + + lock.readLock().unlock(); + + fut1.get(); + fut2.get(); + } + + /** + * @throws Exception If failed. + */ + @SuppressWarnings({"LockAcquiredButNotSafelyReleased"}) + public void testReadLockAcquire() throws Exception { + final ReadWriteLock lock = new ReentrantReadWriteLock(); + + lock.writeLock().lock(); + + X.println("Write lock acquired: " + lock); + + IgniteFuture fut = GridTestUtils.runMultiThreadedAsync( + new Callable<Object>() { + @Nullable @Override public Object call() throws Exception { + X.println("Attempting to acquire read lock: " + lock); + + lock.readLock().lock(); + + try { + X.println("Read lock acquired: " + lock); + + return null; + } + finally { + lock.readLock().unlock(); + } + } + }, + 1, + "read-lock" + ); + + Thread.sleep(2000); + + X.println(">>> Dump threads now! <<<"); + + Thread.sleep(15 * 1000); + + X.println("Write lock released."); + + lock.writeLock().unlock(); + + fut.get(); + } + + /** + * @throws Exception If failed. + */ + @SuppressWarnings({"LockAcquiredButNotSafelyReleased"}) + public void testTryWriteLock() throws Exception { + final ReadWriteLock lock = new ReentrantReadWriteLock(); + + lock.readLock().lock(); + + X.println("Read lock acquired."); + + IgniteFuture fut = GridTestUtils.runMultiThreadedAsync( + new Callable<Object>() { + @Nullable @Override public Object call() throws Exception { + boolean res = lock.writeLock().tryLock(); + + X.println("Attempting to try write lock: " + res); + + try { + return null; + } + finally { + if (res) + lock.writeLock().unlock(); + } + } + }, + 1, + "write-lock" + ); + + Thread.sleep(2000); + + X.println("Read lock released: " + lock); + + lock.readLock().unlock(); + + fut.get(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/jvmtest/RegExpTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/jvmtest/RegExpTest.java b/modules/core/src/test/java/org/apache/ignite/jvmtest/RegExpTest.java new file mode 100644 index 0000000..da94865 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/jvmtest/RegExpTest.java @@ -0,0 +1,56 @@ +/* + * 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.jvmtest; + +import junit.framework.*; +import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.internal.util.typedef.internal.*; + +import java.util.regex.*; + +/** + * Java reg exp test. + */ +public class RegExpTest extends TestCase { + /** + * @throws Exception If failed. + */ + public void testRegExp() throws Exception { + String normal = + "swap-spaces/space1/b53b3a3d6ab90ce0268229151c9bde11|b53b3a3d6ab90ce0268229151c9bde11|1315392441288"; + + byte[] b1 = new byte[200]; + byte[] b2 = normal.getBytes(); + + U.arrayCopy(b2, 0, b1, 30, b2.length); + + CharSequence corrupt = new String(b1); + + String ptrn = "[a-z0-9/\\-]+\\|[a-f0-9]+\\|[0-9]+"; + + Pattern p = Pattern.compile(ptrn); + + Matcher matcher = p.matcher(corrupt); + + assert matcher.find(); + + X.println(String.valueOf(matcher.start())); + + assert normal.matches(ptrn); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/jvmtest/ServerSocketMultiThreadedTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/jvmtest/ServerSocketMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/jvmtest/ServerSocketMultiThreadedTest.java new file mode 100644 index 0000000..f888d03 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/jvmtest/ServerSocketMultiThreadedTest.java @@ -0,0 +1,102 @@ +/* + * 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.jvmtest; + +import junit.framework.*; +import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.testframework.*; +import org.jetbrains.annotations.*; + +import java.net.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; + +/** + * Java server socket test. + * <p> + * http://gridgain.jira.com/browse/GG-2068 + * <p> + * When binding server socket to the same port in multiple threads, either + * BindException or SocketException may be thrown. Purpose of this test is + * to find some explanation to that. + */ +public class ServerSocketMultiThreadedTest extends TestCase { + /** */ + private static final int THREADS_CNT = 10; + + /** */ + private static final int ITER_CNT = 10000; + + /** + * @throws Exception If failed. + */ + public void testConcurrentBind() throws Exception { + final AtomicInteger bindExCnt = new AtomicInteger(); + final AtomicInteger sockExCnt = new AtomicInteger(); + final AtomicInteger okCnt = new AtomicInteger(); + + final CyclicBarrier finishBarrier = new CyclicBarrier( + THREADS_CNT, + new Runnable() { + private int i; + + @Override public void run() { + if (++i % 250 == 0) + X.println("Finished iteration [threadName=" + Thread.currentThread().getName() + + ", iter=" + i + ']'); + } + }); + + final InetAddress addr = InetAddress.getByName("127.0.0.1"); + + GridTestUtils.runMultiThreaded( + new Callable<Object>() { + @Nullable @Override public Object call() throws Exception { + ServerSocket srvSock = null; + + for (int i = 0; i < ITER_CNT; i++) { + try { + srvSock = new ServerSocket(60000, 0, addr); + + okCnt.incrementAndGet(); + } + catch (BindException ignore) { + bindExCnt.incrementAndGet(); + } + catch (SocketException ignore) { + sockExCnt.incrementAndGet(); + } + finally { + finishBarrier.await(); + + U.closeQuiet(srvSock); + } + } + + return null; + } + }, + THREADS_CNT, + "binder" + ); + + X.println("Test stats [bindExCnt=" + bindExCnt.get() + ", sockExCnt=" + sockExCnt.get() + + ", okCnt=" + okCnt + ']'); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/GridCacheMultiNodeLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/GridCacheMultiNodeLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/GridCacheMultiNodeLoadTest.java index 07c135d..f0999b1 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/GridCacheMultiNodeLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/GridCacheMultiNodeLoadTest.java @@ -24,7 +24,7 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.junits.common.*; import static org.apache.ignite.cache.GridCacheMode.*; import static org.apache.ignite.cache.GridCacheDistributionMode.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java index cd55332..a4564e1 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java @@ -26,8 +26,8 @@ import org.apache.log4j.*; import org.apache.log4j.varia.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.testframework.*; -import org.gridgain.testframework.junits.logger.*; +import org.apache.ignite.testframework.*; +import org.apache.ignite.testframework.junits.logger.*; import org.jetbrains.annotations.*; import org.springframework.beans.*; import org.springframework.context.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheBenchmark.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheBenchmark.java index ec8ff01..b781f59 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheBenchmark.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheBenchmark.java @@ -20,7 +20,7 @@ package org.apache.ignite.loadtests.cache; import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; +import org.apache.ignite.testframework.*; import org.jetbrains.annotations.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheGroupLockComparisonTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheGroupLockComparisonTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheGroupLockComparisonTest.java index ee7000b..e8c7b11 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheGroupLockComparisonTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheGroupLockComparisonTest.java @@ -22,7 +22,7 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cache.affinity.*; import org.apache.ignite.transactions.*; import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; +import org.apache.ignite.testframework.*; import org.jetbrains.annotations.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheLoadTest.java index 2689672..0d5935c 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheLoadTest.java @@ -20,7 +20,7 @@ package org.apache.ignite.loadtests.cache; import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; +import org.apache.ignite.testframework.*; import java.util.*; import java.util.concurrent.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSingleNodeLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSingleNodeLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSingleNodeLoadTest.java index d034593..313ab4d 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSingleNodeLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSingleNodeLoadTest.java @@ -26,7 +26,7 @@ import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.testframework.*; +import org.apache.ignite.testframework.*; import org.jetbrains.annotations.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSwapLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSwapLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSwapLoadTest.java index abc5ce0..66e99f8 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSwapLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSwapLoadTest.java @@ -22,7 +22,7 @@ import org.apache.ignite.cache.*; import org.apache.ignite.events.*; import org.apache.ignite.lang.*; import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; +import org.apache.ignite.testframework.*; import org.jetbrains.annotations.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java index 9887317..c53850f 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java @@ -25,7 +25,7 @@ import org.apache.ignite.lang.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.junits.common.*; import javax.cache.*; import javax.cache.configuration.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark.java b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark.java index b5a2b15..ffbda7a 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark.java @@ -26,7 +26,7 @@ import org.apache.ignite.internal.managers.discovery.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.loadtests.util.*; -import org.gridgain.testframework.*; +import org.apache.ignite.testframework.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; @@ -36,7 +36,7 @@ import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.*; import static org.apache.ignite.internal.managers.communication.GridIoPolicy.*; -import static org.gridgain.testframework.GridLoadTestUtils.*; +import static org.apache.ignite.testframework.GridLoadTestUtils.*; /** * By default this benchmarks uses original GridGain configuration http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java index dd4c09e..f985d45 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java @@ -31,8 +31,8 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.testframework.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.*; +import org.apache.ignite.testframework.junits.common.*; import org.jdk8.backport.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTcpCommunicationBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTcpCommunicationBenchmark.java b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTcpCommunicationBenchmark.java index 8c06610..14ce0c3 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTcpCommunicationBenchmark.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTcpCommunicationBenchmark.java @@ -25,9 +25,9 @@ package org.apache.ignite.loadtests.communication; //import org.gridgain.grid.spi.communication.tcp.*; //import org.gridgain.grid.typedef.*; //import org.gridgain.grid.typedef.internal.*; -//import org.gridgain.testframework.*; -//import org.gridgain.testframework.junits.*; -//import org.gridgain.testframework.junits.spi.*; +//import org.apache.ignite.testframework.*; +//import org.apache.ignite.testframework.junits.*; +//import org.apache.ignite.testframework.junits.spi.*; // //import java.util.*; //import java.util.concurrent.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java index d6d4f12..d539dd6 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java @@ -35,8 +35,8 @@ import java.util.concurrent.atomic.*; import static org.apache.ignite.events.IgniteEventType.*; import static org.apache.ignite.loadtests.util.GridLoadTestArgs.*; -import static org.gridgain.testframework.GridLoadTestUtils.*; -import static org.gridgain.testframework.GridTestUtils.*; +import static org.apache.ignite.testframework.GridLoadTestUtils.*; +import static org.apache.ignite.testframework.GridTestUtils.*; /** * Load test for {@link org.apache.ignite.cache.query.GridCacheContinuousQuery}. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/datastructures/GridCachePartitionedAtomicLongLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/datastructures/GridCachePartitionedAtomicLongLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/datastructures/GridCachePartitionedAtomicLongLoadTest.java index 9ccab68..2c01f74 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/datastructures/GridCachePartitionedAtomicLongLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/datastructures/GridCachePartitionedAtomicLongLoadTest.java @@ -27,7 +27,7 @@ import org.apache.ignite.transactions.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.junits.common.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsLoadTest.java index a9bb491..f42fb4b 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsLoadTest.java @@ -26,9 +26,9 @@ import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; -import org.gridgain.testframework.config.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.*; +import org.apache.ignite.testframework.config.*; +import org.apache.ignite.testframework.junits.common.*; import java.util.concurrent.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsRedeployLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsRedeployLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsRedeployLoadTest.java index b000933..2b55e5b 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsRedeployLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/multisplit/GridMultiSplitsRedeployLoadTest.java @@ -22,9 +22,9 @@ import org.apache.ignite.compute.*; import org.apache.ignite.configuration.*; import org.gridgain.grid.loadtest.*; import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; -import org.gridgain.testframework.config.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.*; +import org.apache.ignite.testframework.config.*; +import org.apache.ignite.testframework.junits.common.*; import java.util.concurrent.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java index 42bd8e0..6976ffe 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java @@ -25,9 +25,9 @@ import org.gridgain.grid.loadtest.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.*; import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; -import org.gridgain.testframework.config.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.*; +import org.apache.ignite.testframework.config.*; +import org.apache.ignite.testframework.junits.common.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesMulticastLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesMulticastLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesMulticastLoadTest.java index 2b379fb..baf7a51 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesMulticastLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesMulticastLoadTest.java @@ -20,7 +20,7 @@ package org.apache.ignite.loadtests.direct.newnodes; import org.apache.ignite.configuration.*; import org.apache.ignite.spi.discovery.*; import org.apache.ignite.spi.discovery.tcp.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.junits.common.*; /** * http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/redeploy/GridSingleSplitsRedeployLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/redeploy/GridSingleSplitsRedeployLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/redeploy/GridSingleSplitsRedeployLoadTest.java index 1a3982c..534b65b 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/redeploy/GridSingleSplitsRedeployLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/redeploy/GridSingleSplitsRedeployLoadTest.java @@ -26,9 +26,9 @@ import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; -import org.gridgain.testframework.config.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.*; +import org.apache.ignite.testframework.config.*; +import org.apache.ignite.testframework.junits.common.*; import java.util.concurrent.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bd28003b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/session/GridSessionLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/session/GridSessionLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/session/GridSessionLoadTest.java index cf35d4f..8870f94 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/session/GridSessionLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/session/GridSessionLoadTest.java @@ -21,9 +21,9 @@ import org.apache.ignite.*; import org.apache.ignite.compute.*; import org.gridgain.grid.loadtest.*; import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; -import org.gridgain.testframework.config.*; -import org.gridgain.testframework.junits.common.*; +import org.apache.ignite.testframework.*; +import org.apache.ignite.testframework.config.*; +import org.apache.ignite.testframework.junits.common.*; import java.util.concurrent.atomic.*;