petrov-mg commented on code in PR #10482: URL: https://github.com/apache/ignite/pull/10482#discussion_r1083060832
########## modules/core/src/test/java/org/apache/ignite/internal/processors/compute/TaskOptionsPropagationTest.java: ########## @@ -0,0 +1,315 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.compute; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +import org.apache.ignite.IgniteCompute; +import org.apache.ignite.IgniteException; +import org.apache.ignite.cluster.ClusterNode; +import org.apache.ignite.compute.ComputeJob; +import org.apache.ignite.compute.ComputeTask; +import org.apache.ignite.compute.ComputeTaskAdapter; +import org.apache.ignite.compute.ComputeTaskSession; +import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.internal.util.lang.RunnableX; +import org.apache.ignite.lang.IgniteCallable; +import org.apache.ignite.lang.IgniteClosure; +import org.apache.ignite.lang.IgniteReducer; +import org.apache.ignite.lang.IgniteRunnable; +import org.apache.ignite.resources.TaskSessionResource; +import org.apache.ignite.testframework.GridTestUtils; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.junit.Test; + +import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; +import static org.apache.ignite.internal.processors.compute.TaskOptionsPropagationTest.ComputationType.CALLABLE; +import static org.apache.ignite.internal.processors.compute.TaskOptionsPropagationTest.ComputationType.CLOSURE; +import static org.apache.ignite.internal.processors.compute.TaskOptionsPropagationTest.ComputationType.RUNNABLE; +import static org.apache.ignite.internal.processors.compute.TaskOptionsPropagationTest.ComputationType.TASK; +import static org.apache.ignite.testframework.GridTestUtils.runAsync; + +/** */ +public class TaskOptionsPropagationTest extends GridCommonAbstractTest { + /** */ + private static final String TEST_TASK_NAME = "test-name"; + + /** {@inheritDoc} */ + @Override protected void beforeTestsStarted() throws Exception { + super.beforeTestsStarted(); + + startGrid(); + + grid().createCache(DEFAULT_CACHE_NAME).put(0, 0); + } + + /** */ + @Test + public void testUserTaskOptionsWithPrecedingSystemTaskExecution() throws Exception { + try (IgniteEx cli = startClientGrid(1)) { + cli.compute().withName(TEST_TASK_NAME).affinityCall( + DEFAULT_CACHE_NAME, + 0, + new TestCallable(TEST_TASK_NAME) + ); + } + } + + /** */ + @Test + public void testComputeSharedAcrossMultipleThreads() throws Exception { + IgniteCompute compute = grid().compute(); + + compute.withName(TEST_TASK_NAME); + + runAsync(() -> compute.call(new TestCallable(TestCallable.class.getName()))).get(); + + compute.call(new TestCallable(TEST_TASK_NAME)); + } + + /** */ + @Test + public void testTaskExecutionOptionsReset() throws Exception { + check(TASK, (c, t) -> c.execute((ComputeTask)t, null)); Review Comment: Just refactored tests a bit so dedicated enum with computation types is no longer needed. Please take a look again. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org