IGNITE-22095 Remove compute job jars from the repo (#3655)
diff --git a/modules/compute/build.gradle b/modules/compute/build.gradle
index 4e69e03..05b7257 100644
--- a/modules/compute/build.gradle
+++ b/modules/compute/build.gradle
@@ -19,6 +19,7 @@
apply from: "$rootDir/buildscripts/publishing.gradle"
apply from: "$rootDir/buildscripts/java-junit5.gradle"
apply from: "$rootDir/buildscripts/java-integration-test.gradle"
+apply from: 'jobs.gradle'
dependencies {
implementation project(':ignite-api')
diff --git a/modules/compute/jobs.gradle b/modules/compute/jobs.gradle
new file mode 100644
index 0000000..13d392c
--- /dev/null
+++ b/modules/compute/jobs.gradle
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+sourceSets {
+ jobs
+ unit1
+ unit2
+}
+
+def registerJarTask(SourceSet sourceSet, String baseName) {
+ tasks.register(sourceSet.jarTaskName, Jar) {
+ group = 'build'
+ archiveBaseName = baseName
+ archiveVersion = '1.0-SNAPSHOT'
+ from sourceSet.output
+ }
+}
+
+registerJarTask(sourceSets.jobs, 'ignite-integration-test-jobs')
+registerJarTask(sourceSets.unit1, 'ignite-unit-test-job1')
+registerJarTask(sourceSets.unit2, 'ignite-unit-test-job2')
+
+processTestResources {
+ into('units/unit1') {
+ into('1.0.0') {
+ from unit1Jar
+ }
+ into('2.0.0') {
+ from unit2Jar
+ }
+ into('3.0.1') {
+ from unit1Jar
+ from unit2Jar
+ }
+ into('3.0.2') {
+ into('subdir') {
+ from unit2Jar
+ }
+ from unit1Jar
+ }
+ }
+ into('units/unit2') {
+ into('1.0.0') {
+ from unit1Jar
+ }
+ into('2.0.0') {
+ from unit2Jar
+ }
+ }
+
+ File corruptedJarFile = file("$destinationDir/units/unit1/4.0.0/unit1-1.0-corrupted.jar")
+ doLast {
+ // Generate a 100 bytes long file with random contents to simulate corrupted jar
+ byte[] randomBytes = new byte[100]
+ new Random().nextBytes(randomBytes)
+ corruptedJarFile.parentFile.mkdirs()
+ corruptedJarFile.bytes = randomBytes
+ }
+}
+
+processIntegrationTestResources {
+ into('units') {
+ from jobsJar
+ from unit1Jar
+ from unit2Jar
+ }
+}
+
+dependencies {
+ jobsImplementation project(':ignite-api')
+ unit1Implementation project(':ignite-api')
+ unit2Implementation project(':ignite-api')
+
+ integrationTestImplementation sourceSets.jobs.output
+}
diff --git a/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeBaseTest.java b/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeBaseTest.java
index 6e1c3bb..543d935 100644
--- a/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeBaseTest.java
+++ b/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeBaseTest.java
@@ -56,16 +56,24 @@
import org.junit.jupiter.api.Test;
/**
- * Base integration tests for Compute functionality.
+ * Base integration tests for Compute functionality. To add new compute job for testing both in embedded and standalone mode, add the
+ * corresponding job class to the jobs source set. The integration tests depend on this source set so the job class will be visible and it
+ * will be automatically compiled and packed into the ignite-integration-test-jobs-1.0-SNAPSHOT.jar.
*/
public abstract class ItComputeBaseTest extends ClusterPerClassIntegrationTest {
protected abstract List<DeploymentUnit> units();
- protected abstract String concatJobClassName();
+ static String concatJobClassName() {
+ return ConcatJob.class.getName();
+ }
- protected abstract String getNodeNameJobClassName();
+ private static String getNodeNameJobClassName() {
+ return GetNodeNameJob.class.getName();
+ }
- protected abstract String failingJobClassName();
+ private static String failingJobClassName() {
+ return FailingJob.class.getName();
+ }
@Test
void executesJobLocally() {
diff --git a/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeTestEmbedded.java b/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeTestEmbedded.java
index 592fe7c..294b6fe 100644
--- a/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeTestEmbedded.java
+++ b/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeTestEmbedded.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.compute;
import static java.util.concurrent.CompletableFuture.allOf;
-import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
import static org.apache.ignite.internal.IgniteExceptionTestUtils.assertPublicCheckedException;
@@ -40,7 +39,6 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -85,21 +83,6 @@
return List.of();
}
- @Override
- protected String concatJobClassName() {
- return ConcatJob.class.getName();
- }
-
- @Override
- protected String getNodeNameJobClassName() {
- return GetNodeNameJob.class.getName();
- }
-
- @Override
- protected String failingJobClassName() {
- return FailingJob.class.getName();
- }
-
@ParameterizedTest
@MethodSource("wrongJobClassArguments")
void executesWrongJobClassLocally(String jobClassName, int errorCode, String msg) {
@@ -395,23 +378,6 @@
return IntStream.range(0, initialNodes()).mapToObj(Arguments::of);
}
- private static class ConcatJob implements ComputeJob<String> {
- /** {@inheritDoc} */
- @Override
- public String execute(JobExecutionContext context, Object... args) {
- return Arrays.stream(args)
- .map(Object::toString)
- .collect(joining());
- }
- }
-
- private static class GetNodeNameJob implements ComputeJob<String> {
- /** {@inheritDoc} */
- @Override
- public String execute(JobExecutionContext context, Object... args) {
- return context.ignite().name();
- }
- }
private static class CustomFailingJob implements ComputeJob<String> {
/** {@inheritDoc} */
@@ -421,19 +387,7 @@
}
}
- private static class FailingJob implements ComputeJob<String> {
- /** {@inheritDoc} */
- @Override
- public String execute(JobExecutionContext context, Object... args) {
- throw new JobException("Oops", new Exception());
- }
- }
- private static class JobException extends RuntimeException {
- private JobException(String message, Throwable cause) {
- super(message, cause);
- }
- }
private static List<Arguments> wrongJobClassArguments() {
return List.of(
diff --git a/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeTestStandalone.java b/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeTestStandalone.java
index 250cbb0..82be3db 100644
--- a/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeTestStandalone.java
+++ b/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeTestStandalone.java
@@ -64,7 +64,7 @@
() -> entryNode.deployment().clusterStatusAsync(unit.name(), unit.version()),
willBe(nullValue())
);
- deployJar(entryNode, unit.name(), unit.version(), "ignite-it-jobs-1.0-SNAPSHOT.jar");
+ deployJar(entryNode, unit.name(), unit.version(), "ignite-integration-test-jobs-1.0-SNAPSHOT.jar");
}
@Override
@@ -72,21 +72,6 @@
return units;
}
- @Override
- protected String concatJobClassName() {
- return "org.example.ConcatJob";
- }
-
- @Override
- protected String getNodeNameJobClassName() {
- return "org.example.GetNodeNameJob";
- }
-
- @Override
- protected String failingJobClassName() {
- return "org.example.FailingJob";
- }
-
@Test
@Disabled("https://issues.apache.org/jira/browse/IGNITE-19623")
@Override
@@ -121,7 +106,7 @@
assertComputeException(
ex0,
ClassNotFoundException.class,
- "org.example.ConcatJob. Deployment unit non-existing:1.0.0 doesn't exist"
+ "org.apache.ignite.internal.compute.ConcatJob. Deployment unit non-existing:1.0.0 doesn't exist"
);
}
@@ -132,17 +117,17 @@
IgniteImpl entryNode = node(0);
DeploymentUnit firstVersion = new DeploymentUnit("latest-unit", Version.parseVersion("1.0.0"));
- deployJar(entryNode, firstVersion.name(), firstVersion.version(), "ignite-ut-job1-1.0-SNAPSHOT.jar");
+ deployJar(entryNode, firstVersion.name(), firstVersion.version(), "ignite-unit-test-job1-1.0-SNAPSHOT.jar");
CompletableFuture<Integer> result1 = entryNode.compute()
- .executeAsync(Set.of(entryNode.node()), jobUnits, "org.my.job.compute.unit.UnitJob");
+ .executeAsync(Set.of(entryNode.node()), jobUnits, "org.apache.ignite.internal.compute.UnitJob");
assertThat(result1, willBe(1));
DeploymentUnit secondVersion = new DeploymentUnit("latest-unit", Version.parseVersion("1.0.1"));
- deployJar(entryNode, secondVersion.name(), secondVersion.version(), "ignite-ut-job2-1.0-SNAPSHOT.jar");
+ deployJar(entryNode, secondVersion.name(), secondVersion.version(), "ignite-unit-test-job2-1.0-SNAPSHOT.jar");
CompletableFuture<String> result2 = entryNode.compute()
- .executeAsync(Set.of(entryNode.node()), jobUnits, "org.my.job.compute.unit.UnitJob");
+ .executeAsync(Set.of(entryNode.node()), jobUnits, "org.apache.ignite.internal.compute.UnitJob");
assertThat(result2, willBe("Hello World!"));
}
@@ -150,7 +135,7 @@
void undeployAcquiredUnit() {
IgniteImpl entryNode = node(0);
CompletableFuture<Void> job = entryNode.compute()
- .executeAsync(Set.of(entryNode.node()), units, "org.example.SleepJob", 3L);
+ .executeAsync(Set.of(entryNode.node()), units, SleepJob.class.getName(), 3L);
assertThat(entryNode.deployment().undeployAsync(unit.name(), unit.version()), willCompleteSuccessfully());
@@ -172,12 +157,12 @@
void executeJobWithObsoleteUnit() {
IgniteImpl entryNode = node(0);
CompletableFuture<Void> successJob = entryNode.compute()
- .executeAsync(Set.of(entryNode.node()), units, "org.example.SleepJob", 2L);
+ .executeAsync(Set.of(entryNode.node()), units, SleepJob.class.getName(), 2L);
assertThat(entryNode.deployment().undeployAsync(unit.name(), unit.version()), willCompleteSuccessfully());
CompletableFuture<Void> failedJob = entryNode.compute()
- .executeAsync(Set.of(entryNode.node()), units, "org.example.SleepJob", 2L);
+ .executeAsync(Set.of(entryNode.node()), units, SleepJob.class.getName(), 2L);
CompletionException ex0 = assertThrows(CompletionException.class, failedJob::join);
assertComputeException(
diff --git a/modules/compute/src/integrationTest/resources/units/ignite-it-jobs-1.0-SNAPSHOT.jar b/modules/compute/src/integrationTest/resources/units/ignite-it-jobs-1.0-SNAPSHOT.jar
deleted file mode 100644
index 7700570..0000000
--- a/modules/compute/src/integrationTest/resources/units/ignite-it-jobs-1.0-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/integrationTest/resources/units/ignite-jobs-1.0-SNAPSHOT-src.zip b/modules/compute/src/integrationTest/resources/units/ignite-jobs-1.0-SNAPSHOT-src.zip
deleted file mode 100644
index a9fe96f..0000000
--- a/modules/compute/src/integrationTest/resources/units/ignite-jobs-1.0-SNAPSHOT-src.zip
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/integrationTest/resources/units/ignite-ut-job1-1.0-SNAPSHOT.jar b/modules/compute/src/integrationTest/resources/units/ignite-ut-job1-1.0-SNAPSHOT.jar
deleted file mode 100644
index 1c33f9c..0000000
--- a/modules/compute/src/integrationTest/resources/units/ignite-ut-job1-1.0-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/integrationTest/resources/units/ignite-ut-job2-1.0-SNAPSHOT.jar b/modules/compute/src/integrationTest/resources/units/ignite-ut-job2-1.0-SNAPSHOT.jar
deleted file mode 100644
index e4d23cf..0000000
--- a/modules/compute/src/integrationTest/resources/units/ignite-ut-job2-1.0-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/ConcatJob.java b/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/ConcatJob.java
new file mode 100644
index 0000000..81decb7
--- /dev/null
+++ b/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/ConcatJob.java
@@ -0,0 +1,33 @@
+/*
+ * 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.compute;
+
+import java.util.Arrays;
+import java.util.stream.Collectors;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.JobExecutionContext;
+
+/** Compute job that concatenates the string representation of its arguments. */
+public class ConcatJob implements ComputeJob<String> {
+ @Override
+ public String execute(JobExecutionContext context, Object... args) {
+ return Arrays.stream(args)
+ .map(Object::toString)
+ .collect(Collectors.joining());
+ }
+}
diff --git a/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/FailingJob.java b/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/FailingJob.java
new file mode 100644
index 0000000..4286c56
--- /dev/null
+++ b/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/FailingJob.java
@@ -0,0 +1,29 @@
+/*
+ * 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.compute;
+
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.JobExecutionContext;
+
+/** Compute job that always fails with the {@link JobException}. */
+public class FailingJob implements ComputeJob<String> {
+ @Override
+ public String execute(JobExecutionContext context, Object... args) {
+ throw new JobException("Oops", new Exception());
+ }
+}
diff --git a/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/GetNodeNameJob.java b/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/GetNodeNameJob.java
new file mode 100644
index 0000000..558077a
--- /dev/null
+++ b/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/GetNodeNameJob.java
@@ -0,0 +1,29 @@
+/*
+ * 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.compute;
+
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.JobExecutionContext;
+
+/** Compute job that returns the node name. */
+public class GetNodeNameJob implements ComputeJob<String> {
+ @Override
+ public String execute(JobExecutionContext context, Object... args) {
+ return context.ignite().name();
+ }
+}
diff --git a/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/JobException.java b/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/JobException.java
new file mode 100644
index 0000000..e608edf
--- /dev/null
+++ b/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/JobException.java
@@ -0,0 +1,24 @@
+/*
+ * 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.compute;
+
+class JobException extends RuntimeException {
+ JobException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/SleepJob.java b/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/SleepJob.java
new file mode 100644
index 0000000..0dd3209
--- /dev/null
+++ b/modules/compute/src/jobs/java/org/apache/ignite/internal/compute/SleepJob.java
@@ -0,0 +1,35 @@
+/*
+ * 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.compute;
+
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.JobExecutionContext;
+
+/** Compute job that sleeps for a number of milliseconds passed in the argument. */
+public class SleepJob implements ComputeJob<Void> {
+ @Override
+ public Void execute(JobExecutionContext jobExecutionContext, Object... args) {
+ try {
+ TimeUnit.SECONDS.sleep((Long) args[0]);
+ return null;
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/modules/compute/src/test/README.md b/modules/compute/src/test/README.md
deleted file mode 100644
index 56eda0d..0000000
--- a/modules/compute/src/test/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# ignite-compute
-
-## Unit tests
-[ignite-jobs-1.0-SNAPSHOT-src.zip](resources%2Funits%2Fignite-jobs-1.0-SNAPSHOT-src.zip) contains a zip archive with a
-test project which was used to create jars for `org.apache.ignite.internal.compute.loader.JobClassLoaderFactoryTest` tests.
-
-[ignite-ut-job1-1.0-SNAPSHOT.jar](resources%2Funits%2Funit1%2F1.0.0%2Fignite-ut-job1-1.0-SNAPSHOT.jar) contains two classes
-which are used in tests:
-* `org.apache.ignite.internal.compute.unit1.Unit1` - `extends org.apache.ignite.compute.ComputeJob` and returns 1 as Integer.
-* `org.my.job.compute.unit.Job1Utility`
-
-[ignite-ut-job2-1.0-SNAPSHOT.jar](resources%2Funits%2Funit1%2F2.0.0%2Fignite-ut-job2-1.0-SNAPSHOT.jar) contains two classes
-which are used in tests:
-* `org.apache.ignite.internal.compute.unit1.Unit2` - extends `org.apache.ignite.compute.ComputeJob` and returns "Hello World!" as String.
-* `org.my.job.compute.unit.Job2Utility`
diff --git a/modules/compute/src/test/java/org/apache/ignite/internal/compute/loader/JobClassLoaderFactoryTest.java b/modules/compute/src/test/java/org/apache/ignite/internal/compute/loader/JobClassLoaderFactoryTest.java
index 37eb84b..4887d27 100644
--- a/modules/compute/src/test/java/org/apache/ignite/internal/compute/loader/JobClassLoaderFactoryTest.java
+++ b/modules/compute/src/test/java/org/apache/ignite/internal/compute/loader/JobClassLoaderFactoryTest.java
@@ -41,6 +41,12 @@
@ExtendWith(MockitoExtension.class)
class JobClassLoaderFactoryTest extends BaseIgniteAbstractTest {
+ private static final String UNIT_JOB_CLASS_NAME = "org.apache.ignite.internal.compute.UnitJob";
+
+ private static final String JOB1_UTILITY_CLASS_NAME = "org.apache.ignite.internal.compute.Job1Utility";
+
+ private static final String JOB2_UTILITY_CLASS_NAME = "org.apache.ignite.internal.compute.Job2Utility";
+
private final Path unitsDir = getPath(JobClassLoaderFactory.class.getClassLoader().getResource("units"));
private final JobClassLoaderFactory jobClassLoaderFactory = new JobClassLoaderFactory();
@@ -56,13 +62,13 @@
try (JobClassLoader classLoader1 = jobClassLoaderFactory.createClassLoader(units1);
JobClassLoader classLoader2 = jobClassLoaderFactory.createClassLoader(units2)) {
// then classes from the first unit are loaded from the first class loader
- Class<?> clazz1 = classLoader1.loadClass("org.my.job.compute.unit.UnitJob");
+ Class<?> clazz1 = classLoader1.loadClass(UNIT_JOB_CLASS_NAME);
ComputeJob<Integer> job1 = (ComputeJob<Integer>) clazz1.getDeclaredConstructor().newInstance();
Integer result1 = job1.execute(null);
assertEquals(1, result1);
// and classes from the second unit are loaded from the second class loader
- Class<?> clazz2 = classLoader2.loadClass("org.my.job.compute.unit.UnitJob");
+ Class<?> clazz2 = classLoader2.loadClass(UNIT_JOB_CLASS_NAME);
ComputeJob<String> job2 = (ComputeJob<String>) clazz2.getDeclaredConstructor().newInstance();
String result2 = job2.execute(null);
assertEquals("Hello World!", result2);
@@ -79,7 +85,7 @@
);
try (JobClassLoader classLoader = jobClassLoaderFactory.createClassLoader(units)) {
- Class<?> unitJobClass = classLoader.loadClass("org.my.job.compute.unit.UnitJob");
+ Class<?> unitJobClass = classLoader.loadClass(UNIT_JOB_CLASS_NAME);
assertNotNull(unitJobClass);
// and classes are loaded in the aplhabetical order
@@ -87,10 +93,10 @@
Integer result1 = job1.execute(null);
assertEquals(1, result1);
- Class<?> job1UtilityClass = classLoader.loadClass("org.my.job.compute.unit.Job1Utility");
+ Class<?> job1UtilityClass = classLoader.loadClass(JOB1_UTILITY_CLASS_NAME);
assertNotNull(job1UtilityClass);
- Class<?> job2UtilityClass = classLoader.loadClass("org.my.job.compute.unit.Job2Utility");
+ Class<?> job2UtilityClass = classLoader.loadClass(JOB2_UTILITY_CLASS_NAME);
assertNotNull(job2UtilityClass);
// classes from the different units are loaded from the same class loader
@@ -107,13 +113,13 @@
// then class from all jars are loaded
try (JobClassLoader classLoader = jobClassLoaderFactory.createClassLoader(units)) {
- Class<?> unitJobClass = classLoader.loadClass("org.my.job.compute.unit.UnitJob");
+ Class<?> unitJobClass = classLoader.loadClass(UNIT_JOB_CLASS_NAME);
assertNotNull(unitJobClass);
- Class<?> job1UtilityClass = classLoader.loadClass("org.my.job.compute.unit.Job1Utility");
+ Class<?> job1UtilityClass = classLoader.loadClass(JOB1_UTILITY_CLASS_NAME);
assertNotNull(job1UtilityClass);
- Class<?> job2UtilityClass = classLoader.loadClass("org.my.job.compute.unit.Job2Utility");
+ Class<?> job2UtilityClass = classLoader.loadClass(JOB2_UTILITY_CLASS_NAME);
assertNotNull(job2UtilityClass);
}
}
@@ -127,13 +133,13 @@
// then class from all jars are loaded
try (JobClassLoader classLoader = jobClassLoaderFactory.createClassLoader(units)) {
- Class<?> unitJobClass = classLoader.loadClass("org.my.job.compute.unit.UnitJob");
+ Class<?> unitJobClass = classLoader.loadClass(UNIT_JOB_CLASS_NAME);
assertNotNull(unitJobClass);
- Class<?> job1UtilityClass = classLoader.loadClass("org.my.job.compute.unit.Job1Utility");
+ Class<?> job1UtilityClass = classLoader.loadClass(JOB1_UTILITY_CLASS_NAME);
assertNotNull(job1UtilityClass);
- Class<?> job2UtilityClass = classLoader.loadClass("org.my.job.compute.unit.Job2Utility");
+ Class<?> job2UtilityClass = classLoader.loadClass(JOB2_UTILITY_CLASS_NAME);
assertNotNull(job2UtilityClass);
}
}
@@ -147,7 +153,7 @@
// then class loader throws an exception
try (JobClassLoader classLoader = jobClassLoaderFactory.createClassLoader(units)) {
- assertThrows(ClassNotFoundException.class, () -> classLoader.loadClass("org.my.job.compute.unit.UnitJob"));
+ assertThrows(ClassNotFoundException.class, () -> classLoader.loadClass(UNIT_JOB_CLASS_NAME));
}
}
diff --git a/modules/compute/src/test/resources/units/ignite-jobs-1.0-SNAPSHOT-src.zip b/modules/compute/src/test/resources/units/ignite-jobs-1.0-SNAPSHOT-src.zip
deleted file mode 100644
index a9fe96f..0000000
--- a/modules/compute/src/test/resources/units/ignite-jobs-1.0-SNAPSHOT-src.zip
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/test/resources/units/unit1/1.0.0/ignite-ut-job1-1.0-SNAPSHOT.jar b/modules/compute/src/test/resources/units/unit1/1.0.0/ignite-ut-job1-1.0-SNAPSHOT.jar
deleted file mode 100644
index 1c33f9c..0000000
--- a/modules/compute/src/test/resources/units/unit1/1.0.0/ignite-ut-job1-1.0-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/test/resources/units/unit1/2.0.0/ignite-ut-job2-1.0-SNAPSHOT.jar b/modules/compute/src/test/resources/units/unit1/2.0.0/ignite-ut-job2-1.0-SNAPSHOT.jar
deleted file mode 100644
index e4d23cf..0000000
--- a/modules/compute/src/test/resources/units/unit1/2.0.0/ignite-ut-job2-1.0-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/test/resources/units/unit1/3.0.1/ignite-ut-job1-1.0-SNAPSHOT.jar b/modules/compute/src/test/resources/units/unit1/3.0.1/ignite-ut-job1-1.0-SNAPSHOT.jar
deleted file mode 100644
index 1c33f9c..0000000
--- a/modules/compute/src/test/resources/units/unit1/3.0.1/ignite-ut-job1-1.0-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/test/resources/units/unit1/3.0.1/ignite-ut-job2-1.0-SNAPSHOT.jar b/modules/compute/src/test/resources/units/unit1/3.0.1/ignite-ut-job2-1.0-SNAPSHOT.jar
deleted file mode 100644
index e4d23cf..0000000
--- a/modules/compute/src/test/resources/units/unit1/3.0.1/ignite-ut-job2-1.0-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/test/resources/units/unit1/3.0.2/ignite-ut-job1-1.0-SNAPSHOT.jar b/modules/compute/src/test/resources/units/unit1/3.0.2/ignite-ut-job1-1.0-SNAPSHOT.jar
deleted file mode 100644
index 1c33f9c..0000000
--- a/modules/compute/src/test/resources/units/unit1/3.0.2/ignite-ut-job1-1.0-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/test/resources/units/unit1/3.0.2/subdir/ignite-ut-job2-1.0-SNAPSHOT.jar b/modules/compute/src/test/resources/units/unit1/3.0.2/subdir/ignite-ut-job2-1.0-SNAPSHOT.jar
deleted file mode 100644
index e4d23cf..0000000
--- a/modules/compute/src/test/resources/units/unit1/3.0.2/subdir/ignite-ut-job2-1.0-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/test/resources/units/unit1/4.0.0/unit1-1.0-corrupted.jar b/modules/compute/src/test/resources/units/unit1/4.0.0/unit1-1.0-corrupted.jar
deleted file mode 100644
index 5cb9c2c..0000000
--- a/modules/compute/src/test/resources/units/unit1/4.0.0/unit1-1.0-corrupted.jar
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/test/resources/units/unit2/1.0.0/ignite-ut-job1-1.0-SNAPSHOT.jar b/modules/compute/src/test/resources/units/unit2/1.0.0/ignite-ut-job1-1.0-SNAPSHOT.jar
deleted file mode 100644
index 1c33f9c..0000000
--- a/modules/compute/src/test/resources/units/unit2/1.0.0/ignite-ut-job1-1.0-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/test/resources/units/unit2/2.0.0/ignite-ut-job2-1.0-SNAPSHOT.jar b/modules/compute/src/test/resources/units/unit2/2.0.0/ignite-ut-job2-1.0-SNAPSHOT.jar
deleted file mode 100644
index e4d23cf..0000000
--- a/modules/compute/src/test/resources/units/unit2/2.0.0/ignite-ut-job2-1.0-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/modules/compute/src/unit1/java/org/apache/ignite/internal/compute/Job1Utility.java b/modules/compute/src/unit1/java/org/apache/ignite/internal/compute/Job1Utility.java
new file mode 100644
index 0000000..0dee88c
--- /dev/null
+++ b/modules/compute/src/unit1/java/org/apache/ignite/internal/compute/Job1Utility.java
@@ -0,0 +1,22 @@
+/*
+ * 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.compute;
+
+/** Utility class. */
+public class Job1Utility {
+}
diff --git a/modules/compute/src/unit1/java/org/apache/ignite/internal/compute/UnitJob.java b/modules/compute/src/unit1/java/org/apache/ignite/internal/compute/UnitJob.java
new file mode 100644
index 0000000..d116112
--- /dev/null
+++ b/modules/compute/src/unit1/java/org/apache/ignite/internal/compute/UnitJob.java
@@ -0,0 +1,29 @@
+/*
+ * 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.compute;
+
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.JobExecutionContext;
+
+/** Compute job. */
+public class UnitJob implements ComputeJob<Integer> {
+ @Override
+ public Integer execute(JobExecutionContext context, Object... args) {
+ return 1;
+ }
+}
diff --git a/modules/compute/src/unit2/java/org/apache/ignite/internal/compute/Job2Utility.java b/modules/compute/src/unit2/java/org/apache/ignite/internal/compute/Job2Utility.java
new file mode 100644
index 0000000..618020d
--- /dev/null
+++ b/modules/compute/src/unit2/java/org/apache/ignite/internal/compute/Job2Utility.java
@@ -0,0 +1,22 @@
+/*
+ * 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.compute;
+
+/** Utility class. */
+public class Job2Utility {
+}
diff --git a/modules/compute/src/unit2/java/org/apache/ignite/internal/compute/UnitJob.java b/modules/compute/src/unit2/java/org/apache/ignite/internal/compute/UnitJob.java
new file mode 100644
index 0000000..51163e2
--- /dev/null
+++ b/modules/compute/src/unit2/java/org/apache/ignite/internal/compute/UnitJob.java
@@ -0,0 +1,29 @@
+/*
+ * 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.compute;
+
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.JobExecutionContext;
+
+/** Compute job. */
+public class UnitJob implements ComputeJob<String> {
+ @Override
+ public String execute(JobExecutionContext context, Object... args) {
+ return "Hello World!";
+ }
+}