This is an automated email from the ASF dual-hosted git repository.
ibessonov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new f03de1a85c IGNITE-18778 Move test related entry point to testFixtures
(#1843)
f03de1a85c is described below
commit f03de1a85c0b12bd44bd2555b07bd0d1829dbb0a
Author: Vadim Pakhnushev <[email protected]>
AuthorDate: Wed Mar 29 17:31:16 2023 +0300
IGNITE-18778 Move test related entry point to testFixtures (#1843)
---
.../ignite/example/AbstractExamplesTest.java | 3 +-
modules/api/build.gradle | 1 +
.../src/main/java/org/apache/ignite/Ignition.java | 71 +----------
.../java/org/apache/ignite/IgnitionManager.java | 46 ++-----
.../testframework/IntegrationTestBase.java | 4 +-
.../testframework/TestIgnitionManager.java | 80 ++++++++++++
.../cli/commands/ItClusterCommandTest.java | 3 +-
.../internal/cli/commands/ItConfigCommandTest.java | 3 +-
.../internal/rest/ItGeneratedRestClientTest.java | 3 +-
modules/jdbc/build.gradle | 7 +-
.../apache/ignite/jdbc/AbstractJdbcSelfTest.java | 3 +-
modules/runner/build.gradle | 31 ++---
.../java/org/apache/ignite/internal/Cluster.java | 3 +-
.../cluster/management/ItClusterInitTest.java | 3 +-
.../ItSslConfigurationValidationTest.java | 4 +-
.../storage/ItRebalanceDistributedTest.java | 6 +-
.../ignite/internal/rest/AbstractRestTestBase.java | 3 +-
.../org/apache/ignite/internal/rest/RestNode.java | 5 +-
.../runner/app/AbstractSchemaChangeTest.java | 3 +-
.../internal/runner/app/ItDataSchemaSyncTest.java | 7 +-
.../app/ItIgniteInMemoryNodeRestartTest.java | 3 +-
.../runner/app/ItIgniteNodeRestartTest.java | 19 +--
.../ignite/internal/runner/app/ItIgnitionTest.java | 114 ++++-------------
.../internal/runner/app/ItNoThreadsLeftTest.java | 3 +-
.../internal/runner/app/ItTableCreationTest.java | 3 +-
.../internal/runner/app/ItTablesApiTest.java | 3 +-
.../runner/app/PlatformTestNodeRunner.java | 3 +-
.../app/client/ItAbstractThinClientTest.java | 3 +-
.../sql/engine/ClusterPerClassIntegrationTest.java | 3 +-
.../ignite/internal/sqllogic/ItSqlLogicTest.java | 3 +-
.../ignite/internal/table/ItRoReadsTest.java | 3 +-
.../java/org/apache/ignite/app/IgniteRunner.java | 2 +-
.../org/apache/ignite/internal/app/IgniteImpl.java | 16 +--
.../apache/ignite/internal/app/IgnitionImpl.java | 50 ++------
.../configuration/NodeBootstrapConfiguration.java | 135 ---------------------
.../storage/LocalFileConfigurationStorage.java | 7 +-
.../storage/LocalFileConfigurationStorageTest.java | 8 +-
37 files changed, 224 insertions(+), 443 deletions(-)
diff --git
a/examples/src/integrationTest/java/org/apache/ignite/example/AbstractExamplesTest.java
b/examples/src/integrationTest/java/org/apache/ignite/example/AbstractExamplesTest.java
index 79aae61d4c..1d0aa9a302 100644
---
a/examples/src/integrationTest/java/org/apache/ignite/example/AbstractExamplesTest.java
+++
b/examples/src/integrationTest/java/org/apache/ignite/example/AbstractExamplesTest.java
@@ -51,8 +51,7 @@ public abstract class AbstractExamplesTest extends
IgniteAbstractTest {
CompletableFuture<Ignite> igniteFuture = IgnitionManager.start(
TEST_NODE_NAME,
Path.of("config", "ignite-config.conf"),
- workDir,
- null
+ workDir
);
InitParameters initParameters = InitParameters.builder()
diff --git a/modules/api/build.gradle b/modules/api/build.gradle
index 4ba93f3d69..9069b586a9 100644
--- a/modules/api/build.gradle
+++ b/modules/api/build.gradle
@@ -35,6 +35,7 @@ dependencies {
testFixturesImplementation testFixtures(project(":ignite-core"))
testFixturesImplementation libs.hamcrest.core
testFixturesImplementation libs.micronaut.junit5
+ testFixturesImplementation libs.jetbrains.annotations
}
description = 'ignite-api'
diff --git a/modules/api/src/main/java/org/apache/ignite/Ignition.java
b/modules/api/src/main/java/org/apache/ignite/Ignition.java
index 79f386b19a..3502491c81 100644
--- a/modules/api/src/main/java/org/apache/ignite/Ignition.java
+++ b/modules/api/src/main/java/org/apache/ignite/Ignition.java
@@ -17,8 +17,6 @@
package org.apache.ignite;
-import java.io.InputStream;
-import java.net.URL;
import java.nio.file.Path;
import java.util.concurrent.CompletableFuture;
import org.apache.ignite.lang.IgniteException;
@@ -29,28 +27,28 @@ import org.jetbrains.annotations.Nullable;
*/
public interface Ignition {
/**
- * Starts an Ignite node with an optional bootstrap configuration from a
HOCON file.
+ * Starts an Ignite node with a bootstrap configuration from a HOCON file.
*
* <p>When this method returns, the node is partially started and ready to
accept the init command (that is, its
* REST endpoint is functional).
*
* @param nodeName Name of the node. Must not be {@code null}.
- * @param configPath Path to the node configuration in the HOCON format.
Can be {@code null}.
+ * @param configPath Path to the node configuration in the HOCON format.
Must not be {@code null}.
* @param workDir Work directory for the started node. Must not be {@code
null}.
* @return Completable future that resolves into an Ignite node after all
components are started and the cluster initialization is
* complete.
*/
- CompletableFuture<Ignite> start(String nodeName, @Nullable Path
configPath, Path workDir);
+ CompletableFuture<Ignite> start(String nodeName, Path configPath, Path
workDir);
/**
- * Starts an Ignite node with an optional bootstrap configuration from a
HOCON file, with an optional class loader for further usage by
+ * Starts an Ignite node with a bootstrap configuration from a HOCON file,
with an optional class loader for further usage by
* {@link java.util.ServiceLoader}.
*
* <p>When this method returns, the node is partially started and ready to
accept the init command (that is, its
* REST endpoint is functional).
*
* @param nodeName Name of the node. Must not be {@code null}.
- * @param configPath Path to the node configuration in the HOCON format.
Can be {@code null}.
+ * @param configPath Path to the node configuration in the HOCON format.
Must not be {@code null}.
* @param workDir Work directory for the started node. Must not be {@code
null}.
* @param serviceLoaderClassLoader The class loader to be used to load
provider-configuration files and provider classes, or {@code
* null} if the system class loader (or, failing that, the bootstrap class
loader) is to be used
@@ -59,68 +57,11 @@ public interface Ignition {
*/
CompletableFuture<Ignite> start(
String nodeName,
- @Nullable Path configPath,
+ Path configPath,
Path workDir,
@Nullable ClassLoader serviceLoaderClassLoader
);
- /**
- * Starts an Ignite node with an optional bootstrap configuration from a
URL linking to HOCON configs.
- *
- * <p>When this method returns, the node is partially started and ready to
accept the init command (that is, its
- * REST endpoint is functional).
- *
- * @param nodeName Name of the node. Must not be {@code null}.
- * @param cfgUrl URL linking to the node configuration in the HOCON
format. Can be {@code null}.
- * @param workDir Work directory for the started node. Must not be {@code
null}.
- * @return Completable future that resolves into an Ignite node after all
components are started and the cluster initialization is
- * complete.
- */
- CompletableFuture<Ignite> start(String nodeName, @Nullable URL cfgUrl,
Path workDir);
-
- /**
- * Starts an Ignite node with an optional bootstrap configuration from an
input stream with HOCON configs.
- *
- * <p>When this method returns, the node is partially started and ready to
accept the init command (that is, its
- * REST endpoint is functional).
- *
- * @param nodeName Name of the node. Must not be {@code null}.
- * @param config Optional node configuration.
- * Following rules are used for applying the configuration properties:
- * <ol>
- * <li>Specified property overrides existing one or just applies
itself if it wasn't
- * previously specified.</li>
- * <li>All non-specified properties either use previous value or
use default one from
- * corresponding configuration schema.</li>
- * </ol>
- * So that, in case of initial node start (first start ever)
specified configuration, supplemented
- * with defaults, is used. If no configuration was provided defaults
are used for all
- * configuration properties. In case of node restart, specified
properties override existing
- * ones, non specified properties that also weren't specified
previously use default values.
- * Please pay attention that previously specified properties are
searched in the
- * {@code workDir} specified by the user.
- *
- * @param workDir Work directory for the started node. Must not be {@code
null}.
- * @return Completable future that resolves into an Ignite node after all
components are started and the cluster initialization is
- * complete.
- */
- //TODO: Move IGNITE-18778
- CompletableFuture<Ignite> start(String nodeName, @Nullable InputStream
config, Path workDir);
-
- /**
- * Starts an Ignite node with the default configuration.
- *
- * <p>When this method returns, the node is partially started and ready to
accept the init command (that is, its
- * REST endpoint is functional).
- *
- * @param nodeName Name of the node. Must not be {@code null}.
- * @param workDir Work directory for the started node. Must not be {@code
null}.
- * @return Completable future that resolves into an Ignite node after all
components are started and the cluster initialization is
- * complete.
- */
- //TODO: Move IGNITE-18778
- CompletableFuture<Ignite> start(String nodeName, Path workDir);
-
/**
* Stops the node with given {@code name}. It's possible to stop both
already started node or node that is currently starting. Has no
* effect if node with specified name doesn't exist.
diff --git a/modules/api/src/main/java/org/apache/ignite/IgnitionManager.java
b/modules/api/src/main/java/org/apache/ignite/IgnitionManager.java
index e44d3b9d23..b3b1dba4fb 100644
--- a/modules/api/src/main/java/org/apache/ignite/IgnitionManager.java
+++ b/modules/api/src/main/java/org/apache/ignite/IgnitionManager.java
@@ -17,10 +17,6 @@
package org.apache.ignite;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.ServiceLoader;
import java.util.concurrent.CompletableFuture;
@@ -40,56 +36,29 @@ public class IgnitionManager {
private static Ignition ignition;
/**
- * Starts an Ignite node with an optional bootstrap configuration from an
input stream with HOCON configs.
+ * Starts an Ignite node with a bootstrap configuration from a HOCON file.
*
* <p>When this method returns, the node is partially started and ready to
accept the init command (that is, its
* REST endpoint is functional).
*
* @param nodeName Name of the node. Must not be {@code null}.
- * @param configStr Optional node configuration.
- * Following rules are used for applying the configuration properties:
- * <ol>
- * <li>Specified property overrides existing one or just applies
itself if it wasn't
- * previously specified.</li>
- * <li>All non-specified properties either use previous value or
use default one from
- * corresponding configuration schema.</li>
- * </ol>
- * So that, in case of initial node start (first start ever)
specified configuration, supplemented
- * with defaults, is used. If no configuration was provided defaults
are used for all
- * configuration properties. In case of node restart, specified
properties override existing
- * ones, non specified properties that also weren't specified
previously use default values.
- * Please pay attention that previously specified properties are
searched in the
- * {@code workDir} specified by the user.
- *
+ * @param cfgPath Path to the node configuration in the HOCON format. Must
not be {@code null}.
* @param workDir Work directory for the started node. Must not be {@code
null}.
* @return Completable future that resolves into an Ignite node after all
components are started and the cluster initialization is
* complete.
- * @throws IgniteException If error occurs while reading node
configuration.
*/
- // TODO IGNITE-14580 Add exception handling logic to IgnitionProcessor.
- //TODO: Move IGNITE-18778
- public static CompletableFuture<Ignite> start(String nodeName, @Nullable
String configStr, Path workDir) {
- Ignition ignition =
loadIgnitionService(Thread.currentThread().getContextClassLoader());
-
- if (configStr == null) {
- return ignition.start(nodeName, workDir);
- } else {
- try (InputStream inputStream = new
ByteArrayInputStream(configStr.getBytes(StandardCharsets.UTF_8))) {
- return ignition.start(nodeName, inputStream, workDir);
- } catch (IOException e) {
- throw new IgniteException("Couldn't close the stream with node
config.", e);
- }
- }
+ public static CompletableFuture<Ignite> start(String nodeName, Path
cfgPath, Path workDir) {
+ return start(nodeName, cfgPath, workDir, null);
}
/**
- * Starts an Ignite node with an optional bootstrap configuration from a
HOCON file.
+ * Starts an Ignite node with a bootstrap configuration from a HOCON file.
*
* <p>When this method returns, the node is partially started and ready to
accept the init command (that is, its
* REST endpoint is functional).
*
* @param nodeName Name of the node. Must not be {@code null}.
- * @param cfgPath Path to the node configuration in the HOCON format. Can
be {@code null}.
+ * @param cfgPath Path to the node configuration in the HOCON format.
Must not be {@code null}.
* @param workDir Work directory for the started node. Must not be {@code
null}.
* @param clsLdr The class loader to be used to load
provider-configuration files and provider classes, or {@code null} if the system
* class loader (or, failing that, the bootstrap class
loader) is to be used
@@ -97,7 +66,7 @@ public class IgnitionManager {
* complete.
*/
// TODO IGNITE-14580 Add exception handling logic to IgnitionProcessor.
- public static CompletableFuture<Ignite> start(String nodeName, @Nullable
Path cfgPath, Path workDir, @Nullable ClassLoader clsLdr) {
+ public static CompletableFuture<Ignite> start(String nodeName, Path
cfgPath, Path workDir, @Nullable ClassLoader clsLdr) {
Ignition ignition = loadIgnitionService(clsLdr);
return ignition.start(nodeName, cfgPath, workDir, clsLdr);
@@ -139,7 +108,6 @@ public class IgnitionManager {
* @see Ignition#init(InitParameters)
*/
public static synchronized void init(InitParameters parameters) {
-
if (ignition == null) {
throw new IgniteException("Ignition service has not been started");
}
diff --git
a/modules/api/src/testFixtures/java/org/apache/ignite/internal/testframework/IntegrationTestBase.java
b/modules/api/src/testFixtures/java/org/apache/ignite/internal/testframework/IntegrationTestBase.java
index 4e01de34bc..e648ddf370 100644
---
a/modules/api/src/testFixtures/java/org/apache/ignite/internal/testframework/IntegrationTestBase.java
+++
b/modules/api/src/testFixtures/java/org/apache/ignite/internal/testframework/IntegrationTestBase.java
@@ -104,7 +104,7 @@ public class IntegrationTestBase extends
BaseIgniteAbstractTest {
NODE_CONFIGS.put(nodeName, config);
- return IgnitionManager.start(nodeName, config,
WORK_DIR.resolve(nodeName));
+ return TestIgnitionManager.start(nodeName, config,
WORK_DIR.resolve(nodeName));
})
.collect(toList());
}
@@ -167,7 +167,7 @@ public class IntegrationTestBase extends
BaseIgniteAbstractTest {
}
protected void startNode(String nodeName) {
- IgnitionManager.start(nodeName, NODE_CONFIGS.get(nodeName),
WORK_DIR.resolve(nodeName));
+ TestIgnitionManager.start(nodeName, NODE_CONFIGS.get(nodeName),
WORK_DIR.resolve(nodeName));
CLUSTER_NODE_NAMES.add(nodeName);
}
diff --git
a/modules/api/src/testFixtures/java/org/apache/ignite/internal/testframework/TestIgnitionManager.java
b/modules/api/src/testFixtures/java/org/apache/ignite/internal/testframework/TestIgnitionManager.java
new file mode 100644
index 0000000000..06244f15b9
--- /dev/null
+++
b/modules/api/src/testFixtures/java/org/apache/ignite/internal/testframework/TestIgnitionManager.java
@@ -0,0 +1,80 @@
+/*
+ * 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.testframework;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardOpenOption;
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgnitionManager;
+import org.apache.ignite.lang.IgniteException;
+import org.jetbrains.annotations.Nullable;
+
+/** Helper class for starting a node with a string-based configuration. */
+public class TestIgnitionManager {
+
+ /** Default name of configuration file. */
+ public static final String DEFAULT_CONFIG_NAME = "ignite-config.conf";
+
+ /**
+ * Starts an Ignite node with an optional bootstrap configuration from an
input stream with HOCON configs.
+ *
+ * <p>When this method returns, the node is partially started and ready to
accept the init command (that is, its
+ * REST endpoint is functional).
+ *
+ * @param nodeName Name of the node. Must not be {@code null}.
+ * @param configStr Optional node configuration.
+ * Following rules are used for applying the configuration properties:
+ * <ol>
+ * <li>Specified property overrides existing one or just applies
itself if it wasn't
+ * previously specified.</li>
+ * <li>All non-specified properties either use previous value or
use default one from
+ * corresponding configuration schema.</li>
+ * </ol>
+ * So that, in case of initial node start (first start ever)
specified configuration, supplemented
+ * with defaults, is used. If no configuration was provided defaults
are used for all
+ * configuration properties. In case of node restart, specified
properties override existing
+ * ones, non specified properties that also weren't specified
previously use default values.
+ * Please pay attention that previously specified properties are
searched in the
+ * {@code workDir} specified by the user.
+ *
+ * @param workDir Work directory for the started node. Must not be {@code
null}.
+ * @return Completable future that resolves into an Ignite node after all
components are started and the cluster initialization is
+ * complete.
+ * @throws IgniteException If error occurs while reading node
configuration.
+ */
+ public static CompletableFuture<Ignite> start(String nodeName, @Nullable
String configStr, Path workDir) {
+ try {
+ Files.createDirectories(workDir);
+ Path configPath = workDir.resolve(DEFAULT_CONFIG_NAME);
+ if (configStr == null) {
+ if (Files.notExists(configPath)) {
+ Files.createFile(configPath);
+ }
+ } else {
+ Files.writeString(configPath, configStr,
+ StandardOpenOption.SYNC, StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING);
+ }
+ return IgnitionManager.start(nodeName, configPath, workDir);
+ } catch (IOException e) {
+ throw new IgniteException("Couldn't write node config.", e);
+ }
+ }
+}
diff --git
a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/ItClusterCommandTest.java
b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/ItClusterCommandTest.java
index 08146b4c60..04ddce8ea3 100644
---
a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/ItClusterCommandTest.java
+++
b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/ItClusterCommandTest.java
@@ -39,6 +39,7 @@ import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.apache.ignite.IgnitionManager;
import org.apache.ignite.internal.cli.AbstractCliTest;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.testframework.jul.NoOpHandler;
@@ -130,7 +131,7 @@ class ItClusterCommandTest extends AbstractCliTest {
throw new RuntimeException("Cannot load config", e);
}
- IgnitionManager.start(nodeName, config, workDir.resolve(nodeName));
+ TestIgnitionManager.start(nodeName, config, workDir.resolve(nodeName));
}
private String configJsonFor(Node node) throws IOException {
diff --git
a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/ItConfigCommandTest.java
b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/ItConfigCommandTest.java
index 47c7353651..4e32ac25da 100644
---
a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/ItConfigCommandTest.java
+++
b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/ItConfigCommandTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.IgnitionManager;
import org.apache.ignite.InitParameters;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.cli.AbstractCliTest;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.junit.jupiter.api.AfterEach;
@@ -53,7 +54,7 @@ public class ItConfigCommandTest extends AbstractCliTest {
void setup(@WorkDirectory Path workDir, TestInfo testInfo) {
String nodeName = testNodeName(testInfo, 0);
- CompletableFuture<Ignite> future = IgnitionManager.start(nodeName,
null, workDir);
+ CompletableFuture<Ignite> future = TestIgnitionManager.start(nodeName,
null, workDir);
InitParameters initParameters = InitParameters.builder()
.destinationNodeName(nodeName)
diff --git
a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/rest/ItGeneratedRestClientTest.java
b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/rest/ItGeneratedRestClientTest.java
index 2cd679b3a1..1a4e213c03 100644
---
a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/rest/ItGeneratedRestClientTest.java
+++
b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/rest/ItGeneratedRestClientTest.java
@@ -52,6 +52,7 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgnitionManager;
import org.apache.ignite.InitParameters;
import org.apache.ignite.internal.cli.core.rest.ApiClientFactory;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
@@ -423,7 +424,7 @@ public class ItGeneratedRestClientTest {
clusterNodeNames.add(nodeName);
- return IgnitionManager.start(nodeName, buildConfig(index),
workDir.resolve(nodeName));
+ return TestIgnitionManager.start(nodeName, buildConfig(index),
workDir.resolve(nodeName));
}
}
diff --git a/modules/jdbc/build.gradle b/modules/jdbc/build.gradle
index 69cf3b31c1..13e72bf477 100644
--- a/modules/jdbc/build.gradle
+++ b/modules/jdbc/build.gradle
@@ -35,9 +35,10 @@ dependencies {
annotationProcessor libs.auto.service
- integrationTestImplementation(testFixtures(project(":ignite-core")))
- integrationTestImplementation(project(":ignite-runner"))
- integrationTestImplementation(project(":ignite-api"))
+ integrationTestImplementation testFixtures(project(":ignite-api"))
+ integrationTestImplementation testFixtures(project(":ignite-core"))
+ integrationTestImplementation project(":ignite-runner")
+ integrationTestImplementation project(":ignite-api")
}
description = 'ignite-jdbc'
diff --git
a/modules/jdbc/src/integrationTest/java/org/apache/ignite/jdbc/AbstractJdbcSelfTest.java
b/modules/jdbc/src/integrationTest/java/org/apache/ignite/jdbc/AbstractJdbcSelfTest.java
index 3699be1960..d02e5d1f7f 100644
---
a/modules/jdbc/src/integrationTest/java/org/apache/ignite/jdbc/AbstractJdbcSelfTest.java
+++
b/modules/jdbc/src/integrationTest/java/org/apache/ignite/jdbc/AbstractJdbcSelfTest.java
@@ -35,6 +35,7 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgnitionManager;
import org.apache.ignite.InitParameters;
import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
@@ -78,7 +79,7 @@ public class AbstractJdbcSelfTest extends
BaseIgniteAbstractTest {
public static void beforeAllBase(TestInfo testInfo) throws Exception {
String nodeName = testNodeName(testInfo, TEST_PORT);
- CompletableFuture<Ignite> future = IgnitionManager.start(nodeName,
null, WORK_DIR.resolve(nodeName));
+ CompletableFuture<Ignite> future = TestIgnitionManager.start(nodeName,
null, WORK_DIR.resolve(nodeName));
InitParameters initParameters = InitParameters.builder()
.destinationNodeName(nodeName)
diff --git a/modules/runner/build.gradle b/modules/runner/build.gradle
index cdeef5401c..645fe839ab 100644
--- a/modules/runner/build.gradle
+++ b/modules/runner/build.gradle
@@ -78,10 +78,10 @@ dependencies {
testImplementation project(':ignite-network')
testImplementation project(':ignite-vault')
testImplementation project(':ignite-client')
- testImplementation(testFixtures(project(':ignite-core')))
- testImplementation(testFixtures(project(':ignite-configuration')))
- testImplementation(testFixtures(project(':ignite-vault')))
- testImplementation(testFixtures(project(':ignite-metastorage')))
+ testImplementation testFixtures(project(':ignite-core'))
+ testImplementation testFixtures(project(':ignite-configuration'))
+ testImplementation testFixtures(project(':ignite-vault'))
+ testImplementation testFixtures(project(':ignite-metastorage'))
testImplementation libs.hamcrest.core
testImplementation libs.hamcrest.optional
testImplementation libs.hamcrest.path
@@ -125,17 +125,18 @@ dependencies {
integrationTestImplementation project(':ignite-security')
integrationTestImplementation project(':ignite-catalog')
integrationTestImplementation project(':ignite-placement-driver')
- integrationTestImplementation(testFixtures(project(':ignite-core')))
-
integrationTestImplementation(testFixtures(project(':ignite-configuration')))
-
integrationTestImplementation(testFixtures(project(':ignite-distribution-zones')))
- integrationTestImplementation(testFixtures(project(':ignite-schema')))
-
integrationTestImplementation(testFixtures(project(':ignite-cluster-management')))
- integrationTestImplementation(testFixtures(project(':ignite-metastorage')))
- integrationTestImplementation(testFixtures(project(':ignite-network')))
- integrationTestImplementation(testFixtures(project(':ignite-vault')))
- integrationTestImplementation(testFixtures(project(':ignite-table')))
- integrationTestImplementation(testFixtures(project(':ignite-storage-api')))
-
integrationTestImplementation(testFixtures(project(':ignite-transactions')))
+ integrationTestImplementation testFixtures(project(":ignite-api"))
+ integrationTestImplementation testFixtures(project(':ignite-core'))
+ integrationTestImplementation
testFixtures(project(':ignite-configuration'))
+ integrationTestImplementation
testFixtures(project(':ignite-distribution-zones'))
+ integrationTestImplementation testFixtures(project(':ignite-schema'))
+ integrationTestImplementation
testFixtures(project(':ignite-cluster-management'))
+ integrationTestImplementation testFixtures(project(':ignite-metastorage'))
+ integrationTestImplementation testFixtures(project(':ignite-network'))
+ integrationTestImplementation testFixtures(project(':ignite-vault'))
+ integrationTestImplementation testFixtures(project(':ignite-table'))
+ integrationTestImplementation testFixtures(project(':ignite-storage-api'))
+ integrationTestImplementation testFixtures(project(':ignite-transactions'))
integrationTestImplementation libs.jetbrains.annotations
integrationTestImplementation libs.awaitility
integrationTestImplementation libs.rocksdb.jni
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/Cluster.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/Cluster.java
index 7d35b348cf..cc90a0c156 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/Cluster.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/Cluster.java
@@ -50,6 +50,7 @@ import org.apache.ignite.internal.logger.Loggers;
import org.apache.ignite.internal.raft.RaftNodeId;
import org.apache.ignite.internal.raft.server.impl.JraftServerImpl;
import
org.apache.ignite.internal.table.distributed.replicator.TablePartitionId;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.lang.IgniteStringFormatter;
import org.apache.ignite.network.NetworkMessage;
import org.apache.ignite.raft.jraft.RaftGroupService;
@@ -170,7 +171,7 @@ public class Cluster {
String config =
IgniteStringFormatter.format(nodeBootstrapConfigTemplate, BASE_PORT +
nodeIndex, CONNECT_NODE_ADDR);
- return IgnitionManager.start(nodeName, config,
workDir.resolve(nodeName))
+ return TestIgnitionManager.start(nodeName, config,
workDir.resolve(nodeName))
.thenApply(IgniteImpl.class::cast)
.thenApply(ignite -> {
synchronized (nodes) {
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/cluster/management/ItClusterInitTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/cluster/management/ItClusterInitTest.java
index dd476177f4..dda6cd1a43 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/cluster/management/ItClusterInitTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/cluster/management/ItClusterInitTest.java
@@ -30,6 +30,7 @@ import java.util.stream.IntStream;
import org.apache.ignite.IgnitionManager;
import org.apache.ignite.InitParameters;
import org.apache.ignite.internal.testframework.IgniteAbstractTest;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.util.IgniteUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
@@ -109,7 +110,7 @@ public class ItClusterInitTest extends IgniteAbstractTest {
String nodeName = testNodeName(testInfo, port);
- IgnitionManager.start(nodeName, config, workDir.resolve(nodeName));
+ TestIgnitionManager.start(nodeName, config,
workDir.resolve(nodeName));
nodeNames.add(nodeName);
}
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/configuration/ItSslConfigurationValidationTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/configuration/ItSslConfigurationValidationTest.java
index 7110c60edd..36b858f33d 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/configuration/ItSslConfigurationValidationTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/configuration/ItSslConfigurationValidationTest.java
@@ -21,8 +21,8 @@ import static
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThr
import static
org.apache.ignite.internal.testframework.IgniteTestUtils.testNodeName;
import java.nio.file.Path;
-import org.apache.ignite.IgnitionManager;
import
org.apache.ignite.configuration.validation.ConfigurationValidationException;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.junit.jupiter.api.TestInfo;
@@ -51,7 +51,7 @@ public class ItSslConfigurationValidationTest {
+ "}";
assertThrowsWithCause(
- () -> IgnitionManager.start(testNodeName(testInfo, 0), config,
workDir),
+ () -> TestIgnitionManager.start(testNodeName(testInfo, 0),
config, workDir),
ConfigurationValidationException.class,
"Validation did not pass for keys: [" + rootKey +
".ssl.keyStore, Key store file doesn't exist at bad_path]");
}
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/configuration/storage/ItRebalanceDistributedTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/configuration/storage/ItRebalanceDistributedTest.java
index 69579cbe52..964e399487 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/configuration/storage/ItRebalanceDistributedTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/configuration/storage/ItRebalanceDistributedTest.java
@@ -75,7 +75,6 @@ import
org.apache.ignite.internal.cluster.management.topology.LogicalTopologyImp
import
org.apache.ignite.internal.cluster.management.topology.LogicalTopologyServiceImpl;
import
org.apache.ignite.internal.cluster.management.topology.api.LogicalTopologyService;
import org.apache.ignite.internal.configuration.ConfigurationManager;
-import org.apache.ignite.internal.configuration.NodeBootstrapConfiguration;
import org.apache.ignite.internal.configuration.SecurityConfiguration;
import
org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
import
org.apache.ignite.internal.configuration.testframework.InjectConfiguration;
@@ -597,14 +596,13 @@ public class ItRebalanceDistributedTest {
vaultManager = createVault(dir);
- NodeBootstrapConfiguration configuration =
-
NodeBootstrapConfiguration.directFile(workDir.resolve(testInfo.getDisplayName()));
+ Path configPath = workDir.resolve(testInfo.getDisplayName());
nodeCfgMgr = new ConfigurationManager(
List.of(NetworkConfiguration.KEY,
RestConfiguration.KEY,
ClientConnectorConfiguration.KEY),
Set.of(),
- new LocalFileConfigurationStorage(configuration),
+ new LocalFileConfigurationStorage(configPath),
List.of(),
List.of()
);
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/rest/AbstractRestTestBase.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/rest/AbstractRestTestBase.java
index 688e0c230f..208564fe49 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/rest/AbstractRestTestBase.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/rest/AbstractRestTestBase.java
@@ -37,6 +37,7 @@ import java.util.stream.Collectors;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgnitionManager;
import org.apache.ignite.internal.IgniteIntegrationTest;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.util.IgniteUtils;
import org.junit.jupiter.api.AfterEach;
@@ -141,7 +142,7 @@ abstract class AbstractRestTestBase extends
IgniteIntegrationTest {
);
for (Map.Entry<String, String> e : nodesBootstrapCfg.entrySet()) {
- startNodeWithoutInit(e.getKey(), name ->
IgnitionManager.start(name, e.getValue(), workDir.resolve(name)));
+ startNodeWithoutInit(e.getKey(), name ->
TestIgnitionManager.start(name, e.getValue(), workDir.resolve(name)));
}
}
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/rest/RestNode.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/rest/RestNode.java
index 14ef8977c9..46099e83a3 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/rest/RestNode.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/rest/RestNode.java
@@ -25,6 +25,7 @@ import java.util.concurrent.CompletableFuture;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgnitionManager;
import org.apache.ignite.internal.rest.ssl.ItRestSslTest;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
/** Presentation of Ignite node for tests. */
public class RestNode {
@@ -81,14 +82,14 @@ public class RestNode {
/** Starts the node. */
public CompletableFuture<Ignite> start() {
- igniteNodeFuture = IgnitionManager.start(name, bootstrapCfg(),
workDir.resolve(name));
+ igniteNodeFuture = TestIgnitionManager.start(name, bootstrapCfg(),
workDir.resolve(name));
return igniteNodeFuture;
}
/** Restarts the node. */
public CompletableFuture<Ignite> restart() {
stop();
- igniteNodeFuture = IgnitionManager.start(name, null,
workDir.resolve(name));
+ igniteNodeFuture = TestIgnitionManager.start(name, null,
workDir.resolve(name));
return igniteNodeFuture;
}
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/AbstractSchemaChangeTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/AbstractSchemaChangeTest.java
index 9f26ffc150..c35ce2e88c 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/AbstractSchemaChangeTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/AbstractSchemaChangeTest.java
@@ -39,6 +39,7 @@ import
org.apache.ignite.internal.schema.configuration.ColumnChange;
import
org.apache.ignite.internal.schema.configuration.defaultvalue.ConstantValueDefaultChange;
import org.apache.ignite.internal.schema.testutils.definition.ColumnType;
import org.apache.ignite.internal.table.distributed.TableManager;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.util.IgniteNameUtils;
import org.apache.ignite.internal.util.IgniteUtils;
@@ -174,7 +175,7 @@ abstract class AbstractSchemaChangeTest extends
IgniteIntegrationTest {
*/
protected List<Ignite> startGrid() {
List<CompletableFuture<Ignite>> futures =
nodesBootstrapCfg.entrySet().stream()
- .map(e -> IgnitionManager.start(e.getKey(), e.getValue(),
workDir.resolve(e.getKey())))
+ .map(e -> TestIgnitionManager.start(e.getKey(), e.getValue(),
workDir.resolve(e.getKey())))
.collect(toList());
String metaStorageNode = nodesBootstrapCfg.keySet().iterator().next();
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItDataSchemaSyncTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItDataSchemaSyncTest.java
index 27ab012dc3..1f1e1629a1 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItDataSchemaSyncTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItDataSchemaSyncTest.java
@@ -43,6 +43,7 @@ import org.apache.ignite.internal.table.TableImpl;
import org.apache.ignite.internal.test.WatchListenerInhibitor;
import org.apache.ignite.internal.testframework.IgniteAbstractTest;
import org.apache.ignite.internal.testframework.IgniteTestUtils;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.lang.IgniteException;
@@ -108,7 +109,7 @@ public class ItDataSchemaSyncTest extends
IgniteAbstractTest {
@BeforeEach
void beforeEach() {
List<CompletableFuture<Ignite>> futures =
nodesBootstrapCfg.entrySet().stream()
- .map(e -> IgnitionManager.start(e.getKey(), e.getValue(),
workDir.resolve(e.getKey())))
+ .map(e -> TestIgnitionManager.start(e.getKey(), e.getValue(),
workDir.resolve(e.getKey())))
.collect(toList());
String metaStorageNode = nodesBootstrapCfg.keySet().iterator().next();
@@ -178,7 +179,7 @@ public class ItDataSchemaSyncTest extends
IgniteAbstractTest {
CompletableFuture<Ignite> ignite1Fut =
nodesBootstrapCfg.entrySet().stream()
.filter(k -> k.getKey().equals(nodeToStop))
- .map(e -> IgnitionManager.start(e.getKey(), e.getValue(),
workDir.resolve(e.getKey())))
+ .map(e -> TestIgnitionManager.start(e.getKey(), e.getValue(),
workDir.resolve(e.getKey())))
.findFirst().get();
ignite1 = (IgniteImpl) ignite1Fut.get();
@@ -252,7 +253,7 @@ public class ItDataSchemaSyncTest extends
IgniteAbstractTest {
CompletableFuture<Ignite> ignite1Fut =
nodesBootstrapCfg.entrySet().stream()
.filter(k -> k.getKey().equals(nodeToStop))
- .map(e -> IgnitionManager.start(e.getKey(), e.getValue(),
workDir.resolve(e.getKey())))
+ .map(e -> TestIgnitionManager.start(e.getKey(), e.getValue(),
workDir.resolve(e.getKey())))
.findFirst().get();
ignite1 = ignite1Fut.get();
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteInMemoryNodeRestartTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteInMemoryNodeRestartTest.java
index bcb4e1abb5..5ccd4a27e7 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteInMemoryNodeRestartTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteInMemoryNodeRestartTest.java
@@ -46,6 +46,7 @@ import
org.apache.ignite.internal.table.distributed.replicator.TablePartitionId;
import org.apache.ignite.internal.table.distributed.storage.InternalTableImpl;
import org.apache.ignite.internal.testframework.IgniteAbstractTest;
import org.apache.ignite.internal.testframework.IgniteTestUtils;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.lang.IgniteStringFormatter;
import org.apache.ignite.sql.Session;
@@ -115,7 +116,7 @@ public class ItIgniteInMemoryNodeRestartTest extends
IgniteAbstractTest {
CLUSTER_NODES_NAMES.add(idx, nodeName);
- CompletableFuture<Ignite> future = IgnitionManager.start(nodeName,
cfgString, workDir.resolve(nodeName));
+ CompletableFuture<Ignite> future = TestIgnitionManager.start(nodeName,
cfgString, workDir.resolve(nodeName));
if (CLUSTER_NODES.isEmpty()) {
InitParameters initParameters = InitParameters.builder()
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java
index e8bef64fdc..bd0cadbf0e 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java
@@ -64,7 +64,7 @@ import
org.apache.ignite.internal.cluster.management.topology.LogicalTopologyImp
import
org.apache.ignite.internal.cluster.management.topology.LogicalTopologyServiceImpl;
import org.apache.ignite.internal.configuration.ConfigurationManager;
import org.apache.ignite.internal.configuration.ConfigurationModules;
-import org.apache.ignite.internal.configuration.NodeBootstrapConfiguration;
+import org.apache.ignite.internal.configuration.NodeConfigWriteException;
import org.apache.ignite.internal.configuration.SecurityConfiguration;
import org.apache.ignite.internal.configuration.ServiceLoaderModulesProvider;
import org.apache.ignite.internal.configuration.storage.ConfigurationStorage;
@@ -100,6 +100,7 @@ import
org.apache.ignite.internal.table.distributed.TableManager;
import org.apache.ignite.internal.table.distributed.TableMessageGroup;
import
org.apache.ignite.internal.table.distributed.raft.snapshot.outgoing.OutgoingSnapshotsManager;
import org.apache.ignite.internal.testframework.IgniteAbstractTest;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WithSystemProperty;
import org.apache.ignite.internal.tx.impl.HeapLockManager;
import org.apache.ignite.internal.tx.impl.TxManagerImpl;
@@ -241,13 +242,17 @@ public class ItIgniteNodeRestartTest extends
IgniteAbstractTest {
ConfigurationModules modules = loadConfigurationModules(log,
Thread.currentThread().getContextClassLoader());
- NodeBootstrapConfiguration configuration =
- NodeBootstrapConfiguration.string(cfgString == null ?
configurationString(idx) : cfgString,
- workDir);
+ Path configFile =
workDir.resolve(TestIgnitionManager.DEFAULT_CONFIG_NAME);
+ String configString = cfgString == null ? configurationString(idx) :
cfgString;
+ try {
+ Files.writeString(configFile, configString);
+ } catch (IOException e) {
+ throw new NodeConfigWriteException("Failed to write config content
to file.", e);
+ }
var nodeCfgMgr = new ConfigurationManager(
modules.local().rootKeys(),
modules.local().validators(),
- new LocalFileConfigurationStorage(configuration),
+ new LocalFileConfigurationStorage(configFile),
modules.local().internalSchemaExtensions(),
modules.local().polymorphicSchemaExtensions()
);
@@ -384,7 +389,7 @@ public class ItIgniteNodeRestartTest extends
IgniteAbstractTest {
nodeCfgMgr.start();
try {
- nodeCfgMgr.bootstrap(configuration.configPath());
+ nodeCfgMgr.bootstrap(configFile);
} catch (Exception e) {
throw new IgniteException("Unable to parse user-specific
configuration.", e);
}
@@ -604,7 +609,7 @@ public class ItIgniteNodeRestartTest extends
IgniteAbstractTest {
clusterNodesNames.set(idx, nodeName);
}
- return IgnitionManager.start(nodeName, cfgString,
workDir.resolve(nodeName));
+ return TestIgnitionManager.start(nodeName, cfgString,
workDir.resolve(nodeName));
}
/**
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgnitionTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgnitionTest.java
index bf2148e6e1..badb20145d 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgnitionTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgnitionTest.java
@@ -17,18 +17,14 @@
package org.apache.ignite.internal.runner.app;
+import static
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrowsWithCause;
import static
org.apache.ignite.internal.testframework.IgniteTestUtils.testNodeName;
import static
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-import java.nio.charset.StandardCharsets;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.IOException;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -38,12 +34,9 @@ import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.ignite.Ignite;
-import org.apache.ignite.Ignition;
import org.apache.ignite.IgnitionManager;
import org.apache.ignite.InitParameters;
import org.apache.ignite.internal.IgniteIntegrationTest;
-import org.apache.ignite.internal.app.IgnitionImpl;
-import org.apache.ignite.internal.testframework.IgniteTestUtils;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.lang.IgniteException;
@@ -136,59 +129,37 @@ class ItIgnitionTest extends IgniteIntegrationTest {
@Test
void testNodesStartWithBootstrapConfiguration() {
for (Map.Entry<String, String> e : nodesBootstrapCfg.entrySet()) {
- startNode(e.getKey(), name -> IgnitionManager.start(name,
e.getValue(), workDir.resolve(name)));
+ startNode(e.getKey(), name -> {
+ Path nodeWorkDir = workDir.resolve(name);
+ Path configPath = nodeWorkDir.resolve("ignite-config.conf");
+ try {
+ Files.createDirectories(nodeWorkDir);
+ Files.writeString(configPath, e.getValue());
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ return IgnitionManager.start(name, configPath, nodeWorkDir);
+ });
}
- Assertions.assertEquals(3, startedNodes.size());
+ assertEquals(3, startedNodes.size());
startedNodes.forEach(Assertions::assertNotNull);
}
- /**
- * Check that Ignition.start() with bootstrap configuration returns Ignite
instance.
- */
- @Test
- void testNodeStartWithoutBootstrapConfiguration(TestInfo testInfo) {
- startNode(testNodeName(testInfo, 47500), name ->
IgnitionManager.start(name, null, workDir.resolve(name)));
-
- Assertions.assertNotNull(startedNodes.get(0));
- }
-
/**
* Tests scenario when we try to start node with invalid configuration.
*/
@Test
void testErrorWhenStartNodeWithInvalidConfiguration() {
- try {
- startNode("invalid-config-name", name ->
IgnitionManager.start(name, "{Invalid-Configuration}", workDir.resolve(name)));
-
- fail();
- } catch (Throwable t) {
- assertTrue(IgniteTestUtils.hasCause(t,
- IgniteException.class,
- "Unable to parse user-specific configuration"
- ));
- }
- }
-
- /**
- * Tests scenario when we try to start node with URL configuration.
- */
- @Test
- void testStartNodeWithUrlConfig() throws Exception {
- Ignition ign = new IgnitionImpl();
-
- String nodeName = "node-url-config";
-
- String cfg = "{\n"
- + " network: {\n"
- + " port: " + PORTS[0] + "\n"
- + " }\n"
- + "}";
-
- URL url = buildUrl("testURL.txt", cfg);
-
- startNode(nodeName, name -> ign.start(nodeName, url,
workDir.resolve(nodeName)));
+ assertThrowsWithCause(
+ () -> startNode(
+ "invalid-config-name",
+ name -> IgnitionManager.start(name,
Path.of("no-such-path"), workDir.resolve(name))
+ ),
+ IgniteException.class,
+ "Config file doesn't exist"
+ );
}
private void startNode(String nodeName, Function<String,
CompletableFuture<Ignite>> starter) {
@@ -210,39 +181,4 @@ class ItIgnitionTest extends IgniteIntegrationTest {
startedNodes.add(future.join());
}
- /**
- * Test URL with content in memory.
- *
- * @param path URL path.
- * @param data Data is available by URL.
- * @return URL.
- * @throws Exception If failed.
- */
- private URL buildUrl(String path, String data) throws Exception {
- URLStreamHandler handler = new URLStreamHandler() {
- private final byte[] content =
data.getBytes(StandardCharsets.UTF_8);
-
- @Override
- protected URLConnection openConnection(URL url) {
- return new URLConnection(url) {
- @Override
- public void connect() {
- connected = true;
- }
-
- @Override
- public long getContentLengthLong() {
- return content.length;
- }
-
- @Override
- public InputStream getInputStream() {
- return new ByteArrayInputStream(content);
- }
- };
- }
- };
-
- return new URL("memory", "", -1, path, handler);
- }
}
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItNoThreadsLeftTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItNoThreadsLeftTest.java
index 5a257528f9..8a6d7ae570 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItNoThreadsLeftTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItNoThreadsLeftTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.IgnitionManager;
import org.apache.ignite.InitParameters;
import org.apache.ignite.internal.testframework.IgniteAbstractTest;
import org.apache.ignite.internal.testframework.IgniteTestUtils;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.sql.Session;
import org.apache.ignite.table.Table;
import org.junit.jupiter.api.Test;
@@ -97,7 +98,7 @@ public class ItNoThreadsLeftTest extends IgniteAbstractTest {
private Ignite startNode(TestInfo testInfo) {
String nodeName = IgniteTestUtils.testNodeName(testInfo, 0);
- CompletableFuture<Ignite> future = IgnitionManager.start(nodeName,
NODE_CONFIGURATION, workDir.resolve(nodeName));
+ CompletableFuture<Ignite> future = TestIgnitionManager.start(nodeName,
NODE_CONFIGURATION, workDir.resolve(nodeName));
InitParameters initParameters = InitParameters.builder()
.destinationNodeName(nodeName)
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTableCreationTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTableCreationTest.java
index d7a6a57bc0..44b6ad60e5 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTableCreationTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTableCreationTest.java
@@ -34,6 +34,7 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgnitionManager;
import org.apache.ignite.InitParameters;
import org.apache.ignite.internal.IgniteIntegrationTest;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.table.KeyValueView;
@@ -184,7 +185,7 @@ class ItTableCreationTest extends IgniteIntegrationTest {
);
List<CompletableFuture<Ignite>> futures =
nodesBootstrapCfg.entrySet().stream()
- .map(e -> IgnitionManager.start(e.getKey(), e.getValue(),
workDir.resolve(e.getKey())))
+ .map(e -> TestIgnitionManager.start(e.getKey(), e.getValue(),
workDir.resolve(e.getKey())))
.collect(toList());
String metaStorageNode = nodesBootstrapCfg.keySet().iterator().next();
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTablesApiTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTablesApiTest.java
index fb92531e9f..93c88f77dd 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTablesApiTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTablesApiTest.java
@@ -53,6 +53,7 @@ import
org.apache.ignite.internal.table.distributed.TableManager;
import org.apache.ignite.internal.test.WatchListenerInhibitor;
import org.apache.ignite.internal.testframework.IgniteAbstractTest;
import org.apache.ignite.internal.testframework.IgniteTestUtils;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.lang.ColumnAlreadyExistsException;
import org.apache.ignite.lang.IndexAlreadyExistsException;
@@ -109,7 +110,7 @@ public class ItTablesApiTest extends IgniteAbstractTest {
for (int i = 0; i < nodesBootstrapCfg.size(); i++) {
String nodeName = testNodeName(testInfo, i);
- futures.add(IgnitionManager.start(nodeName,
nodesBootstrapCfg.get(i), workDir.resolve(nodeName)));
+ futures.add(TestIgnitionManager.start(nodeName,
nodesBootstrapCfg.get(i), workDir.resolve(nodeName)));
}
String metaStorageNodeName = testNodeName(testInfo, 0);
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/PlatformTestNodeRunner.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/PlatformTestNodeRunner.java
index 99b567cedd..7b34d5305e 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/PlatformTestNodeRunner.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/PlatformTestNodeRunner.java
@@ -52,6 +52,7 @@ import
org.apache.ignite.internal.schema.testutils.definition.ColumnType.Tempora
import org.apache.ignite.internal.schema.testutils.definition.TableDefinition;
import org.apache.ignite.internal.table.distributed.TableManager;
import org.apache.ignite.internal.table.impl.DummySchemaManagerImpl;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.sql.Session;
import org.apache.ignite.table.Tuple;
@@ -227,7 +228,7 @@ public class PlatformTestNodeRunner {
.replace("TRUSTSTORE_PATH", trustStorePath)
.replace("SSL_STORE_PASS", sslPassword);
- return IgnitionManager.start(nodeName, config,
basePath.resolve(nodeName));
+ return TestIgnitionManager.start(nodeName, config,
basePath.resolve(nodeName));
})
.collect(toList());
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItAbstractThinClientTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItAbstractThinClientTest.java
index e1ca5a0c69..c2b61f9aae 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItAbstractThinClientTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItAbstractThinClientTest.java
@@ -36,6 +36,7 @@ import org.apache.ignite.client.IgniteClient;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.testframework.IgniteAbstractTest;
import org.apache.ignite.internal.testframework.IgniteTestUtils;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
@@ -94,7 +95,7 @@ public abstract class ItAbstractThinClientTest extends
IgniteAbstractTest {
);
List<CompletableFuture<Ignite>> futures =
nodesBootstrapCfg.entrySet().stream()
- .map(e -> IgnitionManager.start(e.getKey(), e.getValue(),
workDir.resolve(e.getKey())))
+ .map(e -> TestIgnitionManager.start(e.getKey(), e.getValue(),
workDir.resolve(e.getKey())))
.collect(toList());
String metaStorageNode = nodesBootstrapCfg.keySet().iterator().next();
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ClusterPerClassIntegrationTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ClusterPerClassIntegrationTest.java
index 1641376762..4c6951898c 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ClusterPerClassIntegrationTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ClusterPerClassIntegrationTest.java
@@ -50,6 +50,7 @@ import
org.apache.ignite.internal.schema.configuration.index.TableIndexConfigura
import org.apache.ignite.internal.sql.engine.property.PropertiesHelper;
import org.apache.ignite.internal.sql.engine.session.SessionId;
import org.apache.ignite.internal.sql.engine.util.QueryChecker;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.lang.IgniteStringFormatter;
@@ -129,7 +130,7 @@ public abstract class ClusterPerClassIntegrationTest
extends IgniteIntegrationTe
String config = IgniteStringFormatter.format(NODE_BOOTSTRAP_CFG,
BASE_PORT + i, connectNodeAddr);
- futures.add(IgnitionManager.start(nodeName, config,
WORK_DIR.resolve(nodeName)));
+ futures.add(TestIgnitionManager.start(nodeName, config,
WORK_DIR.resolve(nodeName)));
}
String metaStorageNodeName = testNodeName(testInfo, 0);
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sqllogic/ItSqlLogicTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sqllogic/ItSqlLogicTest.java
index 49ed6c8447..9f07268c17 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sqllogic/ItSqlLogicTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sqllogic/ItSqlLogicTest.java
@@ -47,6 +47,7 @@ import org.apache.ignite.internal.logger.Loggers;
import org.apache.ignite.internal.sqllogic.SqlLogicTestEnvironment.RestartMode;
import org.apache.ignite.internal.sqllogic.SqlScriptRunner.RunnerRuntime;
import org.apache.ignite.internal.testframework.SystemPropertiesExtension;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WithSystemProperty;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.util.CollectionUtils;
@@ -322,7 +323,7 @@ public class ItSqlLogicTest extends IgniteIntegrationTest {
String config =
IgniteStringFormatter.format(NODE_BOOTSTRAP_CFG, BASE_PORT + i,
connectNodeAddr);
- return IgnitionManager.start(nodeName, config,
WORK_DIR.resolve(nodeName));
+ return TestIgnitionManager.start(nodeName, config,
WORK_DIR.resolve(nodeName));
})
.collect(toList());
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItRoReadsTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItRoReadsTest.java
index 1a77e9955d..8e0a2f5b47 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItRoReadsTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItRoReadsTest.java
@@ -61,6 +61,7 @@ import
org.apache.ignite.internal.schema.testutils.definition.ColumnDefinition;
import org.apache.ignite.internal.schema.testutils.definition.ColumnType;
import org.apache.ignite.internal.table.distributed.TableManager;
import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
+import org.apache.ignite.internal.testframework.TestIgnitionManager;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.tx.InternalTransaction;
@@ -122,7 +123,7 @@ public class ItRoReadsTest extends BaseIgniteAbstractTest {
String config = IgniteStringFormatter.format(NODE_BOOTSTRAP_CFG,
BASE_PORT, connectNodeAddr);
- CompletableFuture<Ignite> future = IgnitionManager.start(nodeName,
config, WORK_DIR.resolve(nodeName));
+ CompletableFuture<Ignite> future = TestIgnitionManager.start(nodeName,
config, WORK_DIR.resolve(nodeName));
String metaStorageNodeName = testNodeName(testInfo, nodes() - 1);
diff --git
a/modules/runner/src/main/java/org/apache/ignite/app/IgniteRunner.java
b/modules/runner/src/main/java/org/apache/ignite/app/IgniteRunner.java
index 7f63ba7ea6..255f985882 100644
--- a/modules/runner/src/main/java/org/apache/ignite/app/IgniteRunner.java
+++ b/modules/runner/src/main/java/org/apache/ignite/app/IgniteRunner.java
@@ -51,7 +51,7 @@ public class IgniteRunner implements
Callable<CompletableFuture<Ignite>> {
@Override
public CompletableFuture<Ignite> call() throws Exception {
// If config path is specified and there are no overrides then pass it
directly.
- return IgnitionManager.start(nodeName, configPath.toAbsolutePath(),
workDir, null);
+ return IgnitionManager.start(nodeName, configPath.toAbsolutePath(),
workDir);
}
/**
diff --git
a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
index 30bf84221c..dc715c2d12 100644
---
a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
+++
b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
@@ -60,7 +60,6 @@ import
org.apache.ignite.internal.configuration.AuthenticationConfiguration;
import org.apache.ignite.internal.configuration.ConfigurationManager;
import org.apache.ignite.internal.configuration.ConfigurationModules;
import org.apache.ignite.internal.configuration.ConfigurationRegistry;
-import org.apache.ignite.internal.configuration.NodeBootstrapConfiguration;
import org.apache.ignite.internal.configuration.NodeConfigReadException;
import org.apache.ignite.internal.configuration.SecurityConfiguration;
import org.apache.ignite.internal.configuration.ServiceLoaderModulesProvider;
@@ -277,15 +276,12 @@ public class IgniteImpl implements Ignite {
* The Constructor.
*
* @param name Ignite node name.
+ * @param configPath Path to node configuration in the HOCON format.
* @param workDir Work directory for the started node. Must not be {@code
null}.
* @param serviceProviderClassLoader The class loader to be used to load
provider-configuration files and provider classes, or
* {@code null} if the system class loader (or, failing that the
bootstrap class loader) is to be used.
*/
- IgniteImpl(String name,
- NodeBootstrapConfiguration configuration,
- Path workDir,
- @Nullable ClassLoader serviceProviderClassLoader
- ) {
+ IgniteImpl(String name, Path configPath, Path workDir, @Nullable
ClassLoader serviceProviderClassLoader) {
this.name = name;
longJvmPauseDetector = new LongJvmPauseDetector(name,
Loggers.forClass(LongJvmPauseDetector.class));
@@ -301,7 +297,7 @@ public class IgniteImpl implements Ignite {
nodeCfgMgr = new ConfigurationManager(
modules.local().rootKeys(),
modules.local().validators(),
- new LocalFileConfigurationStorage(configuration),
+ new LocalFileConfigurationStorage(configPath),
modules.local().internalSchemaExtensions(),
modules.local().polymorphicSchemaExtensions()
);
@@ -592,7 +588,7 @@ public class IgniteImpl implements Ignite {
* <p>When this method returns, the node is partially started and ready to
accept the init command (that is, its
* REST endpoint is functional).
*
- * @param cfg Optional node configuration based on
+ * @param configPath Node configuration based on
* {@link NetworkConfigurationSchema}. Following rules are used
for applying the
* configuration properties:
*
@@ -609,7 +605,7 @@ public class IgniteImpl implements Ignite {
* previously use default values. Please pay attention that
previously specified properties are searched in the
* {@code workDir} specified by the user.
*/
- public CompletableFuture<Ignite> start(NodeBootstrapConfiguration cfg) {
+ public CompletableFuture<Ignite> start(Path configPath) {
ExecutorService startupExecutor =
Executors.newSingleThreadExecutor(NamedThreadFactory.create(name, "start",
LOG));
try {
@@ -627,7 +623,7 @@ public class IgniteImpl implements Ignite {
// Node configuration manager bootstrap.
try {
- nodeCfgMgr.bootstrap(cfg.configPath());
+ nodeCfgMgr.bootstrap(configPath);
} catch (Exception e) {
throw new NodeConfigReadException("Unable to parse
user-specific configuration", e);
}
diff --git
a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgnitionImpl.java
b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgnitionImpl.java
index 6aa164a8c0..641c76cecc 100644
---
a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgnitionImpl.java
+++
b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgnitionImpl.java
@@ -20,19 +20,17 @@ package org.apache.ignite.internal.app;
import static java.lang.System.lineSeparator;
import com.google.auto.service.AutoService;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.ignite.Ignite;
import org.apache.ignite.Ignition;
import org.apache.ignite.InitParameters;
-import org.apache.ignite.internal.configuration.NodeBootstrapConfiguration;
import org.apache.ignite.internal.logger.IgniteLogger;
import org.apache.ignite.internal.logger.Loggers;
import org.apache.ignite.internal.properties.IgniteProductVersion;
@@ -89,45 +87,19 @@ public class IgnitionImpl implements Ignition {
Path workDir,
@Nullable ClassLoader serviceLoaderClassLoader
) {
- return doStart(
- nodeName,
- NodeBootstrapConfiguration.directFile(cfgPath),
- workDir,
- serviceLoaderClassLoader
- );
- }
-
- /** {@inheritDoc} */
- @Override
- public CompletableFuture<Ignite> start(String nodeName, @Nullable URL
cfgUrl, Path workDir) {
- if (cfgUrl == null) {
- return start(nodeName, workDir);
- } else {
- try (InputStream cfgStream = cfgUrl.openStream()) {
- return start(nodeName, cfgStream, workDir);
- } catch (IOException e) {
- throw new IgniteException("Unable to read user specific
configuration.", e);
- }
+ Objects.requireNonNull(cfgPath, "Config path must not be null");
+ if (Files.notExists(cfgPath)) {
+ throw new IgniteException("Config file doesn't exist");
}
- }
- /** {@inheritDoc} */
- @Override
- public CompletableFuture<Ignite> start(String nodeName, @Nullable
InputStream cfg, Path workDir) {
return doStart(
nodeName,
- NodeBootstrapConfiguration.inputStream(cfg, workDir),
+ cfgPath,
workDir,
- defaultServiceClassLoader()
+ serviceLoaderClassLoader
);
}
- /** {@inheritDoc} */
- @Override
- public CompletableFuture<Ignite> start(String nodeName, Path workDir) {
- return doStart(nodeName, NodeBootstrapConfiguration.empty(workDir),
workDir, defaultServiceClassLoader());
- }
-
/** {@inheritDoc} */
@Override
public void stop(String nodeName) {
@@ -186,14 +158,14 @@ public class IgnitionImpl implements Ignition {
* Starts an Ignite node with an optional bootstrap configuration from a
HOCON file.
*
* @param nodeName Name of the node. Must not be {@code null}.
- * @param configuration Path to node configuration in the HOCON format.
Can be {@code null}.
+ * @param configPath Path to node configuration in the HOCON format. Must
not be {@code null}.
* @param workDir Work directory for the started node. Must not be {@code
null}.
* @return Completable future that resolves into an Ignite node after all
components are started and the cluster initialization is
* complete.
*/
private static CompletableFuture<Ignite> doStart(
String nodeName,
- NodeBootstrapConfiguration configuration,
+ Path configPath,
Path workDir,
@Nullable ClassLoader serviceLoaderClassLoader
) {
@@ -201,7 +173,7 @@ public class IgnitionImpl implements Ignition {
throw new IllegalArgumentException("Node name must not be null or
empty.");
}
- IgniteImpl nodeToStart = new IgniteImpl(nodeName, configuration,
workDir, serviceLoaderClassLoader);
+ IgniteImpl nodeToStart = new IgniteImpl(nodeName, configPath, workDir,
serviceLoaderClassLoader);
IgniteImpl prevNode = nodes.putIfAbsent(nodeName, nodeToStart);
@@ -216,7 +188,7 @@ public class IgnitionImpl implements Ignition {
ackBanner();
try {
- CompletableFuture<Ignite> future = nodeToStart.start(configuration)
+ CompletableFuture<Ignite> future = nodeToStart.start(configPath)
.handle((ignite, e) -> {
if (e == null) {
ackSuccessStart();
diff --git
a/modules/runner/src/main/java/org/apache/ignite/internal/configuration/NodeBootstrapConfiguration.java
b/modules/runner/src/main/java/org/apache/ignite/internal/configuration/NodeBootstrapConfiguration.java
deleted file mode 100644
index a74b872a46..0000000000
---
a/modules/runner/src/main/java/org/apache/ignite/internal/configuration/NodeBootstrapConfiguration.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.apache.ignite.internal.configuration;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardOpenOption;
-import java.util.concurrent.atomic.AtomicReference;
-import org.intellij.lang.annotations.Language;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Node bootstrap configuration provider interface.
- */
-@FunctionalInterface
-public interface NodeBootstrapConfiguration {
- /**
- * Default name of configuration file.
- */
- String DEFAULT_CONFIG_NAME = "ignite-config.conf";
-
- /**
- * Path to node configuration file.
- *
- * @return Path to node configuration file in HOCON format.
- */
- Path configPath();
-
- /**
- * Simple config file provider.
- *
- * @param configPath Path to node bootstrap configuration.
- * @return Simple implementation with provided configuration file.
- */
- static NodeBootstrapConfiguration directFile(Path configPath) {
- return () -> configPath;
- }
-
- /**
- * Return node bootstrap configuration with content from {@param is}.
- *
- * @param is Configuration content.
- * @param workDir Dir for configuration file location.
- * @return Node bootstrap configuration with lazy config file creation.
- */
- //TODO: Move IGNITE-18778
- static NodeBootstrapConfiguration inputStream(@Nullable InputStream is,
Path workDir) {
- return new NodeBootstrapConfiguration() {
-
- private final AtomicReference<Path> config = new
AtomicReference<>();
-
- @Override
- public Path configPath() {
- if (config.compareAndSet(null, createEmptyConfig(workDir))) {
- if (is != null) {
- byte[] bytes;
- try {
- bytes = is.readAllBytes();
- } catch (IOException e) {
- throw new NodeConfigReadException("Failed to read
config input stream.", e);
- }
- try {
- Files.write(config.get(), bytes,
- StandardOpenOption.SYNC,
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
- } catch (IOException e) {
- throw new NodeConfigWriteException("Failed to
write config content to file.", e);
- }
- }
- }
-
- return config.get();
- }
- };
- }
-
- /**
- * Return node bootstrap configuration with content from {@param
plainConf}.
- *
- * @param plainConf Configuration content.
- * @param workDir Dir for configuration file location.
- * @return Node bootstrap configuration with lazy config file creation.
- */
- //TODO: Move IGNITE-18778
- static NodeBootstrapConfiguration string(@Nullable @Language("HOCON")
String plainConf, Path workDir) {
- InputStream is = plainConf != null
- ? new
ByteArrayInputStream(plainConf.getBytes(StandardCharsets.UTF_8))
- : null;
- return inputStream(is, workDir);
- }
-
- /**
- * Empty config provider.
- *
- * @param workDir Configuration file location.
- * @return Node bootstrap configuration provider to empty config.
- */
- static NodeBootstrapConfiguration empty(Path workDir) {
- return () -> createEmptyConfig(workDir);
- }
-
- private static Path createEmptyConfig(Path workDir) {
- try {
- Path config = workDir.resolve(DEFAULT_CONFIG_NAME);
- File file = config.toFile();
-
- if (!file.exists()) {
- file.createNewFile();
- }
-
- return config;
- } catch (IOException e) {
- throw new NodeConfigCreateException("Failed to create conf file.",
e);
- }
- }
-}
diff --git
a/modules/runner/src/main/java/org/apache/ignite/internal/configuration/storage/LocalFileConfigurationStorage.java
b/modules/runner/src/main/java/org/apache/ignite/internal/configuration/storage/LocalFileConfigurationStorage.java
index 6d48a8314e..7104f2ee78 100644
---
a/modules/runner/src/main/java/org/apache/ignite/internal/configuration/storage/LocalFileConfigurationStorage.java
+++
b/modules/runner/src/main/java/org/apache/ignite/internal/configuration/storage/LocalFileConfigurationStorage.java
@@ -42,7 +42,6 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.stream.Collectors;
import org.apache.ignite.configuration.annotation.ConfigurationType;
-import org.apache.ignite.internal.configuration.NodeBootstrapConfiguration;
import org.apache.ignite.internal.configuration.NodeConfigCreateException;
import org.apache.ignite.internal.configuration.NodeConfigWriteException;
import org.apache.ignite.internal.future.InFlightFutures;
@@ -88,10 +87,10 @@ public class LocalFileConfigurationStorage implements
ConfigurationStorage {
/**
* Constructor.
*
- * @param configuration Node bootstrap configuration.
+ * @param configPath Path to node bootstrap configuration file.
*/
- public LocalFileConfigurationStorage(NodeBootstrapConfiguration
configuration) {
- this.configPath = configuration.configPath();
+ public LocalFileConfigurationStorage(Path configPath) {
+ this.configPath = configPath;
tempConfigPath = configPath.resolveSibling(configPath.getFileName() +
".tmp");
checkAndRestoreConfigFile();
}
diff --git
a/modules/runner/src/test/java/org/apache/ignite/internal/configuration/storage/LocalFileConfigurationStorageTest.java
b/modules/runner/src/test/java/org/apache/ignite/internal/configuration/storage/LocalFileConfigurationStorageTest.java
index e2ca7d1b19..641947364e 100644
---
a/modules/runner/src/test/java/org/apache/ignite/internal/configuration/storage/LocalFileConfigurationStorageTest.java
+++
b/modules/runner/src/test/java/org/apache/ignite/internal/configuration/storage/LocalFileConfigurationStorageTest.java
@@ -28,7 +28,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.ignite.internal.configuration.NodeBootstrapConfiguration;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.junit.jupiter.api.Test;
@@ -40,13 +39,14 @@ import org.junit.jupiter.api.extension.ExtendWith;
@ExtendWith(WorkDirectoryExtension.class)
public class LocalFileConfigurationStorageTest extends
ConfigurationStorageTest {
+ private static final String CONFIG_NAME = "ignite-config.conf";
+
@WorkDirectory
private Path tmpDir;
@Override
public ConfigurationStorage getStorage() {
- Path configFile = getConfigFile();
- return new
LocalFileConfigurationStorage(NodeBootstrapConfiguration.directFile(configFile));
+ return new LocalFileConfigurationStorage(getConfigFile());
}
@Test
@@ -84,6 +84,6 @@ public class LocalFileConfigurationStorageTest extends
ConfigurationStorageTest
}
private Path getConfigFile() {
- return tmpDir.resolve(NodeBootstrapConfiguration.DEFAULT_CONFIG_NAME);
+ return tmpDir.resolve(CONFIG_NAME);
}
}