# ignite-63
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e1d8f69b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e1d8f69b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e1d8f69b Branch: refs/heads/ignite-63 Commit: e1d8f69b715e16ab1fc427e920e2fdb4bb185341 Parents: cc186b5 Author: sboikov <semen.boi...@inria.fr> Authored: Fri Jan 23 01:35:31 2015 +0300 Committer: sboikov <semen.boi...@inria.fr> Committed: Fri Jan 23 01:35:41 2015 +0300 ---------------------------------------------------------------------- .../grid/gridify/GridAbstractAopTest.java | 734 ------------------- .../grid/gridify/GridBasicAopSelfTest.java | 77 -- .../grid/gridify/GridNonSpringAopSelfTest.java | 57 -- .../grid/gridify/GridSpringAopSelfTest.java | 52 -- .../grid/gridify/GridTestAopTarget.java | 138 ---- .../gridify/GridTestAopTargetInterface.java | 87 --- .../grid/gridify/GridTestGridifyException.java | 38 - .../grid/gridify/GridTestGridifyJob.java | 68 -- .../grid/gridify/GridTestGridifyTask.java | 47 -- .../grid/gridify/GridifySetToSetTarget.java | 372 ---------- .../gridify/GridifySetToSetTargetInterface.java | 109 --- .../grid/gridify/GridifySetToValueTarget.java | 199 ----- .../GridifySetToValueTargetInterface.java | 100 --- .../GridifySetToXXXNonSpringAopSelfTest.java | 203 ----- .../GridifySetToXXXSpringAopSelfTest.java | 204 ------ .../grid/gridify/hierarchy/GridSuperTarget.java | 53 -- .../grid/gridify/hierarchy/GridTarget.java | 45 -- .../gridify/hierarchy/GridifyHierarchyTest.java | 51 -- .../grid/gridify/hierarchy/package.html | 23 - .../java/org/gridgain/grid/gridify/package.html | 23 - .../grid/gridify/test_resource.properties | 18 - .../GridTaskEventSubjectIdSelfTest.java | 392 ++++++++++ .../client/GridClientCacheBenchmark.java | 259 +++++++ .../GridClientMarshallerBenchmarkTest.java | 156 ++++ .../client/GridClientTcpSslLoadTest.java | 83 +++ .../kernal/GridTaskEventSubjectIdSelfTest.java | 392 ---------- .../client/GridClientCacheBenchmark.java | 259 ------- .../GridClientMarshallerBenchmarkTest.java | 156 ---- .../client/GridClientTcpSslLoadTest.java | 83 --- .../src/test/config/io-manager-benchmark.xml | 2 +- modules/core/src/test/config/jobs-load-base.xml | 2 +- .../core/src/test/config/load/dsi-load-base.xml | 14 +- .../src/test/config/load/dsi-load-server.xml | 2 +- .../average/spring-streamer-average-base.xml | 10 +- .../loadtests/GridCacheLoadPopulationTask.java | 152 ++++ .../loadtests/GridCacheMultiNodeLoadTest.java | 106 +++ .../cache/GridCacheAbstractLoadTest.java | 376 ++++++++++ ...ridCacheAffinityTransactionsOffHeapTest.java | 258 +++++++ .../loadtests/cache/GridCacheBenchmark.java | 202 +++++ .../cache/GridCacheDataStructuresLoadTest.java | 364 +++++++++ .../cache/GridCacheGroupLockComparisonTest.java | 203 +++++ .../loadtests/cache/GridCacheLoadTest.java | 161 ++++ .../cache/GridCachePutRemoveLoadTest.java | 373 ++++++++++ .../cache/GridCacheSingleNodeLoadTest.java | 184 +++++ .../loadtests/cache/GridCacheSwapLoadTest.java | 310 ++++++++ .../GridCacheWriteBehindStoreLoadTest.java | 210 ++++++ .../capacity/GridCapacityLoadTest.java | 95 +++ .../capacity/spring-capacity-cache.xml | 124 ++++ .../colocation/GridTestCacheStore.java | 134 ++++ .../loadtests/colocation/GridTestConstants.java | 35 + .../loadtests/colocation/GridTestKey.java | 92 +++ .../colocation/GridTestLifecycleBean.java | 41 ++ .../loadtests/colocation/GridTestMain.java | 207 ++++++ .../loadtests/colocation/spring-colocation.xml | 182 +++++ .../communication/GridIoManagerBenchmark.java | 337 +++++++++ .../communication/GridIoManagerBenchmark0.java | 469 ++++++++++++ .../GridTcpCommunicationBenchmark.java | 586 +++++++++++++++ .../communication/GridTestMessage.java | 135 ++++ .../GridContinuousOperationsLoadTest.java | 211 ++++++ .../GridCachePartitionedAtomicLongLoadTest.java | 129 ++++ .../direct/multisplit/GridLoadTestJob.java | 58 ++ .../multisplit/GridLoadTestJobTarget.java | 33 + .../direct/multisplit/GridLoadTestTask.java | 83 +++ .../multisplit/GridMultiSplitsLoadTest.java | 160 ++++ .../GridMultiSplitsRedeployLoadTest.java | 162 ++++ .../loadtests/direct/multisplit/package.html | 24 + .../GridSingleSplitNewNodesTestJobTarget.java | 50 ++ .../GridSingleSplitNewNodesTestTask.java | 95 +++ ...ridSingleSplitsNewNodesAbstractLoadTest.java | 188 +++++ ...idSingleSplitsNewNodesMulticastLoadTest.java | 45 ++ .../loadtests/direct/newnodes/package.html | 24 + .../GridSingleSplitsRedeployLoadTest.java | 174 +++++ .../loadtests/direct/redeploy/package.html | 24 + .../direct/session/GridSessionLoadTest.java | 112 +++ .../direct/session/GridSessionLoadTestJob.java | 76 ++ .../direct/session/GridSessionLoadTestTask.java | 136 ++++ .../loadtests/direct/session/package.html | 24 + .../direct/stealing/GridStealingLoadTest.java | 154 ++++ .../stealing/GridStealingLoadTestJob.java | 61 ++ .../stealing/GridStealingLoadTestTask.java | 96 +++ .../loadtests/direct/stealing/package.html | 24 + .../loadtests/discovery/GridGcTimeoutTest.java | 63 ++ .../ignite/loadtests/dsi/GridDsiClient.java | 419 +++++++++++ .../loadtests/dsi/GridDsiLifecycleBean.java | 59 ++ .../ignite/loadtests/dsi/GridDsiMessage.java | 74 ++ .../ignite/loadtests/dsi/GridDsiPerfJob.java | 341 +++++++++ .../ignite/loadtests/dsi/GridDsiRequest.java | 93 +++ .../loadtests/dsi/GridDsiRequestTask.java | 41 ++ .../ignite/loadtests/dsi/GridDsiResponse.java | 87 +++ .../loadtests/dsi/GridDsiResponseTask.java | 41 ++ .../ignite/loadtests/dsi/GridDsiSession.java | 84 +++ .../cacheget/GridBenchmarkCacheGetLoadTest.java | 119 +++ .../apache/ignite/loadtests/dsi/package.html | 23 + ...dBoundedConcurrentLinkedHashSetLoadTest.java | 118 +++ .../loadtests/hashmap/GridCacheTestContext.java | 72 ++ .../loadtests/hashmap/GridHashMapLoadTest.java | 100 +++ .../job/GridJobExecutionLoadTestClient.java | 219 ++++++ ...GridJobExecutionLoadTestClientSemaphore.java | 239 ++++++ .../job/GridJobExecutionLoadTestJob.java | 48 ++ .../job/GridJobExecutionLoadTestServer.java | 40 + .../job/GridJobExecutionLoadTestTask.java | 50 ++ .../job/GridJobExecutionSingleNodeLoadTest.java | 237 ++++++ ...JobExecutionSingleNodeSemaphoreLoadTest.java | 226 ++++++ .../ignite/loadtests/job/GridJobLoadTest.java | 201 +++++ .../loadtests/job/GridJobLoadTestJob.java | 162 ++++ .../loadtests/job/GridJobLoadTestParams.java | 84 +++ .../loadtests/job/GridJobLoadTestSubmitter.java | 142 ++++ .../loadtests/job/GridJobLoadTestTask.java | 73 ++ .../apache/ignite/loadtests/job/package.html | 23 + .../GridConcurrentLinkedHashMapBenchmark.java | 238 ++++++ .../mapper/GridContinuousMapperLoadTest1.java | 50 ++ .../mapper/GridContinuousMapperLoadTest2.java | 91 +++ .../mapper/GridContinuousMapperTask1.java | 149 ++++ .../mapper/GridContinuousMapperTask2.java | 87 +++ .../loadtests/mapper/GridNodeStartup.java | 55 ++ .../ignite/loadtests/mapper/TestObject.java | 58 ++ .../mergesort/GridMergeSortLoadTask.java | 188 +++++ .../mergesort/GridMergeSortLoadTest.java | 143 ++++ .../loadtests/nio/GridNioBenchmarkClient.java | 167 +++++ .../loadtests/nio/GridNioBenchmarkTest.java | 119 +++ .../GridOffHeapMapPerformanceAbstractTest.java | 290 ++++++++ ...apPartitionedMapPerformanceAbstractTest.java | 430 +++++++++++ .../unsafe/GridUnsafeMapPerformanceTest.java | 30 + ...GridUnsafePartitionedMapPerformanceTest.java | 32 + .../ignite/loadtests/streamer/EventClosure.java | 60 ++ .../streamer/GridStreamerBenchmark.java | 140 ++++ .../streamer/GridStreamerIndexLoadTest.java | 179 +++++ .../loadtests/streamer/GridStreamerLoad.java | 62 ++ .../ignite/loadtests/streamer/IndexUpdater.java | 46 ++ .../ignite/loadtests/streamer/QueryClosure.java | 106 +++ .../loadtests/streamer/average/TestAverage.java | 70 ++ .../loadtests/streamer/average/TestStage.java | 65 ++ .../swap/GridSwapEvictAllBenchmark.java | 299 ++++++++ .../loadtests/util/GridCumulativeAverage.java | 63 ++ .../ignite/loadtests/util/GridLoadTestArgs.java | 283 +++++++ .../GridCacheStoreValueBytesTest.java | 2 +- ...idFileSwapSpaceSpiMultithreadedLoadTest.java | 2 +- .../loadtests/GridCacheLoadPopulationTask.java | 152 ---- .../loadtests/GridCacheMultiNodeLoadTest.java | 106 --- .../cache/GridCacheAbstractLoadTest.java | 376 ---------- ...ridCacheAffinityTransactionsOffHeapTest.java | 259 ------- .../loadtests/cache/GridCacheBenchmark.java | 202 ----- .../cache/GridCacheDataStructuresLoadTest.java | 364 --------- .../cache/GridCacheGroupLockComparisonTest.java | 203 ----- .../loadtests/cache/GridCacheLoadTest.java | 161 ---- .../cache/GridCachePutRemoveLoadTest.java | 373 ---------- .../cache/GridCacheSingleNodeLoadTest.java | 184 ----- .../loadtests/cache/GridCacheSwapLoadTest.java | 310 -------- .../GridCacheWriteBehindStoreLoadTest.java | 210 ------ .../capacity/GridCapacityLoadTest.java | 95 --- .../capacity/spring-capacity-cache.xml | 124 ---- .../colocation/GridTestCacheStore.java | 134 ---- .../loadtests/colocation/GridTestConstants.java | 35 - .../loadtests/colocation/GridTestKey.java | 92 --- .../colocation/GridTestLifecycleBean.java | 41 -- .../loadtests/colocation/GridTestMain.java | 207 ------ .../loadtests/colocation/spring-colocation.xml | 182 ----- .../communication/GridIoManagerBenchmark.java | 337 --------- .../communication/GridIoManagerBenchmark0.java | 469 ------------ .../GridTcpCommunicationBenchmark.java | 586 --------------- .../communication/GridTestMessage.java | 135 ---- .../GridContinuousOperationsLoadTest.java | 211 ------ .../GridCachePartitionedAtomicLongLoadTest.java | 129 ---- .../direct/multisplit/GridLoadTestJob.java | 59 -- .../multisplit/GridLoadTestJobTarget.java | 33 - .../direct/multisplit/GridLoadTestTask.java | 84 --- .../multisplit/GridMultiSplitsLoadTest.java | 160 ---- .../GridMultiSplitsRedeployLoadTest.java | 162 ---- .../loadtests/direct/multisplit/package.html | 24 - .../GridSingleSplitNewNodesTestJobTarget.java | 50 -- .../GridSingleSplitNewNodesTestTask.java | 95 --- ...ridSingleSplitsNewNodesAbstractLoadTest.java | 188 ----- ...idSingleSplitsNewNodesMulticastLoadTest.java | 45 -- .../loadtests/direct/newnodes/package.html | 24 - .../GridSingleSplitsRedeployLoadTest.java | 174 ----- .../loadtests/direct/redeploy/package.html | 24 - .../direct/session/GridSessionLoadTest.java | 112 --- .../direct/session/GridSessionLoadTestJob.java | 77 -- .../direct/session/GridSessionLoadTestTask.java | 137 ---- .../loadtests/direct/session/package.html | 24 - .../direct/stealing/GridStealingLoadTest.java | 154 ---- .../stealing/GridStealingLoadTestJob.java | 62 -- .../stealing/GridStealingLoadTestTask.java | 96 --- .../loadtests/direct/stealing/package.html | 24 - .../loadtests/discovery/GridGcTimeoutTest.java | 63 -- .../gridgain/loadtests/dsi/GridDsiClient.java | 419 ----------- .../loadtests/dsi/GridDsiLifecycleBean.java | 59 -- .../gridgain/loadtests/dsi/GridDsiMessage.java | 74 -- .../gridgain/loadtests/dsi/GridDsiPerfJob.java | 341 --------- .../gridgain/loadtests/dsi/GridDsiRequest.java | 93 --- .../loadtests/dsi/GridDsiRequestTask.java | 41 -- .../gridgain/loadtests/dsi/GridDsiResponse.java | 87 --- .../loadtests/dsi/GridDsiResponseTask.java | 41 -- .../gridgain/loadtests/dsi/GridDsiSession.java | 84 --- .../cacheget/GridBenchmarkCacheGetLoadTest.java | 119 --- .../org/gridgain/loadtests/dsi/package.html | 23 - ...dBoundedConcurrentLinkedHashSetLoadTest.java | 118 --- .../loadtests/hashmap/GridCacheTestContext.java | 72 -- .../loadtests/hashmap/GridHashMapLoadTest.java | 100 --- .../job/GridJobExecutionLoadTestClient.java | 219 ------ ...GridJobExecutionLoadTestClientSemaphore.java | 239 ------ .../job/GridJobExecutionLoadTestJob.java | 48 -- .../job/GridJobExecutionLoadTestServer.java | 40 - .../job/GridJobExecutionLoadTestTask.java | 50 -- .../job/GridJobExecutionSingleNodeLoadTest.java | 237 ------ ...JobExecutionSingleNodeSemaphoreLoadTest.java | 226 ------ .../gridgain/loadtests/job/GridJobLoadTest.java | 201 ----- .../loadtests/job/GridJobLoadTestJob.java | 163 ---- .../loadtests/job/GridJobLoadTestParams.java | 84 --- .../loadtests/job/GridJobLoadTestSubmitter.java | 143 ---- .../loadtests/job/GridJobLoadTestTask.java | 73 -- .../org/gridgain/loadtests/job/package.html | 23 - .../GridConcurrentLinkedHashMapBenchmark.java | 238 ------ .../mapper/GridContinuousMapperLoadTest1.java | 50 -- .../mapper/GridContinuousMapperLoadTest2.java | 91 --- .../mapper/GridContinuousMapperTask1.java | 149 ---- .../mapper/GridContinuousMapperTask2.java | 87 --- .../loadtests/mapper/GridNodeStartup.java | 55 -- .../gridgain/loadtests/mapper/TestObject.java | 58 -- .../mergesort/GridMergeSortLoadTask.java | 188 ----- .../mergesort/GridMergeSortLoadTest.java | 143 ---- .../loadtests/nio/GridNioBenchmarkClient.java | 167 ----- .../loadtests/nio/GridNioBenchmarkTest.java | 119 --- .../GridOffHeapMapPerformanceAbstractTest.java | 290 -------- ...apPartitionedMapPerformanceAbstractTest.java | 430 ----------- .../unsafe/GridUnsafeMapPerformanceTest.java | 30 - ...GridUnsafePartitionedMapPerformanceTest.java | 32 - .../loadtests/streamer/EventClosure.java | 60 -- .../streamer/GridStreamerBenchmark.java | 140 ---- .../streamer/GridStreamerIndexLoadTest.java | 179 ----- .../loadtests/streamer/GridStreamerLoad.java | 62 -- .../loadtests/streamer/IndexUpdater.java | 46 -- .../loadtests/streamer/QueryClosure.java | 106 --- .../loadtests/streamer/average/TestAverage.java | 70 -- .../loadtests/streamer/average/TestStage.java | 65 -- .../swap/GridSwapEvictAllBenchmark.java | 299 -------- .../loadtests/util/GridCumulativeAverage.java | 63 -- .../loadtests/util/GridLoadTestArgs.java | 283 ------- .../loadtests/ggfs/GridGgfsNodeStartup.java | 49 ++ .../ggfs/GridGgfsPerformanceBenchmark.java | 273 +++++++ .../loadtests/ggfs/GridGgfsNodeStartup.java | 49 -- .../ggfs/GridGgfsPerformanceBenchmark.java | 273 ------- .../loadtests/h2indexing/GridTestEntity.java | 68 ++ .../loadtests/h2indexing/GridTreeBenchmark.java | 276 +++++++ .../loadtests/h2indexing/GridTestEntity.java | 68 -- .../loadtests/h2indexing/GridTreeBenchmark.java | 276 ------- 246 files changed, 16030 insertions(+), 18736 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridAbstractAopTest.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridAbstractAopTest.java b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridAbstractAopTest.java deleted file mode 100644 index 1076aba..0000000 --- a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridAbstractAopTest.java +++ /dev/null @@ -1,734 +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.gridgain.grid.gridify; - -import org.apache.ignite.*; -import org.apache.ignite.cluster.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.events.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.spi.deployment.local.*; -import org.apache.ignite.spi.discovery.tcp.*; -import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; -import org.gridgain.testframework.junits.common.*; - -import java.lang.reflect.*; -import java.util.*; -import java.util.concurrent.atomic.*; - -import static org.apache.ignite.events.IgniteEventType.*; - -/** - * Abstract AOP test. - */ -@SuppressWarnings( {"OverlyStrongTypeCast", "JUnitAbstractTestClassNamingConvention", "ProhibitedExceptionDeclared", "IfMayBeConditional"}) -public abstract class GridAbstractAopTest extends GridCommonAbstractTest { - /** */ - private IgniteDeploymentMode depMode = IgniteDeploymentMode.PRIVATE; - - /** - * @throws Exception If test failed. - */ - public void testDefaultPrivate() throws Exception { - checkDefault(IgniteDeploymentMode.PRIVATE); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultIsolated() throws Exception { - checkDefault(IgniteDeploymentMode.ISOLATED); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultContinuous() throws Exception { - checkDefault(IgniteDeploymentMode.CONTINUOUS); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultShared() throws Exception { - checkDefault(IgniteDeploymentMode.SHARED); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultWithUserClassLoaderPrivate() throws Exception { - checkDefaultWithUserClassLoader(IgniteDeploymentMode.PRIVATE); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultWithUserClassLoaderIsolated() throws Exception { - checkDefaultWithUserClassLoader(IgniteDeploymentMode.ISOLATED); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultWithUserClassLoaderContinuous() throws Exception { - checkDefaultWithUserClassLoader(IgniteDeploymentMode.CONTINUOUS); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultWithUserClassLoaderShared() throws Exception { - checkDefaultWithUserClassLoader(IgniteDeploymentMode.SHARED); - } - - /** - * @throws Exception If test failed. - */ - public void testSingleDeploymentWithUserClassLoaderPrivate() throws Exception { - checkSingleDeploymentWithUserClassLoader(IgniteDeploymentMode.PRIVATE); - } - - /** - * @throws Exception If test failed. - */ - public void testSingleDeploymentWithUserClassLoaderIsolated() throws Exception { - checkSingleDeploymentWithUserClassLoader(IgniteDeploymentMode.ISOLATED); - } - - /** - * @throws Exception If test failed. - */ - public void testSingleDeploymentWithUserClassLoaderContinuous() throws Exception { - checkSingleDeploymentWithUserClassLoader(IgniteDeploymentMode.CONTINUOUS); - } - - /** - * @throws Exception If test failed. - */ - public void testSingleDeploymentWithUserClassLoaderShared() throws Exception { - checkSingleDeploymentWithUserClassLoader(IgniteDeploymentMode.SHARED); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultResourceWithUserClassLoaderPrivate() throws Exception { - checkDefaultResourceWithUserClassLoader(IgniteDeploymentMode.PRIVATE); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultResourceWithUserClassLoaderIsolated() throws Exception { - checkDefaultResourceWithUserClassLoader(IgniteDeploymentMode.ISOLATED); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultResourceWithUserClassLoaderContinuous() throws Exception { - checkDefaultResourceWithUserClassLoader(IgniteDeploymentMode.CONTINUOUS); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultResourceWithUserClassLoaderShared() throws Exception { - checkDefaultResourceWithUserClassLoader(IgniteDeploymentMode.SHARED); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultClassPrivate() throws Exception { - checkNonDefaultClass(IgniteDeploymentMode.PRIVATE); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultClassIsolated() throws Exception { - checkNonDefaultClass(IgniteDeploymentMode.ISOLATED); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultClassContinuous() throws Exception { - checkNonDefaultClass(IgniteDeploymentMode.CONTINUOUS); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultClassShared() throws Exception { - checkNonDefaultClass(IgniteDeploymentMode.SHARED); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultNamePrivate() throws Exception { - checkNonDefaultName(IgniteDeploymentMode.PRIVATE); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultNameIsolated() throws Exception { - checkNonDefaultName(IgniteDeploymentMode.ISOLATED); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultNameContinuous() throws Exception { - checkNonDefaultName(IgniteDeploymentMode.CONTINUOUS); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultNameShared() throws Exception { - checkNonDefaultName(IgniteDeploymentMode.SHARED); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultExceptionPrivate() throws Exception { - checkDefaultException(IgniteDeploymentMode.PRIVATE); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultExceptionIsolated() throws Exception { - checkDefaultException(IgniteDeploymentMode.ISOLATED); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultExceptionContinuous() throws Exception { - checkDefaultException(IgniteDeploymentMode.CONTINUOUS); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultExceptionShared() throws Exception { - checkDefaultException(IgniteDeploymentMode.SHARED); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultResourcePrivate() throws Exception { - checkDefaultResource(IgniteDeploymentMode.PRIVATE); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultResourceIsolated() throws Exception { - checkDefaultResource(IgniteDeploymentMode.ISOLATED); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultResourceContinuous() throws Exception { - checkDefaultResource(IgniteDeploymentMode.CONTINUOUS); - } - - /** - * @throws Exception If test failed. - */ - public void testDefaultResourceShared() throws Exception { - checkDefaultResource(IgniteDeploymentMode.SHARED); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultClassResourcePrivate() throws Exception { - checkNonDefaultClassResource(IgniteDeploymentMode.PRIVATE); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultClassResourceIsolated() throws Exception { - checkNonDefaultClassResource(IgniteDeploymentMode.ISOLATED); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultClassResourceContinuous() throws Exception { - checkNonDefaultClassResource(IgniteDeploymentMode.CONTINUOUS); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultClassResourceShared() throws Exception { - checkNonDefaultClassResource(IgniteDeploymentMode.SHARED); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultNameResourcePrivate() throws Exception { - checkNonDefaultNameResource(IgniteDeploymentMode.PRIVATE); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultNameResourceIsolated() throws Exception { - checkNonDefaultNameResource(IgniteDeploymentMode.ISOLATED); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultNameResourceContinuous() throws Exception { - checkNonDefaultNameResource(IgniteDeploymentMode.CONTINUOUS); - } - - /** - * @throws Exception If test failed. - */ - public void testNonDefaultNameResourceShared() throws Exception { - checkNonDefaultNameResource(IgniteDeploymentMode.SHARED); - } - - /** - * @param depMode Deployment mode to use. - * @throws Exception If failed. - */ - private void checkDefault(IgniteDeploymentMode depMode) throws Exception { - this.depMode = depMode; - - info("Start Gridify test with Default AOP Task in Deployment Mode : " + depMode); - - startGrid(); - - try { - int res; - - Object targetObj = target(); - - if (targetObj instanceof GridTestAopTarget) - res = ((GridTestAopTarget)targetObj).gridifyDefault("1"); - else - res = ((GridTestAopTargetInterface) targetObj).gridifyDefault("1"); - - assert res == 1 : "Invalid gridifyDefault result: " + res; - } - finally { - stopGrid(); - } - } - - /** - * @param depMode Deployment mode to use. - * @throws Exception If failed. - */ - private void checkDefaultWithUserClassLoader(IgniteDeploymentMode depMode) throws Exception { - this.depMode = depMode; - - info("Start Gridify test with Default AOP Task in Deployment Mode : " + depMode); - - startGrid(); - - int res; - - try { - res = -1; - - Object targetObj = targetWithUserClassLoader(); - - Method gridifyMtd = targetObj.getClass().getDeclaredMethod("gridifyDefault", String.class); - - res = (Integer) gridifyMtd.invoke(targetObj, "1"); - - if (res != 1) - fail("Method gridifyDefault returned wrong value [result=" + res + ", expect=1]"); - } - finally { - stopGrid(); - } - - info("Executed @Gridify method gridifyDefault(1) [result=" + res + ']'); - } - - /** - * @param depMode Deployment mode to use. - * @throws Exception If failed. - */ - private void checkSingleDeploymentWithUserClassLoader(IgniteDeploymentMode depMode) throws Exception { - this.depMode = depMode; - - // Create remote grid to execute test on. - Ignite locIgnite = startGrid(); - - Ignite rmtIgnite = startGrid(getTestGridName() + "Remote"); - - try { - AtomicInteger locDepCnt = new AtomicInteger(0); - AtomicInteger rmtDepCnt = new AtomicInteger(0); - - locIgnite.events().localListen(new TestEventListener(locDepCnt), EVT_TASK_DEPLOYED, EVT_CLASS_DEPLOYED); - rmtIgnite.events().localListen(new TestEventListener(rmtDepCnt), EVT_TASK_DEPLOYED, EVT_CLASS_DEPLOYED); - - assertEquals(2, locIgnite.cluster().forPredicate(F.<ClusterNode>alwaysTrue()).nodes().size()); - - Object targetObj = targetWithUserClassLoader(); - - Method gridifyMtd = targetObj.getClass().getDeclaredMethod("gridifyDefault", String.class); - - info("First invocation."); - - int res = (Integer)gridifyMtd.invoke(targetObj, "1"); - - assert res == 1 : "Method gridifyDefault returned wrong value [result=" + res + ", expected=1]"; - - info("Second invocation."); - - res = (Integer)gridifyMtd.invoke(targetObj, "1"); - - assert res == 1 : "Method gridifyDefault returned wrong value [result=" + res + ", expected=1]"; - - assert locDepCnt.get() == 1 : "Invalid local deployment count [expected=1, got=" + locDepCnt.get() + ']'; - assert rmtDepCnt.get() == 1 : "Invalid remote deployment count [expected=1, got=" + rmtDepCnt.get() + ']'; - } - finally { - stopAllGrids(); - } - } - - /** - * @param depMode Deployment mode to use. - * @throws Exception If failed. - */ - private void checkDefaultResourceWithUserClassLoader(IgniteDeploymentMode depMode) throws Exception { - this.depMode = depMode; - - info("Start Gridify test with Default AOP Task."); - - startGrid(); - - int res; - - try { - res = -1; - - Object targetObj = targetWithUserClassLoader(); - - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - - // Set context classloader as user class loader. - Thread.currentThread().setContextClassLoader(targetObj.getClass().getClassLoader()); - - Method gridifyMtd = targetObj.getClass().getDeclaredMethod("gridifyDefaultResource", String.class); - - res = (Integer) gridifyMtd.invoke(targetObj, "2"); - - if (res != 2) - fail("Method gridifyDefaultResource returned wrong value [result=" + res + ", expect=2]"); - - // Set old classloader back. - Thread.currentThread().setContextClassLoader(cl); - } - finally { - stopGrid(); - } - - info("Executed @Gridify method gridifyDefaultResource(2) [result=" + res + ']'); - } - - /** - * @param depMode Deployment mode to use. - * @throws Exception If failed. - */ - private void checkNonDefaultClass(IgniteDeploymentMode depMode) throws Exception { - this.depMode = depMode; - - info("Start Gridify test with Test AOP Task in Deployment Mode : " + depMode); - - startGrid(); - - int res; - - try { - res = -1; - - Object targetObj = target(); - - if (targetObj instanceof GridTestAopTarget) - res = ((GridTestAopTarget) targetObj).gridifyNonDefaultClass("1"); - else - res = ((GridTestAopTargetInterface) targetObj).gridifyNonDefaultClass("1"); - - if (res != 10) - fail("Method gridifyNonDefault returned wrong value [result=" + res + ", expect=10]"); - } - finally { - stopGrid(); - } - - info("Executed @Gridify method gridifyNonDefaultClass(0) [result=" + res + ']'); - } - - /** - * @param depMode Deployment mode to use. - * @throws Exception If failed. - */ - private void checkNonDefaultName(IgniteDeploymentMode depMode) throws Exception { - this.depMode = depMode; - - info("Start Gridify test with Test AOP Task in Deployment Mode : " + depMode); - - startGrid(); - - int res; - - try { - res = -1; - - Object targetObj = target(); - - if (targetObj instanceof GridTestAopTarget) - res = ((GridTestAopTarget) targetObj).gridifyNonDefaultName("2"); - else - res = ((GridTestAopTargetInterface) targetObj).gridifyNonDefaultName("2"); - - if (res != 20) - fail("Method gridifyNonDefault returned wrong value [result=" + res + ", expect=2]"); - } - finally { - stopGrid(); - } - - info("Executed @Gridify method gridifyNonDefaultName(2) [result=" + res + ']'); - } - - /** - * @param depMode Deployment mode to use. - * @throws Exception If failed. - */ - @SuppressWarnings({"CatchGenericClass"}) - private void checkDefaultException(IgniteDeploymentMode depMode) throws Exception { - this.depMode = depMode; - - info("Start Gridify test with Default AOP Task and exception in Deployment Mode : " + depMode); - - startGrid(); - - try { - Object targetObj = target(); - - boolean isE = false; - - try { - if (targetObj instanceof GridTestAopTarget) - ((GridTestAopTarget) targetObj).gridifyDefaultException("1"); - else - ((GridTestAopTargetInterface) targetObj).gridifyDefaultException("1"); - } - catch (GridTestGridifyException e) { - info("@Gridify method gridifyDefaultException(0) returns exception: " + e); - - isE = true; - } - catch (Exception e) { - e.printStackTrace(); - - fail("@Gridify method gridifyDefaultException(0) returns exception [exception" + e - + ", expect=" + GridTestGridifyException.class.getName() + ']'); - } - - if (!isE) - fail("@Gridify method gridifyDefaultException(0) does not return any exception."); - } - finally { - stopGrid(); - } - } - - /** - * @param depMode Deployment mode to use. - * @throws Exception If failed. - */ - private void checkDefaultResource(IgniteDeploymentMode depMode) throws Exception { - this.depMode = depMode; - - info("Start Gridify test with Default AOP Task in Deploy Mode : " + depMode); - - startGrid(); - - int res; - - try { - res = -1; - - Object targetObj = target(); - - if (targetObj instanceof GridTestAopTarget) - res = ((GridTestAopTarget)targetObj).gridifyDefaultResource("1"); - else - res = ((GridTestAopTargetInterface)targetObj).gridifyDefaultResource("1"); - - if (res != 1) - fail("Method gridifyDefaultResource returned wrong value [result=" + res + ", expect=1]"); - } - finally { - stopGrid(); - } - - info("Executed @Gridify method gridifyDefaultResource(0) [result=" + res + ']'); - } - - /** - * @param depMode Deployment mode to use. - * @throws Exception If failed. - */ - private void checkNonDefaultClassResource(IgniteDeploymentMode depMode) throws Exception { - this.depMode = depMode; - - info("Start Gridify test with Test AOP Task in Deploy Mode : " + depMode); - - startGrid(); - - int res; - - try { - res = -1; - - Object targetObj = target(); - - if (targetObj instanceof GridTestAopTarget) - res = ((GridTestAopTarget) targetObj).gridifyNonDefaultClassResource("3"); - else - res = ((GridTestAopTargetInterface) targetObj).gridifyNonDefaultClassResource("3"); - - if (res != 30) - fail("Method gridifyNonDefaultClassResource returned wrong value [result=" + res + ", expect=3]"); - } - finally { - stopGrid(); - } - - info("Executed @Gridify method gridifyNonDefaultClassResource(3) [result=" + res + ']'); - } - - /** - * @param depMode Deployment mode to use. - * @throws Exception If failed. - */ - private void checkNonDefaultNameResource(IgniteDeploymentMode depMode) throws Exception { - this.depMode = depMode; - - info("Start Gridify test with Test AOP Task in Deployment Mode : " + depMode); - - startGrid(); - - int res; - - try { - res = -1; - - Object targetObj = target(); - - if (targetObj instanceof GridTestAopTarget) - res = ((GridTestAopTarget)targetObj).gridifyNonDefaultNameResource("4"); - else - res = ((GridTestAopTargetInterface)targetObj).gridifyNonDefaultNameResource("4"); - - if (res != 40) - fail("Method gridifyNonDefaultNameResource returned wrong value [result=" + res + ", expect=4]"); - } - finally { - stopGrid(); - } - - info("Executed @Gridify method gridifyNonDefaultNameResource(4) [result=" + res + ']'); - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - cfg.setDeploymentSpi(new LocalDeploymentSpi()); - - ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setHeartbeatFrequency(500); - - cfg.setDeploymentMode(depMode); - - return cfg; - } - - /** - * @return Test target. - */ - protected abstract Object target(); - - /** - * @return Target. - * @throws Exception If failed. - */ - protected Object targetWithUserClassLoader() throws Exception { - // Notice that we use another resource naming because file has path. - ClassLoader tstClsLdr = new GridTestClassLoader( - Collections.singletonMap("org/gridgain/grid/gridify/test_resource.properties", "param1=2"), - getClass().getClassLoader(), - GridTestAopTarget.class.getName(), GridTestAopTargetInterface.class.getName()); - - return tstClsLdr.loadClass("org.gridgain.grid.gridify.GridTestAopTarget").newInstance(); - } - - /** - * Event listener. - */ - private static final class TestEventListener implements IgnitePredicate<IgniteEvent> { - /** */ - private static final long serialVersionUID = 0L; - - /** Counter. */ - private final AtomicInteger cnt; - - /** - * @param cnt Deploy counter. - */ - private TestEventListener(AtomicInteger cnt) { this.cnt = cnt; } - - /** {@inheritDoc} */ - @Override public boolean apply(IgniteEvent evt) { - if ((evt.type() == EVT_TASK_DEPLOYED || evt.type() == EVT_CLASS_DEPLOYED) && - evt.message() != null && !evt.message().contains("GridTopic")) - cnt.addAndGet(1); - - return true; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridBasicAopSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridBasicAopSelfTest.java b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridBasicAopSelfTest.java deleted file mode 100644 index 9dde4cf..0000000 --- a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridBasicAopSelfTest.java +++ /dev/null @@ -1,77 +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.gridgain.grid.gridify; - -import org.apache.ignite.*; -import org.apache.ignite.compute.*; -import org.apache.ignite.compute.gridify.*; -import org.gridgain.testframework.*; -import org.gridgain.testframework.junits.common.*; - -import java.util.*; -import java.util.concurrent.*; - -/** - * Tries to execute dummy gridified task. It should fail because grid is not started. - * <p> - * The main purpose of this test is to check that AOP is properly configured. It should - * be included in all suites that require AOP. - */ -public class GridBasicAopSelfTest extends GridCommonAbstractTest { - /** - * @throws Exception If failed. - */ - public void testAop() throws Exception { - GridTestUtils.assertThrows( - log, - new Callable<Object>() { - @Override public Object call() throws Exception { - gridify(); - - return null; - } - }, - IgniteCheckedException.class, - "Grid is not locally started: null" - ); - } - - /** - * Gridified method. - */ - @Gridify(taskClass = TestTask.class) - private void gridify() { - // No-op - } - - /** - * Test task. - */ - private static class TestTask extends GridifyTaskSplitAdapter<Void> { - /** {@inheritDoc} */ - @Override protected Collection<? extends ComputeJob> split(int gridSize, - GridifyArgument arg) throws IgniteCheckedException { - return null; - } - - /** {@inheritDoc} */ - @Override public Void reduce(List<ComputeJobResult> results) throws IgniteCheckedException { - return null; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridNonSpringAopSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridNonSpringAopSelfTest.java b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridNonSpringAopSelfTest.java deleted file mode 100644 index 3e90acf..0000000 --- a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridNonSpringAopSelfTest.java +++ /dev/null @@ -1,57 +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.gridgain.grid.gridify; - -import org.gridgain.testframework.junits.common.*; - -/** - * To run this test with JBoss AOP make sure of the following: - * - * 1. The JVM is started with following parameters to enable jboss online weaving - * (replace ${GRIDGAIN_HOME} to you $GRIDGAIN_HOME): - * -javaagent:${GRIDGAIN_HOME}libs/jboss-aop-jdk50-4.0.4.jar - * -Djboss.aop.class.path=[path to grid compiled classes (Idea out folder) or path to gridgain.jar] - * -Djboss.aop.exclude=org,com -Djboss.aop.include=org.gridgain - * - * 2. The following jars should be in a classpath: - * ${GRIDGAIN_HOME}libs/javassist-3.x.x.jar - * ${GRIDGAIN_HOME}libs/jboss-aop-jdk50-4.0.4.jar - * ${GRIDGAIN_HOME}libs/jboss-aspect-library-jdk50-4.0.4.jar - * ${GRIDGAIN_HOME}libs/jboss-common-4.2.2.jar - * ${GRIDGAIN_HOME}libs/trove-1.0.2.jar - * - * To run this test with AspectJ AOP make sure of the following: - * - * 1. The JVM is started with following parameters for enable AspectJ online weaving - * (replace ${GRIDGAIN_HOME} to you $GRIDGAIN_HOME): - * -javaagent:${GRIDGAIN_HOME}/libs/optional/gridgain-aop/aspectjweaver-1.7.2.jar - * - * 2. Classpath should contains the ${GRIDGAIN_HOME}/modules/tests/config/aop/aspectj folder. - */ -@GridCommonTest(group="AOP") -public class GridNonSpringAopSelfTest extends GridAbstractAopTest { - /** {@inheritDoc} */ - @Override protected Object target() { - return new GridTestAopTarget(); - } - - /** {@inheritDoc} */ - @Override public String getTestGridName() { - return "GridTestAopTarget"; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridSpringAopSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridSpringAopSelfTest.java b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridSpringAopSelfTest.java deleted file mode 100644 index 3f0adee..0000000 --- a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridSpringAopSelfTest.java +++ /dev/null @@ -1,52 +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.gridgain.grid.gridify; - -import org.gridgain.grid.compute.gridify.aop.spring.*; -import org.gridgain.testframework.junits.common.*; - -/** - * Spring AOP test. - */ -@GridCommonTest(group="AOP") -public class GridSpringAopSelfTest extends GridAbstractAopTest { - /** {@inheritDoc} */ - @Override protected Object target() { - return GridifySpringEnhancer.enhance(new GridTestAopTarget()); - } - - /** {@inheritDoc} */ - @Override public String getTestGridName() { - return "GridTestAopTargetInterface"; - } - - /** {@inheritDoc} */ - @Override protected Object targetWithUserClassLoader() throws Exception { - Object res = super.targetWithUserClassLoader(); - - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - - Thread.currentThread().setContextClassLoader(res.getClass().getClassLoader()); - - res = GridifySpringEnhancer.enhance(res); - - Thread.currentThread().setContextClassLoader(cl); - - return res; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestAopTarget.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestAopTarget.java b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestAopTarget.java deleted file mode 100644 index b20de45..0000000 --- a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestAopTarget.java +++ /dev/null @@ -1,138 +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.gridgain.grid.gridify; - -import org.apache.ignite.compute.gridify.*; - -import java.io.*; -import java.util.*; - -/** - * AOP test. - */ -public class GridTestAopTarget implements GridTestAopTargetInterface { - /** - * @param arg Argument. - * @return Result. - */ - @Gridify(gridName="GridTestAopTarget") - @Override public int gridifyDefault(String arg) { - return Integer.parseInt(arg); - } - - /** - * @param arg Argument. - * @return Result. - */ - @Gridify(gridName="GridTestAopTarget", taskClass = GridTestGridifyTask.class) - @Override public int gridifyNonDefaultClass(String arg) { - return Integer.parseInt(arg); - } - - - /** - * @param arg Argument. - * @return Result. - */ - @Gridify(gridName="GridTestAopTarget", taskName = GridTestGridifyTask.TASK_NAME) - @Override public int gridifyNonDefaultName(String arg) { - return Integer.parseInt(arg); - } - - /** - * @param arg Argument. - * @return Result. - */ - @Gridify(gridName="GridTestAopTarget", taskName = "") - @Override public int gridifyNoName(String arg) { - return 0; - } - - /** - * @param arg Argument. - * @return Result. - * @throws GridTestGridifyException If failed. - */ - @Gridify(gridName="GridTestAopTarget") - @Override public int gridifyDefaultException(String arg) throws GridTestGridifyException { - throw new GridTestGridifyException(arg); - } - - /** - * @param arg Argument. - * @return Result. - * @throws GridTestGridifyException If failed. - */ - @Gridify(gridName="GridTestAopTarget") - @Override public int gridifyDefaultResource(String arg) throws GridTestGridifyException { - int res = Integer.parseInt(arg); - - Integer rsrcVal = getResource(); - - assert rsrcVal != null; - assert rsrcVal == res : "Invalid result [res=" + res + ", rsrc=" + rsrcVal + ']'; - - return res; - } - - /** - * @param arg Argument. - * @return Result. - * @throws GridTestGridifyException If failed. - */ - @Gridify(gridName="GridTestAopTarget", taskClass = GridTestGridifyTask.class) - @Override public int gridifyNonDefaultClassResource(String arg) throws GridTestGridifyException { - assert getResource() != null; - - return Integer.parseInt(arg); - } - - - /** - * @param arg Argument. - * @return Result. - * @throws GridTestGridifyException If failed. - */ - @Gridify(gridName="GridTestAopTarget", taskName = GridTestGridifyTask.TASK_NAME) - @Override public int gridifyNonDefaultNameResource(String arg) throws GridTestGridifyException { - assert getResource() != null; - - return Integer.parseInt(arg); - } - - /** - * @return Result. - * @throws GridTestGridifyException If failed. - */ - private Integer getResource() throws GridTestGridifyException { - try (InputStream in = getClass().getResourceAsStream("test_resource.properties")) { - assert in != null; - - Properties prop = new Properties(); - - prop.load(in); - - String val = prop.getProperty("param1"); - - return Integer.parseInt(val); - } - catch (IOException e) { - throw new GridTestGridifyException("Failed to test load properties file.", e); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestAopTargetInterface.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestAopTargetInterface.java b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestAopTargetInterface.java deleted file mode 100644 index 82d4beb..0000000 --- a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestAopTargetInterface.java +++ /dev/null @@ -1,87 +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.gridgain.grid.gridify; - -import org.apache.ignite.compute.gridify.*; - -import java.io.*; - -/** - * Test AOP target interface. - */ -public interface GridTestAopTargetInterface extends Serializable { - /** - * @param arg Argument. - * @return Result. - */ - @Gridify(gridName="GridTestAopTargetInterface") - public int gridifyDefault(String arg); - - /** - * @param arg Argument. - * @return Result. - */ - @Gridify(gridName="GridTestAopTargetInterface", taskName = GridTestGridifyTask.TASK_NAME) - public int gridifyNonDefaultName(String arg); - - /** - * @param arg Argument. - * @return Result. - */ - @Gridify(gridName="GridTestAopTargetInterface", taskClass = GridTestGridifyTask.class) - public int gridifyNonDefaultClass(String arg); - - /** - * @param arg Argument. - * @return Result. - */ - @Gridify(gridName="GridTestAopTargetInterface", taskName = "") - public int gridifyNoName(String arg); - - /** - * @param arg Argument. - * @return Result. - * @throws GridTestGridifyException If failed. - */ - @Gridify(gridName="GridTestAopTargetInterface") - public int gridifyDefaultException(String arg) throws GridTestGridifyException; - - /** - * @param arg Argument. - * @return Result. - * @throws GridTestGridifyException If failed. - */ - @Gridify(gridName="GridTestAopTargetInterface") - public int gridifyDefaultResource(String arg) throws GridTestGridifyException; - - /** - * @param arg Argument. - * @return Result. - * @throws GridTestGridifyException If failed. - */ - @Gridify(gridName="GridTestAopTargetInterface", taskClass = GridTestGridifyTask.class) - public int gridifyNonDefaultClassResource(String arg) throws GridTestGridifyException; - - /** - * @param arg Argument. - * @return Result. - * @throws GridTestGridifyException If failed. - */ - @Gridify(gridName="GridTestAopTargetInterface", taskName = GridTestGridifyTask.TASK_NAME) - public int gridifyNonDefaultNameResource(String arg) throws GridTestGridifyException; -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestGridifyException.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestGridifyException.java b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestGridifyException.java deleted file mode 100644 index 83b4d18..0000000 --- a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestGridifyException.java +++ /dev/null @@ -1,38 +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.gridgain.grid.gridify; - -/** - * Test gridify exception. - */ -public class GridTestGridifyException extends Exception { - /** - * @param msg Message. - */ - public GridTestGridifyException(String msg) { - super(msg); - } - - /** - * @param msg Message. - * @param cause Exception cause. - */ - public GridTestGridifyException(String msg, Throwable cause) { - super(msg, cause); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestGridifyJob.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestGridifyJob.java b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestGridifyJob.java deleted file mode 100644 index 02b3ca8..0000000 --- a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestGridifyJob.java +++ /dev/null @@ -1,68 +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.gridgain.grid.gridify; - -import org.apache.ignite.*; -import org.apache.ignite.compute.*; -import org.apache.ignite.resources.*; -import org.gridgain.grid.*; - -import java.io.*; - -/** - * Test gridify job. - */ -public class GridTestGridifyJob extends ComputeJobAdapter { - /** */ - @IgniteLoggerResource - private IgniteLogger log; - - /** - * @param arg Argument. - */ - public GridTestGridifyJob(String arg) { - super(arg); - } - - /** {@inheritDoc} */ - @Override public Serializable execute() throws IgniteCheckedException { - if (log.isInfoEnabled()) - log.info("Execute GridTestGridifyJob.execute(" + argument(0) + ')'); - - GridTestAopTarget target = new GridTestAopTarget(); - - try { - if ("1".equals(argument(0))) - return target.gridifyNonDefaultClass("10"); - else if ("2".equals(argument(0))) - return target.gridifyNonDefaultName("20"); - else if ("3".equals(argument(0))) - return target.gridifyNonDefaultClassResource("30"); - else if ("4".equals(argument(0))) - return target.gridifyNonDefaultNameResource("40"); - } - catch (GridTestGridifyException e) { - throw new RuntimeException("Failed to execute target method.", e); - } - - assert false : "Argument must be equals to \"0\" [gridifyArg=" + argument(0) + ']'; - - // Never reached. - return null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestGridifyTask.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestGridifyTask.java b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestGridifyTask.java deleted file mode 100644 index 01f92b8..0000000 --- a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridTestGridifyTask.java +++ /dev/null @@ -1,47 +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.gridgain.grid.gridify; - -import org.apache.ignite.*; -import org.apache.ignite.compute.*; -import org.apache.ignite.compute.gridify.*; - -import java.util.*; - -/** - * Test gridify task. - */ -@ComputeTaskName(GridTestGridifyTask.TASK_NAME) -public class GridTestGridifyTask extends ComputeTaskSplitAdapter<GridifyArgument, Object> { - /** */ - public static final String TASK_NAME = "org.gridgain.grid.gridify.GridTestGridifyTask"; - - /** {@inheritDoc} */ - @Override public Collection<? extends ComputeJob> split(int gridSize, GridifyArgument arg) throws IgniteCheckedException { - assert arg.getMethodParameters().length == 1; - - return Collections.singletonList(new GridTestGridifyJob((String)arg.getMethodParameters()[0])); - } - - /** {@inheritDoc} */ - @Override public Object reduce(List<ComputeJobResult> results) throws IgniteCheckedException { - assert results.size() == 1; - - return results.get(0).getData(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridifySetToSetTarget.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridifySetToSetTarget.java b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridifySetToSetTarget.java deleted file mode 100644 index 3ddbec6..0000000 --- a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridifySetToSetTarget.java +++ /dev/null @@ -1,372 +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.gridgain.grid.gridify; - -import org.apache.ignite.compute.gridify.*; - -import java.io.*; -import java.util.*; - -/** - * Test set-to-set target. - */ -public class GridifySetToSetTarget implements GridifySetToSetTargetInterface, Serializable { - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget", threshold = 2, splitSize = 2) - @Override public Collection<Long> findPrimes(Collection<Long> input) { - return findPrimes0(input); - } - - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget", threshold = 2) - @Override public Collection<Long> findPrimesWithoutSplitSize(Collection<Long> input) { - return findPrimes0(input); - } - - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget") - @Override public Collection<Long> findPrimesWithoutSplitSizeAndThreshold(Collection<Long> input) { - return findPrimes0(input); - } - - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget") - @Override public Collection<Long> findPrimesInListWithoutSplitSizeAndThreshold(List<Long> input) { - return findPrimes0(input); - } - - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - @SuppressWarnings({"CollectionDeclaredAsConcreteClass"}) - @GridifySetToSet(gridName = "GridifySetToSetTarget") - @Override public Collection<Long> findPrimesInArrayListWithoutSplitSizeAndThreshold(ArrayList<Long> input) { - return findPrimes0(input); - } - - /** - * Find prime numbers in array. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget", threshold = 2, splitSize = 2) - @Override public Long[] findPrimesInArray(Long[] input) { - return findPrimesInArray0(input); - } - - /** - * Find prime numbers in primitive array. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget", threshold = 2, splitSize = 2) - @Override public long[] findPrimesInPrimitiveArray(long[] input) { - return findPrimesInPrimitiveArray0(input); - } - - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - private Collection<Long> findPrimes0(Iterable<Long> input) { - System.out.println(">>>"); - System.out.println("Find primes in: " + input); - System.out.println(">>>"); - - Collection<Long> res = new ArrayList<>(); - - for (Long val : input) { - Long divisor = checkPrime(val, 2, val); - - if (divisor == null) - res.add(val); - } - - return res; - } - - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - private Long[] findPrimesInArray0(Long[] input) { - System.out.println(">>>"); - System.out.println("Find primes in array: " + Arrays.asList(input)); - System.out.println(">>>"); - - Collection<Long> res = new ArrayList<>(); - - for (Long val : input) { - Long divisor = checkPrime(val, 2, val); - - if (divisor == null) - res.add(val); - } - - return res.toArray(new Long[res.size()]); - } - - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - private long[] findPrimesInPrimitiveArray0(long[] input) { - System.out.println(">>>"); - System.out.println("Find primes in primitive array: " + Arrays.toString(input)); - System.out.println(">>>"); - - Collection<Long> res = new ArrayList<>(); - - for (Long val : input) { - Long divisor = checkPrime(val, 2, val); - - if (divisor == null) - res.add(val); - } - - long[] arr = new long[res.size()]; - - int i = 0; - - for (Long element : res) { - arr[i] = element; - i++; - } - - return arr; - } - - /** - * Find prime numbers in iterator. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget", threshold = 2, splitSize = 2) - @Override public Iterator<Long> findPrimesWithIterator(Iterator<Long> input) { - System.out.println(">>>"); - System.out.println("Find primes in iterator: " + input); - System.out.println(">>>"); - - Collection<Long> res = new ArrayList<>(); - - - while (input.hasNext()) { - Long val = input.next(); - - Long divisor = checkPrime(val, 2, val); - - if (divisor == null) - res.add(val); - } - - return new MathIteratorAdapter<>(res); - } - - /** - * Find prime numbers in enumeration. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget", threshold = 2, splitSize = 2) - @Override public Enumeration<Long> findPrimesWithEnumeration(Enumeration<Long> input) { - System.out.println(">>>"); - System.out.println("Find primes in enumeration: " + input); - System.out.println(">>>"); - - Collection<Long> res = new ArrayList<>(); - - while (input.hasMoreElements()) { - Long val = input.nextElement(); - - Long divisor = checkPrime(val, 2, val); - - if (divisor == null) - res.add(val); - } - - return new MathEnumerationAdapter<>(res); - } - - /** - * Method to check value for prime. - * Returns first divisor found or {@code null} if no divisor was found. - * - * @param val Value to check for prime. - * @param minRage Lower boundary of divisors range. - * @param maxRange Upper boundary of divisors range. - * @return First divisor found or {@code null} if no divisor was found. - */ - private Long checkPrime(long val, long minRage, long maxRange) { - // Loop through all divisors in the range and check if the value passed - // in is divisible by any of these divisors. - // Note that we also check for thread interruption which may happen - // if the job was cancelled from the grid task. - for (long divisor = minRage; divisor <= maxRange && !Thread.currentThread().isInterrupted(); divisor++) { - if (divisor != 1 && divisor != val && val % divisor == 0) - return divisor; - } - - return null; - } - - /** - * Serializable {@link Enumeration} implementation based on {@link Collection}. - */ - private static class MathEnumerationAdapter<T> implements Enumeration<T>, Serializable { - /** */ - private Collection<T> col; - - /** */ - private transient Iterator<T> iter; - - /** - * Creates enumeration. - * - * @param col Collection. - */ - private MathEnumerationAdapter(Collection<T> col) { - this.col = col; - - iter = col.iterator(); - } - - /** {@inheritDoc} */ - @Override public boolean hasMoreElements() { - return iter.hasNext(); - } - - /** {@inheritDoc} */ - @Override public T nextElement() { - return iter.next(); - } - - /** - * Recreate inner state for object after deserialization. - * - * @param in Input stream. - * @throws ClassNotFoundException Thrown in case of error. - * @throws IOException Thrown in case of error. - */ - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException { - // Always perform the default de-serialization first. - in.defaultReadObject(); - - iter = col.iterator(); - } - - /** - * @param out Output stream - * @throws IOException Thrown in case of error. - */ - private void writeObject(ObjectOutputStream out) throws IOException { - // Perform the default serialization for all non-transient, non-static fields. - out.defaultWriteObject(); - } - } - - /** - * Serializable {@link Iterator} implementation based on {@link Collection}. - */ - private static class MathIteratorAdapter<T> implements Iterator<T>, Serializable { - /** */ - private Collection<T> col; - - /** */ - private transient Iterator<T> iter; - - /** - * @param col Collection. - */ - MathIteratorAdapter(Collection<T> col) { - this.col = col; - - iter = col.iterator(); - } - - /** {@inheritDoc} */ - @Override public boolean hasNext() { - return iter.hasNext(); - } - - /** {@inheritDoc} */ - @Override public T next() { - return iter.next(); - } - - /** {@inheritDoc} */ - @Override public void remove() { - iter.remove(); - } - - /** - * Recreate inner state for object after deserialization. - * - * @param in Input stream. - * @throws ClassNotFoundException Thrown in case of error. - * @throws IOException Thrown in case of error. - */ - private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException { - // Always perform the default de-serialization first. - in.defaultReadObject(); - - iter = col.iterator(); - } - - /** - * @param out Output stream - * @throws IOException Thrown in case of error. - */ - private void writeObject(ObjectOutputStream out) throws IOException { - // Perform the default serialization for all non-transient, non-static fields. - out.defaultWriteObject(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridifySetToSetTargetInterface.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridifySetToSetTargetInterface.java b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridifySetToSetTargetInterface.java deleted file mode 100644 index 24ca1d1..0000000 --- a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridifySetToSetTargetInterface.java +++ /dev/null @@ -1,109 +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.gridgain.grid.gridify; - -import org.apache.ignite.compute.gridify.*; - -import java.util.*; - -/** - * Test set-to-set target interface. - */ -public interface GridifySetToSetTargetInterface { - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget", threshold = 2, splitSize = 2) - public Collection<Long> findPrimes(Collection<Long> input); - - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget", threshold = 2) - public Collection<Long> findPrimesWithoutSplitSize(Collection<Long> input); - - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget") - public Collection<Long> findPrimesWithoutSplitSizeAndThreshold(Collection<Long> input); - - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget") - public Collection<Long> findPrimesInListWithoutSplitSizeAndThreshold(List<Long> input); - - /** - * Find prime numbers in collection. - * - * @param input Input collection. - * @return Prime numbers. - */ - @SuppressWarnings({"CollectionDeclaredAsConcreteClass"}) - @GridifySetToSet(gridName = "GridifySetToSetTarget") - public Collection<Long> findPrimesInArrayListWithoutSplitSizeAndThreshold(ArrayList<Long> input); - - /** - * Find prime numbers in array. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget", threshold = 2, splitSize = 2) - public Long[] findPrimesInArray(Long[] input); - - /** - * Find prime numbers in primitive array. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget", threshold = 2, splitSize = 2) - public long[] findPrimesInPrimitiveArray(long[] input); - - /** - * Find prime numbers in iterator. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget", threshold = 2, splitSize = 2) - public Iterator<Long> findPrimesWithIterator(Iterator<Long> input); - - /** - * Find prime numbers in enumeration. - * - * @param input Input collection. - * @return Prime numbers. - */ - @GridifySetToSet(gridName = "GridifySetToSetTarget", threshold = 2, splitSize = 2) - public Enumeration<Long> findPrimesWithEnumeration(Enumeration<Long> input); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1d8f69b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridifySetToValueTarget.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridifySetToValueTarget.java b/modules/aop/src/test/java/org/gridgain/grid/gridify/GridifySetToValueTarget.java deleted file mode 100644 index de05eab..0000000 --- a/modules/aop/src/test/java/org/gridgain/grid/gridify/GridifySetToValueTarget.java +++ /dev/null @@ -1,199 +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.gridgain.grid.gridify; - -import org.apache.ignite.compute.gridify.*; - -import java.io.*; -import java.util.*; - -/** - * Test set-to-value target. - */ -public class GridifySetToValueTarget implements GridifySetToValueTargetInterface, Serializable { - /** - * Find maximum value in collection. - * - * @param input Input collection. - * @return Maximum value. - */ - @GridifySetToValue(gridName = "GridifySetToValueTarget", threshold = 2, splitSize = 2) - @Override public Long findMaximum(Collection<Long> input) { - return findMaximum0(input); - } - - /** - * Find maximum value in collection. - * - * @param input Input collection. - * @return Maximum value. - */ - @GridifySetToValue(gridName = "GridifySetToValueTarget") - @Override public Long findMaximumInList(List<Long> input) { - return findMaximum0(input); - } - - /** - * Find maximum value in collection. - * - * @param input Input collection. - * @return Maximum value. - */ - @GridifySetToValue(gridName = "GridifySetToValueTarget", threshold = 2) - @Override public Long findMaximumWithoutSplitSize(Collection<Long> input) { - return findMaximum0(input); - } - - /** - * Find maximum value in collection. - * - * @param input Input collection. - * @return Maximum value. - */ - @GridifySetToValue(gridName = "GridifySetToValueTarget") - @Override public Long findMaximumWithoutSplitSizeAndThreshold(Collection<Long> input) { - return findMaximum0(input); - } - - /** - * Find maximum in array. - * - * @param input Input collection. - * @return Maximum value. - */ - @GridifySetToValue(gridName = "GridifySetToValueTarget", threshold = 2, splitSize = 2) - @Override public Long findPrimesInArray(Long[] input) { - return findMaximumInArray0(input); - } - - /** - * Find maximum in primitive array. - * - * @param input Input collection. - * @return Maximum value. - */ - @GridifySetToValue(gridName = "GridifySetToValueTarget", threshold = 2, splitSize = 2) - @Override public long findMaximumInPrimitiveArray(long[] input) { - return findMaximumInPrimitiveArray0(input); - } - - /** - * Find maximum value in collection. - * - * @param input Input collection. - * @return Maximum value. - */ - private Long findMaximum0(Collection<Long> input) { - System.out.println(">>>"); - System.out.println("Find maximum in: " + input); - System.out.println(">>>"); - - return Collections.max(input); - } - - /** - * Find maximum value in array. - * - * @param input Input collection. - * @return Maximum value. - */ - private Long findMaximumInArray0(Long[] input) { - System.out.println(">>>"); - System.out.println("Find maximum in array: " + Arrays.asList(input)); - System.out.println(">>>"); - - return Collections.max(Arrays.asList(input)); - } - - /** - * Find maximum value in array. - * - * @param input Input collection. - * @return Maximum value. - */ - private long findMaximumInPrimitiveArray0(long[] input) { - assert input != null; - assert input.length > 0; - System.out.println(">>>"); - System.out.println("Find maximum in primitive array: " + Arrays.toString(input)); - System.out.println(">>>"); - - long maximum = input[0]; - - for (int i = 1; i < input.length; i++) { - if (input[i] > maximum) - maximum = input[i]; - } - - return maximum; - } - - /** - * Find maximum value in Iterator. - * - * @param input Input collection. - * @return Maximum value. - */ - @GridifySetToValue(gridName = "GridifySetToValueTarget", threshold = 2, splitSize = 2) - @Override public long findMaximumInIterator(Iterator<Long> input) { - assert input != null; - assert input.hasNext(); - - System.out.println(">>>"); - System.out.println("Find maximum in iterator: " + input); - System.out.println(">>>"); - - long maximum = input.next(); - - while(input.hasNext()) { - Long val = input.next(); - - if (val > maximum) - maximum = val; - } - - return maximum; - } - - /** - * Find maximum value in Enumeration. - * - * @param input Input collection. - * @return Maximum value. - */ - @GridifySetToValue(gridName = "GridifySetToValueTarget", threshold = 2, splitSize = 2) - @Override public long findMaximumInEnumeration(Enumeration<Long> input) { - assert input != null; - assert input.hasMoreElements(); - - System.out.println(">>>"); - System.out.println("Find maximum in enumeration: " + input); - System.out.println(">>>"); - - long maximum = input.nextElement(); - - while(input.hasMoreElements()) { - Long val = input.nextElement(); - - if (val > maximum) - maximum = val; - } - - return maximum; - } -}