From 864ea8844ade7774fde543904894199c1115d34a Mon Sep 17 00:00:00 2001 From: Hendrik Ebbers Date: Mon, 4 Dec 2023 17:17:50 +0100 Subject: [PATCH] feat: Config constants created & used (#10117) Signed-off-by: Hendrik Ebbers --- .../ConsistencyTestingTool/build.gradle.kts | 2 ++ .../tests/ISSTestingTool/build.gradle.kts | 2 ++ .../tests/StressTestingTool/build.gradle.kts | 2 ++ .../common/config/BasicConfigTest.java | 2 +- .../common/config/TransactionConfigTest.java | 4 +-- .../common/io/utility/RecycleBinTests.java | 12 ++++--- .../metrics/platform/DefaultMetricsTest.java | 5 +-- .../metrics/platform/LegacyCsvWriterTest.java | 33 +++++++++++-------- .../common/scratchpad/ScratchpadTests.java | 3 +- .../PlatformStatusStateMachineTests.java | 4 +-- .../status/logic/ActiveStatusLogicTests.java | 3 +- .../logic/ObservingStatusLogicTests.java | 3 +- .../swirlds-config-processor/build.gradle.kts | 2 +- .../ConfigDataAnnotationProcessor.java | 4 ++- .../swirlds-fchashmap/build.gradle.kts | 2 ++ .../swirlds-jasperdb/build.gradle.kts | 2 ++ .../reconnect/VirtualMapReconnectTest.java | 7 ++-- .../VirtualMapReconnectTestBase.java | 7 ++-- .../swirlds-platform-core/build.gradle.kts | 5 ++- .../platform/AddressBookInitializerTest.java | 7 ++-- .../platform/ReconnectThrottleTest.java | 9 ++--- .../platform/SignedStateFileManagerTests.java | 27 ++++++++++----- .../SignedStateFileReadWriteTest.java | 3 +- .../SwirldTransactionSubmitterTest.java | 3 +- .../com/swirlds/platform/SyncManagerTest.java | 8 +++-- .../state/StateManagementComponentTests.java | 5 +-- .../ConsensusRoundHandlerTests.java | 3 +- .../connectivity/SocketFactoryTest.java | 5 +-- .../RandomVirtualMapReconnectTests.java | 7 ++-- .../reconnect/ReconnectProtocolTests.java | 3 +- .../VirtualMapReconnectTestBase.java | 7 ++-- .../EmergencyReconnectProtocolTests.java | 3 +- .../AbstractSignedStateManagerTest.java | 7 ++-- .../state/signed/StartupStateUtilsTests.java | 5 +-- .../platform/util/MetricsDocUtilsTest.java | 3 +- .../common/test/merkle/AsyncStreamTest.java | 7 ++-- .../merkle/MerkleSynchronizationTests.java | 5 +-- .../test/chatter/ChatterCoreTests.java | 3 +- .../network/framework/NodeBuilder.java | 7 ++-- .../consensus/IntakeAndConsensusTests.java | 5 +-- .../AsyncPreconsensusEventWriterTests.java | 14 ++++---- .../PreconsensusEventFileManagerTests.java | 11 ++++--- .../PreconsensusEventFileTests.java | 3 +- .../SyncPreconsensusEventWriterTests.java | 14 ++++---- .../event/tipset/EventCreationRulesTests.java | 3 +- .../OutboundConnectionCreatorTest.java | 5 +-- .../reconnect/FallenBehindManagerTest.java | 3 +- .../swirlds-virtualmap/build.gradle.kts | 2 ++ .../internal/merkle/VirtualRootNodeTest.java | 3 +- .../pipeline/VirtualPipelineTests.java | 5 +-- .../VirtualMapReconnectTestBase.java | 5 +-- 51 files changed, 190 insertions(+), 114 deletions(-) diff --git a/platform-sdk/platform-apps/tests/ConsistencyTestingTool/build.gradle.kts b/platform-sdk/platform-apps/tests/ConsistencyTestingTool/build.gradle.kts index b1fb7d06e0e7..52a46f153bfa 100644 --- a/platform-sdk/platform-apps/tests/ConsistencyTestingTool/build.gradle.kts +++ b/platform-sdk/platform-apps/tests/ConsistencyTestingTool/build.gradle.kts @@ -18,6 +18,8 @@ plugins { id("com.hedera.hashgraph.application") } application.mainClass.set("com.swirlds.demo.consistency.ConsistencyTestingToolMain") +mainModuleInfo { annotationProcessor("com.swirlds.config.processor") } + testModuleInfo { requires("com.swirlds.platform.core") requires("org.junit.jupiter.api") diff --git a/platform-sdk/platform-apps/tests/ISSTestingTool/build.gradle.kts b/platform-sdk/platform-apps/tests/ISSTestingTool/build.gradle.kts index 1185780d150f..d78d070bf5d5 100644 --- a/platform-sdk/platform-apps/tests/ISSTestingTool/build.gradle.kts +++ b/platform-sdk/platform-apps/tests/ISSTestingTool/build.gradle.kts @@ -17,3 +17,5 @@ plugins { id("com.hedera.hashgraph.application") } application.mainClass.set("com.swirlds.demo.iss.ISSTestingToolMain") + +mainModuleInfo { annotationProcessor("com.swirlds.config.processor") } diff --git a/platform-sdk/platform-apps/tests/StressTestingTool/build.gradle.kts b/platform-sdk/platform-apps/tests/StressTestingTool/build.gradle.kts index 6dd61456f710..7f0aa489fc8d 100644 --- a/platform-sdk/platform-apps/tests/StressTestingTool/build.gradle.kts +++ b/platform-sdk/platform-apps/tests/StressTestingTool/build.gradle.kts @@ -17,3 +17,5 @@ plugins { id("com.hedera.hashgraph.application") } application.mainClass.set("com.swirlds.demo.stress.StressTestingToolMain") + +mainModuleInfo { annotationProcessor("com.swirlds.config.processor") } diff --git a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/config/BasicConfigTest.java b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/config/BasicConfigTest.java index f44b29e1db7d..a1b79d442417 100644 --- a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/config/BasicConfigTest.java +++ b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/config/BasicConfigTest.java @@ -37,7 +37,7 @@ public void testDefaultValuesValid() { void propertiesHasNoPrefix() { // given final Configuration configuration = new TestConfigBuilder() - .withValue("jvmPauseDetectorSleepMs", "42") + .withValue(BasicConfig_.JVM_PAUSE_DETECTOR_SLEEP_MS, "42") .getOrCreateConfig(); final BasicConfig basicConfig = configuration.getConfigData(BasicConfig.class); diff --git a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/config/TransactionConfigTest.java b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/config/TransactionConfigTest.java index ae4fc5bf0f60..efa3befb3ebf 100644 --- a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/config/TransactionConfigTest.java +++ b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/config/TransactionConfigTest.java @@ -25,8 +25,8 @@ class TransactionConfigTest { @Test void testValidation() { final TestConfigBuilder builder = new TestConfigBuilder() - .withValue("transaction.maxTransactionBytesPerEvent", "1") - .withValue("transaction.transactionMaxBytes", "12"); + .withValue(TransactionConfig_.MAX_TRANSACTION_BYTES_PER_EVENT, "1") + .withValue(TransactionConfig_.TRANSACTION_MAX_BYTES, "12"); Assertions.assertThrows( ConfigViolationException.class, diff --git a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/io/utility/RecycleBinTests.java b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/io/utility/RecycleBinTests.java index 6b885d1365ec..9dada38e204e 100644 --- a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/io/utility/RecycleBinTests.java +++ b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/io/utility/RecycleBinTests.java @@ -24,7 +24,9 @@ import com.swirlds.base.test.fixtures.time.FakeTime; import com.swirlds.base.time.Time; +import com.swirlds.common.config.StateConfig_; import com.swirlds.common.io.config.RecycleBinConfig; +import com.swirlds.common.io.config.RecycleBinConfig_; import com.swirlds.common.metrics.noop.NoOpMetrics; import com.swirlds.common.system.NodeId; import com.swirlds.config.api.Configuration; @@ -57,7 +59,7 @@ class RecycleBinTests { void beforeEach() throws IOException { FileUtils.deleteDirectory(testDirectory); configuration = new TestConfigBuilder() - .withValue("state.savedStateDirectory", testDirectory.toString()) + .withValue(StateConfig_.SAVED_STATE_DIRECTORY, testDirectory.toString()) .getOrCreateConfig(); } @@ -213,8 +215,8 @@ void filesDeletedAfterTimePasses() throws IOException, InterruptedException { final FakeTime time = new FakeTime(Instant.now(), Duration.ZERO); final Configuration customConfiguration = new TestConfigBuilder() - .withValue("state.savedStateDirectory", testDirectory.toString()) - .withValue("recycleBin.collectionPeriod", "1ns") + .withValue(StateConfig_.SAVED_STATE_DIRECTORY, testDirectory.toString()) + .withValue(RecycleBinConfig_.COLLECTION_PERIOD, "1ns") .getOrCreateConfig(); final Duration maximumFileAge = @@ -279,8 +281,8 @@ void clearTest() throws IOException, InterruptedException { final FakeTime time = new FakeTime(Instant.now(), Duration.ZERO); final Configuration customConfiguration = new TestConfigBuilder() - .withValue("state.savedStateDirectory", testDirectory.toString()) - .withValue("recycleBin.collectionPeriod", "1ns") + .withValue(StateConfig_.SAVED_STATE_DIRECTORY, testDirectory.toString()) + .withValue(RecycleBinConfig_.COLLECTION_PERIOD, "1ns") .getOrCreateConfig(); final RecycleBinImpl recycleBin = new RecycleBinImpl( diff --git a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/metrics/platform/DefaultMetricsTest.java b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/metrics/platform/DefaultMetricsTest.java index 6e627f156d17..8cf734d4e9ad 100644 --- a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/metrics/platform/DefaultMetricsTest.java +++ b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/metrics/platform/DefaultMetricsTest.java @@ -38,6 +38,7 @@ import com.swirlds.common.metrics.MetricConfig; import com.swirlds.common.metrics.PlatformMetricsFactory; import com.swirlds.common.metrics.config.MetricsConfig; +import com.swirlds.common.metrics.config.MetricsConfig_; import com.swirlds.common.system.NodeId; import com.swirlds.config.api.Configuration; import com.swirlds.test.framework.config.TestConfigBuilder; @@ -100,7 +101,7 @@ class DefaultMetricsTest { @BeforeEach void setupService() { final Configuration configuration = new TestConfigBuilder() - .withValue("metrics.metricsUpdatePeriodMillis", 10L) + .withValue(MetricsConfig_.METRICS_UPDATE_PERIOD_MILLIS, 10L) .getOrCreateConfig(); metricsConfig = configuration.getConfigData(MetricsConfig.class); @@ -577,7 +578,7 @@ void testUpdater(@Mock final Runnable updater) { void testDisabledUpdater(@Mock final Runnable updater) { // given final Configuration configuration = new TestConfigBuilder() - .withValue("metrics.metricsUpdatePeriodMillis", 0L) + .withValue(MetricsConfig_.METRICS_UPDATE_PERIOD_MILLIS, 0L) .getOrCreateConfig(); metricsConfig = configuration.getConfigData(MetricsConfig.class); final DefaultMetrics metrics = new DefaultMetrics(NODE_ID, registry, executor, factory, metricsConfig); diff --git a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/metrics/platform/LegacyCsvWriterTest.java b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/metrics/platform/LegacyCsvWriterTest.java index 3617c82d548d..a71ea8f30389 100644 --- a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/metrics/platform/LegacyCsvWriterTest.java +++ b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/metrics/platform/LegacyCsvWriterTest.java @@ -22,6 +22,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import com.swirlds.common.config.BasicConfig_; import com.swirlds.common.metrics.Counter; import com.swirlds.common.metrics.DoubleGauge; import com.swirlds.common.metrics.FunctionGauge; @@ -36,6 +37,7 @@ import com.swirlds.common.metrics.SpeedometerMetric; import com.swirlds.common.metrics.StatEntry; import com.swirlds.common.metrics.config.MetricsConfig; +import com.swirlds.common.metrics.config.MetricsConfig_; import com.swirlds.common.system.NodeId; import com.swirlds.config.api.Configuration; import com.swirlds.test.framework.config.TestConfigBuilder; @@ -61,10 +63,10 @@ class LegacyCsvWriterTest { @BeforeEach void setStandardSettings() { configuration = new TestConfigBuilder() - .withValue("metrics.csvOutputFolder", tempDir.toString()) - .withValue("metrics.csvAppend", "false") - .withValue("showInternalStats", "false") - .withValue("verboseStatistics", "false") + .withValue(MetricsConfig_.CSV_OUTPUT_FOLDER, tempDir.toString()) + .withValue(MetricsConfig_.CSV_APPEND, "false") + .withValue(BasicConfig_.SHOW_INTERNAL_STATS, "false") + .withValue(BasicConfig_.VERBOSE_STATISTICS, "false") .getOrCreateConfig(); metricsConfig = configuration.getConfigData(MetricsConfig.class); @@ -251,8 +253,8 @@ void testWriteWithExistingFile() throws IOException { void testWriteWithAppendedModeAndExistingFile() throws IOException { // given final Configuration configuration = new TestConfigBuilder() - .withValue("metrics.csvOutputFolder", tempDir.toString()) - .withValue("metrics.csvAppend", "true") + .withValue(MetricsConfig_.CSV_OUTPUT_FOLDER, tempDir.toString()) + .withValue(MetricsConfig_.CSV_APPEND, "true") .getOrCreateConfig(); final LegacyCsvWriter writer = new LegacyCsvWriter(NODE_ID, tempDir, configuration); final Path csvFilePath = writer.getCsvFilePath(); @@ -301,8 +303,8 @@ void testWriteWithAppendedModeAndExistingFile() throws IOException { void testWriteWithAppendedModeAndNonExistingFile() throws IOException { // given final Configuration configuration = new TestConfigBuilder() - .withValue("metrics.csvOutputFolder", tempDir.toString()) - .withValue("metrics.csvAppend", "true") + .withValue(MetricsConfig_.CSV_OUTPUT_FOLDER, tempDir.toString()) + .withValue(MetricsConfig_.CSV_APPEND, "true") .getOrCreateConfig(); final LegacyCsvWriter writer = new LegacyCsvWriter(NODE_ID, tempDir, configuration); final Path csvFilePath = writer.getCsvFilePath(); @@ -379,8 +381,9 @@ void testWriteWithInternalIgnored() throws IOException { @Test void testWriteWithInternalNotIgnored() throws IOException { - final Configuration configuration = - new TestConfigBuilder().withValue("showInternalStats", "true").getOrCreateConfig(); + final Configuration configuration = new TestConfigBuilder() + .withValue(BasicConfig_.SHOW_INTERNAL_STATS, "true") + .getOrCreateConfig(); // given final LegacyCsvWriter writer = new LegacyCsvWriter(NODE_ID, tempDir, configuration); final Path csvFilePath = writer.getCsvFilePath(); @@ -476,8 +479,9 @@ void testWriteWithSecondaryValuesNotIncluded() throws IOException { @Test void testWriteWithSecondaryValuesIncluded() throws IOException { // given - final Configuration configuration = - new TestConfigBuilder().withValue("verboseStatistics", "true").getOrCreateConfig(); + final Configuration configuration = new TestConfigBuilder() + .withValue(BasicConfig_.VERBOSE_STATISTICS, "true") + .getOrCreateConfig(); final LegacyCsvWriter writer = new LegacyCsvWriter(NODE_ID, tempDir, configuration); final Path csvFilePath = writer.getCsvFilePath(); final List metrics = createListWithSecondaryValues(); @@ -643,8 +647,9 @@ void testChangedEntriesWithComplexMetricsAndNoSecondaryValues() throws IOExcepti @Test void testChangedEntriesWithComplexMetricsAndSecondaryValues() throws IOException { // given - final Configuration configuration = - new TestConfigBuilder().withValue("verboseStatistics", "true").getOrCreateConfig(); + final Configuration configuration = new TestConfigBuilder() + .withValue(BasicConfig_.VERBOSE_STATISTICS, "true") + .getOrCreateConfig(); final LegacyCsvWriter writer = new LegacyCsvWriter(NODE_ID, tempDir, configuration); final Path csvFilePath = writer.getCsvFilePath(); final List metrics = createComplexList(); diff --git a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/scratchpad/ScratchpadTests.java b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/scratchpad/ScratchpadTests.java index 1719d702b12a..17780f27535f 100644 --- a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/scratchpad/ScratchpadTests.java +++ b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/scratchpad/ScratchpadTests.java @@ -26,6 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; +import com.swirlds.common.config.StateConfig_; import com.swirlds.common.constructable.ConstructableRegistry; import com.swirlds.common.constructable.ConstructableRegistryException; import com.swirlds.common.context.PlatformContext; @@ -68,7 +69,7 @@ void beforeEach() throws IOException { Files.createDirectories(testDirectory); TemporaryFileBuilder.overrideTemporaryFileLocation(testDirectory.resolve("tmp")); final Configuration configuration = new TestConfigBuilder() - .withValue("state.savedStateDirectory", testDirectory.toString()) + .withValue(StateConfig_.SAVED_STATE_DIRECTORY, testDirectory.toString()) .getOrCreateConfig(); platformContext = TestPlatformContextBuilder.create() .withConfiguration(configuration) diff --git a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/system/status/PlatformStatusStateMachineTests.java b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/system/status/PlatformStatusStateMachineTests.java index 4f031cd2e03a..292e34d229c4 100644 --- a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/system/status/PlatformStatusStateMachineTests.java +++ b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/system/status/PlatformStatusStateMachineTests.java @@ -50,8 +50,8 @@ class PlatformStatusStateMachineTests { void setup() { time = new FakeTime(); final Configuration configuration = new TestConfigBuilder() - .withValue("platformStatus.observingStatusDelay", "5s") - .withValue("platformStatus.activeStatusDelay", "10s") + .withValue(PlatformStatusConfig_.OBSERVING_STATUS_DELAY, "5s") + .withValue(PlatformStatusConfig_.ACTIVE_STATUS_DELAY, "10s") .getOrCreateConfig(); stateMachine = new PlatformStatusStateMachine( diff --git a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/system/status/logic/ActiveStatusLogicTests.java b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/system/status/logic/ActiveStatusLogicTests.java index 0f924252032a..5639c55a554b 100644 --- a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/system/status/logic/ActiveStatusLogicTests.java +++ b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/system/status/logic/ActiveStatusLogicTests.java @@ -23,6 +23,7 @@ import com.swirlds.base.test.fixtures.time.FakeTime; import com.swirlds.common.system.status.PlatformStatus; import com.swirlds.common.system.status.PlatformStatusConfig; +import com.swirlds.common.system.status.PlatformStatusConfig_; import com.swirlds.common.system.status.actions.CatastrophicFailureAction; import com.swirlds.common.system.status.actions.DoneReplayingEventsAction; import com.swirlds.common.system.status.actions.EmergencyReconnectStartedAction; @@ -51,7 +52,7 @@ class ActiveStatusLogicTests { void setup() { time = new FakeTime(); final Configuration configuration = new TestConfigBuilder() - .withValue("platformStatus.activeStatusDelay", "5s") + .withValue(PlatformStatusConfig_.ACTIVE_STATUS_DELAY, "5s") .getOrCreateConfig(); logic = new ActiveStatusLogic(time.now(), configuration.getConfigData(PlatformStatusConfig.class)); } diff --git a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/system/status/logic/ObservingStatusLogicTests.java b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/system/status/logic/ObservingStatusLogicTests.java index a9f26fcfb0c0..fcfb76897949 100644 --- a/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/system/status/logic/ObservingStatusLogicTests.java +++ b/platform-sdk/swirlds-common/src/test/java/com/swirlds/common/system/status/logic/ObservingStatusLogicTests.java @@ -23,6 +23,7 @@ import com.swirlds.base.test.fixtures.time.FakeTime; import com.swirlds.common.system.status.PlatformStatus; import com.swirlds.common.system.status.PlatformStatusConfig; +import com.swirlds.common.system.status.PlatformStatusConfig_; import com.swirlds.common.system.status.actions.CatastrophicFailureAction; import com.swirlds.common.system.status.actions.DoneReplayingEventsAction; import com.swirlds.common.system.status.actions.EmergencyReconnectStartedAction; @@ -51,7 +52,7 @@ class ObservingStatusLogicTests { void setup() { time = new FakeTime(); final Configuration configuration = new TestConfigBuilder() - .withValue("platformStatus.observingStatusDelay", "5s") + .withValue(PlatformStatusConfig_.OBSERVING_STATUS_DELAY, "5s") .getOrCreateConfig(); logic = new ObservingStatusLogic(time.now(), configuration.getConfigData(PlatformStatusConfig.class)); } diff --git a/platform-sdk/swirlds-config-processor/build.gradle.kts b/platform-sdk/swirlds-config-processor/build.gradle.kts index bf1e20a29685..0587a0f95cdb 100644 --- a/platform-sdk/swirlds-config-processor/build.gradle.kts +++ b/platform-sdk/swirlds-config-processor/build.gradle.kts @@ -26,7 +26,7 @@ testModuleInfo { requires("org.junit.jupiter.api") } tasks.register("generateParser") { conventionMapping.map("antlrClasspath") { - configurations.detachedConfiguration(dependencies.create("org.antlr:antlr4:4.13.1")) + configurations.detachedConfiguration(dependencies.create("org.antlr:antlr4:4.11.1")) } source(layout.projectDirectory.dir("src/main/antlr")) outputDirectory = diff --git a/platform-sdk/swirlds-config-processor/src/main/java/com/swirlds/config/processor/ConfigDataAnnotationProcessor.java b/platform-sdk/swirlds-config-processor/src/main/java/com/swirlds/config/processor/ConfigDataAnnotationProcessor.java index 13bb5680fac8..975b0a2d62c0 100644 --- a/platform-sdk/swirlds-config-processor/src/main/java/com/swirlds/config/processor/ConfigDataAnnotationProcessor.java +++ b/platform-sdk/swirlds-config-processor/src/main/java/com/swirlds/config/processor/ConfigDataAnnotationProcessor.java @@ -138,6 +138,8 @@ private FileObject getSource(@NonNull final String fileName, @NonNull final Stri protected void log(@NonNull final String message) { Objects.requireNonNull(message, "message must not be null"); - processingEnv.getMessager().printMessage(Kind.NOTE, message); + processingEnv + .getMessager() + .printMessage(Kind.OTHER, ConfigDataAnnotationProcessor.class.getSimpleName() + ": " + message); } } diff --git a/platform-sdk/swirlds-fchashmap/build.gradle.kts b/platform-sdk/swirlds-fchashmap/build.gradle.kts index 7ac6810e06ed..a1a99a4095f4 100644 --- a/platform-sdk/swirlds-fchashmap/build.gradle.kts +++ b/platform-sdk/swirlds-fchashmap/build.gradle.kts @@ -19,6 +19,8 @@ plugins { id("com.hedera.hashgraph.platform-maven-publish") } +mainModuleInfo { annotationProcessor("com.swirlds.config.processor") } + testModuleInfo { requires("com.swirlds.base") requires("com.swirlds.config.extensions") diff --git a/platform-sdk/swirlds-jasperdb/build.gradle.kts b/platform-sdk/swirlds-jasperdb/build.gradle.kts index 549f72f690cb..bbf0140e378d 100644 --- a/platform-sdk/swirlds-jasperdb/build.gradle.kts +++ b/platform-sdk/swirlds-jasperdb/build.gradle.kts @@ -20,6 +20,8 @@ plugins { id("com.hedera.hashgraph.benchmark-conventions") } +mainModuleInfo { annotationProcessor("com.swirlds.config.processor") } + jmhModuleInfo { requires("jmh.core") } testModuleInfo { diff --git a/platform-sdk/swirlds-merkle/src/test/java/com/swirlds/virtual/merkle/reconnect/VirtualMapReconnectTest.java b/platform-sdk/swirlds-merkle/src/test/java/com/swirlds/virtual/merkle/reconnect/VirtualMapReconnectTest.java index 3d5c1eddf489..97f8dd166350 100644 --- a/platform-sdk/swirlds-merkle/src/test/java/com/swirlds/virtual/merkle/reconnect/VirtualMapReconnectTest.java +++ b/platform-sdk/swirlds-merkle/src/test/java/com/swirlds/virtual/merkle/reconnect/VirtualMapReconnectTest.java @@ -31,6 +31,7 @@ import com.swirlds.common.test.merkle.dummy.DummyMerkleInternal; import com.swirlds.common.test.merkle.util.MerkleTestUtils; import com.swirlds.config.api.Configuration; +import com.swirlds.merkledb.config.MerkleDbConfig_; import com.swirlds.test.framework.config.TestConfigBuilder; import com.swirlds.virtual.merkle.TestKey; import com.swirlds.virtual.merkle.TestValue; @@ -59,9 +60,9 @@ class VirtualMapReconnectTest extends VirtualMapReconnectTestBase { @BeforeAll static void beforeAll() throws Exception { final Configuration config = new TestConfigBuilder() - .withValue("merkleDb.keySetBloomFilterSizeInBytes", 2 * MEBIBYTES_TO_BYTES * BYTES_TO_BITS) - .withValue("merkleDb.keySetHalfDiskHashMapSize", "10000") - .withValue("merkleDb.keySetHalfDiskHashMapBuffer", "1000") + .withValue(MerkleDbConfig_.KEY_SET_BLOOM_FILTER_SIZE_IN_BYTES, 2 * MEBIBYTES_TO_BYTES * BYTES_TO_BITS) + .withValue(MerkleDbConfig_.KEY_SET_HALF_DISK_HASH_MAP_SIZE, "10000") + .withValue(MerkleDbConfig_.KEY_SET_HALF_DISK_HASH_MAP_BUFFER, "1000") .getOrCreateConfig(); ConfigurationHolder.getInstance().setConfiguration(config); diff --git a/platform-sdk/swirlds-merkle/src/test/java/com/swirlds/virtual/merkle/reconnect/VirtualMapReconnectTestBase.java b/platform-sdk/swirlds-merkle/src/test/java/com/swirlds/virtual/merkle/reconnect/VirtualMapReconnectTestBase.java index a775775e1cc5..4d31d509cb8a 100644 --- a/platform-sdk/swirlds-merkle/src/test/java/com/swirlds/virtual/merkle/reconnect/VirtualMapReconnectTestBase.java +++ b/platform-sdk/swirlds-merkle/src/test/java/com/swirlds/virtual/merkle/reconnect/VirtualMapReconnectTestBase.java @@ -29,6 +29,7 @@ import com.swirlds.common.merkle.MerkleInternal; import com.swirlds.common.merkle.MerkleNode; import com.swirlds.common.merkle.synchronization.config.ReconnectConfig; +import com.swirlds.common.merkle.synchronization.config.ReconnectConfig_; import com.swirlds.common.merkle.synchronization.internal.Lesson; import com.swirlds.common.merkle.synchronization.internal.QueryResponse; import com.swirlds.common.test.merkle.dummy.DummyMerkleInternal; @@ -151,10 +152,10 @@ public static void startup() throws ConstructableRegistryException, FileNotFound registry.registerConstructable(new ClassConstructorPair(TestValue.class, TestValue::new)); new TestConfigBuilder() - .withValue("reconnect.active", "true") + .withValue(ReconnectConfig_.ACTIVE, "true") // This is lower than the default, helps test that is supposed to fail to finish faster. - .withValue("reconnect.asyncStreamTimeout", "5000ms") - .withValue("reconnect.maxAckDelay", "1000ms") + .withValue(ReconnectConfig_.ASYNC_STREAM_TIMEOUT, "5000ms") + .withValue(ReconnectConfig_.MAX_ACK_DELAY, "1000ms") .getOrCreateConfig(); } diff --git a/platform-sdk/swirlds-platform-core/build.gradle.kts b/platform-sdk/swirlds-platform-core/build.gradle.kts index 41d48d7fe3cc..68543749dbe9 100644 --- a/platform-sdk/swirlds-platform-core/build.gradle.kts +++ b/platform-sdk/swirlds-platform-core/build.gradle.kts @@ -21,7 +21,10 @@ plugins { id("java-test-fixtures") } -mainModuleInfo { runtimeOnly("com.swirlds.config.impl") } +mainModuleInfo { + annotationProcessor("com.swirlds.config.processor") + runtimeOnly("com.swirlds.config.impl") +} jmhModuleInfo { requires("com.swirlds.base") diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/AddressBookInitializerTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/AddressBookInitializerTest.java index e31985b7928a..936cd6f88576 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/AddressBookInitializerTest.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/AddressBookInitializerTest.java @@ -37,6 +37,7 @@ import com.swirlds.common.system.address.Address; import com.swirlds.common.system.address.AddressBook; import com.swirlds.common.test.fixtures.RandomAddressBookGenerator; +import com.swirlds.platform.config.AddressBookConfig_; import com.swirlds.platform.state.PlatformData; import com.swirlds.platform.state.PlatformState; import com.swirlds.platform.state.State; @@ -500,9 +501,9 @@ private void assertAddressBookFileContent( private PlatformContext getPlatformContext(boolean forceUseOfConfigAddressBook) { return TestPlatformContextBuilder.create() .withConfiguration(new TestConfigBuilder() - .withValue("addressBook.forceUseOfConfigAddressBook", forceUseOfConfigAddressBook) - .withValue("addressBook.addressBookDirectory", testDirectory.toString()) - .withValue("addressBook.maxRecordedAddressBookFiles", 50) + .withValue(AddressBookConfig_.FORCE_USE_OF_CONFIG_ADDRESS_BOOK, forceUseOfConfigAddressBook) + .withValue(AddressBookConfig_.ADDRESS_BOOK_DIRECTORY, testDirectory.toString()) + .withValue(AddressBookConfig_.MAX_RECORDED_ADDRESS_BOOK_FILES, 50) .getOrCreateConfig()) .build(); } diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/ReconnectThrottleTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/ReconnectThrottleTest.java index 2316bffad20f..2a305a76d8e3 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/ReconnectThrottleTest.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/ReconnectThrottleTest.java @@ -21,6 +21,7 @@ import com.swirlds.base.time.Time; import com.swirlds.common.merkle.synchronization.config.ReconnectConfig; +import com.swirlds.common.merkle.synchronization.config.ReconnectConfig_; import com.swirlds.common.system.NodeId; import com.swirlds.config.api.Configuration; import com.swirlds.platform.reconnect.ReconnectThrottle; @@ -37,10 +38,10 @@ class ReconnectThrottleTest { private ReconnectConfig buildSettings(final String minimumTimeBetweenReconnects) { final Configuration config = new TestConfigBuilder() - .withValue("reconnect.active", "true") - .withValue("reconnect.asyncStreamTimeout", "0ms") // Not needed in Test - .withValue("reconnect.asyncOutputStreamFlush", "0ms") // Not needed in Test - .withValue("reconnect.minimumTimeBetweenReconnects", minimumTimeBetweenReconnects) + .withValue(ReconnectConfig_.ACTIVE, "true") + .withValue(ReconnectConfig_.ASYNC_STREAM_TIMEOUT, "0ms") // Not needed in Test + .withValue(ReconnectConfig_.ASYNC_OUTPUT_STREAM_FLUSH, "0ms") // Not needed in Test + .withValue(ReconnectConfig_.MINIMUM_TIME_BETWEEN_RECONNECTS, minimumTimeBetweenReconnects) .getOrCreateConfig(); return config.getConfigData(ReconnectConfig.class); diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SignedStateFileManagerTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SignedStateFileManagerTests.java index 26a6d093d271..2085307d0cf9 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SignedStateFileManagerTests.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SignedStateFileManagerTests.java @@ -38,6 +38,7 @@ import com.swirlds.base.test.fixtures.time.FakeTime; import com.swirlds.common.config.StateConfig; +import com.swirlds.common.config.StateConfig_; import com.swirlds.common.constructable.ConstructableRegistry; import com.swirlds.common.constructable.ConstructableRegistryException; import com.swirlds.common.context.PlatformContext; @@ -167,7 +168,9 @@ private void validateSavingOfState(final SignedState originalState, final Path s @DisplayName("Standard Operation Test") void standardOperationTest(final boolean successExpected) throws IOException { final TestConfigBuilder configBuilder = new TestConfigBuilder() - .withValue("state.savedStateDirectory", testDirectory.toFile().toString()); + .withValue( + StateConfig_.SAVED_STATE_DIRECTORY, + testDirectory.toFile().toString()); final PlatformContext context = TestPlatformContextBuilder.create() .withConfiguration(configBuilder.getOrCreateConfig()) .build(); @@ -199,7 +202,9 @@ void standardOperationTest(final boolean successExpected) throws IOException { @DisplayName("Save Fatal Signed State") void saveFatalSignedState() throws InterruptedException, IOException { final TestConfigBuilder configBuilder = new TestConfigBuilder() - .withValue("state.savedStateDirectory", testDirectory.toFile().toString()); + .withValue( + StateConfig_.SAVED_STATE_DIRECTORY, + testDirectory.toFile().toString()); final PlatformContext context = TestPlatformContextBuilder.create() .withConfiguration(configBuilder.getOrCreateConfig()) .build(); @@ -232,7 +237,9 @@ void saveFatalSignedState() throws InterruptedException, IOException { @DisplayName("Save ISS Signed State") void saveISSignedState() throws IOException { final TestConfigBuilder configBuilder = new TestConfigBuilder() - .withValue("state.savedStateDirectory", testDirectory.toFile().toString()); + .withValue( + StateConfig_.SAVED_STATE_DIRECTORY, + testDirectory.toFile().toString()); final PlatformContext context = TestPlatformContextBuilder.create() .withConfiguration(configBuilder.getOrCreateConfig()) .build(); @@ -264,9 +271,11 @@ void sequenceOfStatesTest(final boolean startAtGenesis) throws IOException { final int stateSavePeriod = 100; final int statesOnDisk = 3; final TestConfigBuilder configBuilder = new TestConfigBuilder() - .withValue("state.saveStatePeriod", stateSavePeriod) - .withValue("state.signedStateDisk", statesOnDisk) - .withValue("state.savedStateDirectory", testDirectory.toFile().toString()); + .withValue(StateConfig_.SAVE_STATE_PERIOD, stateSavePeriod) + .withValue(StateConfig_.SIGNED_STATE_DISK, statesOnDisk) + .withValue( + StateConfig_.SAVED_STATE_DIRECTORY, + testDirectory.toFile().toString()); final PlatformContext context = TestPlatformContextBuilder.create() .withConfiguration(configBuilder.getOrCreateConfig()) .build(); @@ -385,8 +394,10 @@ void stateDeletionTest() throws IOException { final int statesOnDisk = 3; final TestConfigBuilder configBuilder = new TestConfigBuilder() - .withValue("state.signedStateDisk", statesOnDisk) - .withValue("state.savedStateDirectory", testDirectory.toFile().toString()); + .withValue(StateConfig_.SIGNED_STATE_DISK, statesOnDisk) + .withValue( + StateConfig_.SAVED_STATE_DIRECTORY, + testDirectory.toFile().toString()); final PlatformContext context = TestPlatformContextBuilder.create() .withConfiguration(configBuilder.getOrCreateConfig()) .build(); diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SignedStateFileReadWriteTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SignedStateFileReadWriteTest.java index badbef034dd5..49644a8f0d00 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SignedStateFileReadWriteTest.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SignedStateFileReadWriteTest.java @@ -38,6 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import com.swirlds.common.config.StateConfig; +import com.swirlds.common.config.StateConfig_; import com.swirlds.common.constructable.ConstructableRegistry; import com.swirlds.common.constructable.ConstructableRegistryException; import com.swirlds.common.context.PlatformContext; @@ -259,7 +260,7 @@ void getSignedStateDirectoryTest() { private Configuration changeConfigAndConfigHolder(String directory) { return new TestConfigBuilder() - .withValue("state.savedStateDirectory", directory) + .withValue(StateConfig_.SAVED_STATE_DIRECTORY, directory) .getOrCreateConfig(); } } diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SwirldTransactionSubmitterTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SwirldTransactionSubmitterTest.java index 75f62839b5eb..565373415909 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SwirldTransactionSubmitterTest.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SwirldTransactionSubmitterTest.java @@ -21,6 +21,7 @@ import static org.mockito.Mockito.mock; import com.swirlds.common.config.TransactionConfig; +import com.swirlds.common.config.TransactionConfig_; import com.swirlds.common.constructable.ConstructableRegistry; import com.swirlds.common.constructable.ConstructableRegistryException; import com.swirlds.common.system.status.PlatformStatus; @@ -65,7 +66,7 @@ void setup() { random = RandomUtils.getRandom(); platformStatus = PlatformStatus.ACTIVE; final Configuration configuration = new TestConfigBuilder() - .withValue("transaction.transactionMaxBytes", 6144) + .withValue(TransactionConfig_.TRANSACTION_MAX_BYTES, 6144) .getOrCreateConfig(); transactionConfig = configuration.getConfigData(TransactionConfig.class); diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SyncManagerTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SyncManagerTest.java index 0c01703dcba3..fb44d9d94539 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SyncManagerTest.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/SyncManagerTest.java @@ -24,8 +24,10 @@ import static org.mockito.Mockito.spy; import com.swirlds.common.config.EventConfig; +import com.swirlds.common.config.EventConfig_; import com.swirlds.common.context.PlatformContext; import com.swirlds.common.merkle.synchronization.config.ReconnectConfig; +import com.swirlds.common.merkle.synchronization.config.ReconnectConfig_; import com.swirlds.common.system.NodeId; import com.swirlds.common.system.address.AddressBook; import com.swirlds.common.system.status.StatusActionSubmitter; @@ -74,9 +76,9 @@ public SyncManagerTestData() { connectionGraph = new RandomGraph(size, 40, 0); configuration = new TestConfigBuilder() - .withValue("reconnect.fallenBehindThreshold", "0.25") - .withValue("event.eventIntakeQueueThrottleSize", "100") - .withValue("event.staleEventPreventionThreshold", "10") + .withValue(ReconnectConfig_.FALLEN_BEHIND_THRESHOLD, "0.25") + .withValue(EventConfig_.EVENT_INTAKE_QUEUE_THROTTLE_SIZE, "100") + .withValue(EventConfig_.STALE_EVENT_PREVENTION_THRESHOLD, "10") .getOrCreateConfig(); final ReconnectConfig reconnectConfig = configuration.getConfigData(ReconnectConfig.class); final EventConfig eventConfig = configuration.getConfigData(EventConfig.class); diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/components/state/StateManagementComponentTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/components/state/StateManagementComponentTests.java index a64fbfd2710c..45f94e331947 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/components/state/StateManagementComponentTests.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/components/state/StateManagementComponentTests.java @@ -26,6 +26,7 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; +import com.swirlds.common.config.StateConfig_; import com.swirlds.common.context.PlatformContext; import com.swirlds.common.crypto.Hash; import com.swirlds.common.crypto.Signature; @@ -413,8 +414,8 @@ private void verifySystemTransaction(final int roundNum, final Hash hash) { @NonNull private TestConfigBuilder defaultConfigBuilder() { return new TestConfigBuilder() - .withValue("state.roundsToKeepForSigning", roundsToKeepForSigning) - .withValue("state.saveStatePeriod", 1); + .withValue(StateConfig_.ROUNDS_TO_KEEP_FOR_SIGNING, roundsToKeepForSigning) + .withValue(StateConfig_.SAVE_STATE_PERIOD, 1); } @NonNull diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/eventhandling/ConsensusRoundHandlerTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/eventhandling/ConsensusRoundHandlerTests.java index c212514016ce..6cffe50d5c2b 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/eventhandling/ConsensusRoundHandlerTests.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/eventhandling/ConsensusRoundHandlerTests.java @@ -27,6 +27,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import com.swirlds.common.config.EventConfig_; import com.swirlds.common.context.PlatformContext; import com.swirlds.common.stream.EventStreamManager; import com.swirlds.common.system.BasicSoftwareVersion; @@ -204,7 +205,7 @@ private void initConsensusHandler(final SwirldState swirldState) { when(platformState.getPlatformData()).thenReturn(platformData); final Configuration configuration = new TestConfigBuilder() - .withValue("event.maxEventQueueForCons", 500) + .withValue(EventConfig_.MAX_EVENT_QUEUE_FOR_CONS, 500) .getOrCreateConfig(); final PlatformContext platformContext = TestPlatformContextBuilder.create() .withConfiguration(configuration) diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/network/connectivity/SocketFactoryTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/network/connectivity/SocketFactoryTest.java index b9e6991aebd1..87b47efad19a 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/network/connectivity/SocketFactoryTest.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/network/connectivity/SocketFactoryTest.java @@ -19,6 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertArrayEquals; import com.swirlds.common.config.SocketConfig; +import com.swirlds.common.config.SocketConfig_; import com.swirlds.common.crypto.config.CryptoConfig; import com.swirlds.common.system.address.AddressBook; import com.swirlds.config.api.Configuration; @@ -46,11 +47,11 @@ class SocketFactoryTest { static { final Configuration configurationNoIpTos = - new TestConfigBuilder().withValue("socket.ipTos", "-1").getOrCreateConfig(); + new TestConfigBuilder().withValue(SocketConfig_.IP_TOS, "-1").getOrCreateConfig(); NO_IP_TOS = configurationNoIpTos.getConfigData(SocketConfig.class); final Configuration configurationIpTos = - new TestConfigBuilder().withValue("socket.ipTos", "100").getOrCreateConfig(); + new TestConfigBuilder().withValue(SocketConfig_.IP_TOS, "100").getOrCreateConfig(); IP_TOS = configurationIpTos.getConfigData(SocketConfig.class); CRYPTO_CONFIG = configurationIpTos.getConfigData(CryptoConfig.class); diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/RandomVirtualMapReconnectTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/RandomVirtualMapReconnectTests.java index 3d13268f1398..a54b49920a4b 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/RandomVirtualMapReconnectTests.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/RandomVirtualMapReconnectTests.java @@ -34,6 +34,7 @@ import com.swirlds.merkledb.MerkleDb; import com.swirlds.merkledb.MerkleDbDataSourceBuilder; import com.swirlds.merkledb.MerkleDbTableConfig; +import com.swirlds.merkledb.config.MerkleDbConfig_; import com.swirlds.test.framework.TestQualifierTags; import com.swirlds.test.framework.config.TestConfigBuilder; import com.swirlds.virtualmap.VirtualMap; @@ -67,9 +68,9 @@ class RandomVirtualMapReconnectTests extends VirtualMapReconnectTestBase { @BeforeAll static void beforeAll() { new TestConfigBuilder() - .withValue("merkleDb.keySetBloomFilterSizeInBytes", 2 * MEBIBYTES_TO_BYTES * BYTES_TO_BITS) - .withValue("merkleDb.keySetHalfDiskHashMapSize", "10000") - .withValue("merkleDb.keySetHalfDiskHashMapBuffer", "1000") + .withValue(MerkleDbConfig_.KEY_SET_BLOOM_FILTER_SIZE_IN_BYTES, 2 * MEBIBYTES_TO_BYTES * BYTES_TO_BITS) + .withValue(MerkleDbConfig_.KEY_SET_HALF_DISK_HASH_MAP_SIZE, "10000") + .withValue(MerkleDbConfig_.KEY_SET_HALF_DISK_HASH_MAP_BUFFER, "1000") .getOrCreateConfig(); } diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/ReconnectProtocolTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/ReconnectProtocolTests.java index dbdf23459829..6107551266f3 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/ReconnectProtocolTests.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/ReconnectProtocolTests.java @@ -33,6 +33,7 @@ import com.swirlds.base.time.Time; import com.swirlds.common.merkle.synchronization.config.ReconnectConfig; +import com.swirlds.common.merkle.synchronization.config.ReconnectConfig_; import com.swirlds.common.system.NodeId; import com.swirlds.common.system.status.PlatformStatus; import com.swirlds.common.system.status.PlatformStatusGetter; @@ -263,7 +264,7 @@ void testTeacherThrottleReleased() { final FallenBehindManager fallenBehindManager = mock(FallenBehindManager.class); final Configuration config = new TestConfigBuilder() // we don't want the time based throttle to interfere - .withValue("reconnect.minimumTimeBetweenReconnects", "0s") + .withValue(ReconnectConfig_.MINIMUM_TIME_BETWEEN_RECONNECTS, "0s") .getOrCreateConfig(); final ReconnectThrottle reconnectThrottle = new ReconnectThrottle(config.getConfigData(ReconnectConfig.class), Time.getCurrent()); diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/VirtualMapReconnectTestBase.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/VirtualMapReconnectTestBase.java index 56b465c2e96e..6a9456eae501 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/VirtualMapReconnectTestBase.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/VirtualMapReconnectTestBase.java @@ -28,6 +28,7 @@ import com.swirlds.common.io.streams.SerializableDataOutputStream; import com.swirlds.common.merkle.MerkleInternal; import com.swirlds.common.merkle.synchronization.config.ReconnectConfig; +import com.swirlds.common.merkle.synchronization.config.ReconnectConfig_; import com.swirlds.common.merkle.synchronization.internal.QueryResponse; import com.swirlds.common.metrics.Metrics; import com.swirlds.common.test.merkle.dummy.DummyMerkleInternal; @@ -119,10 +120,10 @@ public static void startup() throws ConstructableRegistryException, FileNotFound registry.registerConstructable(new ClassConstructorPair(BrokenBuilder.class, BrokenBuilder::new)); new TestConfigBuilder() - .withValue("reconnect.active", "true") + .withValue(ReconnectConfig_.ACTIVE, "true") // This is lower than the default, helps test that is supposed to fail to finish faster. - .withValue("reconnect.asyncStreamTimeout", "5000ms") - .withValue("reconnect.maxAckDelay", "1000ms") + .withValue(ReconnectConfig_.ASYNC_STREAM_TIMEOUT, "5000ms") + .withValue(ReconnectConfig_.MAX_ACK_DELAY, "1000ms") .getOrCreateConfig(); } diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/emergency/EmergencyReconnectProtocolTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/emergency/EmergencyReconnectProtocolTests.java index 5473d8112da3..c8d5d8b7a4e3 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/emergency/EmergencyReconnectProtocolTests.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/reconnect/emergency/EmergencyReconnectProtocolTests.java @@ -27,6 +27,7 @@ import com.swirlds.base.time.Time; import com.swirlds.common.merkle.synchronization.config.ReconnectConfig; +import com.swirlds.common.merkle.synchronization.config.ReconnectConfig_; import com.swirlds.common.notification.NotificationEngine; import com.swirlds.common.system.NodeId; import com.swirlds.common.system.status.StatusActionSubmitter; @@ -199,7 +200,7 @@ void testPermitReleased() throws InterruptedException { void testTeacherThrottleReleased() { final Configuration config = new TestConfigBuilder() // we don't want the time based throttle to interfere - .withValue("reconnect.minimumTimeBetweenReconnects", "0s") + .withValue(ReconnectConfig_.MINIMUM_TIME_BETWEEN_RECONNECTS, "0s") .getOrCreateConfig(); final ReconnectThrottle teacherThrottle = new ReconnectThrottle(config.getConfigData(ReconnectConfig.class), Time.getCurrent()); diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/manager/AbstractSignedStateManagerTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/manager/AbstractSignedStateManagerTest.java index 6b77a21c5cdf..6143d37544fd 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/manager/AbstractSignedStateManagerTest.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/manager/AbstractSignedStateManagerTest.java @@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import com.swirlds.common.config.StateConfig; +import com.swirlds.common.config.StateConfig_; import com.swirlds.common.crypto.Hash; import com.swirlds.common.system.NodeId; import com.swirlds.common.system.address.AddressBook; @@ -66,9 +67,9 @@ public class AbstractSignedStateManagerTest { protected StateConfig buildStateConfig() { final Configuration configuration = new TestConfigBuilder() - .withValue("state.roundsToKeepForSigning", roundsToKeepForSigning) - .withValue("state.maxAgeOfFutureStateSignatures", futureStateSignatureRounds) - .withValue("state.roundsToKeepAfterSigning", roundsToKeepAfterSigning) + .withValue(StateConfig_.ROUNDS_TO_KEEP_FOR_SIGNING, roundsToKeepForSigning) + .withValue(StateConfig_.MAX_AGE_OF_FUTURE_STATE_SIGNATURES, futureStateSignatureRounds) + .withValue(StateConfig_.ROUNDS_TO_KEEP_AFTER_SIGNING, roundsToKeepAfterSigning) .getOrCreateConfig(); return configuration.getConfigData(StateConfig.class); diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/signed/StartupStateUtilsTests.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/signed/StartupStateUtilsTests.java index 51ed8452aa3f..43bfda059bd0 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/signed/StartupStateUtilsTests.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/state/signed/StartupStateUtilsTests.java @@ -33,6 +33,7 @@ import static org.mockito.Mockito.when; import com.swirlds.common.config.StateConfig; +import com.swirlds.common.config.StateConfig_; import com.swirlds.common.constructable.ConstructableRegistry; import com.swirlds.common.constructable.ConstructableRegistryException; import com.swirlds.common.context.PlatformContext; @@ -103,8 +104,8 @@ static void beforeAll() throws ConstructableRegistryException { @NonNull private PlatformContext buildContext(final boolean deleteInvalidStateFiles) { final Configuration configuration = new TestConfigBuilder() - .withValue("state.savedStateDirectory", testDirectory.toString()) - .withValue("state.deleteInvalidStateFiles", deleteInvalidStateFiles) + .withValue(StateConfig_.SAVED_STATE_DIRECTORY, testDirectory.toString()) + .withValue(StateConfig_.DELETE_INVALID_STATE_FILES, deleteInvalidStateFiles) .getOrCreateConfig(); final PlatformContext platformContext = TestPlatformContextBuilder.create() diff --git a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/util/MetricsDocUtilsTest.java b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/util/MetricsDocUtilsTest.java index 10b3933f6490..7d2113ae75bd 100644 --- a/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/util/MetricsDocUtilsTest.java +++ b/platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/util/MetricsDocUtilsTest.java @@ -27,6 +27,7 @@ import com.swirlds.common.metrics.Counter; import com.swirlds.common.metrics.Metric; import com.swirlds.common.metrics.Metrics; +import com.swirlds.common.metrics.config.MetricsConfig_; import com.swirlds.common.metrics.platform.DefaultCounter; import com.swirlds.common.metrics.platform.DefaultMetrics; import com.swirlds.config.api.Configuration; @@ -51,7 +52,7 @@ void writeMetricsDocumentToFile() { // setup // Unable to mock BasicConfig.class because it is a final class, so using the test builder instead of mocking. final Configuration configuration = new TestConfigBuilder() - .withValue("metrics.metricsDocFileName", METRIC_DOC_FILE_NAME) + .withValue(MetricsConfig_.METRICS_DOC_FILE_NAME, METRIC_DOC_FILE_NAME) .getOrCreateConfig(); final String docFilePath = FileUtils.getUserDir() + File.separator + METRIC_DOC_FILE_NAME; final File oldFile = new File(docFilePath); diff --git a/platform-sdk/swirlds-unit-tests/common/swirlds-common-test/src/test/java/com/swirlds/common/test/merkle/AsyncStreamTest.java b/platform-sdk/swirlds-unit-tests/common/swirlds-common-test/src/test/java/com/swirlds/common/test/merkle/AsyncStreamTest.java index 456a498eb568..f1c89d744f6e 100644 --- a/platform-sdk/swirlds-unit-tests/common/swirlds-common-test/src/test/java/com/swirlds/common/test/merkle/AsyncStreamTest.java +++ b/platform-sdk/swirlds-unit-tests/common/swirlds-common-test/src/test/java/com/swirlds/common/test/merkle/AsyncStreamTest.java @@ -26,6 +26,7 @@ import com.swirlds.common.io.streams.SerializableDataInputStream; import com.swirlds.common.io.streams.SerializableDataOutputStream; import com.swirlds.common.merkle.synchronization.config.ReconnectConfig; +import com.swirlds.common.merkle.synchronization.config.ReconnectConfig_; import com.swirlds.common.merkle.synchronization.streams.AsyncInputStream; import com.swirlds.common.merkle.synchronization.streams.AsyncOutputStream; import com.swirlds.common.merkle.utility.SerializableLong; @@ -49,9 +50,9 @@ @DisplayName("Async Stream Test") class AsyncStreamTest { private final Configuration configuration = new TestConfigBuilder() - .withValue("reconnect.asyncOutputStream", 10000) - .withValue("reconnect.asyncStreamBufferSize", 100) - .withValue("reconnect.asyncOutputStreamFlush", "50ms") + .withValue("reconnect.asyncOutputStream", 10000) // FUTURE: Looks like that property is not defined + .withValue(ReconnectConfig_.ASYNC_STREAM_BUFFER_SIZE, 100) + .withValue(ReconnectConfig_.ASYNC_OUTPUT_STREAM_FLUSH, "50ms") .getOrCreateConfig(); private final ReconnectConfig reconnectConfig = configuration.getConfigData(ReconnectConfig.class); diff --git a/platform-sdk/swirlds-unit-tests/common/swirlds-common-test/src/test/java/com/swirlds/common/test/merkle/MerkleSynchronizationTests.java b/platform-sdk/swirlds-unit-tests/common/swirlds-common-test/src/test/java/com/swirlds/common/test/merkle/MerkleSynchronizationTests.java index c1be6de2c1af..75f1945bb461 100644 --- a/platform-sdk/swirlds-unit-tests/common/swirlds-common-test/src/test/java/com/swirlds/common/test/merkle/MerkleSynchronizationTests.java +++ b/platform-sdk/swirlds-unit-tests/common/swirlds-common-test/src/test/java/com/swirlds/common/test/merkle/MerkleSynchronizationTests.java @@ -31,6 +31,7 @@ import com.swirlds.common.merkle.copy.MerkleCopy; import com.swirlds.common.merkle.crypto.MerkleCryptoFactory; import com.swirlds.common.merkle.synchronization.config.ReconnectConfig; +import com.swirlds.common.merkle.synchronization.config.ReconnectConfig_; import com.swirlds.common.merkle.synchronization.utility.MerkleSynchronizationException; import com.swirlds.common.merkle.utility.MerkleUtils; import com.swirlds.common.test.merkle.dummy.DummyCustomReconnectRoot; @@ -66,9 +67,9 @@ public static void startup() throws ConstructableRegistryException, FileNotFound ConstructableRegistry.getInstance().registerConstructables("com.swirlds.common"); new TestConfigBuilder() - .withValue("reconnect.active", "true") + .withValue(ReconnectConfig_.ACTIVE, "true") // This is lower than the default, helps test that is supposed to fail to finish faster. - .withValue("reconnect.asyncStreamTimeout", "500ms") + .withValue(ReconnectConfig_.ASYNC_STREAM_TIMEOUT, "500ms") .getOrCreateConfig(); } diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/chatter/ChatterCoreTests.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/chatter/ChatterCoreTests.java index b0bf84679e2b..97d1afee2442 100644 --- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/chatter/ChatterCoreTests.java +++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/chatter/ChatterCoreTests.java @@ -28,6 +28,7 @@ import com.swirlds.config.api.Configuration; import com.swirlds.platform.event.GossipEvent; import com.swirlds.platform.gossip.chatter.config.ChatterConfig; +import com.swirlds.platform.gossip.chatter.config.ChatterConfig_; import com.swirlds.platform.gossip.chatter.protocol.ChatterCore; import com.swirlds.platform.state.signed.SignedState; import com.swirlds.platform.test.event.GossipEventBuilder; @@ -49,7 +50,7 @@ public class ChatterCoreTests { @Test void loadFromSignedStateTest() { final Configuration configuration = new TestConfigBuilder() - .withValue("chatter.futureGenerationLimit", "100") + .withValue(ChatterConfig_.FUTURE_GENERATION_LIMIT, "100") .getOrCreateConfig(); final ChatterConfig chatterConfig = configuration.getConfigData(ChatterConfig.class); diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/chatter/network/framework/NodeBuilder.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/chatter/network/framework/NodeBuilder.java index 7f9bd0a23671..4ec4421b2778 100644 --- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/chatter/network/framework/NodeBuilder.java +++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/chatter/network/framework/NodeBuilder.java @@ -18,6 +18,7 @@ import com.swirlds.common.system.NodeId; import com.swirlds.platform.gossip.chatter.config.ChatterConfig; +import com.swirlds.platform.gossip.chatter.config.ChatterConfig_; import com.swirlds.platform.test.chatter.network.NoOpSimulatedEventPipeline; import com.swirlds.test.framework.config.TestConfigBuilder; @@ -99,9 +100,9 @@ public Node build() { } final TestConfigBuilder configBuilder = new TestConfigBuilder() - .withValue("chatter.otherEventDelay", networkParams.otherEventDelay()) - .withValue("chatter.processingTimeInterval", networkParams.procTimeInterval()) - .withValue("chatter.heartbeatInterval", networkParams.heartbeatInterval()); + .withValue(ChatterConfig_.OTHER_EVENT_DELAY, networkParams.otherEventDelay()) + .withValue(ChatterConfig_.PROCESSING_TIME_INTERVAL, networkParams.procTimeInterval()) + .withValue(ChatterConfig_.HEARTBEAT_INTERVAL, networkParams.heartbeatInterval()); final ChatterInstance chatterInstance = new ChatterInstance<>( networkParams.numNodes(), diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/consensus/IntakeAndConsensusTests.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/consensus/IntakeAndConsensusTests.java index e4baa148f719..67f8b2a6d8ff 100644 --- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/consensus/IntakeAndConsensusTests.java +++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/consensus/IntakeAndConsensusTests.java @@ -19,6 +19,7 @@ import static com.swirlds.test.framework.TestQualifierTags.TIME_CONSUMING; import com.swirlds.common.config.ConsensusConfig; +import com.swirlds.common.config.ConsensusConfig_; import com.swirlds.common.system.NodeId; import com.swirlds.common.system.address.AddressBook; import com.swirlds.config.api.Configuration; @@ -66,8 +67,8 @@ void nonAncientEventWithMissingParents() { final List partitionNodes = List.of(0, 1); final Configuration configuration = new TestConfigBuilder() - .withValue("consensus.roundsNonAncient", 25) - .withValue("consensus.roundsExpired", 25) + .withValue(ConsensusConfig_.ROUNDS_NON_ANCIENT, 25) + .withValue(ConsensusConfig_.ROUNDS_EXPIRED, 25) .getOrCreateConfig(); final ConsensusConfig consensusConfig = configuration.getConfigData(ConsensusConfig.class); diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/AsyncPreconsensusEventWriterTests.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/AsyncPreconsensusEventWriterTests.java index 8577092416bf..ce0341f85fba 100644 --- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/AsyncPreconsensusEventWriterTests.java +++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/AsyncPreconsensusEventWriterTests.java @@ -28,6 +28,7 @@ import com.swirlds.base.test.fixtures.time.FakeTime; import com.swirlds.base.time.Time; +import com.swirlds.common.config.TransactionConfig_; import com.swirlds.common.constructable.ConstructableRegistry; import com.swirlds.common.constructable.ConstructableRegistryException; import com.swirlds.common.context.DefaultPlatformContext; @@ -50,6 +51,7 @@ import com.swirlds.platform.event.preconsensus.PreconsensusEventFile; import com.swirlds.platform.event.preconsensus.PreconsensusEventFileManager; import com.swirlds.platform.event.preconsensus.PreconsensusEventMultiFileIterator; +import com.swirlds.platform.event.preconsensus.PreconsensusEventStreamConfig_; import com.swirlds.platform.event.preconsensus.PreconsensusEventStreamSequencer; import com.swirlds.platform.event.preconsensus.PreconsensusEventWriter; import com.swirlds.platform.event.preconsensus.SyncPreconsensusEventWriter; @@ -236,12 +238,12 @@ static void verifyStream( private PlatformContext buildContext() { final Configuration configuration = new TestConfigBuilder() - .withValue("event.preconsensus.databaseDirectory", testDirectory) - .withValue("event.preconsensus.preferredFileSizeMegabytes", 5) - .withValue("transaction.maxTransactionBytesPerEvent", Integer.MAX_VALUE) - .withValue("transaction.maxTransactionCountPerEvent", Integer.MAX_VALUE) - .withValue("transaction.transactionMaxBytes", Integer.MAX_VALUE) - .withValue("transaction.maxAddressSizeAllowed", Integer.MAX_VALUE) + .withValue(PreconsensusEventStreamConfig_.DATABASE_DIRECTORY, testDirectory) + .withValue(PreconsensusEventStreamConfig_.PREFERRED_FILE_SIZE_MEGABYTES, 5) + .withValue(TransactionConfig_.MAX_TRANSACTION_BYTES_PER_EVENT, Integer.MAX_VALUE) + .withValue(TransactionConfig_.MAX_TRANSACTION_COUNT_PER_EVENT, Integer.MAX_VALUE) + .withValue(TransactionConfig_.TRANSACTION_MAX_BYTES, Integer.MAX_VALUE) + .withValue(TransactionConfig_.MAX_ADDRESS_SIZE_ALLOWED, Integer.MAX_VALUE) .getOrCreateConfig(); final Metrics metrics = new NoOpMetrics(); diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/PreconsensusEventFileManagerTests.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/PreconsensusEventFileManagerTests.java index 4cdf047db67d..06bc3d1128fc 100644 --- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/PreconsensusEventFileManagerTests.java +++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/PreconsensusEventFileManagerTests.java @@ -43,6 +43,7 @@ import com.swirlds.config.api.Configuration; import com.swirlds.platform.event.preconsensus.PreconsensusEventFile; import com.swirlds.platform.event.preconsensus.PreconsensusEventFileManager; +import com.swirlds.platform.event.preconsensus.PreconsensusEventStreamConfig_; import com.swirlds.test.framework.config.TestConfigBuilder; import edu.umd.cs.findbugs.annotations.NonNull; import java.io.FileOutputStream; @@ -95,10 +96,12 @@ private PlatformContext buildContext() { private PlatformContext buildContext(final boolean permitGaps) { final Configuration configuration = new TestConfigBuilder() - .withValue("event.preconsensus.databaseDirectory", testDirectory.resolve("data")) - .withValue("event.preconsensus.recycleBinDirectory", testDirectory.resolve("recycle")) - .withValue("event.preconsensus.preferredFileSizeMegabytes", 5) - .withValue("event.preconsensus.permitGaps", permitGaps) + .withValue(PreconsensusEventStreamConfig_.DATABASE_DIRECTORY, testDirectory.resolve("data")) + .withValue( + "event.preconsensus.recycleBinDirectory", + testDirectory.resolve("recycle")) // FUTURE: No property defined for value + .withValue(PreconsensusEventStreamConfig_.PREFERRED_FILE_SIZE_MEGABYTES, 5) + .withValue(PreconsensusEventStreamConfig_.PERMIT_GAPS, permitGaps) .getOrCreateConfig(); final Metrics metrics = new NoOpMetrics(); diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/PreconsensusEventFileTests.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/PreconsensusEventFileTests.java index a317fd824794..968cf556b407 100644 --- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/PreconsensusEventFileTests.java +++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/PreconsensusEventFileTests.java @@ -31,6 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import com.swirlds.base.time.Time; +import com.swirlds.common.io.config.RecycleBinConfig_; import com.swirlds.common.io.utility.FileUtils; import com.swirlds.common.io.utility.RecycleBin; import com.swirlds.common.io.utility.RecycleBinImpl; @@ -300,7 +301,7 @@ void recycleTest() throws IOException { final Path actualRecycleDirectory = recycleDirectory.resolve(selfId.toString()); final Configuration configuration = new TestConfigBuilder() - .withValue("recycleBin.recycleBinPath", recycleDirectory.toString()) + .withValue(RecycleBinConfig_.RECYCLE_BIN_PATH, recycleDirectory.toString()) .getOrCreateConfig(); final RecycleBin recycleBin = new RecycleBinImpl( diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/SyncPreconsensusEventWriterTests.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/SyncPreconsensusEventWriterTests.java index 5db0544fb0ca..b10cb080e202 100644 --- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/SyncPreconsensusEventWriterTests.java +++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/preconsensus/SyncPreconsensusEventWriterTests.java @@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import com.swirlds.base.time.Time; +import com.swirlds.common.config.TransactionConfig_; import com.swirlds.common.constructable.ConstructableRegistry; import com.swirlds.common.constructable.ConstructableRegistryException; import com.swirlds.common.context.DefaultPlatformContext; @@ -37,6 +38,7 @@ import com.swirlds.config.api.Configuration; import com.swirlds.platform.event.preconsensus.PreconsensusEventFile; import com.swirlds.platform.event.preconsensus.PreconsensusEventFileManager; +import com.swirlds.platform.event.preconsensus.PreconsensusEventStreamConfig_; import com.swirlds.platform.event.preconsensus.PreconsensusEventStreamSequencer; import com.swirlds.platform.event.preconsensus.PreconsensusEventWriter; import com.swirlds.platform.event.preconsensus.SyncPreconsensusEventWriter; @@ -86,12 +88,12 @@ void afterEach() throws IOException { private PlatformContext buildContext() { final Configuration configuration = new TestConfigBuilder() - .withValue("event.preconsensus.databaseDirectory", testDirectory) - .withValue("event.preconsensus.preferredFileSizeMegabytes", 5) - .withValue("transaction.maxTransactionBytesPerEvent", Integer.MAX_VALUE) - .withValue("transaction.maxTransactionCountPerEvent", Integer.MAX_VALUE) - .withValue("transaction.transactionMaxBytes", Integer.MAX_VALUE) - .withValue("transaction.maxAddressSizeAllowed", Integer.MAX_VALUE) + .withValue(PreconsensusEventStreamConfig_.DATABASE_DIRECTORY, testDirectory) + .withValue(PreconsensusEventStreamConfig_.PREFERRED_FILE_SIZE_MEGABYTES, 5) + .withValue(TransactionConfig_.MAX_TRANSACTION_BYTES_PER_EVENT, Integer.MAX_VALUE) + .withValue(TransactionConfig_.MAX_TRANSACTION_COUNT_PER_EVENT, Integer.MAX_VALUE) + .withValue(TransactionConfig_.TRANSACTION_MAX_BYTES, Integer.MAX_VALUE) + .withValue(TransactionConfig_.MAX_ADDRESS_SIZE_ALLOWED, Integer.MAX_VALUE) .getOrCreateConfig(); final Metrics metrics = new NoOpMetrics(); diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/tipset/EventCreationRulesTests.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/tipset/EventCreationRulesTests.java index 962419873071..455b3481f87b 100644 --- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/tipset/EventCreationRulesTests.java +++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/event/tipset/EventCreationRulesTests.java @@ -33,6 +33,7 @@ import com.swirlds.common.system.status.PlatformStatus; import com.swirlds.config.api.Configuration; import com.swirlds.platform.event.GossipEvent; +import com.swirlds.platform.event.creation.EventCreationConfig_; import com.swirlds.platform.event.creation.EventCreator; import com.swirlds.platform.event.creation.rules.AggregateEventCreationRules; import com.swirlds.platform.event.creation.rules.EventCreationRule; @@ -216,7 +217,7 @@ void rateLimitTest() { final Duration period = Duration.ofSeconds(1).dividedBy(maxRate); final Configuration configuration = new TestConfigBuilder() - .withValue("event.creation.maxCreationRate", maxRate) + .withValue(EventCreationConfig_.MAX_CREATION_RATE, maxRate) .getOrCreateConfig(); final PlatformContext platformContext = TestPlatformContextBuilder.create() diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/network/OutboundConnectionCreatorTest.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/network/OutboundConnectionCreatorTest.java index 61d8dba6cb41..c6db7cdf84d6 100644 --- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/network/OutboundConnectionCreatorTest.java +++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/network/OutboundConnectionCreatorTest.java @@ -24,6 +24,7 @@ import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; +import com.swirlds.common.config.SocketConfig_; import com.swirlds.common.constructable.ClassConstructorPair; import com.swirlds.common.constructable.ConstructableRegistry; import com.swirlds.common.constructable.ConstructableRegistryException; @@ -283,8 +284,8 @@ void mismatchedVersionIgnoredTest() throws IOException, ConstructableRegistryExc @NonNull private static Configuration getConfig() { return new TestConfigBuilder() - .withValue("socket.bufferSize", "100") - .withValue("socket.gzipCompression", false) + .withValue(SocketConfig_.BUFFER_SIZE, "100") + .withValue(SocketConfig_.GZIP_COMPRESSION, false) .getOrCreateConfig(); } } diff --git a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/reconnect/FallenBehindManagerTest.java b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/reconnect/FallenBehindManagerTest.java index ec6cd39cb4ba..f75cba728a63 100644 --- a/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/reconnect/FallenBehindManagerTest.java +++ b/platform-sdk/swirlds-unit-tests/core/swirlds-platform-test/src/test/java/com/swirlds/platform/test/reconnect/FallenBehindManagerTest.java @@ -20,6 +20,7 @@ import static org.mockito.Mockito.mock; import com.swirlds.common.merkle.synchronization.config.ReconnectConfig; +import com.swirlds.common.merkle.synchronization.config.ReconnectConfig_; import com.swirlds.common.system.NodeId; import com.swirlds.common.system.address.AddressBook; import com.swirlds.common.system.status.StatusActionSubmitter; @@ -41,7 +42,7 @@ class FallenBehindManagerTest { final AtomicInteger platformNotification = new AtomicInteger(0); final AtomicInteger fallenBehindNotification = new AtomicInteger(0); final ReconnectConfig config = new TestConfigBuilder() - .withValue("reconnect.fallenBehindThreshold", fallenBehindThreshold) + .withValue(ReconnectConfig_.FALLEN_BEHIND_THRESHOLD, fallenBehindThreshold) .getOrCreateConfig() .getConfigData(ReconnectConfig.class); final FallenBehindManager manager = new FallenBehindManagerImpl( diff --git a/platform-sdk/swirlds-virtualmap/build.gradle.kts b/platform-sdk/swirlds-virtualmap/build.gradle.kts index 8709ebb90819..be3539e1acf6 100644 --- a/platform-sdk/swirlds-virtualmap/build.gradle.kts +++ b/platform-sdk/swirlds-virtualmap/build.gradle.kts @@ -20,6 +20,8 @@ plugins { id("com.hedera.hashgraph.benchmark-conventions") } +mainModuleInfo { annotationProcessor("com.swirlds.config.processor") } + jmhModuleInfo { requires("com.swirlds.common") requires("jmh.core") diff --git a/platform-sdk/swirlds-virtualmap/src/test/java/com/swirlds/virtualmap/internal/merkle/VirtualRootNodeTest.java b/platform-sdk/swirlds-virtualmap/src/test/java/com/swirlds/virtualmap/internal/merkle/VirtualRootNodeTest.java index 43a42cd3d7c1..f1fea9fa6969 100644 --- a/platform-sdk/swirlds-virtualmap/src/test/java/com/swirlds/virtualmap/internal/merkle/VirtualRootNodeTest.java +++ b/platform-sdk/swirlds-virtualmap/src/test/java/com/swirlds/virtualmap/internal/merkle/VirtualRootNodeTest.java @@ -39,6 +39,7 @@ import com.swirlds.virtualmap.VirtualMap; import com.swirlds.virtualmap.VirtualTestBase; import com.swirlds.virtualmap.config.VirtualMapConfig; +import com.swirlds.virtualmap.config.VirtualMapConfig_; import com.swirlds.virtualmap.datasource.InMemoryBuilder; import com.swirlds.virtualmap.datasource.InMemoryDataSource; import com.swirlds.virtualmap.datasource.VirtualDataSourceBuilder; @@ -396,7 +397,7 @@ void defaultZeroFlushThresholdTest() { final Configuration originalConfig = ConfigurationHolder.getInstance().get(); final Configuration configuration = new TestConfigBuilder() - .withValue("virtualMap.copyFlushThreshold", "0") + .withValue(VirtualMapConfig_.COPY_FLUSH_THRESHOLD, "0") .getOrCreateConfig(); ConfigurationHolder.getInstance().setConfiguration(configuration); diff --git a/platform-sdk/swirlds-virtualmap/src/test/java/com/swirlds/virtualmap/internal/pipeline/VirtualPipelineTests.java b/platform-sdk/swirlds-virtualmap/src/test/java/com/swirlds/virtualmap/internal/pipeline/VirtualPipelineTests.java index 1355666fcdb4..d43f1ce98fde 100644 --- a/platform-sdk/swirlds-virtualmap/src/test/java/com/swirlds/virtualmap/internal/pipeline/VirtualPipelineTests.java +++ b/platform-sdk/swirlds-virtualmap/src/test/java/com/swirlds/virtualmap/internal/pipeline/VirtualPipelineTests.java @@ -45,6 +45,7 @@ import com.swirlds.test.framework.TestTypeTags; import com.swirlds.test.framework.config.TestConfigBuilder; import com.swirlds.virtualmap.config.VirtualMapConfig; +import com.swirlds.virtualmap.config.VirtualMapConfig_; import java.time.Duration; import java.time.Instant; import java.util.ArrayList; @@ -847,8 +848,8 @@ void flushThrottle() throws InterruptedException { final int maxThrottle = 100; // For the purposes of this test, this should be a multiple of throttleStepSize final Configuration config = new TestConfigBuilder() - .withValue("virtualMap.flushThrottleStepSize", throttleStepSize + "ms") - .withValue("virtualMap.maximumFlushThrottlePeriod", maxThrottle + "ms") + .withValue(VirtualMapConfig_.FLUSH_THROTTLE_STEP_SIZE, throttleStepSize + "ms") + .withValue(VirtualMapConfig_.MAXIMUM_FLUSH_THROTTLE_PERIOD, maxThrottle + "ms") .getOrCreateConfig(); ConfigurationHolder.getInstance().setConfiguration(config); diff --git a/platform-sdk/swirlds-virtualmap/src/test/java/com/swirlds/virtualmap/internal/reconnect/VirtualMapReconnectTestBase.java b/platform-sdk/swirlds-virtualmap/src/test/java/com/swirlds/virtualmap/internal/reconnect/VirtualMapReconnectTestBase.java index 7d4792f40ce5..ac9209848619 100644 --- a/platform-sdk/swirlds-virtualmap/src/test/java/com/swirlds/virtualmap/internal/reconnect/VirtualMapReconnectTestBase.java +++ b/platform-sdk/swirlds-virtualmap/src/test/java/com/swirlds/virtualmap/internal/reconnect/VirtualMapReconnectTestBase.java @@ -29,6 +29,7 @@ import com.swirlds.common.io.streams.SerializableDataOutputStream; import com.swirlds.common.merkle.MerkleInternal; import com.swirlds.common.merkle.synchronization.config.ReconnectConfig; +import com.swirlds.common.merkle.synchronization.config.ReconnectConfig_; import com.swirlds.common.merkle.synchronization.internal.QueryResponse; import com.swirlds.common.metrics.Metrics; import com.swirlds.common.test.merkle.dummy.DummyMerkleInternal; @@ -120,9 +121,9 @@ public static void startup() throws ConstructableRegistryException, FileNotFound registry.registerConstructable(new ClassConstructorPair(BrokenBuilder.class, BrokenBuilder::new)); new TestConfigBuilder() - .withValue("reconnect.active", "true") + .withValue(ReconnectConfig_.ACTIVE, "true") // This is lower than the default, helps test that is supposed to fail to finish faster. - .withValue("reconnect.asyncStreamTimeout", "5000ms") + .withValue(ReconnectConfig_.ASYNC_STREAM_TIMEOUT, "5000ms") .getOrCreateConfig(); }