http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java index 4c40e75..a689abb 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java @@ -35,8 +35,7 @@ public class IgniteCacheDataStructuresSelfTestSuite extends TestSuite { TestSuite suite = new TestSuite("Ignite Cache Data Structures Test Suite"); // Data structures. - // TODO: IGNITE-264 - // suite.addTest(new TestSuite(GridCachePartitionedQueueFailoverDataConsistencySelfTest.class)); + suite.addTest(new TestSuite(GridCachePartitionedQueueFailoverDataConsistencySelfTest.class)); suite.addTest(new TestSuite(GridCachePartitionedAtomicQueueFailoverDataConsistencySelfTest.class)); suite.addTest(new TestSuite(GridCacheLocalSequenceApiSelfTest.class)); @@ -54,8 +53,7 @@ public class IgniteCacheDataStructuresSelfTestSuite extends TestSuite { suite.addTest(new TestSuite(GridCacheReplicatedQueueMultiNodeSelfTest.class)); suite.addTest(new TestSuite(GridCacheReplicatedQueueRotativeMultiNodeTest.class)); suite.addTest(new TestSuite(GridCacheReplicatedSetSelfTest.class)); - // TODO: GG-5306 - // suite.addTest(new TestSuite(GridCacheReplicatedDataStructuresFailoverSelfTest.class)); + suite.addTest(new TestSuite(GridCacheReplicatedDataStructuresFailoverSelfTest.class)); suite.addTest(new TestSuite(IgniteReplicatedCountDownLatchSelfTest.class)); suite.addTest(new TestSuite(GridCachePartitionedSequenceApiSelfTest.class)); @@ -68,10 +66,9 @@ public class IgniteCacheDataStructuresSelfTestSuite extends TestSuite { suite.addTest(new TestSuite(GridCachePartitionedAtomicQueueMultiNodeSelfTest.class)); suite.addTest(new TestSuite(GridCachePartitionedAtomicOffheapQueueMultiNodeSelfTest.class)); - // TODO: IGNITE-80. - //suite.addTest(new TestSuite(GridCachePartitionedQueueCreateMultiNodeSelfTest.class)); - //suite.addTest(new TestSuite(GridCachePartitionedAtomicQueueCreateMultiNodeSelfTest.class)); - //suite.addTest(new TestSuite(GridCachePartitionedAtomicOffheapQueueCreateMultiNodeSelfTest.class)); + suite.addTest(new TestSuite(GridCachePartitionedQueueCreateMultiNodeSelfTest.class)); + suite.addTest(new TestSuite(GridCachePartitionedAtomicQueueCreateMultiNodeSelfTest.class)); + suite.addTest(new TestSuite(GridCachePartitionedAtomicOffheapQueueCreateMultiNodeSelfTest.class)); suite.addTest(new TestSuite(GridCachePartitionedSetSelfTest.class)); suite.addTest(new TestSuite(GridCachePartitionedOffHeapValuesSetSelfTest.class)); suite.addTest(new TestSuite(IgnitePartitionedSetNoBackupsSelfTest.class)); @@ -86,14 +83,11 @@ public class IgniteCacheDataStructuresSelfTestSuite extends TestSuite { suite.addTest(new TestSuite(GridCachePartitionedAtomicQueueRotativeMultiNodeTest.class)); suite.addTest(new TestSuite(GridCacheQueueCleanupSelfTest.class)); - // TODO: GG-5620 Uncomment when fix - //suite.addTest(new TestSuite(GridCachePartitionedQueueEntryMoveSelfTest.class)); + suite.addTest(new TestSuite(GridCachePartitionedQueueEntryMoveSelfTest.class)); - // TODO: GG-2699 - //suite.addTest(new TestSuite(GridCachePartitionedDataStructuresFailoverSelfTest.class)); - //suite.addTest(new TestSuite(GridCachePartitionedOffheapDataStructuresFailoverSelfTest.class)); - // TODO: GG-4807 Uncomment when fix - // suite.addTest(new TestSuite(GridCacheQueueMultiNodeConsistencySelfTest.class)); + suite.addTest(new TestSuite(GridCachePartitionedDataStructuresFailoverSelfTest.class)); + suite.addTest(new TestSuite(GridCachePartitionedOffheapDataStructuresFailoverSelfTest.class)); + suite.addTest(new TestSuite(GridCacheQueueMultiNodeConsistencySelfTest.class)); suite.addTest(new TestSuite(IgniteLocalAtomicLongApiSelfTest.class)); suite.addTest(new TestSuite(IgnitePartitionedAtomicLongApiSelfTest.class)); @@ -112,6 +106,9 @@ public class IgniteCacheDataStructuresSelfTestSuite extends TestSuite { suite.addTest(new TestSuite(IgniteDataStructureUniqueNameTest.class)); + suite.addTest(new TestSuite(IgniteClientDataStructuresTest.class)); + suite.addTest(new TestSuite(IgniteClientDiscoveryDataStructuresTest.class)); + return suite; } }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java index 0852496..4401dc5 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java @@ -37,15 +37,13 @@ public class IgniteCacheEvictionSelfTestSuite extends TestSuite { public static TestSuite suite() throws Exception { TestSuite suite = new TestSuite("Ignite Cache Eviction Test Suite"); - suite.addTest(new TestSuite(GridCacheFifoEvictionPolicySelfTest.class)); - suite.addTest(new TestSuite(GridCacheFifoBatchEvictionPolicySelfTest.class)); - suite.addTest(new TestSuite(GridCacheSortedEvictionPolicySelfTest.class)); - suite.addTest(new TestSuite(GridCacheSortedBatchEvictionPolicySelfTest.class)); - suite.addTest(new TestSuite(GridCacheLruEvictionPolicySelfTest.class)); - suite.addTest(new TestSuite(GridCacheLruNearEvictionPolicySelfTest.class)); - suite.addTest(new TestSuite(GridCacheNearOnlyLruNearEvictionPolicySelfTest.class)); + suite.addTest(new TestSuite(FifoEvictionPolicySelfTest.class)); + suite.addTest(new TestSuite(SortedEvictionPolicySelfTest.class)); + suite.addTest(new TestSuite(LruEvictionPolicySelfTest.class)); + suite.addTest(new TestSuite(LruNearEvictionPolicySelfTest.class)); + suite.addTest(new TestSuite(LruNearOnlyNearEvictionPolicySelfTest.class)); + suite.addTest(new TestSuite(RandomEvictionPolicySelfTest.class)); suite.addTest(new TestSuite(RandomEvictionPolicyCacheSizeSelfTest.class)); - suite.addTest(new TestSuite(GridCacheRandomEvictionPolicySelfTest.class)); suite.addTest(new TestSuite(GridCacheNearEvictionSelfTest.class)); suite.addTest(new TestSuite(GridCacheAtomicNearEvictionSelfTest.class)); suite.addTest(new TestSuite(GridCacheEvictionFilterSelfTest.class)); @@ -59,8 +57,7 @@ public class IgniteCacheEvictionSelfTestSuite extends TestSuite { suite.addTest(new TestSuite(GridCacheEmptyEntriesPartitionedSelfTest.class)); suite.addTest(new TestSuite(GridCacheEmptyEntriesLocalSelfTest.class)); suite.addTest(new TestSuite(GridCacheMemoryModeSelfTest.class)); - // TODO: 5276. - //suite.addTest(new TestSuite(GridCacheSynchronousEvictionsFailoverSelfTest.class)); + suite.addTest(new TestSuite(GridCacheSynchronousEvictionsFailoverSelfTest.class)); return suite; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java index c7f85b3..08178db 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java @@ -23,6 +23,7 @@ import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; +import org.apache.ignite.internal.processors.cache.distributed.replicated.*; import org.apache.ignite.testframework.*; import java.util.*; @@ -48,15 +49,18 @@ public class IgniteCacheFailoverTestSuite extends TestSuite { TestSuite suite = new TestSuite("Cache Failover Test Suite"); suite.addTestSuite(GridCacheAtomicInvalidPartitionHandlingSelfTest.class); + suite.addTestSuite(GridCacheAtomicClientInvalidPartitionHandlingSelfTest.class); GridTestUtils.addTestIfNeeded(suite, GridCacheIncrementTransformTest.class, ignoredTests); // Failure consistency tests. suite.addTestSuite(GridCacheAtomicRemoveFailureTest.class); suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderRemoveFailureTest.class); + suite.addTestSuite(GridCacheAtomicClientRemoveFailureTest.class); suite.addTestSuite(GridCacheDhtAtomicRemoveFailureTest.class); suite.addTestSuite(GridCacheDhtRemoveFailureTest.class); + suite.addTestSuite(GridCacheDhtClientRemoveFailureTest.class); suite.addTestSuite(GridCacheNearRemoveFailureTest.class); suite.addTestSuite(GridCacheAtomicNearRemoveFailureTest.class); suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest.class); @@ -72,10 +76,9 @@ public class IgniteCacheFailoverTestSuite extends TestSuite { suite.addTestSuite(IgniteCacheTxNearDisabledPutGetRestartTest.class); suite.addTestSuite(IgniteCacheTxNearDisabledFairAffinityPutGetRestartTest.class); - // TODO IGNITE-882. - //suite.addTestSuite(GridCachePartitionedFailoverSelfTest.class); - //suite.addTestSuite(GridCacheColocatedFailoverSelfTest.class); - //suite.addTestSuite(GridCacheReplicatedFailoverSelfTest.class); + suite.addTestSuite(GridCachePartitionedFailoverSelfTest.class); + suite.addTestSuite(GridCacheColocatedFailoverSelfTest.class); + suite.addTestSuite(GridCacheReplicatedFailoverSelfTest.class); return suite; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java index 369e041..8ceb7e7 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java @@ -130,16 +130,10 @@ public class IgniteCacheFullApiSelfTestSuite extends TestSuite { suite.addTestSuite(GridCachePartitionedNearDisabledOffHeapTieredMultiNodeFullApiSelfTest.class); suite.addTestSuite(GridCachePartitionedNearDisabledAtomicOffHeapTieredMultiNodeFullApiSelfTest.class); - // Private cache API. - suite.addTestSuite(GridCacheExLocalFullApiSelfTest.class); - suite.addTestSuite(GridCacheExReplicatedFullApiSelfTest.class); - suite.addTestSuite(GridCacheExNearFullApiSelfTest.class); - suite.addTestSuite(GridCacheExColocatedFullApiSelfTest.class); - -// Multithreaded // TODO: GG-708 -// suite.addTestSuite(GridCacheLocalFullApiMultithreadedSelfTest.class); -// suite.addTestSuite(GridCacheReplicatedFullApiMultithreadedSelfTest.class); -// suite.addTestSuite(GridCachePartitionedFullApiMultithreadedSelfTest.class); + // Multithreaded + suite.addTestSuite(GridCacheLocalFullApiMultithreadedSelfTest.class); + suite.addTestSuite(GridCacheReplicatedFullApiMultithreadedSelfTest.class); + suite.addTestSuite(GridCachePartitionedFullApiMultithreadedSelfTest.class); return suite; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMetricsSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMetricsSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMetricsSelfTestSuite.java index 1adf55f..9a0e5fc 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMetricsSelfTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMetricsSelfTestSuite.java @@ -39,6 +39,7 @@ public class IgniteCacheMetricsSelfTestSuite extends TestSuite { suite.addTestSuite(GridCacheReplicatedMetricsSelfTest.class); suite.addTestSuite(GridCachePartitionedMetricsSelfTest.class); suite.addTestSuite(GridCachePartitionedHitsAndMissesSelfTest.class); + suite.addTestSuite(CacheLocalOffHeapAndSwapMetricsSelfTest.class); // Atomic cache. suite.addTestSuite(GridCacheAtomicLocalMetricsSelfTest.class); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheNearOnlySelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheNearOnlySelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheNearOnlySelfTestSuite.java index a010c5d..7d28578 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheNearOnlySelfTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheNearOnlySelfTestSuite.java @@ -20,7 +20,6 @@ package org.apache.ignite.testsuites; import junit.framework.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; -import org.apache.ignite.internal.processors.cache.distributed.replicated.*; /** * Test suite for near-only cache. @@ -33,12 +32,17 @@ public class IgniteCacheNearOnlySelfTestSuite { public static TestSuite suite() throws Exception { TestSuite suite = new TestSuite("Near-only cache test suite."); - suite.addTest(new TestSuite(GridCacheNearOnlySelfTest.class)); - suite.addTest(new TestSuite(GridCacheAtomicNearOnlySelfTest.class)); - suite.addTest(new TestSuite(GridCacheClientOnlySelfTest.class)); + suite.addTest(new TestSuite(GridCacheClientOnlySelfTest.CasePartitionedAtomic.class)); + suite.addTest(new TestSuite(GridCacheClientOnlySelfTest.CasePartitionedTransactional.class)); + suite.addTest(new TestSuite(GridCacheClientOnlySelfTest.CaseReplicatedAtomic.class)); + suite.addTest(new TestSuite(GridCacheClientOnlySelfTest.CaseReplicatedTransactional.class)); + suite.addTest(new TestSuite(GridCacheNearOnlyTopologySelfTest.class)); - suite.addTest(new TestSuite(GridCacheReplicatedClientOnlySelfTest.class)); - suite.addTest(new TestSuite(GridCacheReplicatedNearOnlySelfTest.class)); + + suite.addTest(new TestSuite(GridCacheNearOnlySelfTest.CasePartitionedAtomic.class)); + suite.addTest(new TestSuite(GridCacheNearOnlySelfTest.CasePartitionedTransactional.class)); + suite.addTest(new TestSuite(GridCacheNearOnlySelfTest.CaseReplicatedAtomic.class)); + suite.addTest(new TestSuite(GridCacheNearOnlySelfTest.CaseReplicatedTransactional.class)); return suite; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuit.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuit.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuit.java deleted file mode 100644 index ebf904e..0000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuit.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.testsuites; - -import junit.framework.*; -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.testframework.*; - -import java.util.*; - -/** - * Checks behavior on exception while unmarshalling key. - */ -public class IgniteCacheP2pUnmarshallingErrorTestSuit extends TestSuite { - /** - * @return Suite. - * @throws Exception If failed. - */ - public static TestSuite suite() throws Exception { - return suite(null); - } - - /** - * @param ignoredTests Tests don't include in the execution. - * @return Test suite. - * @throws Exception Thrown in case of the failure. - */ - public static TestSuite suite(Set<Class> ignoredTests) throws Exception { - TestSuite suite = new TestSuite("P2p Unmarshalling Test Suite"); - - GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2pUnmarshallingErrorTest.class, ignoredTests); - GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2pUnmarshallingNearErrorTest.class, ignoredTests); - GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2pUnmarshallingRebalanceErrorTest.class, ignoredTests); - GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2pUnmarshallingTxErrorTest.class, ignoredTests); - - return suite; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java new file mode 100644 index 0000000..7cfefd1 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java @@ -0,0 +1,53 @@ +/* + * 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.testsuites; + +import junit.framework.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.testframework.*; + +import java.util.*; + +/** + * Checks behavior on exception while unmarshalling key. + */ +public class IgniteCacheP2pUnmarshallingErrorTestSuite extends TestSuite { + /** + * @return Suite. + * @throws Exception If failed. + */ + public static TestSuite suite() throws Exception { + return suite(null); + } + + /** + * @param ignoredTests Tests don't include in the execution. + * @return Test suite. + * @throws Exception Thrown in case of the failure. + */ + public static TestSuite suite(Set<Class> ignoredTests) throws Exception { + TestSuite suite = new TestSuite("P2p Unmarshalling Test Suite"); + + GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2pUnmarshallingErrorTest.class, ignoredTests); + GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2pUnmarshallingNearErrorTest.class, ignoredTests); + GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2pUnmarshallingRebalanceErrorTest.class, ignoredTests); + GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2pUnmarshallingTxErrorTest.class, ignoredTests); + + return suite; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java index 24945dd..f0649f5 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java @@ -21,6 +21,7 @@ import junit.framework.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; +import org.apache.ignite.internal.processors.cache.distributed.replicated.*; /** * In-Memory Data Grid stability test suite on changing topology. @@ -35,13 +36,12 @@ public class IgniteCacheRestartTestSuite extends TestSuite { suite.addTestSuite(GridCachePartitionedTxSalvageSelfTest.class); - // TODO IGNITE-882. - //suite.addTestSuite(GridCachePartitionedNodeRestartTest.class); - //suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class); - //suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class); + suite.addTestSuite(GridCachePartitionedNodeRestartTest.class); + suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class); + suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class); suite.addTestSuite(IgniteCacheAtomicNodeRestartTest.class); - // suite.addTestSuite(IgniteCacheAtomicReplicatedNodeRestartSelfTest.class); // TODO IGNITE-747 + suite.addTestSuite(IgniteCacheAtomicReplicatedNodeRestartSelfTest.class); suite.addTestSuite(IgniteCacheAtomicPutAllFailoverSelfTest.class); suite.addTestSuite(IgniteCachePutAllRestartTest.class); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTcpClientDiscoveryTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTcpClientDiscoveryTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTcpClientDiscoveryTestSuite.java new file mode 100644 index 0000000..8c046f0 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTcpClientDiscoveryTestSuite.java @@ -0,0 +1,47 @@ +/* + * 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.testsuites; + +import junit.framework.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.*; + +/** + * Tests a cache with TcpClientDiscovery SPI being enabled. + */ +public class IgniteCacheTcpClientDiscoveryTestSuite { + /** + * @return Suite. + * @throws Exception If failed. + */ + public static TestSuite suite() throws Exception { + TestSuite suite = new TestSuite("Cache + TcpClientDiscovery SPI test suite."); + + suite.addTest(new TestSuite(GridCacheClientModesTcpClientDiscoveryAbstractTest.CaseNearPartitionedAtomic.class)); + suite.addTest(new TestSuite(GridCacheClientModesTcpClientDiscoveryAbstractTest.CaseNearPartitionedTransactional.class)); + suite.addTest(new TestSuite(GridCacheClientModesTcpClientDiscoveryAbstractTest.CaseNearReplicatedAtomic.class)); + suite.addTest(new TestSuite(GridCacheClientModesTcpClientDiscoveryAbstractTest.CaseNearReplicatedTransactional.class)); + suite.addTest(new TestSuite(GridCacheClientModesTcpClientDiscoveryAbstractTest.CaseClientPartitionedAtomic.class)); + suite.addTest(new TestSuite(GridCacheClientModesTcpClientDiscoveryAbstractTest.CaseClientPartitionedTransactional.class)); + suite.addTest(new TestSuite(GridCacheClientModesTcpClientDiscoveryAbstractTest.CaseClientReplicatedAtomic.class)); + suite.addTest(new TestSuite(GridCacheClientModesTcpClientDiscoveryAbstractTest.CaseClientReplicatedTransactional.class)); + suite.addTest(new TestSuite(GridCacheTcpClientDiscoveryMultiThreadedTest.class)); + + return suite; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 2a0065c..6245308 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 @@ -20,6 +20,7 @@ package org.apache.ignite.testsuites; import junit.framework.*; import org.apache.ignite.*; import org.apache.ignite.cache.*; +import org.apache.ignite.cache.affinity.*; import org.apache.ignite.cache.affinity.fair.*; import org.apache.ignite.cache.store.*; import org.apache.ignite.cache.store.jdbc.*; @@ -28,6 +29,8 @@ import org.apache.ignite.internal.processors.cache.context.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; +import org.apache.ignite.internal.processors.cache.distributed.replicated.*; +import org.apache.ignite.internal.processors.cache.local.*; import org.apache.ignite.internal.processors.datastreamer.*; import org.apache.ignite.testframework.*; @@ -97,6 +100,7 @@ public class IgniteCacheTestSuite extends TestSuite { suite.addTestSuite(IgniteFairAffinityDynamicCacheSelfTest.class); suite.addTestSuite(GridCacheAffinityBackupsSelfTest.class); suite.addTestSuite(IgniteCacheAffinitySelfTest.class); + suite.addTestSuite(IgniteClientNodeAffinityTest.class); // Swap tests. suite.addTestSuite(GridCacheSwapPreloadSelfTest.class); @@ -121,6 +125,7 @@ public class IgniteCacheTestSuite extends TestSuite { suite.addTestSuite(GridCacheStoreValueBytesSelfTest.class); GridTestUtils.addTestIfNeeded(suite, DataStreamProcessorSelfTest.class, ignoredTests); suite.addTestSuite(DataStreamerMultiThreadedSelfTest.class); + suite.addTestSuite(DataStreamerMultinodeCreateCacheTest.class); suite.addTestSuite(DataStreamerImplSelfTest.class); GridTestUtils.addTestIfNeeded(suite, GridCacheEntryMemorySizeSelfTest.class, ignoredTests); suite.addTestSuite(GridCacheClearAllSelfTest.class); @@ -131,7 +136,7 @@ public class IgniteCacheTestSuite extends TestSuite { suite.addTestSuite(GridCacheTtlManagerSelfTest.class); suite.addTestSuite(GridCacheLifecycleAwareSelfTest.class); suite.addTestSuite(IgniteCacheAtomicStopBusySelfTest.class); - // suite.addTestSuite(IgniteCacheTransactionalStopBusySelfTest.class); TODO Ignite-257. + suite.addTestSuite(IgniteCacheTransactionalStopBusySelfTest.class); suite.addTestSuite(GridCacheAtomicNearCacheSelfTest.class); suite.addTestSuite(CacheAtomicNearUpdateTopologyChangeTest.class); suite.addTestSuite(CacheTxNearUpdateTopologyChangeTest.class); @@ -158,12 +163,14 @@ public class IgniteCacheTestSuite extends TestSuite { suite.addTestSuite(GridCacheTxPartitionedLocalStoreSelfTest.class); suite.addTestSuite(IgniteCacheSystemTransactionsSelfTest.class); - // Heuristic exception handling. TODO IGNITE-257 -// suite.addTestSuite(GridCacheColocatedTxExceptionSelfTest.class); -// suite.addTestSuite(GridCacheReplicatedTxExceptionSelfTest.class); -// suite.addTestSuite(GridCacheLocalTxExceptionSelfTest.class); -// suite.addTestSuite(GridCacheNearTxExceptionSelfTest.class); -// suite.addTestSuite(GridCacheStopSelfTest.class); TODO IGNITE-257 + suite.addTest(IgniteCacheTcpClientDiscoveryTestSuite.suite()); + + // Heuristic exception handling. + suite.addTestSuite(GridCacheColocatedTxExceptionSelfTest.class); + suite.addTestSuite(GridCacheReplicatedTxExceptionSelfTest.class); + suite.addTestSuite(GridCacheLocalTxExceptionSelfTest.class); + suite.addTestSuite(GridCacheNearTxExceptionSelfTest.class); + suite.addTestSuite(GridCacheStopSelfTest.class); suite.addTestSuite(IgniteCacheNearLockValueSelfTest.class); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java index 7fa0a03..6a59826 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java @@ -91,7 +91,7 @@ public class IgniteCacheTestSuite2 extends TestSuite { suite.addTest(new TestSuite(GridCacheDhtEntrySelfTest.class)); suite.addTest(new TestSuite(GridCacheDhtInternalEntrySelfTest.class)); suite.addTest(new TestSuite(GridCacheDhtMappingSelfTest.class)); -// suite.addTest(new TestSuite(GridCachePartitionedTxMultiThreadedSelfTest.class)); TODO-gg-4066 + suite.addTest(new TestSuite(GridCachePartitionedTxMultiThreadedSelfTest.class)); suite.addTest(new TestSuite(GridCacheDhtPreloadSelfTest.class)); suite.addTest(new TestSuite(GridCacheDhtPreloadOffHeapSelfTest.class)); suite.addTest(new TestSuite(GridCacheDhtPreloadBigDataSelfTest.class)); @@ -116,7 +116,7 @@ public class IgniteCacheTestSuite2 extends TestSuite { suite.addTest(new TestSuite(GridCacheReplicatedEvictionSelfTest.class)); suite.addTest(new TestSuite(GridCacheDhtEvictionNearReadersSelfTest.class)); suite.addTest(new TestSuite(GridCacheDhtAtomicEvictionNearReadersSelfTest.class)); -// suite.addTest(new TestSuite(GridCachePartitionedTopologyChangeSelfTest.class)); TODO-gg-5489 + suite.addTest(new TestSuite(GridCachePartitionedTopologyChangeSelfTest.class)); suite.addTest(new TestSuite(GridCachePartitionedPreloadEventsSelfTest.class)); suite.addTest(new TestSuite(GridCachePartitionedUnloadEventsSelfTest.class)); suite.addTest(new TestSuite(GridCachePartitionedAffinityHashIdResolverSelfTest.class)); @@ -130,15 +130,14 @@ public class IgniteCacheTestSuite2 extends TestSuite { suite.addTest(new TestSuite(GridCacheOffheapUpdateSelfTest.class)); - // TODO: GG-7242, GG-7243: Enabled when fixed. -// suite.addTest(new TestSuite(GridCacheDhtRemoveFailureTest.class)); -// suite.addTest(new TestSuite(GridCacheNearRemoveFailureTest.class)); - // TODO: GG-7201: Enable when fixed. - //suite.addTest(new TestSuite(GridCacheDhtAtomicRemoveFailureTest.class)); - suite.addTest(new TestSuite(GridCacheNearPrimarySyncSelfTest.class)); suite.addTest(new TestSuite(GridCacheColocatedPrimarySyncSelfTest.class)); + suite.addTest(new TestSuite(IgniteCachePartitionMapUpdateTest.class)); + suite.addTest(new TestSuite(IgniteCacheClientNodePartitionsExchangeTest.class)); + suite.addTest(new TestSuite(IgniteCacheClientNodeChangingTopologyTest.class)); + suite.addTest(new TestSuite(IgniteCacheClientNodeConcurrentStart.class)); + return suite; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java index c2b56ca..5947d33 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java @@ -56,12 +56,10 @@ public class IgniteCacheTestSuite3 extends TestSuite { suite.addTestSuite(GridCacheReplicatedEventSelfTest.class); suite.addTestSuite(GridCacheReplicatedSynchronousCommitTest.class); - // TODO: GG-7437. - // suite.addTestSuite(GridCacheReplicatedInvalidateSelfTest.class); + suite.addTestSuite(GridCacheReplicatedInvalidateSelfTest.class); suite.addTestSuite(GridCacheReplicatedLockSelfTest.class); - // TODO: enable when GG-7437 is fixed. - //suite.addTestSuite(GridCacheReplicatedMultiNodeLockSelfTest.class); - //suite.addTestSuite(GridCacheReplicatedMultiNodeSelfTest.class); + suite.addTestSuite(GridCacheReplicatedMultiNodeLockSelfTest.class); + suite.addTestSuite(GridCacheReplicatedMultiNodeSelfTest.class); suite.addTestSuite(GridCacheReplicatedNodeFailureSelfTest.class); suite.addTestSuite(GridCacheReplicatedTxSingleThreadedSelfTest.class); suite.addTestSuite(GridCacheReplicatedTxTimeoutSelfTest.class); @@ -76,12 +74,10 @@ public class IgniteCacheTestSuite3 extends TestSuite { suite.addTestSuite(GridCachePutArrayValueSelfTest.class); suite.addTestSuite(GridCacheReplicatedUnswapAdvancedSelfTest.class); suite.addTestSuite(GridCacheReplicatedEvictionEventSelfTest.class); - // TODO: GG-7569. - // suite.addTestSuite(GridCacheReplicatedTxMultiThreadedSelfTest.class); + suite.addTestSuite(GridCacheReplicatedTxMultiThreadedSelfTest.class); suite.addTestSuite(GridCacheReplicatedPreloadEventsSelfTest.class); suite.addTestSuite(GridCacheReplicatedPreloadStartStopEventsSelfTest.class); - // TODO: GG-7434 - // suite.addTestSuite(GridReplicatedTxPreloadTest.class); + suite.addTestSuite(GridReplicatedTxPreloadTest.class); suite.addTestSuite(IgniteTxReentryNearSelfTest.class); suite.addTestSuite(IgniteTxReentryColocatedSelfTest.class); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java index aaf7e5b..cca28af 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java @@ -18,6 +18,7 @@ package org.apache.ignite.testsuites; import junit.framework.*; +import org.apache.ignite.cache.store.jdbc.*; import org.apache.ignite.internal.processors.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; @@ -38,9 +39,8 @@ public class IgniteCacheTestSuite4 extends TestSuite { // Multi node update. suite.addTestSuite(GridCacheMultinodeUpdateSelfTest.class); - // TODO: GG-5353. - // suite.addTestSuite(GridCacheMultinodeUpdateNearEnabledSelfTest.class); - // suite.addTestSuite(GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.class); + suite.addTestSuite(GridCacheMultinodeUpdateNearEnabledSelfTest.class); + suite.addTestSuite(GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.class); suite.addTestSuite(GridCacheMultinodeUpdateAtomicSelfTest.class); suite.addTestSuite(GridCacheMultinodeUpdateAtomicNearEnabledSelfTest.class); @@ -87,9 +87,8 @@ public class IgniteCacheTestSuite4 extends TestSuite { suite.addTestSuite(IgniteCacheTxLocalPeekModesTest.class); suite.addTestSuite(IgniteCacheTxReplicatedPeekModesTest.class); - // TODO: IGNITE-114. - // suite.addTestSuite(IgniteCacheInvokeReadThroughTest.class); - // suite.addTestSuite(GridCacheVersionMultinodeTest.class); + suite.addTestSuite(IgniteCacheInvokeReadThroughTest.class); + suite.addTestSuite(GridCacheVersionMultinodeTest.class); suite.addTestSuite(IgniteCacheNearReadCommittedTest.class); suite.addTestSuite(IgniteCacheAtomicCopyOnReadDisabledTest.class); @@ -98,9 +97,11 @@ public class IgniteCacheTestSuite4 extends TestSuite { suite.addTestSuite(IgniteCacheTxPreloadNoWriteTest.class); suite.addTestSuite(IgniteDynamicCacheStartSelfTest.class); + suite.addTestSuite(IgniteDynamicCacheWithConfigStartSelfTest.class); suite.addTestSuite(IgniteCacheDynamicStopSelfTest.class); suite.addTestSuite(IgniteCacheConfigurationTemplateTest.class); suite.addTestSuite(IgniteCacheConfigurationDefaultTemplateTest.class); + suite.addTestSuite(IgniteDynamicClientCacheStartSelfTest.class); suite.addTestSuite(GridCacheTxLoadFromStoreOnLockSelfTest.class); @@ -125,11 +126,16 @@ public class IgniteCacheTestSuite4 extends TestSuite { suite.addTestSuite(IgniteExchangeFutureHistoryTest.class); suite.addTestSuite(CacheNoValueClassOnServerNodeTest.class); + suite.addTestSuite(IgniteSystemCacheOnClientTest.class); suite.addTestSuite(CacheRemoveAllSelfTest.class); suite.addTestSuite(CacheOffheapMapEntrySelfTest.class); + suite.addTestSuite(CacheJdbcStoreSessionListenerSelfTest.class); + + suite.addTestSuite(CacheReadOnlyTransactionalClientSelfTest.class); + return suite; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java index 6bf5470..978941d 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java @@ -67,9 +67,11 @@ public class IgniteKernalSelfTestSuite extends TestSuite { suite.addTestSuite(GridCacheMessageSelfTest.class); suite.addTestSuite(GridDeploymentManagerStopSelfTest.class); suite.addTestSuite(GridManagerStopSelfTest.class); - suite.addTestSuite(GridDiscoveryManagerAttributesSelfTest.class); + suite.addTestSuite(GridDiscoveryManagerAttributesSelfTest.RegularDiscovery.class); + suite.addTestSuite(GridDiscoveryManagerAttributesSelfTest.ClientDiscovery.class); suite.addTestSuite(GridDiscoveryManagerAliveCacheSelfTest.class); - suite.addTestSuite(GridDiscoveryManagerSelfTest.class); + suite.addTestSuite(GridDiscoveryManagerSelfTest.RegularDiscovery.class); + suite.addTestSuite(GridDiscoveryManagerSelfTest.ClientDiscovery.class); suite.addTestSuite(GridDiscoveryEventSelfTest.class); suite.addTestSuite(GridPortProcessorSelfTest.class); suite.addTestSuite(GridHomePathSelfTest.class); @@ -88,6 +90,7 @@ public class IgniteKernalSelfTestSuite extends TestSuite { suite.addTestSuite(GridServiceProcessorMultiNodeConfigSelfTest.class); suite.addTestSuite(GridServiceProcessorProxySelfTest.class); suite.addTestSuite(GridServiceReassignmentSelfTest.class); + suite.addTestSuite(GridServiceClientNodeTest.class); return suite; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java index 09ba42b..ea5a7ac 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java @@ -51,7 +51,9 @@ public class IgniteSpiDiscoverySelfTestSuite extends TestSuite { suite.addTest(new TestSuite(GridTcpSpiForwardingSelfTest.class)); - suite.addTest(new TestSuite(TcpClientDiscoverySelfTest.class)); + suite.addTest(new TestSuite(TcpClientDiscoverySpiSelfTest.class)); + suite.addTest(new TestSuite(TcpClientDiscoveryMarshallerCheckSelfTest.class)); + suite.addTest(new TestSuite(TcpClientDiscoverySpiMulticastTest.class)); return suite; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamSelfTestSuite.java new file mode 100644 index 0000000..a277fc8 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamSelfTestSuite.java @@ -0,0 +1,39 @@ +/* + * 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.testsuites; + +import org.apache.ignite.stream.socket.*; + +import junit.framework.*; + +/** + * Stream test suite. + */ +public class IgniteStreamSelfTestSuite extends TestSuite { + /** + * @return Stream tests suite. + * @throws Exception If failed. + */ + public static TestSuite suite() throws Exception { + TestSuite suite = new TestSuite("Ignite Stream Test Suite"); + + suite.addTest(new TestSuite(SocketStreamerSelfTest.class)); + + return suite; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java deleted file mode 100644 index 61be976..0000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.testsuites; - -import org.apache.ignite.stream.socket.*; - -import junit.framework.*; - -/** - * Stream test suite. - */ -public class IgniteStreamTestSuite extends TestSuite { - /** - * @return Stream tests suite. - * @throws Exception If failed. - */ - public static TestSuite suite() throws Exception { - TestSuite suite = new TestSuite("Ignite Stream Test Suite"); - - suite.addTest(new TestSuite(SocketStreamerSelfTest.class)); - - return suite; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java index 440cb4a..64ff6ee 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java @@ -79,7 +79,7 @@ public class IgniteUtilSelfTestSuite extends TestSuite { GridTestUtils.addTestIfNeeded(suite, GridNioSelfTest.class, ignoredTests); suite.addTestSuite(GridNioFilterChainSelfTest.class); GridTestUtils.addTestIfNeeded(suite, GridNioSslSelfTest.class, ignoredTests); - suite.addTestSuite(GridNioDelimitedBufferTest.class); + suite.addTestSuite(GridNioDelimitedBufferSelfTest.class); return suite; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/util/GridRandomSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/util/GridRandomSelfTest.java b/modules/core/src/test/java/org/apache/ignite/util/GridRandomSelfTest.java index d31e5bc..0dc4879 100644 --- a/modules/core/src/test/java/org/apache/ignite/util/GridRandomSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/util/GridRandomSelfTest.java @@ -56,7 +56,9 @@ public class GridRandomSelfTest extends TestCase { /** * Test performance difference. */ - public void _testPerformance() { + public void testPerformance() { + fail("https://issues.apache.org/jira/browse/IGNITE-824"); + Random rnd = new GridRandom(); // new Random(); long start = System.nanoTime(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java ---------------------------------------------------------------------- diff --git a/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java b/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java index b496f60..48991e8 100644 --- a/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java +++ b/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java @@ -68,34 +68,37 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.*; * Note that this finder is shared by default (see {@link org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder#isShared()}. */ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapter { - /* Default object's content. */ + /** Default object's content. */ private final static ByteArrayInputStream OBJECT_CONTENT = new ByteArrayInputStream(new byte[0]); /** Grid logger. */ @LoggerResource private IgniteLogger log; - /* Google Cloud Platform's project name.*/ + /** Google Cloud Platform's project name.*/ private String projectName; - /* Google Storage bucket name. */ + /** Google Storage bucket name. */ private String bucketName; - /* Service account p12 private key file name. */ - private String serviceAccountP12FilePath; + /** Service account p12 private key file name. */ + private String srvcAccountP12FilePath; - /* Service account id. */ - private String serviceAccountId; + /** Service account id. */ + private String srvcAccountId; - /* Google storage. */ + /** Google storage. */ private Storage storage; - /* Init routine guard. */ + /** Init routine guard. */ private final AtomicBoolean initGuard = new AtomicBoolean(); - /* Init routine latch. */ + /** Init routine latch. */ private final CountDownLatch initLatch = new CountDownLatch(1); + /** + * + */ public TcpDiscoveryGoogleStorageIpFinder() { setShared(true); } @@ -221,7 +224,7 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt */ @IgniteSpiConfiguration(optional = false) public void setServiceAccountP12FilePath(String p12FileName) { - this.serviceAccountP12FilePath = p12FileName; + this.srvcAccountP12FilePath = p12FileName; } /** @@ -235,7 +238,7 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt */ @IgniteSpiConfiguration(optional = false) public void setServiceAccountId(String id) { - this.serviceAccountId = id; + this.srvcAccountId = id; } /** @@ -245,13 +248,13 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt */ private void init() throws IgniteSpiException { if (initGuard.compareAndSet(false, true)) { - if (serviceAccountId == null || - serviceAccountP12FilePath == null || + if (srvcAccountId == null || + srvcAccountP12FilePath == null || projectName == null || bucketName == null) { throw new IgniteSpiException( "One or more of the required parameters is not set [serviceAccountId=" + - serviceAccountId + ", serviceAccountP12FilePath=" + serviceAccountP12FilePath + ", projectName=" + + srvcAccountId + ", serviceAccountP12FilePath=" + srvcAccountP12FilePath + ", projectName=" + projectName + ", bucketName=" + bucketName + "]"); } @@ -265,12 +268,12 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt throw new IgniteSpiException(e); } - GoogleCredential credential; + GoogleCredential cred; try { - credential = new GoogleCredential.Builder().setTransport(httpTransport) - .setJsonFactory(JacksonFactory.getDefaultInstance()).setServiceAccountId(serviceAccountId) - .setServiceAccountPrivateKeyFromP12File(new File(serviceAccountP12FilePath)) + cred = new GoogleCredential.Builder().setTransport(httpTransport) + .setJsonFactory(JacksonFactory.getDefaultInstance()).setServiceAccountId(srvcAccountId) + .setServiceAccountPrivateKeyFromP12File(new File(srvcAccountP12FilePath)) .setServiceAccountScopes(Collections.singleton(StorageScopes.DEVSTORAGE_FULL_CONTROL)).build(); } @@ -279,7 +282,7 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt } try { - storage = new Storage.Builder(httpTransport, JacksonFactory.getDefaultInstance(), credential) + storage = new Storage.Builder(httpTransport, JacksonFactory.getDefaultInstance(), cred) .setApplicationName(projectName).build(); } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopFileSystemCounterWriter.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopFileSystemCounterWriter.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopFileSystemCounterWriter.java index 66e9761..d910507 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopFileSystemCounterWriter.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopFileSystemCounterWriter.java @@ -20,10 +20,12 @@ package org.apache.ignite.hadoop.fs; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.*; +import org.apache.hadoop.mapreduce.*; import org.apache.ignite.*; import org.apache.ignite.internal.processors.hadoop.*; import org.apache.ignite.internal.processors.hadoop.counter.*; import org.apache.ignite.internal.processors.hadoop.counter.HadoopCounters; +import org.apache.ignite.internal.processors.igfs.*; import org.apache.ignite.internal.util.typedef.*; import java.io.*; @@ -37,9 +39,6 @@ public class IgniteHadoopFileSystemCounterWriter implements HadoopCounterWriter public static final String PERFORMANCE_COUNTER_FILE_NAME = "performance"; /** */ - private static final String DEFAULT_USER_NAME = "anonymous"; - - /** */ public static final String COUNTER_WRITER_DIR_PROPERTY = "ignite.counters.fswriter.directory"; /** */ @@ -52,15 +51,14 @@ public class IgniteHadoopFileSystemCounterWriter implements HadoopCounterWriter @Override public void write(HadoopJobInfo jobInfo, HadoopJobId jobId, HadoopCounters cntrs) throws IgniteCheckedException { - Configuration hadoopCfg = new Configuration(); + Configuration hadoopCfg = HadoopUtils.safeCreateConfiguration(); for (Map.Entry<String, String> e : ((HadoopDefaultJobInfo)jobInfo).properties().entrySet()) hadoopCfg.set(e.getKey(), e.getValue()); String user = jobInfo.user(); - if (F.isEmpty(user)) - user = DEFAULT_USER_NAME; + user = IgfsUtils.fixUserName(user); String dir = jobInfo.property(COUNTER_WRITER_DIR_PROPERTY); @@ -72,7 +70,9 @@ public class IgniteHadoopFileSystemCounterWriter implements HadoopCounterWriter HadoopPerformanceCounter perfCntr = HadoopPerformanceCounter.getCounter(cntrs, null); try { - FileSystem fs = jobStatPath.getFileSystem(hadoopCfg); + hadoopCfg.set(MRJobConfig.USER_NAME, user); + + FileSystem fs = HadoopUtils.fileSystemForMrUser(jobStatPath.toUri(), hadoopCfg, true); fs.mkdirs(jobStatPath); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java index ba891f8..6a630fb 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java @@ -20,15 +20,16 @@ package org.apache.ignite.hadoop.fs; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.permission.*; -import org.apache.hadoop.ipc.*; import org.apache.ignite.*; import org.apache.ignite.igfs.*; import org.apache.ignite.igfs.secondary.*; import org.apache.ignite.internal.processors.hadoop.*; +import org.apache.ignite.internal.processors.hadoop.fs.*; import org.apache.ignite.internal.processors.hadoop.igfs.*; import org.apache.ignite.internal.processors.igfs.*; import org.apache.ignite.internal.util.typedef.*; import org.jetbrains.annotations.*; +import org.apache.ignite.internal.processors.hadoop.fs.HadoopLazyConcurrentMap.*; import java.io.*; import java.net.*; @@ -37,15 +38,45 @@ import java.util.*; import static org.apache.ignite.internal.processors.igfs.IgfsEx.*; /** - * Adapter to use any Hadoop file system {@link FileSystem} as {@link IgfsSecondaryFileSystem}. + * Adapter to use any Hadoop file system {@link FileSystem} as {@link IgfsSecondaryFileSystem}. + * In fact, this class deals with different FileSystems depending on the user context, + * see {@link IgfsUserContext#currentUser()}. */ -public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem, AutoCloseable { - /** Hadoop file system. */ - private final FileSystem fileSys; - - /** Properties of file system */ +public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem { + /** Properties of file system, see {@link #properties()} + * + * See {@link IgfsEx#SECONDARY_FS_CONFIG_PATH} + * See {@link IgfsEx#SECONDARY_FS_URI} + * See {@link IgfsEx#SECONDARY_FS_USER_NAME} + * */ private final Map<String, String> props = new HashMap<>(); + /** Secondary file system provider. */ + private final SecondaryFileSystemProvider secProvider; + + /** The default user name. It is used if no user context is set. */ + private final String dfltUserName; + + /** FileSystem instance created for the default user. + * Stored outside the fileSysLazyMap due to performance reasons. */ + private final FileSystem dfltFs; + + /** Lazy per-user cache for the file systems. It is cleared and nulled in #close() method. */ + private final HadoopLazyConcurrentMap<String, FileSystem> fileSysLazyMap = new HadoopLazyConcurrentMap<>( + new ValueFactory<String, FileSystem>() { + @Override public FileSystem createValue(String key) { + try { + assert !F.isEmpty(key); + + return secProvider.createFileSystem(key); + } + catch (IOException ioe) { + throw new IgniteException(ioe); + } + } + } + ); + /** * Simple constructor that is to be used by default. * @@ -77,8 +108,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys * @throws IgniteCheckedException In case of error. */ public IgniteHadoopIgfsSecondaryFileSystem(@Nullable String uri, @Nullable String cfgPath, - @Nullable String userName) - throws IgniteCheckedException { + @Nullable String userName) throws IgniteCheckedException { // Treat empty uri and userName arguments as nulls to improve configuration usability: if (F.isEmpty(uri)) uri = null; @@ -89,27 +119,31 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys if (F.isEmpty(userName)) userName = null; + this.dfltUserName = IgfsUtils.fixUserName(userName); + try { - SecondaryFileSystemProvider secProvider = new SecondaryFileSystemProvider(uri, cfgPath, userName); + this.secProvider = new SecondaryFileSystemProvider(uri, cfgPath); - fileSys = secProvider.createFileSystem(); + // File system creation for the default user name. + // The value is *not* stored in the 'fileSysLazyMap' cache, but saved in field: + this.dfltFs = secProvider.createFileSystem(dfltUserName); + } + catch (IOException e) { + throw new IgniteCheckedException(e); + } - uri = secProvider.uri().toString(); + assert dfltFs != null; - if (!uri.endsWith("/")) - uri += "/"; + uri = secProvider.uri().toString(); - if (cfgPath != null) - props.put(SECONDARY_FS_CONFIG_PATH, cfgPath); + if (!uri.endsWith("/")) + uri += "/"; - if (userName != null) - props.put(SECONDARY_FS_USER_NAME, userName); + if (cfgPath != null) + props.put(SECONDARY_FS_CONFIG_PATH, cfgPath); - props.put(SECONDARY_FS_URI, uri); - } - catch (IOException e) { - throw new IgniteCheckedException(e); - } + props.put(SECONDARY_FS_URI, uri); + props.put(SECONDARY_FS_USER_NAME, dfltUserName); } /** @@ -119,7 +153,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys * @return Hadoop path. */ private Path convert(IgfsPath path) { - URI uri = fileSys.getUri(); + URI uri = fileSysForUser().getUri(); return new Path(uri.getScheme(), uri.getAuthority(), path.toString()); } @@ -131,14 +165,9 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys * @param detailMsg Detailed error message. * @return Appropriate exception. */ - @SuppressWarnings({"ThrowableResultOfMethodCallIgnored", "unchecked"}) private IgfsException handleSecondaryFsError(IOException e, String detailMsg) { - boolean wrongVer = X.hasCause(e, RemoteException.class) || - (e.getMessage() != null && e.getMessage().contains("Failed on local")); - - return !wrongVer ? cast(detailMsg, e) : - new IgfsInvalidHdfsVersionException("HDFS version you are connecting to differs from local " + - "version.", e); } + return cast(detailMsg, e); + } /** * Cast IO exception to IGFS exception. @@ -178,7 +207,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys /** {@inheritDoc} */ @Override public boolean exists(IgfsPath path) { try { - return fileSys.exists(convert(path)); + return fileSysForUser().exists(convert(path)); } catch (IOException e) { throw handleSecondaryFsError(e, "Failed to check file existence [path=" + path + "]"); @@ -189,6 +218,8 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys @Nullable @Override public IgfsFile update(IgfsPath path, Map<String, String> props) { HadoopIgfsProperties props0 = new HadoopIgfsProperties(props); + final FileSystem fileSys = fileSysForUser(); + try { if (props0.userName() != null || props0.groupName() != null) fileSys.setOwner(convert(path), props0.userName(), props0.groupName()); @@ -208,7 +239,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys @Override public void rename(IgfsPath src, IgfsPath dest) { // Delegate to the secondary file system. try { - if (!fileSys.rename(convert(src), convert(dest))) + if (!fileSysForUser().rename(convert(src), convert(dest))) throw new IgfsException("Failed to rename (secondary file system returned false) " + "[src=" + src + ", dest=" + dest + ']'); } @@ -220,7 +251,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys /** {@inheritDoc} */ @Override public boolean delete(IgfsPath path, boolean recursive) { try { - return fileSys.delete(convert(path), recursive); + return fileSysForUser().delete(convert(path), recursive); } catch (IOException e) { throw handleSecondaryFsError(e, "Failed to delete file [path=" + path + ", recursive=" + recursive + "]"); @@ -230,7 +261,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys /** {@inheritDoc} */ @Override public void mkdirs(IgfsPath path) { try { - if (!fileSys.mkdirs(convert(path))) + if (!fileSysForUser().mkdirs(convert(path))) throw new IgniteException("Failed to make directories [path=" + path + "]"); } catch (IOException e) { @@ -241,7 +272,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys /** {@inheritDoc} */ @Override public void mkdirs(IgfsPath path, @Nullable Map<String, String> props) { try { - if (!fileSys.mkdirs(convert(path), new HadoopIgfsProperties(props).permission())) + if (!fileSysForUser().mkdirs(convert(path), new HadoopIgfsProperties(props).permission())) throw new IgniteException("Failed to make directories [path=" + path + ", props=" + props + "]"); } catch (IOException e) { @@ -252,7 +283,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys /** {@inheritDoc} */ @Override public Collection<IgfsPath> listPaths(IgfsPath path) { try { - FileStatus[] statuses = fileSys.listStatus(convert(path)); + FileStatus[] statuses = fileSysForUser().listStatus(convert(path)); if (statuses == null) throw new IgfsPathNotFoundException("Failed to list files (path not found): " + path); @@ -275,7 +306,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys /** {@inheritDoc} */ @Override public Collection<IgfsFile> listFiles(IgfsPath path) { try { - FileStatus[] statuses = fileSys.listStatus(convert(path)); + FileStatus[] statuses = fileSysForUser().listStatus(convert(path)); if (statuses == null) throw new IgfsPathNotFoundException("Failed to list files (path not found): " + path); @@ -302,13 +333,13 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys /** {@inheritDoc} */ @Override public IgfsSecondaryFileSystemPositionedReadable open(IgfsPath path, int bufSize) { - return new HadoopIgfsSecondaryFileSystemPositionedReadable(fileSys, convert(path), bufSize); + return new HadoopIgfsSecondaryFileSystemPositionedReadable(fileSysForUser(), convert(path), bufSize); } /** {@inheritDoc} */ @Override public OutputStream create(IgfsPath path, boolean overwrite) { try { - return fileSys.create(convert(path), overwrite); + return fileSysForUser().create(convert(path), overwrite); } catch (IOException e) { throw handleSecondaryFsError(e, "Failed to create file [path=" + path + ", overwrite=" + overwrite + "]"); @@ -322,8 +353,8 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys new HadoopIgfsProperties(props != null ? props : Collections.<String, String>emptyMap()); try { - return fileSys.create(convert(path), props0.permission(), overwrite, bufSize, (short)replication, blockSize, - null); + return fileSysForUser().create(convert(path), props0.permission(), overwrite, bufSize, + (short)replication, blockSize, null); } catch (IOException e) { throw handleSecondaryFsError(e, "Failed to create file [path=" + path + ", props=" + props + @@ -336,7 +367,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys @Override public OutputStream append(IgfsPath path, int bufSize, boolean create, @Nullable Map<String, String> props) { try { - return fileSys.append(convert(path), bufSize); + return fileSysForUser().append(convert(path), bufSize); } catch (IOException e) { throw handleSecondaryFsError(e, "Failed to append file [path=" + path + ", bufSize=" + bufSize + "]"); @@ -346,7 +377,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys /** {@inheritDoc} */ @Override public IgfsFile info(final IgfsPath path) { try { - final FileStatus status = fileSys.getFileStatus(convert(path)); + final FileStatus status = fileSysForUser().getFileStatus(convert(path)); if (status == null) return null; @@ -421,7 +452,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys try { // We don't use FileSystem#getUsed() since it counts only the files // in the filesystem root, not all the files recursively. - return fileSys.getContentSummary(new Path("/")).getSpaceConsumed(); + return fileSysForUser().getContentSummary(new Path("/")).getSpaceConsumed(); } catch (IOException e) { throw handleSecondaryFsError(e, "Failed to get used space size of file system."); @@ -429,25 +460,57 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys } /** {@inheritDoc} */ - @Nullable @Override public Map<String, String> properties() { + @Override public Map<String, String> properties() { return props; } /** {@inheritDoc} */ - @Override public void close() throws IgniteCheckedException { + @Override public void close() throws IgniteException { + Exception e = null; + try { - fileSys.close(); + dfltFs.close(); } - catch (IOException e) { - throw new IgniteCheckedException(e); + catch (Exception e0) { + e = e0; + } + + try { + fileSysLazyMap.close(); + } + catch (IgniteCheckedException ice) { + if (e == null) + e = ice; } + + if (e != null) + throw new IgniteException(e); } /** * Gets the underlying {@link FileSystem}. + * This method is used solely for testing. * @return the underlying Hadoop {@link FileSystem}. */ public FileSystem fileSystem() { - return fileSys; + return fileSysForUser(); + } + + /** + * Gets the FileSystem for the current context user. + * @return the FileSystem instance, never null. + */ + private FileSystem fileSysForUser() { + String user = IgfsUserContext.currentUser(); + + if (F.isEmpty(user)) + user = dfltUserName; // default is never empty. + + assert !F.isEmpty(user); + + if (F.eq(user, dfltUserName)) + return dfltFs; // optimization + + return fileSysLazyMap.getOrCreate(user); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java index 1f53a06..9d94e5b 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java @@ -22,7 +22,7 @@ import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.permission.*; import org.apache.hadoop.hdfs.*; -import org.apache.hadoop.mapreduce.*; +import org.apache.hadoop.security.*; import org.apache.hadoop.util.*; import org.apache.ignite.*; import org.apache.ignite.igfs.*; @@ -97,21 +97,8 @@ public class IgniteHadoopFileSystem extends FileSystem { /** Grid remote client. */ private HadoopIgfsWrapper rmtClient; - /** User name for each thread. */ - private final ThreadLocal<String> userName = new ThreadLocal<String>(){ - /** {@inheritDoc} */ - @Override protected String initialValue() { - return DFLT_USER_NAME; - } - }; - - /** Working directory for each thread. */ - private final ThreadLocal<Path> workingDir = new ThreadLocal<Path>(){ - /** {@inheritDoc} */ - @Override protected Path initialValue() { - return getHomeDirectory(); - } - }; + /** working directory. */ + private Path workingDir; /** Default replication factor. */ private short dfltReplication; @@ -129,6 +116,9 @@ public class IgniteHadoopFileSystem extends FileSystem { /** Secondary URI string. */ private URI secondaryUri; + /** The user name this file system was created on behalf of. */ + private String user; + /** IGFS mode resolver. */ private IgfsModeResolver modeRslvr; @@ -153,9 +143,6 @@ public class IgniteHadoopFileSystem extends FileSystem { /** Custom-provided sequential reads before prefetch. */ private int seqReadsBeforePrefetch; - /** The cache was disabled when the instance was creating. */ - private boolean cacheEnabled; - /** {@inheritDoc} */ @Override public URI getUri() { if (uri == null) @@ -182,6 +169,22 @@ public class IgniteHadoopFileSystem extends FileSystem { } /** + * Gets non-null user name as per the Hadoop file system viewpoint. + * @return the user name, never null. + */ + public static String getFsHadoopUser() throws IOException { + UserGroupInformation currUgi = UserGroupInformation.getCurrentUser(); + + String user = currUgi.getShortUserName(); + + user = IgfsUtils.fixUserName(user); + + assert user != null; + + return user; + } + + /** * Public setter that can be used by direct users of FS or Visor. * * @param colocateFileWrites Whether all ongoing file writes should be colocated. @@ -207,10 +210,6 @@ public class IgniteHadoopFileSystem extends FileSystem { setConf(cfg); - String disableCacheName = String.format("fs.%s.impl.disable.cache", name.getScheme()); - - cacheEnabled = !cfg.getBoolean(disableCacheName, false); - mgmt = cfg.getBoolean(IGFS_MANAGEMENT, false); if (!IGFS_SCHEME.equals(name.getScheme())) @@ -221,7 +220,7 @@ public class IgniteHadoopFileSystem extends FileSystem { uriAuthority = uri.getAuthority(); - setUser(cfg.get(MRJobConfig.USER_NAME, DFLT_USER_NAME)); + user = getFsHadoopUser(); // Override sequential reads before prefetch if needed. seqReadsBeforePrefetch = parameter(cfg, PARAM_IGFS_SEQ_READS_BEFORE_PREFETCH, uriAuthority, 0); @@ -244,7 +243,7 @@ public class IgniteHadoopFileSystem extends FileSystem { String logDir = logDirFile != null ? logDirFile.getAbsolutePath() : null; - rmtClient = new HadoopIgfsWrapper(uriAuthority, logDir, cfg, LOG); + rmtClient = new HadoopIgfsWrapper(uriAuthority, logDir, cfg, LOG, user); // Handshake. IgfsHandshakeResponse handshake = rmtClient.handshake(logDir); @@ -289,13 +288,12 @@ public class IgniteHadoopFileSystem extends FileSystem { String secUri = props.get(SECONDARY_FS_URI); String secConfPath = props.get(SECONDARY_FS_CONFIG_PATH); - String secUserName = props.get(SECONDARY_FS_USER_NAME); try { - SecondaryFileSystemProvider secProvider = new SecondaryFileSystemProvider(secUri, secConfPath, - secUserName); + SecondaryFileSystemProvider secProvider = new SecondaryFileSystemProvider(secUri, secConfPath); + + secondaryFs = secProvider.createFileSystem(user); - secondaryFs = secProvider.createFileSystem(); secondaryUri = secProvider.uri(); } catch (IOException e) { @@ -306,6 +304,9 @@ public class IgniteHadoopFileSystem extends FileSystem { "will have no effect): " + e.getMessage()); } } + + // set working directory to the home directory of the current Fs user: + setWorkingDirectory(null); } finally { leaveBusy(); @@ -337,15 +338,13 @@ public class IgniteHadoopFileSystem extends FileSystem { @Override protected void finalize() throws Throwable { super.finalize(); - close0(); + close(); } /** {@inheritDoc} */ @Override public void close() throws IOException { - if (cacheEnabled && get(getUri(), getConf()) == this) - return; - - close0(); + if (closeGuard.compareAndSet(false, true)) + close0(); } /** @@ -354,27 +353,25 @@ public class IgniteHadoopFileSystem extends FileSystem { * @throws IOException If failed. */ private void close0() throws IOException { - if (closeGuard.compareAndSet(false, true)) { - if (LOG.isDebugEnabled()) - LOG.debug("File system closed [uri=" + uri + ", endpoint=" + uriAuthority + ']'); + if (LOG.isDebugEnabled()) + LOG.debug("File system closed [uri=" + uri + ", endpoint=" + uriAuthority + ']'); - if (rmtClient == null) - return; + if (rmtClient == null) + return; - super.close(); + super.close(); - rmtClient.close(false); + rmtClient.close(false); - if (clientLog.isLogEnabled()) - clientLog.close(); + if (clientLog.isLogEnabled()) + clientLog.close(); - if (secondaryFs != null) - U.closeQuiet(secondaryFs); + if (secondaryFs != null) + U.closeQuiet(secondaryFs); - // Reset initialized resources. - uri = null; - rmtClient = null; - } + // Reset initialized resources. + uri = null; + rmtClient = null; } /** {@inheritDoc} */ @@ -849,22 +846,11 @@ public class IgniteHadoopFileSystem extends FileSystem { /** {@inheritDoc} */ @Override public Path getHomeDirectory() { - Path path = new Path("/user/" + userName.get()); + Path path = new Path("/user/" + user); return path.makeQualified(getUri(), null); } - /** - * Set user name and default working directory for current thread. - * - * @param userName User name. - */ - public void setUser(String userName) { - this.userName.set(userName); - - setWorkingDirectory(null); - } - /** {@inheritDoc} */ @Override public void setWorkingDirectory(Path newPath) { if (newPath == null) { @@ -873,7 +859,7 @@ public class IgniteHadoopFileSystem extends FileSystem { if (secondaryFs != null) secondaryFs.setWorkingDirectory(toSecondary(homeDir)); - workingDir.set(homeDir); + workingDir = homeDir; } else { Path fixedNewPath = fixRelativePart(newPath); @@ -886,13 +872,13 @@ public class IgniteHadoopFileSystem extends FileSystem { if (secondaryFs != null) secondaryFs.setWorkingDirectory(toSecondary(fixedNewPath)); - workingDir.set(fixedNewPath); + workingDir = fixedNewPath; } } /** {@inheritDoc} */ @Override public Path getWorkingDirectory() { - return workingDir.get(); + return workingDir; } /** {@inheritDoc} */ @@ -1153,7 +1139,7 @@ public class IgniteHadoopFileSystem extends FileSystem { return null; return path.isAbsolute() ? new IgfsPath(path.toUri().getPath()) : - new IgfsPath(convert(workingDir.get()), path.toUri().getPath()); + new IgfsPath(convert(workingDir), path.toUri().getPath()); } /** @@ -1191,9 +1177,16 @@ public class IgniteHadoopFileSystem extends FileSystem { */ @SuppressWarnings("deprecation") private FileStatus convert(IgfsFile file) { - return new FileStatus(file.length(), file.isDirectory(), getDefaultReplication(), - file.groupBlockSize(), file.modificationTime(), file.accessTime(), permission(file), - file.property(PROP_USER_NAME, DFLT_USER_NAME), file.property(PROP_GROUP_NAME, "users"), + return new FileStatus( + file.length(), + file.isDirectory(), + getDefaultReplication(), + file.groupBlockSize(), + file.modificationTime(), + file.accessTime(), + permission(file), + file.property(PROP_USER_NAME, user), + file.property(PROP_GROUP_NAME, "users"), convert(file.path())) { @Override public String toString() { return "FileStatus [path=" + getPath() + ", isDir=" + isDir() + ", len=" + getLen() + @@ -1247,4 +1240,12 @@ public class IgniteHadoopFileSystem extends FileSystem { @Override public String toString() { return S.toString(IgniteHadoopFileSystem.class, this); } + + /** + * Returns the user name this File System is created on behalf of. + * @return the user name + */ + public String user() { + return user; + } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java index 9cfb79b..8330143 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java @@ -22,7 +22,6 @@ import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.Options; import org.apache.hadoop.fs.permission.*; -import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.util.*; import org.apache.ignite.*; import org.apache.ignite.igfs.*; @@ -40,6 +39,7 @@ import java.util.*; import java.util.concurrent.atomic.*; import static org.apache.ignite.configuration.FileSystemConfiguration.*; +import static org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem.*; import static org.apache.ignite.igfs.IgfsMode.*; import static org.apache.ignite.internal.processors.hadoop.fs.HadoopParameters.*; import static org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsUtils.*; @@ -91,11 +91,14 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea /** Grid remote client. */ private HadoopIgfsWrapper rmtClient; + /** The name of the user this File System created on behalf of. */ + private final String user; + /** Working directory. */ private IgfsPath workingDir; /** URI. */ - private URI uri; + private final URI uri; /** Authority. */ private String uriAuthority; @@ -141,6 +144,8 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea uri = name; + user = getFsHadoopUser(); + try { initialize(name, cfg); } @@ -152,7 +157,7 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea throw e; } - workingDir = new IgfsPath("/user/" + cfg.get(MRJobConfig.USER_NAME, DFLT_USER_NAME)); + workingDir = new IgfsPath("/user/" + user); } /** {@inheritDoc} */ @@ -240,7 +245,7 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea String logDir = logDirFile != null ? logDirFile.getAbsolutePath() : null; - rmtClient = new HadoopIgfsWrapper(uriAuthority, logDir, cfg, LOG); + rmtClient = new HadoopIgfsWrapper(uriAuthority, logDir, cfg, LOG, user); // Handshake. IgfsHandshakeResponse handshake = rmtClient.handshake(logDir); @@ -284,13 +289,12 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea String secUri = props.get(SECONDARY_FS_URI); String secConfPath = props.get(SECONDARY_FS_CONFIG_PATH); - String secUserName = props.get(SECONDARY_FS_USER_NAME); try { - SecondaryFileSystemProvider secProvider = new SecondaryFileSystemProvider(secUri, secConfPath, - secUserName); + SecondaryFileSystemProvider secProvider = new SecondaryFileSystemProvider(secUri, secConfPath); + + secondaryFs = secProvider.createAbstractFileSystem(user); - secondaryFs = secProvider.createAbstractFileSystem(); secondaryUri = secProvider.uri(); } catch (IOException e) { @@ -929,7 +933,7 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea file.modificationTime(), file.accessTime(), permission(file), - file.property(PROP_USER_NAME, DFLT_USER_NAME), + file.property(PROP_USER_NAME, user), file.property(PROP_GROUP_NAME, "users"), convert(file.path())) { @Override public String toString() { @@ -983,4 +987,12 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea @Override public String toString() { return S.toString(IgniteHadoopFileSystem.class, this); } -} + + /** + * Returns the user name this File System is created on behalf of. + * @return the user name + */ + public String user() { + return user; + } +} \ No newline at end of file