http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc186b52/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/GridSingleSplitsLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/GridSingleSplitsLoadTest.java b/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/GridSingleSplitsLoadTest.java deleted file mode 100644 index 806428c..0000000 --- a/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/GridSingleSplitsLoadTest.java +++ /dev/null @@ -1,135 +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.loadtests.direct.singlesplit; - -import org.apache.ignite.*; -import org.apache.ignite.compute.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.logger.log4j.*; -import org.apache.log4j.*; -import org.gridgain.grid.loadtest.*; -import org.apache.ignite.spi.communication.tcp.*; -import org.apache.ignite.spi.discovery.tcp.*; -import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; -import org.gridgain.testframework.config.*; -import org.gridgain.testframework.junits.common.*; - -import java.util.concurrent.*; - -/** - * Single split load test. - */ -@GridCommonTest(group = "Load Test") -public class GridSingleSplitsLoadTest extends GridCommonAbstractTest { - /** */ - public GridSingleSplitsLoadTest() { - super(true); - } - - /** {@inheritDoc} */ - @SuppressWarnings("ConstantConditions") - @Override protected IgniteConfiguration getConfiguration() throws Exception { - IgniteConfiguration cfg = super.getConfiguration(); - - cfg.setCommunicationSpi(new TcpCommunicationSpi()); - cfg.setDiscoverySpi(new TcpDiscoverySpi()); - - IgniteLog4jLogger log = (IgniteLog4jLogger)cfg.getGridLogger().getLogger(null); - - log.setLevel(Level.INFO); - - ((ThreadPoolExecutor)cfg.getExecutorService()).prestartAllCoreThreads(); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected long getTestTimeout() { - return (getTestDurationInMinutes() + 5) * 60 * 1000; - } - - /** - * @return Time for load test in minutes. - */ - private int getTestDurationInMinutes() { - return Integer.valueOf(GridTestProperties.getProperty("load.test.duration")); - } - - /** - * @return Number of threads for the test. - */ - private int getThreadCount() { - return Integer.valueOf(GridTestProperties.getProperty("load.test.threadnum")); - } - - /** - * Load test grid. - * - * @throws Exception If task execution failed. - */ - public void testLoad() throws Exception { - final Ignite ignite = G.ignite(getTestGridName()); - - final long end = getTestDurationInMinutes() * 60 * 1000 + System.currentTimeMillis(); - - // Warm up. - ignite.compute().withTimeout(5000).execute(GridSingleSplitTestTask.class.getName(), 3); - - info("Load test will be executed for '" + getTestDurationInMinutes() + "' mins."); - info("Thread count: " + getThreadCount()); - - final GridLoadTestStatistics stats = new GridLoadTestStatistics(); - - GridTestUtils.runMultiThreaded(new Runnable() { - /** {@inheritDoc} */ - @Override public void run() { - while (end - System.currentTimeMillis() > 0) { - long start = System.currentTimeMillis(); - - try { - int levels = 20; - - IgniteCompute comp = ignite.compute().enableAsync(); - - comp.execute(new GridSingleSplitTestTask(), levels); - - ComputeTaskFuture<Integer> fut = comp.future(); - - int res = fut.get(); - - if (res != levels) - fail("Received wrong result [expected=" + levels + ", actual=" + res + ']'); - - long taskCnt = stats.onTaskCompleted(fut, levels, System.currentTimeMillis() - start); - - if (taskCnt % 500 == 0) - info(stats.toString()); - } - catch (IgniteCheckedException e) { - error("Failed to execute grid task.", e); - - fail(); - } - } - } - }, getThreadCount(), "grid-notaop-load-test"); - - info("Final test statistics: " + stats); - } -}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc186b52/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/package.html ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/package.html b/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/package.html deleted file mode 100644 index 135eb1a..0000000 --- a/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/package.html +++ /dev/null @@ -1,24 +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. - --> - -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<body> - <!-- Package description. --> - Contains internal tests or test related classes and interfaces. -</body> -</html> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc186b52/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifyLoadTestJobTarget.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifyLoadTestJobTarget.java b/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifyLoadTestJobTarget.java deleted file mode 100644 index 1ad6b24..0000000 --- a/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifyLoadTestJobTarget.java +++ /dev/null @@ -1,37 +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.loadtests.gridify; - -import org.apache.ignite.compute.gridify.*; - -/** - * Gridify load test job target. - */ -public class GridifyLoadTestJobTarget { - /** - * @param level Level. - * @return Always returns {@code 1}. - */ - @SuppressWarnings("unused") - @Gridify(taskClass = GridifyLoadTestTask.class, timeout = 20000) - public int executeLoadTestJob(int level) { - assert level > 0; - - return 1; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc186b52/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifyLoadTestTask.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifyLoadTestTask.java b/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifyLoadTestTask.java deleted file mode 100644 index 26406b3..0000000 --- a/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifyLoadTestTask.java +++ /dev/null @@ -1,70 +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.loadtests.gridify; - -import org.apache.ignite.*; -import org.apache.ignite.compute.*; -import org.apache.ignite.compute.gridify.*; - -import java.io.*; -import java.util.*; - -/** - * Gridify load test task. - */ -public class GridifyLoadTestTask extends ComputeTaskSplitAdapter<GridifyArgument, Integer> { - /** {@inheritDoc} */ - @Override protected Collection<? extends ComputeJob> split(int gridSize, GridifyArgument arg) throws IgniteCheckedException { - assert gridSize > 0 : "Subgrid cannot be empty."; - - int jobsNum = (Integer)arg.getMethodParameters()[0]; - - assert jobsNum > 0; - - Collection<ComputeJobAdapter> jobs = new ArrayList<>(gridSize); - - for (int i = 0; i < jobsNum; i++) - jobs.add(new ComputeJobAdapter(1) { - @Override public Serializable execute() { - Integer arg = this.<Integer>argument(0); - - assert arg != null; - - return new GridifyLoadTestJobTarget().executeLoadTestJob(arg); - } - }); - - return jobs; - } - - /** {@inheritDoc} */ - @Override public Integer reduce(List<ComputeJobResult> results) throws IgniteCheckedException { - int retVal = 0; - - for (ComputeJobResult res : results) { - if (res.getException() != null) { - throw new IgniteCheckedException("Received exception in reduce method (load test jobs can never fail): " + res, - res.getException()); - } - - retVal += (Integer)res.getData(); - } - - return retVal; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc186b52/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifySingleSplitLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifySingleSplitLoadTest.java b/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifySingleSplitLoadTest.java deleted file mode 100644 index aaa6441..0000000 --- a/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifySingleSplitLoadTest.java +++ /dev/null @@ -1,157 +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.loadtests.gridify; - -import org.apache.ignite.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.logger.log4j.*; -import org.apache.log4j.*; -import org.gridgain.grid.loadtest.*; -import org.apache.ignite.spi.communication.*; -import org.apache.ignite.spi.communication.tcp.*; -import org.apache.ignite.spi.discovery.*; -import org.apache.ignite.spi.discovery.tcp.*; -import org.apache.ignite.internal.util.typedef.*; -import org.gridgain.testframework.*; -import org.gridgain.testframework.config.*; -import org.gridgain.testframework.junits.common.*; -import java.util.concurrent.*; - -/** - * Gridify single split load test. - */ -@SuppressWarnings({"CatchGenericClass"}) -@GridCommonTest(group = "Load Test") -public class GridifySingleSplitLoadTest extends GridCommonAbstractTest { - /** */ - public GridifySingleSplitLoadTest() { - super(true); - } - - - /** {@inheritDoc} */ - @SuppressWarnings("ConstantConditions") - @Override public String getTestGridName() { - // Gridify task has empty grid name by default so we need to change it - // here. - return null; - } - - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration() throws Exception { - IgniteConfiguration cfg = super.getConfiguration(); - - /* Uncomment following code if you start it manually. */ - CommunicationSpi commSpi = new TcpCommunicationSpi(); - - cfg.setCommunicationSpi(commSpi); - - DiscoverySpi discoSpi = new TcpDiscoverySpi(); - - cfg.setDiscoverySpi(discoSpi); - /* - */ - @SuppressWarnings("TypeMayBeWeakened") - IgniteLog4jLogger log = (IgniteLog4jLogger)cfg.getGridLogger(); - - log.getLogger("org.gridgain.grid").setLevel(Level.INFO); - - ((ThreadPoolExecutor)cfg.getExecutorService()).prestartAllCoreThreads(); - - return cfg; - } - - /** - * @return Time for load test in minutes. - */ - private int getTestDurationInMinutes() { - return Integer.valueOf(GridTestProperties.getProperty("load.test.duration")); - } - - /** - * @return Number of threads for the test. - */ - private int getThreadCount() { - return Integer.valueOf(GridTestProperties.getProperty("load.test.threadnum")); - } - - /** {@inheritDoc} */ - @Override protected long getTestTimeout() { - return (getTestDurationInMinutes() + 1) * 60 * 1000; - } - - /** - * Load test grid. - * - * @throws Exception If task execution failed. - */ - @SuppressWarnings("unchecked") - public void testGridifyLoad() throws Exception { - Ignite ignite = G.ignite(getTestGridName()); - - ignite.compute().localDeployTask(GridifyLoadTestTask.class, GridifyLoadTestTask.class.getClassLoader()); - - final long end = getTestDurationInMinutes() * 60 * 1000 + System.currentTimeMillis(); - - // Warm up. - new GridifyLoadTestJobTarget().executeLoadTestJob(3); - - info("Load test will be executed for '" + getTestDurationInMinutes() + "' mins."); - info("Thread count: " + getThreadCount()); - - final GridLoadTestStatistics stats = new GridLoadTestStatistics(); - - GridTestUtils.runMultiThreaded(new Runnable() { - @Override public void run() { - while (end - System.currentTimeMillis() > 0) { - int levels = 3; - - int exp = factorial(levels); - - long start = System.currentTimeMillis(); - - int res = new GridifyLoadTestJobTarget().executeLoadTestJob(exp); - - if (res != exp) - fail("Received wrong result [expected=" + exp + ", actual=" + res + ']'); - - long taskCnt = stats.onTaskCompleted(null, exp, System.currentTimeMillis() - start); - - if (taskCnt % 500 == 0) - info(stats.toString()); - } - } - - }, getThreadCount(), "grid-load-test-thread"); - - info("Final test statistics: " + stats); - } - - /** - * Calculates factorial. - * - * @param num Factorial to calculate. - * @return Factorial for the number passed in. - */ - private int factorial(int num) { - assert num > 0; - - return num == 1 ? 1 : num * factorial(num - 1); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc186b52/modules/aop/src/test/java/org/test/gridify/GridExternalNonSpringAopSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/aop/src/test/java/org/test/gridify/GridExternalNonSpringAopSelfTest.java b/modules/aop/src/test/java/org/test/gridify/GridExternalNonSpringAopSelfTest.java index f51e759..ba154ea 100644 --- a/modules/aop/src/test/java/org/test/gridify/GridExternalNonSpringAopSelfTest.java +++ b/modules/aop/src/test/java/org/test/gridify/GridExternalNonSpringAopSelfTest.java @@ -17,8 +17,8 @@ package org.test.gridify; +import org.apache.ignite.gridify.*; import org.apache.ignite.configuration.*; -import org.gridgain.grid.gridify.*; import org.apache.ignite.spi.deployment.local.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.internal.util.typedef.*;