diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/MirrorProperties.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/ImporterProperties.java similarity index 99% rename from hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/MirrorProperties.java rename to hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/ImporterProperties.java index 6cacbd5eee0..1ca193fdd2c 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/MirrorProperties.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/ImporterProperties.java @@ -36,7 +36,7 @@ @Data @Validated @ConfigurationProperties("hedera.mirror.importer") -public class MirrorProperties { +public class ImporterProperties { public static final String STREAMS = "streams"; static final String NETWORK_PREFIX_DELIMITER = "-"; diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/addressbook/AddressBookServiceImpl.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/addressbook/AddressBookServiceImpl.java index 2e95075368a..b88085bf947 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/addressbook/AddressBookServiceImpl.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/addressbook/AddressBookServiceImpl.java @@ -27,8 +27,8 @@ import com.hedera.mirror.common.domain.file.FileData; import com.hedera.mirror.common.domain.transaction.TransactionType; import com.hedera.mirror.common.util.DomainUtils; -import com.hedera.mirror.importer.MirrorProperties; -import com.hedera.mirror.importer.MirrorProperties.ConsensusMode; +import com.hedera.mirror.importer.ImporterProperties; +import com.hedera.mirror.importer.ImporterProperties.ConsensusMode; import com.hedera.mirror.importer.exception.InvalidDatasetException; import com.hedera.mirror.importer.repository.AddressBookRepository; import com.hedera.mirror.importer.repository.FileDataRepository; @@ -80,7 +80,7 @@ public class AddressBookServiceImpl implements AddressBookService { private final AddressBookRepository addressBookRepository; private final FileDataRepository fileDataRepository; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final NodeStakeRepository nodeStakeRepository; private final TransactionTemplate transactionTemplate; @@ -135,7 +135,7 @@ public Collection getNodes() { var totalStake = new AtomicLong(0L); var nodes = new TreeSet(); var nodeStakes = new HashMap(); - var consensusMode = mirrorProperties.getConsensusMode(); + var consensusMode = importerProperties.getConsensusMode(); var nodesInAddressBook = addressBook.getEntries().stream() .map(AddressBookEntry::getNodeId) .collect(Collectors.toSet()); @@ -531,12 +531,12 @@ private FileData getInitialAddressBookFileData() { // retrieve bootstrap address book from filesystem or classpath try { - Path initialAddressBook = mirrorProperties.getInitialAddressBook(); + Path initialAddressBook = importerProperties.getInitialAddressBook(); if (initialAddressBook != null) { log.info("Loading bootstrap address book from {}", initialAddressBook); addressBookBytes = Files.readAllBytes(initialAddressBook); } else { - var resourcePath = String.format("/addressbook/%s", mirrorProperties.getNetwork()); + var resourcePath = String.format("/addressbook/%s", importerProperties.getNetwork()); log.info("Loading bootstrap address book from {}", resourcePath); Resource resource = new ClassPathResource(resourcePath, getClass()); addressBookBytes = resource.getInputStream().readAllBytes(); diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/DateRangeCalculator.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/DateRangeCalculator.java index 5c269b2eb5d..ad3d9fc8a8d 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/DateRangeCalculator.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/DateRangeCalculator.java @@ -22,7 +22,7 @@ import com.hedera.mirror.common.domain.StreamFile; import com.hedera.mirror.common.domain.StreamType; import com.hedera.mirror.common.util.DomainUtils; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.domain.StreamFilename; import com.hedera.mirror.importer.exception.InvalidConfigurationException; import com.hedera.mirror.importer.repository.AccountBalanceFileRepository; @@ -46,7 +46,7 @@ public class DateRangeCalculator { static final Instant STARTUP_TIME = Instant.now(); - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final AccountBalanceFileRepository accountBalanceFileRepository; private final EventFileRepository eventFileRepository; private final RecordFileRepository recordFileRepository; @@ -69,8 +69,8 @@ public DateRangeFilter getFilter(StreamType type) { } private DateRangeFilter newDateRangeFilter(StreamType streamType) { - Instant startDate = mirrorProperties.getStartDate(); - Instant endDate = mirrorProperties.getEndDate(); + Instant startDate = importerProperties.getStartDate(); + Instant endDate = importerProperties.getEndDate(); Instant lastFileInstant = findLatest(streamType) .map(StreamFile::getConsensusStart) .map(nanos -> Instant.ofEpochSecond(0, nanos)) @@ -85,7 +85,7 @@ private DateRangeFilter newDateRangeFilter(StreamType streamType) { if (startDate != null) { filterStartDate = max(startDate, lastFileInstant); } else { - if (!MirrorProperties.HederaNetwork.DEMO.equalsIgnoreCase(mirrorProperties.getNetwork()) + if (!ImporterProperties.HederaNetwork.DEMO.equalsIgnoreCase(importerProperties.getNetwork()) && lastFileInstant == null) { filterStartDate = STARTUP_TIME; } @@ -98,7 +98,7 @@ private DateRangeFilter newDateRangeFilter(StreamType streamType) { } /** - * Gets the latest stream file for downloader based on startDate in MirrorProperties, the startDateAdjustment and + * Gets the latest stream file for downloader based on startDate in ImporterProperties, the startDateAdjustment and * last valid downloaded stream file. * * @param streamType What type of stream to retrieve @@ -106,7 +106,7 @@ private DateRangeFilter newDateRangeFilter(StreamType streamType) { * start date */ public > Optional getLastStreamFile(StreamType streamType) { - Instant startDate = mirrorProperties.getStartDate(); + Instant startDate = importerProperties.getStartDate(); Optional streamFile = findLatest(streamType); Instant lastFileInstant = streamFile .map(StreamFile::getConsensusStart) @@ -120,11 +120,11 @@ public > Optional getLastStreamFile(StreamType stream effectiveStartDate = max(startDate, hasStreamFile ? lastFileInstant : Instant.EPOCH); } else if (hasStreamFile) { effectiveStartDate = lastFileInstant; - } else if (MirrorProperties.HederaNetwork.DEMO.equalsIgnoreCase(mirrorProperties.getNetwork())) { + } else if (ImporterProperties.HederaNetwork.DEMO.equalsIgnoreCase(importerProperties.getNetwork())) { effectiveStartDate = Instant.EPOCH; // Demo network contains only data in the past, so don't default to now } - Instant endDate = mirrorProperties.getEndDate(); + Instant endDate = importerProperties.getEndDate(); if (startDate != null && startDate.compareTo(endDate) > 0) { throw new InvalidConfigurationException(String.format( "Date range constraint violation: " + "startDate (%s) > endDate (%s)", startDate, endDate)); @@ -149,7 +149,7 @@ public > Optional getLastStreamFile(StreamType stream "{}: downloader will download files in time range ({}, {}]", streamType, effectiveStartDate, - mirrorProperties.getEndDate()); + importerProperties.getEndDate()); return streamFile; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/HealthCheckConfiguration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/HealthCheckConfiguration.java index 9c8aadf4e6a..3ecb21a0125 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/HealthCheckConfiguration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/HealthCheckConfiguration.java @@ -16,7 +16,7 @@ package com.hedera.mirror.importer.config; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.leader.LeaderService; import com.hedera.mirror.importer.parser.ParserProperties; import io.micrometer.core.instrument.MeterRegistry; @@ -36,7 +36,7 @@ class HealthCheckConfiguration { private final LeaderService leaderService; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final Collection parserProperties; @Bean @@ -45,7 +45,7 @@ CompositeHealthContributor streamFileActivity(MeterRegistry meterRegistry) { Map healthIndicators = parserProperties.stream() .collect(Collectors.toMap( k -> k.getStreamType().toString(), - v -> new StreamFileHealthIndicator(leaderService, registry, mirrorProperties, v))); + v -> new StreamFileHealthIndicator(leaderService, registry, importerProperties, v))); return CompositeHealthContributor.fromMap(healthIndicators); } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/ImporterConfiguration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/ImporterConfiguration.java index 57db97cabc2..fee5a3927ed 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/ImporterConfiguration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/ImporterConfiguration.java @@ -16,7 +16,7 @@ package com.hedera.mirror.importer.config; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.leader.LeaderAspect; import com.hedera.mirror.importer.leader.LeaderService; import lombok.CustomLog; @@ -43,7 +43,7 @@ @AutoConfigureBefore(FlywayAutoConfiguration.class) // Since this configuration creates FlywayConfigurationCustomizer class ImporterConfiguration { - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; @Bean @ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES) @@ -61,9 +61,9 @@ LeaderService leaderService() { @Bean FlywayConfigurationCustomizer flywayConfigurationCustomizer() { return configuration -> { - Long timestamp = mirrorProperties.getTopicRunningHashV2AddedTimestamp(); + Long timestamp = importerProperties.getTopicRunningHashV2AddedTimestamp(); if (timestamp == null) { - if (MirrorProperties.HederaNetwork.MAINNET.equalsIgnoreCase(mirrorProperties.getNetwork())) { + if (ImporterProperties.HederaNetwork.MAINNET.equalsIgnoreCase(importerProperties.getNetwork())) { timestamp = 1592499600000000000L; } else { timestamp = 1588706343553042000L; diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/StreamFileHealthIndicator.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/StreamFileHealthIndicator.java index 95edc975bcd..2202da62733 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/StreamFileHealthIndicator.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/config/StreamFileHealthIndicator.java @@ -19,7 +19,7 @@ import static com.hedera.mirror.importer.downloader.Downloader.STREAM_CLOSE_LATENCY_METRIC_NAME; import static com.hedera.mirror.importer.parser.AbstractStreamFileParser.STREAM_PARSE_DURATION_METRIC_NAME; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.leader.LeaderService; import com.hedera.mirror.importer.parser.ParserProperties; import io.micrometer.core.instrument.MeterRegistry; @@ -60,7 +60,7 @@ public class StreamFileHealthIndicator implements HealthIndicator { private final LeaderService leaderService; private final MeterRegistry meterRegistry; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final ParserProperties parserProperty; @Override @@ -73,7 +73,7 @@ public Health health() { } // consider case where endTime has been passed - if (mirrorProperties.getEndDate().isBefore(currentInstant)) { + if (importerProperties.getEndDate().isBefore(currentInstant)) { return endDateInPastHealth; } @@ -111,9 +111,9 @@ public Health health() { } private Instant getStartTime() { - return mirrorProperties.getStartDate() == null + return importerProperties.getStartDate() == null ? DateRangeCalculator.STARTUP_TIME - : mirrorProperties.getStartDate(); + : importerProperties.getStartDate(); } private Health getResolvedHealthWhenNoStreamFilesParsed(Instant currentInstant, Instant lastCheck) { diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/CommonDownloaderProperties.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/CommonDownloaderProperties.java index ab5344f91a5..1e7856ccf28 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/CommonDownloaderProperties.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/CommonDownloaderProperties.java @@ -16,8 +16,8 @@ package com.hedera.mirror.importer.downloader; -import com.hedera.mirror.importer.MirrorProperties; -import com.hedera.mirror.importer.MirrorProperties.HederaNetwork; +import com.hedera.mirror.importer.ImporterProperties; +import com.hedera.mirror.importer.ImporterProperties.HederaNetwork; import jakarta.annotation.PostConstruct; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; @@ -46,7 +46,7 @@ public class CommonDownloaderProperties { private static final MathContext MATH_CONTEXT = new MathContext(19, RoundingMode.DOWN); - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private String accessKey; @@ -92,9 +92,9 @@ public class CommonDownloaderProperties { @PostConstruct public void init() { if (StringUtils.isBlank(bucketName) - && StringUtils.isBlank(HederaNetwork.getBucketName(mirrorProperties.getNetwork()))) { + && StringUtils.isBlank(HederaNetwork.getBucketName(importerProperties.getNetwork()))) { throw new IllegalArgumentException( - "Must define bucketName for network named '%s'".formatted(mirrorProperties.getNetwork())); + "Must define bucketName for network named '%s'".formatted(importerProperties.getNetwork())); } StreamSourceProperties.SourceCredentials credentials = null; @@ -134,13 +134,13 @@ private void validateRatios() { public String getBucketName() { return StringUtils.isNotBlank(bucketName) ? bucketName - : HederaNetwork.getBucketName(mirrorProperties.getNetwork()); + : HederaNetwork.getBucketName(importerProperties.getNetwork()); } public boolean isAnonymousCredentials() { return allowAnonymousAccess != null ? allowAnonymousAccess - : HederaNetwork.isAllowAnonymousAccess(mirrorProperties.getNetwork()); + : HederaNetwork.isAllowAnonymousAccess(importerProperties.getNetwork()); } public enum PathType { diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/Downloader.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/Downloader.java index 9d53414cb7c..203533fd590 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/Downloader.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/Downloader.java @@ -27,7 +27,7 @@ import com.hedera.mirror.common.domain.StreamFile; import com.hedera.mirror.common.domain.StreamItem; import com.hedera.mirror.common.domain.StreamType; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.addressbook.ConsensusNode; import com.hedera.mirror.importer.addressbook.ConsensusNodeService; import com.hedera.mirror.importer.config.DateRangeCalculator; @@ -89,6 +89,7 @@ public abstract class Downloader, I extends StreamItem> protected final Logger log = LoggerFactory.getLogger(getClass()); protected final DownloaderProperties downloaderProperties; + protected final ImporterProperties importerProperties; protected final NodeSignatureVerifier nodeSignatureVerifier; protected final SignatureFileReader signatureFileReader; protected final StreamFileProvider streamFileProvider; @@ -98,7 +99,6 @@ public abstract class Downloader, I extends StreamItem> protected final AtomicReference> lastStreamFile = new AtomicReference<>(Optional.empty()); private final ConsensusNodeService consensusNodeService; - private final MirrorProperties mirrorProperties; private final StreamType streamType; // Metrics @@ -113,6 +113,7 @@ public abstract class Downloader, I extends StreamItem> protected Downloader( ConsensusNodeService consensusNodeService, DownloaderProperties downloaderProperties, + ImporterProperties importerProperties, MeterRegistry meterRegistry, DateRangeCalculator dateRangeCalculator, NodeSignatureVerifier nodeSignatureVerifier, @@ -122,6 +123,7 @@ protected Downloader( StreamFileReader streamFileReader) { this.consensusNodeService = consensusNodeService; this.downloaderProperties = downloaderProperties; + this.importerProperties = importerProperties; this.meterRegistry = meterRegistry; this.dateRangeCalculator = dateRangeCalculator; this.nodeSignatureVerifier = nodeSignatureVerifier; @@ -129,7 +131,6 @@ protected Downloader( this.streamFileProvider = streamFileProvider; this.streamFileReader = streamFileReader; this.streamFileNotifier = streamFileNotifier; - this.mirrorProperties = downloaderProperties.getMirrorProperties(); this.streamType = downloaderProperties.getStreamType(); // Metrics @@ -167,7 +168,7 @@ protected void downloadNextBatch() { // Following is a cost optimization to not unnecessarily list the public demo bucket once complete if (sigFilesMap.isEmpty() - && MirrorProperties.HederaNetwork.DEMO.equalsIgnoreCase(mirrorProperties.getNetwork())) { + && ImporterProperties.HederaNetwork.DEMO.equalsIgnoreCase(importerProperties.getNetwork())) { downloaderProperties.setEnabled(false); log.warn("Disabled polling after downloading all files in demo bucket"); } @@ -191,7 +192,7 @@ protected void setStreamFileIndex(T streamFile) { .get() .map(StreamFile::getIndex) .map(v -> v + 1) - .or(() -> Optional.ofNullable(mirrorProperties.getStartBlockNumber())) + .or(() -> Optional.ofNullable(importerProperties.getStartBlockNumber())) .orElse(0L); streamFile.setIndex(index); } @@ -338,7 +339,7 @@ private void verifySigsAndDownloadDataFiles(Multimap signatures) { - Instant endDate = mirrorProperties.getEndDate(); + Instant endDate = importerProperties.getEndDate(); for (var signature : signatures) { // Ignore signatures that didn't validate or weren't in the majority @@ -360,11 +361,11 @@ private boolean verifySignatures(Collection signatures) { if (downloaderProperties.isWriteFiles()) { Utility.archiveFile( - streamFileData.getFilePath(), streamFile.getBytes(), mirrorProperties.getStreamPath()); + streamFileData.getFilePath(), streamFile.getBytes(), importerProperties.getStreamPath()); } if (downloaderProperties.isWriteSignatures()) { - var destination = mirrorProperties.getStreamPath(); + var destination = importerProperties.getStreamPath(); signatures.forEach( s -> Utility.archiveFile(s.getFilename().getFilePath(), s.getBytes(), destination)); } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/DownloaderProperties.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/DownloaderProperties.java index 36de880774e..a815e7f8e96 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/DownloaderProperties.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/DownloaderProperties.java @@ -17,7 +17,6 @@ package com.hedera.mirror.importer.downloader; import com.hedera.mirror.common.domain.StreamType; -import com.hedera.mirror.importer.MirrorProperties; import java.time.Duration; public interface DownloaderProperties { @@ -26,8 +25,6 @@ public interface DownloaderProperties { Duration getFrequency(); - MirrorProperties getMirrorProperties(); - StreamType getStreamType(); boolean isEnabled(); diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/balance/AccountBalancesDownloader.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/balance/AccountBalancesDownloader.java index 409bec9f28a..2d193ad67ee 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/balance/AccountBalancesDownloader.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/balance/AccountBalancesDownloader.java @@ -18,6 +18,7 @@ import com.hedera.mirror.common.domain.balance.AccountBalance; import com.hedera.mirror.common.domain.balance.AccountBalanceFile; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.addressbook.ConsensusNode; import com.hedera.mirror.importer.addressbook.ConsensusNodeService; import com.hedera.mirror.importer.config.DateRangeCalculator; @@ -46,6 +47,7 @@ public AccountBalancesDownloader( AccountBalanceFileRepository accountBalanceFileRepository, ConsensusNodeService consensusNodeService, BalanceDownloaderProperties downloaderProperties, + ImporterProperties importerProperties, MeterRegistry meterRegistry, DateRangeCalculator dateRangeCalculator, NodeSignatureVerifier nodeSignatureVerifier, @@ -56,6 +58,7 @@ public AccountBalancesDownloader( super( consensusNodeService, downloaderProperties, + importerProperties, meterRegistry, dateRangeCalculator, nodeSignatureVerifier, diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/balance/BalanceDownloaderProperties.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/balance/BalanceDownloaderProperties.java index 12017be69c2..10cd383ab6e 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/balance/BalanceDownloaderProperties.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/balance/BalanceDownloaderProperties.java @@ -17,7 +17,6 @@ package com.hedera.mirror.importer.downloader.balance; import com.hedera.mirror.common.domain.StreamType; -import com.hedera.mirror.importer.MirrorProperties; import com.hedera.mirror.importer.downloader.CommonDownloaderProperties; import com.hedera.mirror.importer.downloader.DownloaderProperties; import jakarta.validation.constraints.NotNull; @@ -35,7 +34,6 @@ @Validated public class BalanceDownloaderProperties implements DownloaderProperties { - private final MirrorProperties mirrorProperties; private final CommonDownloaderProperties common; private boolean enabled = false; diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/event/EventDownloaderProperties.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/event/EventDownloaderProperties.java index 3f14309f015..b41eb4777d4 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/event/EventDownloaderProperties.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/event/EventDownloaderProperties.java @@ -17,7 +17,6 @@ package com.hedera.mirror.importer.downloader.event; import com.hedera.mirror.common.domain.StreamType; -import com.hedera.mirror.importer.MirrorProperties; import com.hedera.mirror.importer.downloader.CommonDownloaderProperties; import com.hedera.mirror.importer.downloader.DownloaderProperties; import jakarta.validation.constraints.NotNull; @@ -35,7 +34,6 @@ @Validated public class EventDownloaderProperties implements DownloaderProperties { - private final MirrorProperties mirrorProperties; private final CommonDownloaderProperties common; private boolean enabled = false; diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/event/EventFileDownloader.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/event/EventFileDownloader.java index 64b634e25c7..feebb413010 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/event/EventFileDownloader.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/event/EventFileDownloader.java @@ -18,6 +18,7 @@ import com.hedera.mirror.common.domain.event.EventFile; import com.hedera.mirror.common.domain.event.EventItem; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.addressbook.ConsensusNodeService; import com.hedera.mirror.importer.config.DateRangeCalculator; import com.hedera.mirror.importer.downloader.Downloader; @@ -38,6 +39,7 @@ public class EventFileDownloader extends Downloader { public EventFileDownloader( ConsensusNodeService consensusNodeService, EventDownloaderProperties downloaderProperties, + ImporterProperties importerProperties, MeterRegistry meterRegistry, DateRangeCalculator dateRangeCalculator, NodeSignatureVerifier nodeSignatureVerifier, @@ -48,6 +50,7 @@ public EventFileDownloader( super( consensusNodeService, downloaderProperties, + importerProperties, meterRegistry, dateRangeCalculator, nodeSignatureVerifier, diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/provider/LocalStreamFileProvider.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/provider/LocalStreamFileProvider.java index 2db1e09e360..5443e39fc4b 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/provider/LocalStreamFileProvider.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/provider/LocalStreamFileProvider.java @@ -48,7 +48,7 @@ public class LocalStreamFileProvider implements StreamFileProvider { @Override public Mono get(ConsensusNode node, StreamFilename streamFilename) { - var basePath = properties.getMirrorProperties().getStreamPath(); + var basePath = properties.getImporterProperties().getStreamPath(); return Mono.fromSupplier(() -> StreamFileData.from(basePath, streamFilename)) .timeout(properties.getTimeout()) .onErrorMap(FileOperationException.class, TransientProviderException::new); @@ -87,9 +87,10 @@ else if (pathTypeProp != pathType && pathTypeProp != PathType.AUTO) { case ACCOUNT_ID, AUTO -> Path.of( streamType.getPath(), streamType.getNodePrefix() + node.getNodeAccountId()); case NODE_ID -> Path.of( - properties.getMirrorProperties().getNetwork(), - String.valueOf( - properties.getMirrorProperties().getShard()), + properties.getImporterProperties().getNetwork(), + String.valueOf(properties + .getImporterProperties() + .getShard()), String.valueOf(node.getNodeId()), streamType.getNodeIdBasedSuffix()); }; @@ -106,7 +107,7 @@ else if (pathTypeProp != pathType && pathTypeProp != PathType.AUTO) { * Search YYYY-MM-DD sub-folders if present, otherwise just search streams directory. */ private Flux getBasePaths(StreamFilename streamFilename) { - var basePath = properties.getMirrorProperties().getStreamPath(); + var basePath = properties.getImporterProperties().getStreamPath(); basePath.toFile().mkdirs(); try (var subDirs = Files.list(basePath)) { @@ -154,7 +155,7 @@ private boolean matches(String lastFilename, File file) { } private StreamFileData toStreamFileData(File file) { - var basePath = properties.getMirrorProperties().getStreamPath(); + var basePath = properties.getImporterProperties().getStreamPath(); var filename = StreamFilename.from(basePath.relativize(file.toPath()).toString()); return StreamFileData.from(basePath, filename); } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/provider/S3StreamFileProvider.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/provider/S3StreamFileProvider.java index 5ec12c56b13..ab8e805e0a3 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/provider/S3StreamFileProvider.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/provider/S3StreamFileProvider.java @@ -116,8 +116,8 @@ private String getAccountIdPrefix(PathKey key) { } private String getNodeIdPrefix(PathKey key) { - var network = properties.getMirrorProperties().getNetwork(); - var shard = properties.getMirrorProperties().getShard(); + var network = properties.getImporterProperties().getNetwork(); + var shard = properties.getImporterProperties().getShard(); var streamFolder = key.type().getNodeIdBasedSuffix(); return TEMPLATE_NODE_ID_PREFIX.formatted(network, shard, key.node().getNodeId(), streamFolder); } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/record/RecordDownloaderProperties.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/record/RecordDownloaderProperties.java index 3fed8857e0b..838122497ee 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/record/RecordDownloaderProperties.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/record/RecordDownloaderProperties.java @@ -17,7 +17,6 @@ package com.hedera.mirror.importer.downloader.record; import com.hedera.mirror.common.domain.StreamType; -import com.hedera.mirror.importer.MirrorProperties; import com.hedera.mirror.importer.downloader.CommonDownloaderProperties; import com.hedera.mirror.importer.downloader.DownloaderProperties; import jakarta.validation.constraints.NotNull; @@ -35,8 +34,6 @@ @Validated public class RecordDownloaderProperties implements DownloaderProperties { - private final MirrorProperties mirrorProperties; - private final CommonDownloaderProperties common; private boolean enabled = true; diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/record/RecordFileDownloader.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/record/RecordFileDownloader.java index 4c257bdb291..c5eb8aa0868 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/record/RecordFileDownloader.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/downloader/record/RecordFileDownloader.java @@ -21,6 +21,7 @@ import com.hedera.mirror.common.domain.transaction.RecordFile; import com.hedera.mirror.common.domain.transaction.RecordItem; import com.hedera.mirror.common.domain.transaction.SidecarFile; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.addressbook.ConsensusNode; import com.hedera.mirror.importer.addressbook.ConsensusNodeService; import com.hedera.mirror.importer.config.DateRangeCalculator; @@ -61,6 +62,7 @@ public class RecordFileDownloader extends Downloader { public RecordFileDownloader( ConsensusNodeService consensusNodeService, RecordDownloaderProperties downloaderProperties, + ImporterProperties importerProperties, MeterRegistry meterRegistry, DateRangeCalculator dateRangeCalculator, NodeSignatureVerifier nodeSignatureVerifier, @@ -73,6 +75,7 @@ public RecordFileDownloader( super( consensusNodeService, downloaderProperties, + importerProperties, meterRegistry, dateRangeCalculator, nodeSignatureVerifier, @@ -148,7 +151,7 @@ private Mono getSidecar(ConsensusNode node, StreamFilename recordFi } if (downloaderProperties.isWriteFiles()) { - var streamPath = downloaderProperties.getMirrorProperties().getStreamPath(); + var streamPath = importerProperties.getStreamPath(); Utility.archiveFile(streamFileData.getFilePath(), sidecar.getBytes(), streamPath); } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/AccountEvmAddressMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/AccountEvmAddressMigration.java index 7ef029de253..1fba6991062 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/AccountEvmAddressMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/AccountEvmAddressMigration.java @@ -16,7 +16,7 @@ package com.hedera.mirror.importer.migration; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.util.Utility; import jakarta.inject.Named; import java.io.IOException; @@ -31,8 +31,9 @@ public class AccountEvmAddressMigration extends RepeatableMigration { private final NamedParameterJdbcOperations jdbcOperations; @Lazy - public AccountEvmAddressMigration(NamedParameterJdbcOperations jdbcOperations, MirrorProperties mirrorProperties) { - super(mirrorProperties.getMigration()); + public AccountEvmAddressMigration( + NamedParameterJdbcOperations jdbcOperations, ImporterProperties importerProperties) { + super(importerProperties.getMigration()); this.jdbcOperations = jdbcOperations; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BackfillAndDeduplicateBalanceMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BackfillAndDeduplicateBalanceMigration.java index 8404009f5ec..334d0c20a07 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BackfillAndDeduplicateBalanceMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BackfillAndDeduplicateBalanceMigration.java @@ -17,7 +17,7 @@ package com.hedera.mirror.importer.migration; import com.google.common.base.Stopwatch; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.db.DBProperties; import com.hedera.mirror.importer.db.TimePartitionService; @@ -155,10 +155,13 @@ select coalesce(max(consensus_timestamp), 0) @Lazy public BackfillAndDeduplicateBalanceMigration( DBProperties dbProperties, - MirrorProperties mirrorProperties, + ImporterProperties importerProperties, @Owner JdbcTemplate jdbcTemplate, TimePartitionService timePartitionService) { - super(mirrorProperties.getMigration(), new NamedParameterJdbcTemplate(jdbcTemplate), dbProperties.getSchema()); + super( + importerProperties.getMigration(), + new NamedParameterJdbcTemplate(jdbcTemplate), + dbProperties.getSchema()); this.jdbcTemplate = jdbcTemplate; this.timePartitionService = timePartitionService; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BackfillBlockMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BackfillBlockMigration.java index ee721d56f2f..843577c7446 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BackfillBlockMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BackfillBlockMigration.java @@ -17,7 +17,7 @@ package com.hedera.mirror.importer.migration; import com.hedera.mirror.common.aggregator.LogsBloomAggregator; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.db.DBProperties; import com.hedera.mirror.importer.repository.RecordFileRepository; import jakarta.annotation.Nonnull; @@ -59,11 +59,11 @@ public class BackfillBlockMigration extends AsyncJavaMigration { @Lazy public BackfillBlockMigration( DBProperties dbProperties, - MirrorProperties mirrorProperties, + ImporterProperties importerProperties, NamedParameterJdbcTemplate jdbcTemplate, RecordFileRepository recordFileRepository, TransactionOperations transactionOperations) { - super(mirrorProperties.getMigration(), jdbcTemplate, dbProperties.getSchema()); + super(importerProperties.getMigration(), jdbcTemplate, dbProperties.getSchema()); this.recordFileRepository = recordFileRepository; this.transactionOperations = transactionOperations; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BackfillTransactionHashMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BackfillTransactionHashMigration.java index f256c1e6276..dcd366e76ba 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BackfillTransactionHashMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BackfillTransactionHashMigration.java @@ -20,7 +20,7 @@ import com.google.common.base.Stopwatch; import com.hedera.mirror.common.domain.transaction.TransactionType; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.parser.record.entity.EntityProperties; import jakarta.inject.Named; @@ -55,9 +55,9 @@ public class BackfillTransactionHashMigration extends RepeatableMigration { public BackfillTransactionHashMigration( EntityProperties entityProperties, @Owner JdbcTemplate jdbcTemplate, - MirrorProperties mirrorProperties, + ImporterProperties importerProperties, Environment environment) { - super(mirrorProperties.getMigration()); + super(importerProperties.getMigration()); this.entityProperties = entityProperties; this.jdbcTemplate = jdbcTemplate; this.isV2 = environment.acceptsProfiles(Profiles.of("v2")); diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BlockNumberMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BlockNumberMigration.java index 0597a8e5377..3384f3c3278 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BlockNumberMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/BlockNumberMigration.java @@ -16,12 +16,12 @@ package com.hedera.mirror.importer.migration; -import static com.hedera.mirror.importer.MirrorProperties.HederaNetwork.MAINNET; -import static com.hedera.mirror.importer.MirrorProperties.HederaNetwork.TESTNET; +import static com.hedera.mirror.importer.ImporterProperties.HederaNetwork.MAINNET; +import static com.hedera.mirror.importer.ImporterProperties.HederaNetwork.TESTNET; import com.google.common.base.Stopwatch; import com.hedera.mirror.common.domain.transaction.RecordFile; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.repository.RecordFileRepository; import jakarta.inject.Named; import java.util.Map; @@ -36,13 +36,13 @@ public class BlockNumberMigration extends RepeatableMigration { TESTNET, Pair.of(1656461617493248000L, 22384256L), MAINNET, Pair.of(1656461547557609267L, 34305852L)); - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final RecordFileRepository recordFileRepository; @Lazy - public BlockNumberMigration(MirrorProperties mirrorProperties, RecordFileRepository recordFileRepository) { - super(mirrorProperties.getMigration()); - this.mirrorProperties = mirrorProperties; + public BlockNumberMigration(ImporterProperties importerProperties, RecordFileRepository recordFileRepository) { + super(importerProperties.getMigration()); + this.importerProperties = importerProperties; this.recordFileRepository = recordFileRepository; } @@ -58,7 +58,7 @@ protected MigrationVersion getMinimumVersion() { @Override protected void doMigrate() { - var hederaNetwork = mirrorProperties.getNetwork(); + var hederaNetwork = importerProperties.getNetwork(); var consensusEndAndBlockNumber = BLOCK_NUMBER_MAPPING.get(hederaNetwork); if (consensusEndAndBlockNumber == null) { diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/ErrataMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/ErrataMigration.java index 1682d710faf..d965a5c0ce0 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/ErrataMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/ErrataMigration.java @@ -22,7 +22,7 @@ import com.hedera.mirror.common.domain.entity.EntityId; import com.hedera.mirror.common.domain.token.TokenTransfer; import com.hedera.mirror.common.domain.transaction.RecordItem; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.DateRangeCalculator.DateRangeFilter; import com.hedera.mirror.importer.exception.FileOperationException; import com.hedera.mirror.importer.parser.balance.BalanceStreamFileListener; @@ -74,7 +74,7 @@ public class ErrataMigration extends RepeatableMigration implements BalanceStrea private final EntityRecordItemListener entityRecordItemListener; private final EntityProperties entityProperties; private final NamedParameterJdbcOperations jdbcOperations; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final RecordStreamFileListener recordStreamFileListener; private final TokenTransferRepository tokenTransferRepository; private final TransactionOperations transactionOperations; @@ -89,18 +89,18 @@ public ErrataMigration( EntityRecordItemListener entityRecordItemListener, EntityProperties entityProperties, NamedParameterJdbcOperations jdbcOperations, - MirrorProperties mirrorProperties, + ImporterProperties importerProperties, RecordStreamFileListener recordStreamFileListener, TokenTransferRepository tokenTransferRepository, TransactionOperations transactionOperations, TransactionRepository transactionRepository) { - super(mirrorProperties.getMigration()); + super(importerProperties.getMigration()); this.balanceOffsets = balanceOffsets; this.accountBalanceFileRepository = accountBalanceFileRepository; this.entityRecordItemListener = entityRecordItemListener; this.entityProperties = entityProperties; this.jdbcOperations = jdbcOperations; - this.mirrorProperties = mirrorProperties; + this.importerProperties = importerProperties; this.recordStreamFileListener = recordStreamFileListener; this.tokenTransferRepository = tokenTransferRepository; this.transactionOperations = transactionOperations; @@ -221,7 +221,7 @@ private void missingTransactions() { Resource[] resources = resourceResolver.getResources("classpath*:errata/mainnet/missingtransactions/*.bin"); Arrays.sort(resources, Comparator.comparing(Resource::getFilename)); recordStreamFileListener.onStart(); - var dateRangeFilter = new DateRangeFilter(mirrorProperties.getStartDate(), mirrorProperties.getEndDate()); + var dateRangeFilter = new DateRangeFilter(importerProperties.getStartDate(), importerProperties.getEndDate()); for (Resource resource : resources) { String name = resource.getFilename(); @@ -325,7 +325,7 @@ private Set getTimestamps() { } private boolean isMainnet() { - return MirrorProperties.HederaNetwork.MAINNET.equalsIgnoreCase(mirrorProperties.getNetwork()); + return ImporterProperties.HederaNetwork.MAINNET.equalsIgnoreCase(importerProperties.getNetwork()); } private boolean shouldApplyFixedTimeOffset(long consensusTimestamp) { diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/FixCryptoAllowanceAmountMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/FixCryptoAllowanceAmountMigration.java index 75049de5ad4..5f4c069f24c 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/FixCryptoAllowanceAmountMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/FixCryptoAllowanceAmountMigration.java @@ -16,7 +16,7 @@ package com.hedera.mirror.importer.migration; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.db.DBProperties; import com.hedera.mirror.importer.parser.record.entity.EntityProperties; @@ -140,9 +140,12 @@ select sum(t.amount) as amount_spent, entity_id as owner, t.payer_account_id as public FixCryptoAllowanceAmountMigration( DBProperties dbProperties, EntityProperties entityProperties, - MirrorProperties mirrorProperties, + ImporterProperties importerProperties, @Owner JdbcTemplate jdbcTemplate) { - super(mirrorProperties.getMigration(), new NamedParameterJdbcTemplate(jdbcTemplate), dbProperties.getSchema()); + super( + importerProperties.getMigration(), + new NamedParameterJdbcTemplate(jdbcTemplate), + dbProperties.getSchema()); this.entityProperties = entityProperties; this.jdbcTemplate = jdbcTemplate; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/FixFungibleTokenTotalSupplyMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/FixFungibleTokenTotalSupplyMigration.java index c8a84aff8f5..214973675fa 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/FixFungibleTokenTotalSupplyMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/FixFungibleTokenTotalSupplyMigration.java @@ -17,7 +17,7 @@ package com.hedera.mirror.importer.migration; import com.google.common.base.Stopwatch; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import jakarta.inject.Named; import java.io.IOException; import lombok.CustomLog; @@ -65,8 +65,8 @@ select coalesce(i.token_id, c.token_id) token_id, coalesce(i.amount, 0) + coales private final JdbcTemplate jdbcTemplate; @Lazy - public FixFungibleTokenTotalSupplyMigration(JdbcTemplate jdbcTemplate, MirrorProperties mirrorProperties) { - super(mirrorProperties.getMigration()); + public FixFungibleTokenTotalSupplyMigration(JdbcTemplate jdbcTemplate, ImporterProperties importerProperties) { + super(importerProperties.getMigration()); this.jdbcTemplate = jdbcTemplate; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/FixStakedBeforeEnabledMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/FixStakedBeforeEnabledMigration.java index 68a4f651c8b..244f56299e4 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/FixStakedBeforeEnabledMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/FixStakedBeforeEnabledMigration.java @@ -17,7 +17,7 @@ package com.hedera.mirror.importer.migration; import com.google.common.base.Stopwatch; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.util.Utility; import jakarta.inject.Named; import lombok.RequiredArgsConstructor; @@ -77,7 +77,7 @@ where coalesce(lower(h.timestamp_range), lower(p.timestamp_range)) <= :consensus private static final MigrationVersion VERSION = MigrationVersion.fromVersion("1.68.3"); private final NamedParameterJdbcOperations jdbcOperations; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; @Override public MigrationVersion getVersion() { @@ -91,8 +91,8 @@ public String getDescription() { @Override protected void doMigrate() { - var hederaNetwork = mirrorProperties.getNetwork(); - if (!MirrorProperties.HederaNetwork.MAINNET.equalsIgnoreCase(hederaNetwork)) { + var hederaNetwork = importerProperties.getNetwork(); + if (!ImporterProperties.HederaNetwork.MAINNET.equalsIgnoreCase(hederaNetwork)) { return; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/HistoricalAccountInfoMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/HistoricalAccountInfoMigration.java index 2409f1577b4..368fd9e50f7 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/HistoricalAccountInfoMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/HistoricalAccountInfoMigration.java @@ -21,7 +21,7 @@ import com.hedera.mirror.common.domain.entity.EntityId; import com.hedera.mirror.common.domain.entity.EntityType; import com.hedera.mirror.common.util.DomainUtils; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.repository.EntityRepository; import com.hederahashgraph.api.proto.java.CryptoGetInfoResponse.AccountInfo; import jakarta.inject.Named; @@ -54,7 +54,7 @@ public class HistoricalAccountInfoMigration extends RepeatableMigration { private final Set contractIds = new HashSet<>(); private final EntityRepository entityRepository; private final NamedParameterJdbcTemplate jdbcOperations; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; @Value("classpath:accountInfoContracts.txt") private Resource accountInfoContracts; @@ -66,11 +66,11 @@ public class HistoricalAccountInfoMigration extends RepeatableMigration { public HistoricalAccountInfoMigration( EntityRepository entityRepository, NamedParameterJdbcTemplate jdbcTemplate, - MirrorProperties mirrorProperties) { - super(mirrorProperties.getMigration()); + ImporterProperties importerProperties) { + super(importerProperties.getMigration()); this.entityRepository = entityRepository; this.jdbcOperations = jdbcTemplate; - this.mirrorProperties = mirrorProperties; + this.importerProperties = importerProperties; } @Override @@ -90,17 +90,17 @@ protected boolean skipMigration(Configuration configuration) { @Override protected void doMigrate() throws IOException { - if (!mirrorProperties.isImportHistoricalAccountInfo()) { + if (!importerProperties.isImportHistoricalAccountInfo()) { log.info("Skipping migration since importing historical account information is disabled"); return; } - if (!MirrorProperties.HederaNetwork.MAINNET.equalsIgnoreCase(mirrorProperties.getNetwork())) { + if (!ImporterProperties.HederaNetwork.MAINNET.equalsIgnoreCase(importerProperties.getNetwork())) { log.info("Skipping migration since it only applies to mainnet"); return; } - Instant startDate = Objects.requireNonNullElseGet(mirrorProperties.getStartDate(), Instant::now); + Instant startDate = Objects.requireNonNullElseGet(importerProperties.getStartDate(), Instant::now); if (startDate.isAfter(EXPORT_DATE)) { log.info("Skipping migration since start date {} is after the export date {}", startDate, EXPORT_DATE); return; diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/InitializeEntityBalanceMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/InitializeEntityBalanceMigration.java index 9958c1939ce..fe0046bfde6 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/InitializeEntityBalanceMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/InitializeEntityBalanceMigration.java @@ -17,7 +17,7 @@ package com.hedera.mirror.importer.migration; import com.google.common.base.Stopwatch; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.repository.AccountBalanceFileRepository; import com.hedera.mirror.importer.repository.RecordFileRepository; import jakarta.inject.Named; @@ -77,10 +77,10 @@ on conflict (id) do update @Lazy public InitializeEntityBalanceMigration( JdbcOperations jdbcOperations, - MirrorProperties mirrorProperties, + ImporterProperties importerProperties, AccountBalanceFileRepository accountBalanceFileRepository, RecordFileRepository recordFileRepository) { - super(mirrorProperties.getMigration(), accountBalanceFileRepository, recordFileRepository); + super(importerProperties.getMigration(), accountBalanceFileRepository, recordFileRepository); this.jdbcOperations = jdbcOperations; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/MergeDuplicateBlocksMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/MergeDuplicateBlocksMigration.java index bd3d88eafc3..da1fde4e745 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/MergeDuplicateBlocksMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/MergeDuplicateBlocksMigration.java @@ -17,7 +17,7 @@ package com.hedera.mirror.importer.migration; import com.google.common.base.Stopwatch; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.Owner; import jakarta.inject.Named; import java.io.IOException; @@ -55,18 +55,18 @@ merged_block as ( """; private final JdbcTemplate jdbcTemplate; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; @Lazy - protected MergeDuplicateBlocksMigration(@Owner JdbcTemplate jdbcTemplate, MirrorProperties mirrorProperties) { - super(mirrorProperties.getMigration()); + protected MergeDuplicateBlocksMigration(@Owner JdbcTemplate jdbcTemplate, ImporterProperties importerProperties) { + super(importerProperties.getMigration()); this.jdbcTemplate = jdbcTemplate; - this.mirrorProperties = mirrorProperties; + this.importerProperties = importerProperties; } @Override protected void doMigrate() throws IOException { - if (!MirrorProperties.HederaNetwork.MAINNET.equalsIgnoreCase(mirrorProperties.getNetwork())) { + if (!ImporterProperties.HederaNetwork.MAINNET.equalsIgnoreCase(importerProperties.getNetwork())) { return; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/MissingAddressBooksMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/MissingAddressBooksMigration.java index 98c0fe61af8..24350e00e8d 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/MissingAddressBooksMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/MissingAddressBooksMigration.java @@ -16,7 +16,7 @@ package com.hedera.mirror.importer.migration; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.addressbook.AddressBookService; import com.hedera.mirror.importer.repository.AddressBookServiceEndpointRepository; import jakarta.inject.Named; @@ -33,8 +33,8 @@ public class MissingAddressBooksMigration extends RepeatableMigration { public MissingAddressBooksMigration( AddressBookService addressBookService, AddressBookServiceEndpointRepository addressBookServiceEndpointRepository, - MirrorProperties mirrorProperties) { - super(mirrorProperties.getMigration()); + ImporterProperties importerProperties) { + super(importerProperties.getMigration()); this.addressBookService = addressBookService; this.addressBookServiceEndpointRepository = addressBookServiceEndpointRepository; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/RecalculatePendingRewardMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/RecalculatePendingRewardMigration.java index ddebe1dddae..15224195999 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/RecalculatePendingRewardMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/RecalculatePendingRewardMigration.java @@ -17,8 +17,8 @@ package com.hedera.mirror.importer.migration; import com.google.common.base.Stopwatch; -import com.hedera.mirror.importer.MirrorProperties; -import com.hedera.mirror.importer.MirrorProperties.HederaNetwork; +import com.hedera.mirror.importer.ImporterProperties; +import com.hedera.mirror.importer.ImporterProperties.HederaNetwork; import jakarta.inject.Named; import java.util.Map; import lombok.RequiredArgsConstructor; @@ -87,7 +87,7 @@ select sum(reward_rate) private static final MigrationVersion VERSION = MigrationVersion.fromVersion("1.68.4"); private final NamedParameterJdbcOperations jdbcOperations; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; @Override public String getDescription() { @@ -101,7 +101,7 @@ public MigrationVersion getVersion() { @Override protected void doMigrate() { - var hederaNetwork = mirrorProperties.getNetwork(); + var hederaNetwork = importerProperties.getNetwork(); Long consensusTimestamp = FIRST_NONZERO_REWARD_RATE_TIMESTAMP.get(hederaNetwork); if (consensusTimestamp == null) { return; diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/SyntheticCryptoTransferApprovalMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/SyntheticCryptoTransferApprovalMigration.java index 9ed94845495..66c6e27e640 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/SyntheticCryptoTransferApprovalMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/SyntheticCryptoTransferApprovalMigration.java @@ -19,7 +19,7 @@ import com.google.common.annotations.VisibleForTesting; import com.hedera.mirror.common.domain.entity.EntityId; import com.hedera.mirror.common.domain.transaction.RecordFile; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.db.DBProperties; import com.hedera.mirror.importer.exception.ImporterException; import com.hedera.mirror.importer.parser.record.RecordStreamFileListener; @@ -186,7 +186,7 @@ private enum TRANSFER_TYPE { private static final DataClassRowMapper resultRowMapper = new DataClassRowMapper<>(ApprovalTransfer.class); - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final NamedParameterJdbcTemplate transferJdbcTemplate; @Getter @@ -196,12 +196,12 @@ private enum TRANSFER_TYPE { public SyntheticCryptoTransferApprovalMigration( DBProperties dbProperties, RecordFileRepository recordFileRepository, - MirrorProperties mirrorProperties, + ImporterProperties importerProperties, NamedParameterJdbcTemplate transferJdbcTemplate, TransactionOperations transactionOperations) { - super(mirrorProperties.getMigration(), transferJdbcTemplate, dbProperties.getSchema()); + super(importerProperties.getMigration(), transferJdbcTemplate, dbProperties.getSchema()); this.recordFileRepository = recordFileRepository; - this.mirrorProperties = mirrorProperties; + this.importerProperties = importerProperties; this.transferJdbcTemplate = transferJdbcTemplate; this.transactionOperations = transactionOperations; } @@ -224,7 +224,7 @@ protected Long getInitial() { @Override protected Optional migratePartial(Long lowerBound) { - if (!MirrorProperties.HederaNetwork.MAINNET.equalsIgnoreCase(mirrorProperties.getNetwork())) { + if (!ImporterProperties.HederaNetwork.MAINNET.equalsIgnoreCase(importerProperties.getNetwork())) { log.info("Skipping migration since it only applies to mainnet"); return Optional.empty(); } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/SyntheticNftAllowanceOwnerMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/SyntheticNftAllowanceOwnerMigration.java index 75fd238a8d5..74cb8077148 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/SyntheticNftAllowanceOwnerMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/SyntheticNftAllowanceOwnerMigration.java @@ -18,7 +18,7 @@ import com.google.common.base.Stopwatch; import com.hedera.mirror.common.domain.transaction.RecordFile; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.exception.ImporterException; import com.hedera.mirror.importer.parser.record.RecordStreamFileListener; @@ -119,9 +119,9 @@ insert into nft_allowance (approved_for_all, owner, payer_account_id, spender, t @Lazy public SyntheticNftAllowanceOwnerMigration( @Owner JdbcTemplate jdbcTemplate, - MirrorProperties mirrorProperties, + ImporterProperties importerProperties, RecordFileRepository recordFileRepository) { - super(mirrorProperties.getMigration()); + super(importerProperties.getMigration()); this.jdbcTemplate = jdbcTemplate; this.recordFileRepository = recordFileRepository; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/SyntheticTokenAllowanceOwnerMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/SyntheticTokenAllowanceOwnerMigration.java index d65cc5b6133..b240d062860 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/SyntheticTokenAllowanceOwnerMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/SyntheticTokenAllowanceOwnerMigration.java @@ -18,7 +18,7 @@ import com.google.common.base.Stopwatch; import com.hedera.mirror.common.domain.transaction.RecordFile; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.exception.ImporterException; import com.hedera.mirror.importer.parser.record.RecordStreamFileListener; @@ -122,9 +122,9 @@ insert into token_allowance (amount, amount_granted, owner, payer_account_id, sp @Lazy public SyntheticTokenAllowanceOwnerMigration( @Owner JdbcTemplate jdbcTemplate, - MirrorProperties mirrorProperties, + ImporterProperties importerProperties, RecordFileRepository recordFileRepository) { - super(mirrorProperties.getMigration()); + super(importerProperties.getMigration()); this.jdbcTemplate = jdbcTemplate; this.recordFileRepository = recordFileRepository; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/TokenAccountBalanceMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/TokenAccountBalanceMigration.java index e8e32615bc1..1f47a7fb602 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/TokenAccountBalanceMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/TokenAccountBalanceMigration.java @@ -17,7 +17,7 @@ package com.hedera.mirror.importer.migration; import com.google.common.base.Stopwatch; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.repository.AccountBalanceFileRepository; import com.hedera.mirror.importer.repository.RecordFileRepository; import jakarta.inject.Named; @@ -76,10 +76,10 @@ on conflict (account_id, token_id) do update @Lazy public TokenAccountBalanceMigration( JdbcOperations jdbcOperations, - MirrorProperties mirrorProperties, + ImporterProperties importerProperties, AccountBalanceFileRepository accountBalanceFileRepository, RecordFileRepository recordFileRepository) { - super(mirrorProperties.getMigration(), accountBalanceFileRepository, recordFileRepository); + super(importerProperties.getMigration(), accountBalanceFileRepository, recordFileRepository); this.jdbcOperations = jdbcOperations; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/TopicMessageLookupMigration.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/TopicMessageLookupMigration.java index 36f80e644a3..e857e5b571a 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/TopicMessageLookupMigration.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/migration/TopicMessageLookupMigration.java @@ -17,7 +17,7 @@ package com.hedera.mirror.importer.migration; import com.google.common.base.Stopwatch; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.db.TimePartitionService; import com.hedera.mirror.importer.parser.record.entity.EntityProperties; @@ -57,10 +57,10 @@ insert into topic_message_lookup (partition, sequence_number_range, timestamp_ra protected TopicMessageLookupMigration( EntityProperties entityProperties, @Owner JdbcTemplate jdbcTemplate, - MirrorProperties mirrorProperties, + ImporterProperties importerProperties, RecordFileRepository recordFileRepository, TimePartitionService timePartitionService) { - super(mirrorProperties.getMigration()); + super(importerProperties.getMigration()); this.entityProperties = entityProperties; this.jdbcTemplate = jdbcTemplate; this.recordFileRepository = recordFileRepository; diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV1.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV1.java index a1110b91c42..b1c36f4c30b 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV1.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV1.java @@ -19,7 +19,7 @@ import com.google.common.base.Splitter; import com.hedera.mirror.common.domain.balance.AccountBalance; import com.hedera.mirror.common.domain.entity.EntityId; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.exception.InvalidDatasetException; import jakarta.inject.Named; import java.util.Collections; @@ -32,7 +32,7 @@ public class AccountBalanceLineParserV1 implements AccountBalanceLineParser { private static final Splitter SPLITTER = Splitter.on(',').trimResults().omitEmptyStrings(); - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; /** * Parses an account balance line to extract shard, realm, account, and balance. If the shard matches @@ -63,10 +63,10 @@ public AccountBalance parse(String line, long consensusTimestamp) { throw new InvalidDatasetException(INVALID_BALANCE + line); } - if (shardNum != mirrorProperties.getShard()) { + if (shardNum != importerProperties.getShard()) { throw new InvalidDatasetException(String.format( "Invalid account balance line: %s. Expect " + "shard (%d), got shard (%d)", - line, mirrorProperties.getShard(), shardNum)); + line, importerProperties.getShard(), shardNum)); } return new AccountBalance( diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV2.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV2.java index e0a10e4aaff..c93202e8ba4 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV2.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV2.java @@ -21,7 +21,7 @@ import com.hedera.mirror.common.domain.balance.AccountBalance; import com.hedera.mirror.common.domain.balance.TokenBalance; import com.hedera.mirror.common.domain.entity.EntityId; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.exception.InvalidDatasetException; import com.hederahashgraph.api.proto.java.TokenBalances; import com.hederahashgraph.api.proto.java.TokenID; @@ -38,7 +38,7 @@ public class AccountBalanceLineParserV2 implements AccountBalanceLineParser { private static final Splitter SPLITTER = Splitter.on(',').trimResults().omitEmptyStrings(); - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; /** * Parses an account balance line to extract shard, realm, account, balance, and token balances. If the shard @@ -75,10 +75,10 @@ public AccountBalance parse(String line, long consensusTimestamp) { throw new InvalidDatasetException(INVALID_BALANCE + line); } - if (shardNum != mirrorProperties.getShard()) { + if (shardNum != importerProperties.getShard()) { throw new InvalidDatasetException(String.format( "Invalid account balance line: %s. Expect " + "shard (%d), got shard (%d)", - line, mirrorProperties.getShard(), shardNum)); + line, importerProperties.getShard(), shardNum)); } EntityId accountId = EntityId.of(shardNum, realmNum, accountNum); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/ImporterIntegrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/ImporterIntegrationTest.java index 33969d931d3..9e1ee123ddc 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/ImporterIntegrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/ImporterIntegrationTest.java @@ -82,7 +82,7 @@ public abstract class ImporterIntegrationTest extends CommonIntegrationTest { private DateRangeCalculator dateRangeCalculator; @Resource - private MirrorProperties mirrorProperties; + private ImporterProperties importerProperties; @Getter @Value("#{environment.matchesProfiles('!v2')}") @@ -132,8 +132,8 @@ protected Collection findHistory(Class historyClass, String ids, Strin protected void reset() { super.reset(); dateRangeCalculator.clear(); - mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.TESTNET); - mirrorProperties.setStartDate(Instant.EPOCH); + importerProperties.setNetwork(ImporterProperties.HederaNetwork.TESTNET); + importerProperties.setStartDate(Instant.EPOCH); retryRecorder.reset(); } diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/MirrorPropertiesTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/ImporterPropertiesTest.java similarity index 92% rename from hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/MirrorPropertiesTest.java rename to hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/ImporterPropertiesTest.java index 94c1f23badc..acf7316fe9b 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/MirrorPropertiesTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/ImporterPropertiesTest.java @@ -19,12 +19,12 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -import com.hedera.mirror.importer.MirrorProperties.HederaNetwork; +import com.hedera.mirror.importer.ImporterProperties.HederaNetwork; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; -class MirrorPropertiesTest { +class ImporterPropertiesTest { @ParameterizedTest(name = "Network {2} is canonical network {0}, with prefix {1}") @CsvSource({ @@ -47,7 +47,7 @@ class MirrorPropertiesTest { }) void verifyCanonicalNetworkWithPrefix(String expectedHederaNetwork, String expectedPrefix, String networkName) { - var properties = new MirrorProperties(); + var properties = new ImporterProperties(); properties.setNetwork(networkName); assertThat(properties.getNetwork()).isEqualTo(expectedHederaNetwork); assertThat(properties.getNetworkPrefix()).isEqualTo(expectedPrefix); @@ -62,7 +62,7 @@ void verifyCanonicalNetworkWithPrefix(String expectedHederaNetwork, String expec }) void verifyNonCanonicalNetworkWithPrefix(String expectedNetwork, String expectedPrefix, String networkName) { - var properties = new MirrorProperties(); + var properties = new ImporterProperties(); properties.setNetwork(networkName); assertThat(properties.getNetwork()).isEqualTo(expectedNetwork); assertThat(properties.getNetworkPrefix()).isEqualTo(expectedPrefix); @@ -70,7 +70,7 @@ void verifyNonCanonicalNetworkWithPrefix(String expectedNetwork, String expected @Test void verifySetNetworkPropertyValidation() { - var properties = new MirrorProperties(); + var properties = new ImporterProperties(); assertThat(properties.getNetwork()).isEqualTo(HederaNetwork.DEMO); // Default assertThat(properties.getNetworkPrefix()).isNull(); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/addressbook/AddressBookServiceImplTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/addressbook/AddressBookServiceImplTest.java index ae20c914bcf..ad5dd2d8e60 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/addressbook/AddressBookServiceImplTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/addressbook/AddressBookServiceImplTest.java @@ -33,8 +33,8 @@ import com.hedera.mirror.common.domain.transaction.TransactionType; import com.hedera.mirror.importer.FileCopier; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; -import com.hedera.mirror.importer.MirrorProperties.ConsensusMode; +import com.hedera.mirror.importer.ImporterProperties; +import com.hedera.mirror.importer.ImporterProperties.ConsensusMode; import com.hedera.mirror.importer.config.CacheConfiguration; import com.hedera.mirror.importer.repository.AddressBookEntryRepository; import com.hedera.mirror.importer.repository.AddressBookRepository; @@ -92,7 +92,7 @@ class AddressBookServiceImplTest extends ImporterIntegrationTest { private final CacheManager cacheManager; private final FileDataRepository fileDataRepository; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final NodeStakeRepository nodeStakeRepository; private final TransactionTemplate transactionTemplate; @@ -162,14 +162,14 @@ private void append(byte[] contents, long consensusTimeStamp, boolean is102) { @Test void startupWithOtherNetworkIncorrectInitialAddressBookPath() { - MirrorProperties otherNetworkMirrorProperties = new MirrorProperties(); - otherNetworkMirrorProperties.setDataPath(dataPath); - otherNetworkMirrorProperties.setInitialAddressBook(dataPath.resolve("test-v1")); - otherNetworkMirrorProperties.setNetwork(MirrorProperties.HederaNetwork.OTHER); + ImporterProperties otherNetworkImporterProperties = new ImporterProperties(); + otherNetworkImporterProperties.setDataPath(dataPath); + otherNetworkImporterProperties.setInitialAddressBook(dataPath.resolve("test-v1")); + otherNetworkImporterProperties.setNetwork(ImporterProperties.HederaNetwork.OTHER); AddressBookService customAddressBookService = new AddressBookServiceImpl( addressBookRepository, fileDataRepository, - otherNetworkMirrorProperties, + otherNetworkImporterProperties, nodeStakeRepository, transactionTemplate); assertThrows(IllegalStateException.class, () -> { @@ -200,14 +200,14 @@ void startupWithOtherNetwork() { .to(""); fileCopier.copy(); - MirrorProperties otherNetworkMirrorProperties = new MirrorProperties(); - otherNetworkMirrorProperties.setDataPath(dataPath); - otherNetworkMirrorProperties.setInitialAddressBook(dataPath.resolve("test-v1")); - otherNetworkMirrorProperties.setNetwork(MirrorProperties.HederaNetwork.OTHER); + ImporterProperties otherNetworkImporterProperties = new ImporterProperties(); + otherNetworkImporterProperties.setDataPath(dataPath); + otherNetworkImporterProperties.setInitialAddressBook(dataPath.resolve("test-v1")); + otherNetworkImporterProperties.setNetwork(ImporterProperties.HederaNetwork.OTHER); AddressBookService customAddressBookService = new AddressBookServiceImpl( addressBookRepository, fileDataRepository, - otherNetworkMirrorProperties, + otherNetworkImporterProperties, nodeStakeRepository, transactionTemplate); AddressBook addressBook = customAddressBookService.getCurrent(); @@ -969,7 +969,7 @@ void getNodes(ConsensusMode mode, long stake, long expectedNodeStake, long expec .stake(stake)) .persist(); } - mirrorProperties.setConsensusMode(mode); + importerProperties.setConsensusMode(mode); assertThat(addressBookService.getNodes()) .hasSize(TEST_INITIAL_ADDRESS_BOOK_NODE_COUNT) @@ -1001,7 +1001,7 @@ void getNodesWithNodeStakeCountMoreThanAddressBook( .stake(10000L)) .persist(); } - mirrorProperties.setConsensusMode(mode); + importerProperties.setConsensusMode(mode); assertThat(addressBookService.getNodes()) .hasSize(TEST_INITIAL_ADDRESS_BOOK_NODE_COUNT) diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/config/AbstractStreamFileHealthIndicatorTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/config/AbstractStreamFileHealthIndicatorTest.java index cb616402dcc..63852b4677d 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/config/AbstractStreamFileHealthIndicatorTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/config/AbstractStreamFileHealthIndicatorTest.java @@ -24,7 +24,7 @@ import static org.mockito.Mock.Strictness.LENIENT; import static org.mockito.Mockito.doReturn; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.leader.LeaderService; import com.hedera.mirror.importer.parser.AbstractParserProperties; import io.micrometer.core.instrument.MeterRegistry; @@ -69,7 +69,7 @@ abstract class AbstractStreamFileHealthIndicatorTest { private AbstractParserProperties parserProperties; - protected MirrorProperties mirrorProperties; + protected ImporterProperties importerProperties; abstract AbstractParserProperties getParserProperties(); @@ -88,12 +88,12 @@ void setup() { doReturn(streamCloseLatencySearch).when(meterRegistry).find(STREAM_CLOSE_LATENCY_METRIC_NAME); doReturn(streamParseDurationSearch).when(meterRegistry).find(STREAM_PARSE_DURATION_METRIC_NAME); - mirrorProperties = new MirrorProperties(); - mirrorProperties.setEndDate(Instant.MAX); + importerProperties = new ImporterProperties(); + importerProperties.setEndDate(Instant.MAX); parserProperties = getParserProperties(); streamFileHealthIndicator = - new StreamFileHealthIndicator(leaderService, meterRegistry, mirrorProperties, parserProperties); + new StreamFileHealthIndicator(leaderService, meterRegistry, importerProperties, parserProperties); } @Test @@ -148,7 +148,7 @@ void startupNoStreamFilesBeforeWindow() { void startupNoStreamFilesAfterWindowBeforeFirstFileClose() { // set window time to smaller value parserProperties.setProcessingTimeout(Duration.ofSeconds(-10L)); - mirrorProperties.setStartDate(Instant.now().plus(1, ChronoUnit.DAYS)); + importerProperties.setStartDate(Instant.now().plus(1, ChronoUnit.DAYS)); Health health = streamFileHealthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.UNKNOWN); @@ -172,7 +172,7 @@ void startupNoNewDownloadedStreamFilesAfterWindowBeforeFileClose() { void startupNoStreamFilesAfterFirstFileClose() { // set window time to smaller value parserProperties.setProcessingTimeout(Duration.ofSeconds(-10L)); - mirrorProperties.setStartDate(Instant.now().minus(1, ChronoUnit.DAYS)); + importerProperties.setStartDate(Instant.now().minus(1, ChronoUnit.DAYS)); // update fileClose mean otherwise larger default value is used doReturn(1.0).when(streamCloseLatencyDurationTimer).mean(any()); @@ -221,7 +221,7 @@ void noNewStreamFilesInWindow() { @Test void noNewStreamFilesAfterWindow() { // parserProperties.setProcessingTimeout(Duration.ofMinutes(-10L)); // force end of timeout to before now - mirrorProperties.setStartDate(Instant.EPOCH); + importerProperties.setStartDate(Instant.EPOCH); Health health = streamFileHealthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.UNKNOWN); @@ -245,7 +245,7 @@ void noNewStreamFilesAfterWindow() { @Test void noNewStreamFilesAfterWindowAndEndTime() { - mirrorProperties.setEndDate(Instant.now().minusSeconds(60)); // force endDate to before now + importerProperties.setEndDate(Instant.now().minusSeconds(60)); // force endDate to before now parserProperties = getParserProperties(); Health health = streamFileHealthIndicator.health(); @@ -255,7 +255,7 @@ void noNewStreamFilesAfterWindowAndEndTime() { @Test void recoverWhenNewStreamFiles() { - mirrorProperties.setStartDate(Instant.now().minus(1, ChronoUnit.DAYS)); + importerProperties.setStartDate(Instant.now().minus(1, ChronoUnit.DAYS)); Health health = streamFileHealthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.UNKNOWN); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/config/DateRangeCalculatorTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/config/DateRangeCalculatorTest.java index 3a2d9dbaa95..afd4c688d35 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/config/DateRangeCalculatorTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/config/DateRangeCalculatorTest.java @@ -28,7 +28,7 @@ import com.hedera.mirror.common.domain.StreamFile; import com.hedera.mirror.common.domain.StreamType; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.domain.StreamFilename; import com.hedera.mirror.importer.downloader.CommonDownloaderProperties; import com.hedera.mirror.importer.downloader.DownloaderProperties; @@ -69,22 +69,22 @@ class DateRangeCalculatorTest { @Mock private RecordFileRepository recordFileRepository; - private MirrorProperties mirrorProperties; + private ImporterProperties importerProperties; private List downloaderPropertiesList; private DateRangeCalculator dateRangeCalculator; @BeforeEach void setUp() { - mirrorProperties = new MirrorProperties(); - mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.TESTNET); - var commonDownloaderProperties = new CommonDownloaderProperties(mirrorProperties); - var balanceDownloaderProperties = new BalanceDownloaderProperties(mirrorProperties, commonDownloaderProperties); - var eventDownloaderProperties = new EventDownloaderProperties(mirrorProperties, commonDownloaderProperties); - var recordDownloaderProperties = new RecordDownloaderProperties(mirrorProperties, commonDownloaderProperties); + importerProperties = new ImporterProperties(); + importerProperties.setNetwork(ImporterProperties.HederaNetwork.TESTNET); + var commonDownloaderProperties = new CommonDownloaderProperties(importerProperties); + var balanceDownloaderProperties = new BalanceDownloaderProperties(commonDownloaderProperties); + var eventDownloaderProperties = new EventDownloaderProperties(commonDownloaderProperties); + var recordDownloaderProperties = new RecordDownloaderProperties(commonDownloaderProperties); downloaderPropertiesList = List.of(balanceDownloaderProperties, eventDownloaderProperties, recordDownloaderProperties); dateRangeCalculator = new DateRangeCalculator( - mirrorProperties, accountBalanceFileRepository, eventFileRepository, recordFileRepository); + importerProperties, accountBalanceFileRepository, eventFileRepository, recordFileRepository); balanceDownloaderProperties.setEnabled(true); eventDownloaderProperties.setEnabled(true); @@ -118,7 +118,7 @@ void notSetAndDatabaseNotEmpty() { @Test void startDateNotSetAndEndDateAfterLongMaxAndDatabaseNotEmpty() { var past = STARTUP_TIME.minusSeconds(100); - mirrorProperties.setEndDate(Utility.MAX_INSTANT_LONG.plusNanos(1)); + importerProperties.setEndDate(Utility.MAX_INSTANT_LONG.plusNanos(1)); streamFileRepositories.forEach((streamType, repository) -> doReturn(streamFile(streamType, past, false)).when(repository).findLatest()); verifyWhenLastStreamFileFromDatabase(past); @@ -127,9 +127,9 @@ void startDateNotSetAndEndDateAfterLongMaxAndDatabaseNotEmpty() { @Test void startDateSetAndDatabaseEmpty() { var startDate = STARTUP_TIME.plusSeconds(10L); - mirrorProperties.setStartDate(startDate); - var expectedFilter = new DateRangeFilter(mirrorProperties.getStartDate(), null); - var expectedDate = mirrorProperties.getStartDate(); + importerProperties.setStartDate(startDate); + var expectedFilter = new DateRangeFilter(importerProperties.getStartDate(), null); + var expectedDate = importerProperties.getStartDate(); for (var downloaderProperties : downloaderPropertiesList) { StreamType streamType = downloaderProperties.getStreamType(); assertThat(dateRangeCalculator.getLastStreamFile(streamType)) @@ -142,7 +142,7 @@ void startDateSetAndDatabaseEmpty() { @ValueSource(longs = {0, 1}) void startDateNotAfterDatabase(long nanos) { var past = STARTUP_TIME.minusSeconds(100); - mirrorProperties.setStartDate(past.minusNanos(nanos)); + importerProperties.setStartDate(past.minusNanos(nanos)); streamFileRepositories.forEach((streamType, repository) -> doReturn(streamFile(streamType, past, false)).when(repository).findLatest()); verifyWhenLastStreamFileFromDatabase(past); @@ -158,7 +158,7 @@ void startDateAfterDatabase(long diffNanos) { .findLatest()); var startDate = lastFileInstant.plusNanos(diffNanos); - mirrorProperties.setStartDate(startDate); + importerProperties.setStartDate(startDate); var effectiveStartDate = max(startDate, lastFileInstant); var expectedFilter = new DateRangeFilter(startDate, null); @@ -183,8 +183,8 @@ void startDateAfterDatabase(long diffNanos) { ", 2020-08-18T09:00:05.123Z," }) void startDateNotBeforeEndDate(Instant startDate, Instant endDate, Instant lastFileDate) { - mirrorProperties.setStartDate(startDate); - mirrorProperties.setEndDate(endDate); + importerProperties.setStartDate(startDate); + importerProperties.setEndDate(endDate); if (lastFileDate != null) { streamFileRepositories.forEach( diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/AbstractDownloaderTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/AbstractDownloaderTest.java index 1660c87e785..9ce6a9aeede 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/AbstractDownloaderTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/AbstractDownloaderTest.java @@ -37,7 +37,7 @@ import com.hedera.mirror.common.domain.transaction.RecordFile; import com.hedera.mirror.common.util.DomainUtils; import com.hedera.mirror.importer.FileCopier; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.TestUtils; import com.hedera.mirror.importer.addressbook.ConsensusNode; import com.hedera.mirror.importer.addressbook.ConsensusNodeService; @@ -125,7 +125,7 @@ public abstract class AbstractDownloaderTest> { protected S3Proxy s3Proxy; protected FileCopier fileCopier; protected CommonDownloaderProperties commonDownloaderProperties; - protected MirrorProperties mirrorProperties; + protected ImporterProperties importerProperties; protected S3AsyncClient s3AsyncClient; protected DownloaderProperties downloaderProperties; protected Downloader downloader; @@ -207,7 +207,7 @@ protected void loadAddressBook(String filename) { } } - // Implementation can assume that mirrorProperties and commonDownloaderProperties have been initialized. + // Implementation can assume that importerProperties and commonDownloaderProperties have been initialized. protected abstract DownloaderProperties getDownloaderProperties(); protected Map getExpectedFileIndexMap() { @@ -267,12 +267,12 @@ void after() throws Exception { } private void initProperties() { - mirrorProperties = new MirrorProperties(); - mirrorProperties.setDataPath(dataPath); - mirrorProperties.setStartBlockNumber(101L); - mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.TESTNET); + importerProperties = new ImporterProperties(); + importerProperties.setDataPath(dataPath); + importerProperties.setStartBlockNumber(101L); + importerProperties.setNetwork(ImporterProperties.HederaNetwork.TESTNET); - commonDownloaderProperties = new CommonDownloaderProperties(mirrorProperties); + commonDownloaderProperties = new CommonDownloaderProperties(importerProperties); commonDownloaderProperties.setEndpointOverride("http://localhost:" + S3_PROXY_PORT); // tests (except for "testPartialCollection" test) expect every Streamfile to be present commonDownloaderProperties.setDownloadRatio(BigDecimal.ONE); @@ -308,27 +308,27 @@ private void preparePathType(PathType pathType) { if (pathType == PathType.ACCOUNT_ID) { fileCopier.copy(); } else { - fileCopier.copyAsNodeIdStructure(Path::getParent, mirrorProperties.getNetwork()); + fileCopier.copyAsNodeIdStructure(Path::getParent, importerProperties.getNetwork()); } } @ParameterizedTest(name = "Download and verify files with path type: {0}") @EnumSource(PathType.class) void download(PathType pathType) { - mirrorProperties.setStartBlockNumber(null); + importerProperties.setStartBlockNumber(null); preparePathType(pathType); expectLastStreamFile(Instant.EPOCH); downloader.download(); verifyForSuccess(); - assertThat(mirrorProperties.getDataPath()).isEmptyDirectory(); + assertThat(importerProperties.getDataPath()).isEmptyDirectory(); } @Test @DisplayName("Non-unanimous consensus reached") void partialConsensus() throws IOException { - mirrorProperties.setStartBlockNumber(null); + importerProperties.setStartBlockNumber(null); fileCopier.copy(); var nodePath = @@ -345,7 +345,7 @@ void partialConsensus() throws IOException { void oneThirdConsensus() { nodes.forEach(c -> ((ConsensusNodeStub) c).setTotalStake(3)); nodes.remove(Iterables.getLast(nodes)); - mirrorProperties.setStartBlockNumber(null); + importerProperties.setStartBlockNumber(null); var nodeAccountId = nodes.iterator().next().getNodeAccountId(); var nodePath = downloaderProperties.getStreamType().getNodePrefix() + nodeAccountId; @@ -361,7 +361,7 @@ void oneThirdConsensus() { void lessThanOneThirdConsensus() { nodes.forEach(c -> ((ConsensusNodeStub) c).setTotalStake(4)); nodes.remove(Iterables.getLast(nodes)); - mirrorProperties.setStartBlockNumber(null); + importerProperties.setStartBlockNumber(null); var nodeAccountId = nodes.iterator().next().getNodeAccountId(); var nodePath = downloaderProperties.getStreamType().getNodePrefix() + nodeAccountId; @@ -435,7 +435,7 @@ void writeFiles(PathType pathType) throws Exception { preparePathType(pathType); expectLastStreamFile(Instant.EPOCH); downloader.download(); - assertThat(Files.walk(mirrorProperties.getDataPath())) + assertThat(Files.walk(importerProperties.getDataPath())) .filteredOn(p -> !p.toFile().isDirectory()) .hasSizeGreaterThan(0) .allMatch(this::isStreamFile); @@ -448,7 +448,7 @@ void writeSignatureFiles(PathType pathType) throws Exception { preparePathType(pathType); expectLastStreamFile(Instant.EPOCH); downloader.download(); - assertThat(Files.walk(mirrorProperties.getDataPath())) + assertThat(Files.walk(importerProperties.getDataPath())) .filteredOn(p -> !p.toFile().isDirectory()) .hasSizeGreaterThan(0) .allMatch(this::isSigFile); @@ -487,7 +487,7 @@ void differentFilenamesNextInterval() { @Test @DisplayName("Download and verify two group of files in the same bucket") void downloadValidFilesInSameBucket() { - mirrorProperties.setStartBlockNumber(null); + importerProperties.setStartBlockNumber(null); // last valid downloaded file's timestamp is set to file1's timestamp - (I/2 + 1ns), so both file1 and file2 // will be in the bucket [lastTimestamp + I/2, lastTimestamp + 3*I/2). Note the interval I is set to twice of @@ -500,7 +500,7 @@ void downloadValidFilesInSameBucket() { downloader.download(); verifyForSuccess(); - assertThat(mirrorProperties.getDataPath()).isEmptyDirectory(); + assertThat(importerProperties.getDataPath()).isEmptyDirectory(); } @Test @@ -536,11 +536,11 @@ void startDate(long seconds, String fileChoice) { "1, file2", }) void endDate(long seconds, String fileChoice) { - mirrorProperties.setEndDate(chooseFileInstant(fileChoice).plusSeconds(seconds)); - mirrorProperties.setStartBlockNumber(null); + importerProperties.setEndDate(chooseFileInstant(fileChoice).plusSeconds(seconds)); + importerProperties.setStartBlockNumber(null); commonDownloaderProperties.setBatchSize(1); List expectedFiles = instantFilenamePairs.stream() - .filter(pair -> !pair.getLeft().isAfter(mirrorProperties.getEndDate())) + .filter(pair -> !pair.getLeft().isAfter(importerProperties.getEndDate())) .map(Pair::getRight) .collect(Collectors.toList()); expectLastStreamFile(Instant.EPOCH); @@ -556,7 +556,7 @@ void endDate(long seconds, String fileChoice) { @Test void singleNodeSigFileCorrupted() throws Exception { corruptedNodeAccountId = nodes.iterator().next().getNodeAccountId(); - mirrorProperties.setStartBlockNumber(null); + importerProperties.setStartBlockNumber(null); fileCopier.copy(); Files.walk(s3Path) .filter(this::isSigFile) @@ -570,7 +570,7 @@ void singleNodeSigFileCorrupted() throws Exception { @Test void singleNodeStreamFileCorrupted() throws Exception { corruptedNodeAccountId = nodes.iterator().next().getNodeAccountId(); - mirrorProperties.setStartBlockNumber(null); + importerProperties.setStartBlockNumber(null); fileCopier.copy(); Files.walk(s3Path) .filter(Predicate.not(this::isSigFile)) @@ -585,7 +585,7 @@ void singleNodeStreamFileCorrupted() throws Exception { @DisplayName("Max download items reached") void maxDownloadItemsReached() { commonDownloaderProperties.setBatchSize(1); - mirrorProperties.setStartBlockNumber(null); + importerProperties.setStartBlockNumber(null); fileCopier.copy(); expectLastStreamFile(Instant.EPOCH); @@ -625,13 +625,13 @@ void noSigFiles() throws IOException { @Test void persistBytes() { downloaderProperties.setPersistBytes(true); - mirrorProperties.setStartBlockNumber(null); + importerProperties.setStartBlockNumber(null); fileCopier.copy(); expectLastStreamFile(Instant.EPOCH); downloader.download(); verifyForSuccess(); - assertThat(mirrorProperties.getDataPath()).isEmptyDirectory(); + assertThat(importerProperties.getDataPath()).isEmptyDirectory(); } @Test @@ -667,7 +667,7 @@ void testDownloadRatioSetTooLow() throws Exception { @SneakyThrows private void differentFilenames(Duration offset) { - mirrorProperties.setStartBlockNumber(null); + importerProperties.setStartBlockNumber(null); // Copy all files and modify only node 0.0.3's files to have a different timestamp fileCopier.filterFiles(getStreamFilenameInstantString(file2) + "*").copy(); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/CommonDownloaderPropertiesTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/CommonDownloaderPropertiesTest.java index 5df4b9bd269..61282b344af 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/CommonDownloaderPropertiesTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/CommonDownloaderPropertiesTest.java @@ -21,8 +21,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -import com.hedera.mirror.importer.MirrorProperties; -import com.hedera.mirror.importer.MirrorProperties.HederaNetwork; +import com.hedera.mirror.importer.ImporterProperties; +import com.hedera.mirror.importer.ImporterProperties.HederaNetwork; import java.net.URI; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -32,7 +32,7 @@ class CommonDownloaderPropertiesTest { @Test void getBucketName() { - var mirrorProperties = new MirrorProperties(); + var mirrorProperties = new ImporterProperties(); var properties = new CommonDownloaderProperties(mirrorProperties); assertThat(properties.getBucketName()).isEqualTo(HederaNetwork.getBucketName(mirrorProperties.getNetwork())); @@ -43,7 +43,7 @@ void getBucketName() { @Test void initNoNetworkDefaultBucketName() { - var mirrorProperties = new MirrorProperties(); + var mirrorProperties = new ImporterProperties(); var properties = new CommonDownloaderProperties(mirrorProperties); mirrorProperties.setNetwork(HederaNetwork.OTHER); @@ -55,7 +55,7 @@ void initNoNetworkDefaultBucketName() { @Test void isAnonymousCredentials() { - var mirrorProperties = new MirrorProperties(); + var mirrorProperties = new ImporterProperties(); var properties = new CommonDownloaderProperties(mirrorProperties); // Default network is DEMO, which is the only network allowing anonymous access @@ -72,7 +72,7 @@ void isAnonymousCredentials() { @Test void initNoSources() { - var properties = new CommonDownloaderProperties(new MirrorProperties()); + var properties = new CommonDownloaderProperties(new ImporterProperties()); properties.setCloudProvider(SourceType.S3); properties.setEndpointOverride("http://localhost"); properties.setGcpProjectId("project1"); @@ -95,7 +95,7 @@ void initSources() { sourceProperties.setUri(URI.create("http://localhost")); sourceProperties.setType(SourceType.GCP); sourceProperties.setProjectId("project1"); - var properties = new CommonDownloaderProperties(new MirrorProperties()); + var properties = new CommonDownloaderProperties(new ImporterProperties()); properties.getSources().add(sourceProperties); properties.init(); @@ -117,7 +117,7 @@ void initSourcesAndLegacySource() { sourceProperties.setType(SourceType.GCP); sourceProperties.setProjectId("project1"); - var properties = new CommonDownloaderProperties(new MirrorProperties()); + var properties = new CommonDownloaderProperties(new ImporterProperties()); properties.setAccessKey("foo"); properties.setCloudProvider(SourceType.S3); properties.setEndpointOverride("http://localhost"); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/ConsensusValidatorImplTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/ConsensusValidatorImplTest.java index d7c38e4210e..d8797f7cb23 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/ConsensusValidatorImplTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/ConsensusValidatorImplTest.java @@ -45,7 +45,7 @@ import com.hedera.mirror.common.domain.DomainBuilder; import com.hedera.mirror.common.domain.StreamType; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.domain.ConsensusNodeStub; import com.hedera.mirror.importer.domain.StreamFileSignature; import com.hedera.mirror.importer.domain.StreamFileSignature.SignatureType; @@ -74,7 +74,7 @@ class ConsensusValidatorImplTest { @BeforeEach void setup() { - commonDownloaderProperties = new CommonDownloaderProperties(new MirrorProperties()); + commonDownloaderProperties = new CommonDownloaderProperties(new ImporterProperties()); commonDownloaderProperties.setConsensusRatio( BigDecimal.ONE.divide(BigDecimal.valueOf(3), 19, RoundingMode.DOWN)); consensusValidator = new ConsensusValidatorImpl(commonDownloaderProperties); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/NodeSignatureVerifierTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/NodeSignatureVerifierTest.java index 9fefe2a524c..427445668eb 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/NodeSignatureVerifierTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/NodeSignatureVerifierTest.java @@ -43,7 +43,7 @@ import com.hedera.mirror.common.domain.StreamType; import com.hedera.mirror.common.domain.entity.EntityId; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.TestUtils; import com.hedera.mirror.importer.domain.ConsensusNodeStub; import com.hedera.mirror.importer.domain.StreamFileSignature; @@ -92,7 +92,7 @@ static void generateKeys() { @BeforeEach @SneakyThrows void setup() { - commonDownloaderProperties = new CommonDownloaderProperties(new MirrorProperties()); + commonDownloaderProperties = new CommonDownloaderProperties(new ImporterProperties()); commonDownloaderProperties.setConsensusRatio( BigDecimal.ONE.divide(BigDecimal.valueOf(3), 19, RoundingMode.DOWN)); nodeSignatureVerifier = new NodeSignatureVerifier(consensusValidator); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/balance/AccountBalancesDownloaderTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/balance/AccountBalancesDownloaderTest.java index d658f067134..9778d6584b8 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/balance/AccountBalancesDownloaderTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/balance/AccountBalancesDownloaderTest.java @@ -55,7 +55,7 @@ class AccountBalancesDownloaderTest extends AbstractDownloaderTest getDownloader() { BalanceFileReader balanceFileReader = new BalanceFileReaderImplV1( - new BalanceParserProperties(), new AccountBalanceLineParserV1(mirrorProperties)); + new BalanceParserProperties(), new AccountBalanceLineParserV1(importerProperties)); var streamFileProvider = new S3StreamFileProvider(commonDownloaderProperties, s3AsyncClient); return new AccountBalancesDownloader( accountBalanceFileRepository, consensusNodeService, (BalanceDownloaderProperties) downloaderProperties, + importerProperties, meterRegistry, dateRangeProcessor, nodeSignatureVerifier, @@ -107,6 +108,7 @@ void downloadWithMixedStreamFileExtensions() { accountBalanceFileRepository, consensusNodeService, (BalanceDownloaderProperties) downloaderProperties, + importerProperties, meterRegistry, dateRangeProcessor, nodeSignatureVerifier, @@ -125,7 +127,7 @@ void downloadWithMixedStreamFileExtensions() { downloader.download(); verifyForSuccess(); - assertThat(mirrorProperties.getDataPath()).isEmptyDirectory(); + assertThat(importerProperties.getDataPath()).isEmptyDirectory(); } @Test diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/event/EventFileDownloaderTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/event/EventFileDownloaderTest.java index ff6b6624eff..62ec9884f54 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/event/EventFileDownloaderTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/event/EventFileDownloaderTest.java @@ -40,7 +40,7 @@ protected void beforeEach() { @Override protected DownloaderProperties getDownloaderProperties() { - var eventDownloaderProperties = new EventDownloaderProperties(mirrorProperties, commonDownloaderProperties); + var eventDownloaderProperties = new EventDownloaderProperties(commonDownloaderProperties); eventDownloaderProperties.setEnabled(true); return eventDownloaderProperties; } @@ -51,6 +51,7 @@ protected Downloader getDownloader() { return new EventFileDownloader( consensusNodeService, (EventDownloaderProperties) downloaderProperties, + importerProperties, meterRegistry, dateRangeProcessor, nodeSignatureVerifier, diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/AbstractStreamFileProviderTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/AbstractStreamFileProviderTest.java index 277e986cc48..da74707b30a 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/AbstractStreamFileProviderTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/AbstractStreamFileProviderTest.java @@ -21,7 +21,7 @@ import com.hedera.mirror.common.domain.StreamType; import com.hedera.mirror.importer.FileCopier; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.TestUtils; import com.hedera.mirror.importer.addressbook.ConsensusNode; import com.hedera.mirror.importer.domain.StreamFileData; @@ -50,7 +50,7 @@ abstract class AbstractStreamFileProviderTest { @BeforeEach void setup() throws Exception { - var mirrorProperties = new MirrorProperties(); + var mirrorProperties = new ImporterProperties(); mirrorProperties.setDataPath(dataPath); properties = new CommonDownloaderProperties(mirrorProperties); customizeProperties(properties); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/AutoS3StreamFileProviderTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/AutoS3StreamFileProviderTest.java index 937d8ff3d5c..7935f0b5f28 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/AutoS3StreamFileProviderTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/AutoS3StreamFileProviderTest.java @@ -49,7 +49,7 @@ protected FileCopier createFileCopier(Path dataPath) { .to(properties.getBucketName(), StreamType.RECORD.getPath()); var nodeIdFromPath = Path.of("data", "hip679", "provider-auto", "demo"); - var network = properties.getMirrorProperties().getNetwork(); + var network = properties.getImporterProperties().getNetwork(); var nodeIdFileCopier = FileCopier.create( TestUtils.getResource(nodeIdFromPath.toString()).toPath(), dataPath) .to(properties.getBucketName(), network); @@ -93,7 +93,7 @@ protected String resolveProviderRelativePath(ConsensusNode node, String fileName node, StreamType.RECORD, fileName, - properties.getMirrorProperties().getNetwork()); + properties.getImporterProperties().getNetwork()); } @Test @@ -106,7 +106,7 @@ void nodeAccountIdToNodeIdListTransition() throws Exception { .to(properties.getBucketName(), StreamType.RECORD.getPath()); var nodeIdFromPath = Path.of("data", "hip679", "provider-auto-transition", "demo"); - var network = properties.getMirrorProperties().getNetwork(); + var network = properties.getImporterProperties().getNetwork(); var nodeIdFileCopier = FileCopier.create( TestUtils.getResource(nodeIdFromPath.toString()).toPath(), dataPath) .to(properties.getBucketName(), network); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/CompositeStreamFileProviderTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/CompositeStreamFileProviderTest.java index ac8e2edf600..feb170bef81 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/CompositeStreamFileProviderTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/CompositeStreamFileProviderTest.java @@ -20,7 +20,7 @@ import static org.awaitility.Awaitility.await; import static org.mockito.Mockito.when; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.addressbook.ConsensusNode; import com.hedera.mirror.importer.domain.ConsensusNodeStub; import com.hedera.mirror.importer.domain.StreamFileData; @@ -59,7 +59,7 @@ class CompositeStreamFileProviderTest { @BeforeEach void setup() { - properties = new CommonDownloaderProperties(new MirrorProperties()); + properties = new CommonDownloaderProperties(new ImporterProperties()); properties.getSources().add(new StreamSourceProperties()); properties.getSources().add(new StreamSourceProperties()); compositeStreamFileProvider = diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/LocalStreamFileProviderTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/LocalStreamFileProviderTest.java index f9f9df24933..5e04e4e287d 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/LocalStreamFileProviderTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/LocalStreamFileProviderTest.java @@ -16,7 +16,7 @@ package com.hedera.mirror.importer.downloader.provider; -import static com.hedera.mirror.importer.MirrorProperties.STREAMS; +import static com.hedera.mirror.importer.ImporterProperties.STREAMS; import static org.assertj.core.api.Assertions.assertThat; import com.hedera.mirror.common.domain.StreamType; @@ -178,7 +178,7 @@ void listAllPathTypes(PathType pathType) { fileCopier.copy(); } else { fileCopier.copyAsNodeIdStructure( - Path::getParent, properties.getMirrorProperties().getNetwork()); + Path::getParent, properties.getImporterProperties().getNetwork()); } var accountId = "0.0.3"; @@ -196,7 +196,7 @@ void listAllPathTypes(PathType pathType) { @SneakyThrows private File createSignature(String... paths) { var subPath = Path.of("", paths); - var streamsDir = properties.getMirrorProperties().getStreamPath(); + var streamsDir = properties.getImporterProperties().getStreamPath(); var file = streamsDir.resolve(subPath).toFile(); file.getParentFile().mkdirs(); file.createNewFile(); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/NodeIdS3StreamProviderTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/NodeIdS3StreamProviderTest.java index aadac2665f0..f84553117a4 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/NodeIdS3StreamProviderTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/provider/NodeIdS3StreamProviderTest.java @@ -33,7 +33,7 @@ public class NodeIdS3StreamProviderTest extends S3StreamFileProviderTest { @Override protected FileCopier createFileCopier(Path dataPath) { - String network = properties.getMirrorProperties().getNetwork(); + String network = properties.getImporterProperties().getNetwork(); var fromPath = Path.of("data", "hip679", "provider-node-id"); return FileCopier.create(TestUtils.getResource(fromPath.toString()).toPath(), dataPath) @@ -58,6 +58,6 @@ protected String resolveProviderRelativePath(ConsensusNode node, String fileName node, StreamType.RECORD, fileName, - properties.getMirrorProperties().getNetwork()); + properties.getImporterProperties().getNetwork()); } } diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/record/AbstractRecordFileDownloaderTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/record/AbstractRecordFileDownloaderTest.java index 7545e31039b..cfe5cde7bcb 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/record/AbstractRecordFileDownloaderTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/record/AbstractRecordFileDownloaderTest.java @@ -64,7 +64,7 @@ protected void beforeEach() { @Override protected DownloaderProperties getDownloaderProperties() { - return new RecordDownloaderProperties(mirrorProperties, commonDownloaderProperties); + return new RecordDownloaderProperties(commonDownloaderProperties); } @Override @@ -85,6 +85,7 @@ private Downloader getDownloader(S3AsyncClient s3AsyncCl return new RecordFileDownloader( consensusNodeService, (RecordDownloaderProperties) downloaderProperties, + importerProperties, meterRegistry, dateRangeProcessor, nodeSignatureVerifier, diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/record/ProtoRecordFileDownloaderTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/record/ProtoRecordFileDownloaderTest.java index 60ce248e3de..a0858741324 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/record/ProtoRecordFileDownloaderTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/record/ProtoRecordFileDownloaderTest.java @@ -72,7 +72,7 @@ void sidecarDisabled() { downloader.download(); super.verifyStreamFiles(List.of(file1, file2), s -> {}); - assertThat(mirrorProperties.getDataPath()).isEmptyDirectory(); + assertThat(importerProperties.getDataPath()).isEmptyDirectory(); } @Test @@ -98,7 +98,7 @@ void sidecarTypesFilter() { .block(); assertThat(transactionSidecarRecords).isEmpty(); }); - assertThat(mirrorProperties.getDataPath()).isEmptyDirectory(); + assertThat(importerProperties.getDataPath()).isEmptyDirectory(); } @Test @@ -122,7 +122,7 @@ void sidecarTypesFilterSome() { assertThat(sidecarTypes).isEmpty(); } }); - assertThat(mirrorProperties.getDataPath()).isEmptyDirectory(); + assertThat(importerProperties.getDataPath()).isEmptyDirectory(); } @Test @@ -132,7 +132,7 @@ void sidecarWriteFiles() { expectLastStreamFile(Instant.EPOCH); downloader.download(); - assertThat(mirrorProperties.getDataPath()) + assertThat(importerProperties.getDataPath()) .isNotEmptyDirectory() .isDirectoryRecursivelyContaining( "glob:**/streams/recordstreams/record*/sidecar/2022-07-13T08_46_11.304284003Z_01.rcd.gz"); @@ -146,7 +146,7 @@ void sidecarFileCorrupted() throws IOException { downloader.download(); verifyForSuccess(List.of(file1)); - assertThat(mirrorProperties.getDataPath()).isEmptyDirectory(); + assertThat(importerProperties.getDataPath()).isEmptyDirectory(); } @Test @@ -169,7 +169,7 @@ void sidecarFileHashMismatch() throws IOException { downloader.download(); verifyForSuccess(List.of(file1)); - assertThat(mirrorProperties.getDataPath()).isEmptyDirectory(); + assertThat(importerProperties.getDataPath()).isEmptyDirectory(); } } diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/record/RecordFileV2DownloaderTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/record/RecordFileV2DownloaderTest.java index 4e4dc0785db..add2b89be46 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/record/RecordFileV2DownloaderTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/downloader/record/RecordFileV2DownloaderTest.java @@ -51,7 +51,7 @@ protected Duration getCloseInterval() { @Test @DisplayName("Download and verify V1 files") void downloadV1() { - mirrorProperties.setStartBlockNumber(null); + importerProperties.setStartBlockNumber(null); loadAddressBook("test-v1"); var allRecordFiles = TestRecordFiles.getAll(); var testRecordFiles = Map.of( diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/BackfillAndDeduplicateBalanceMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/BackfillAndDeduplicateBalanceMigrationTest.java index edc1406e2a7..44b6dded62f 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/BackfillAndDeduplicateBalanceMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/BackfillAndDeduplicateBalanceMigrationTest.java @@ -25,7 +25,7 @@ import com.hedera.mirror.common.domain.balance.TokenBalance; import com.hedera.mirror.common.domain.entity.EntityId; import com.hedera.mirror.importer.EnabledIfV1; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.repository.AccountBalanceRepository; import com.hedera.mirror.importer.repository.TokenBalanceRepository; @@ -77,7 +77,7 @@ primary key (consensus_timestamp, account_id, token_id) private final @Getter BackfillAndDeduplicateBalanceMigration migration; private final @Getter Class migrationClass = BackfillAndDeduplicateBalanceMigration.class; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; @Value("classpath:db/migration/v1/V1.89.1__add_balance_deduplicate_functions.sql") private final Resource migrationSql; @@ -608,7 +608,7 @@ insert into token_balance_old (account_id, balance, consensus_timestamp, token_i } private MigrationProperties getMigrationProperties() { - return mirrorProperties.getMigration().get("backfillAndDeduplicateBalanceMigration"); + return importerProperties.getMigration().get("backfillAndDeduplicateBalanceMigration"); } @SneakyThrows diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/BackfillTransactionHashMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/BackfillTransactionHashMigrationTest.java index b95fa399123..54574348a92 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/BackfillTransactionHashMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/BackfillTransactionHashMigrationTest.java @@ -22,7 +22,7 @@ import com.hedera.mirror.common.domain.transaction.TransactionHash; import com.hedera.mirror.common.domain.transaction.TransactionType; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.TestUtils; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.parser.record.entity.EntityProperties; @@ -53,7 +53,7 @@ class BackfillTransactionHashMigrationTest extends ImporterIntegrationTest { private final EntityProperties entityProperties; private final @Owner JdbcTemplate jdbcTemplate; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final TransactionHashRepository transactionHashRepository; private final Environment environment; @@ -72,8 +72,9 @@ void setup() { migrationProperties .getParams() .put("startTimestamp", Long.valueOf(DEFAULT_START_TIMESTAMP).toString()); - mirrorProperties.getMigration().put(MIGRATION_NAME, migrationProperties); - migration = new BackfillTransactionHashMigration(entityProperties, jdbcTemplate, mirrorProperties, environment); + importerProperties.getMigration().put(MIGRATION_NAME, migrationProperties); + migration = + new BackfillTransactionHashMigration(entityProperties, jdbcTemplate, importerProperties, environment); } @AfterEach diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/BlockNumberMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/BlockNumberMigrationTest.java index f81ff1752e2..c625de45451 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/BlockNumberMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/BlockNumberMigrationTest.java @@ -16,14 +16,14 @@ package com.hedera.mirror.importer.migration; -import static com.hedera.mirror.importer.MirrorProperties.HederaNetwork.PREVIEWNET; -import static com.hedera.mirror.importer.MirrorProperties.HederaNetwork.TESTNET; +import static com.hedera.mirror.importer.ImporterProperties.HederaNetwork.PREVIEWNET; +import static com.hedera.mirror.importer.ImporterProperties.HederaNetwork.TESTNET; import static com.hedera.mirror.importer.migration.BlockNumberMigration.BLOCK_NUMBER_MAPPING; import static org.assertj.core.api.Assertions.assertThat; import com.hedera.mirror.common.domain.transaction.RecordFile; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.repository.RecordFileRepository; import java.util.ArrayList; import java.util.List; @@ -45,12 +45,12 @@ class BlockNumberMigrationTest extends ImporterIntegrationTest { BLOCK_NUMBER_MAPPING.get(TESTNET).getValue(); private final BlockNumberMigration blockNumberMigration; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final RecordFileRepository recordFileRepository; @BeforeEach void setup() { - mirrorProperties.setNetwork(TESTNET); + importerProperties.setNetwork(TESTNET); } @Test @@ -60,8 +60,8 @@ void checksum() { @Test void unsupportedNetwork() { - var previousNetwork = mirrorProperties.getNetwork(); - mirrorProperties.setNetwork(PREVIEWNET); + var previousNetwork = importerProperties.getNetwork(); + importerProperties.setNetwork(PREVIEWNET); List expectedBlockNumbersAndConsensusEnd = insertDefaultRecordFiles(Set.of(CORRECT_CONSENSUS_END)).stream() .map(recordFile -> Tuple.tuple(recordFile.getConsensusEnd(), recordFile.getIndex())) @@ -70,7 +70,7 @@ void unsupportedNetwork() { blockNumberMigration.doMigrate(); assertConsensusEndAndBlockNumber(expectedBlockNumbersAndConsensusEnd); - mirrorProperties.setNetwork(previousNetwork); + importerProperties.setNetwork(previousNetwork); } @Test diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/CleanupEntityMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/CleanupEntityMigrationTest.java index 3737439dd35..05431b0a4f5 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/CleanupEntityMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/CleanupEntityMigrationTest.java @@ -28,7 +28,7 @@ import com.hedera.mirror.importer.DisableRepeatableSqlMigration; import com.hedera.mirror.importer.EnabledIfV1; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.repository.EntityRepository; import com.hedera.mirror.importer.repository.TransactionRepository; @@ -62,13 +62,13 @@ class CleanupEntityMigrationTest extends ImporterIntegrationTest { private final File migrationSql; private final EntityRepository entityRepository; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final TransactionRepository transactionRepository; @BeforeEach void before() { - mirrorProperties.setStartDate(Instant.EPOCH); - mirrorProperties.setEndDate(Instant.EPOCH.plusSeconds(1)); + importerProperties.setStartDate(Instant.EPOCH); + importerProperties.setEndDate(Instant.EPOCH.plusSeconds(1)); setEntityTablesPreV_1_36(); } diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/DummyMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/DummyMigrationTest.java index 4e8004aa86e..c5ec0fcd44b 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/DummyMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/DummyMigrationTest.java @@ -19,7 +19,7 @@ import static org.assertj.core.api.Assertions.assertThat; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.junit.jupiter.api.Tag; @@ -30,11 +30,11 @@ @Tag("migration") class DummyMigrationTest extends ImporterIntegrationTest { - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; @Test void checksum() { - var dummyMigration = new DummyMigration(mirrorProperties); + var dummyMigration = new DummyMigration(importerProperties); assertThat(dummyMigration.getChecksum()).isEqualTo(5); } @@ -44,8 +44,8 @@ static class DummyMigration extends RepeatableMigration { private boolean migrated = false; @Lazy - public DummyMigration(MirrorProperties mirrorProperties) { - super(mirrorProperties.getMigration()); + public DummyMigration(ImporterProperties importerProperties) { + super(importerProperties.getMigration()); } @Override diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/ErrataMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/ErrataMigrationTest.java index c71f2c0a9ad..3720ee6e51c 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/ErrataMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/ErrataMigrationTest.java @@ -25,7 +25,7 @@ import com.hedera.mirror.common.domain.transaction.TransactionType; import com.hedera.mirror.common.util.DomainUtils; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.repository.AccountBalanceFileRepository; import com.hedera.mirror.importer.repository.ContractResultRepository; import com.hedera.mirror.importer.repository.CryptoTransferRepository; @@ -72,19 +72,19 @@ public class ErrataMigrationTest extends ImporterIntegrationTest { private final CryptoTransferRepository cryptoTransferRepository; private final TokenTransferRepository tokenTransferRepository; private final ErrataMigration errataMigration; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final TransactionRepository transactionRepository; @BeforeEach void setup() { - mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.MAINNET); + importerProperties.setNetwork(ImporterProperties.HederaNetwork.MAINNET); } @AfterEach void teardown() { - mirrorProperties.setEndDate(Utility.MAX_INSTANT_LONG); - mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.TESTNET); - mirrorProperties.setStartDate(Instant.EPOCH); + importerProperties.setEndDate(Utility.MAX_INSTANT_LONG); + importerProperties.setNetwork(ImporterProperties.HederaNetwork.TESTNET); + importerProperties.setStartDate(Instant.EPOCH); } @Test @@ -94,7 +94,7 @@ void checksum() { @Test void migrateNotMainnet() throws Exception { - mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.TESTNET); + importerProperties.setNetwork(ImporterProperties.HederaNetwork.TESTNET); domainBuilder.accountBalanceFile().persist(); domainBuilder .accountBalanceFile() @@ -115,8 +115,8 @@ void migrateNotMainnet() throws Exception { @Test void migrateOutsideDateRange() throws Exception { Instant now = Instant.now(); - mirrorProperties.setStartDate(now); - mirrorProperties.setEndDate(now.plusSeconds(1L)); + importerProperties.setStartDate(now); + importerProperties.setEndDate(now.plusSeconds(1L)); errataMigration.doMigrate(); @@ -220,7 +220,7 @@ void onEndWithOffset() { @Test void onEndNotMainnet() { - mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.TESTNET); + importerProperties.setNetwork(ImporterProperties.HederaNetwork.TESTNET); AccountBalanceFile accountBalanceFile = new AccountBalanceFile(); accountBalanceFile.setConsensusTimestamp(BAD_TIMESTAMP1); errataMigration.onStart(); // Call to increase test coverage of no-op methods diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/FixCryptoAllowanceAmountMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/FixCryptoAllowanceAmountMigrationTest.java index 4229de10462..a8fba0b780f 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/FixCryptoAllowanceAmountMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/FixCryptoAllowanceAmountMigrationTest.java @@ -24,7 +24,7 @@ import com.hedera.mirror.common.domain.entity.EntityId; import com.hedera.mirror.common.domain.transaction.CryptoTransfer; import com.hedera.mirror.importer.EnabledIfV1; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.TestUtils; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.db.DBProperties; @@ -69,7 +69,7 @@ class FixCryptoAllowanceAmountMigrationTest extends AbstractAsyncJavaMigrationTe @BeforeEach void setup() { // Create migration object for each test case due to the cached earliestTimestamp - var mirrorProperties = new MirrorProperties(); + var mirrorProperties = new ImporterProperties(); migration = new FixCryptoAllowanceAmountMigration(dbProperties, entityProperties, mirrorProperties, jdbcTemplate); } @@ -279,7 +279,7 @@ void skipMigration(boolean trackAllowance) { var entityProperties = new EntityProperties(); entityProperties.getPersist().setTrackAllowance(trackAllowance); var migration = new FixCryptoAllowanceAmountMigration( - dbProperties, entityProperties, new MirrorProperties(), jdbcTemplate); + dbProperties, entityProperties, new ImporterProperties(), jdbcTemplate); var configuration = new FluentConfiguration().target(migration.getMinimumVersion()); // when, then diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/FixStakedBeforeEnabledMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/FixStakedBeforeEnabledMigrationTest.java index 54b34954917..d77c1eb3224 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/FixStakedBeforeEnabledMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/FixStakedBeforeEnabledMigrationTest.java @@ -22,8 +22,8 @@ import com.google.common.collect.Range; import com.hedera.mirror.common.domain.entity.Entity; import com.hedera.mirror.importer.EnabledIfV1; -import com.hedera.mirror.importer.MirrorProperties; -import com.hedera.mirror.importer.MirrorProperties.HederaNetwork; +import com.hedera.mirror.importer.ImporterProperties; +import com.hedera.mirror.importer.ImporterProperties.HederaNetwork; import com.hedera.mirror.importer.util.Utility; import lombok.RequiredArgsConstructor; import org.assertj.core.api.IterableAssert; @@ -41,14 +41,14 @@ class FixStakedBeforeEnabledMigrationTest extends AbstractStakingMigrationTest { private static final String[] ENTITY_FIELDS = new String[] {"id", "declineReward", "stakedNodeId", "stakePeriodStart"}; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final FixStakedBeforeEnabledMigration migration; private long lastHapi26EpochDay; @AfterEach void teardown() { - mirrorProperties.setNetwork(HederaNetwork.TESTNET); + importerProperties.setNetwork(HederaNetwork.TESTNET); } @Test @@ -82,7 +82,7 @@ void notStaked() { void otherNetwork() { // given setupForMainnet(); - mirrorProperties.setNetwork(HederaNetwork.OTHER); + importerProperties.setNetwork(HederaNetwork.OTHER); var entity = domainBuilder .entity() .customize(e -> e.stakedNodeId(0L) @@ -257,7 +257,7 @@ private ListAssert assertEntityStakes() { } private void setupForMainnet() { - mirrorProperties.setNetwork(HederaNetwork.MAINNET); + importerProperties.setNetwork(HederaNetwork.MAINNET); lastHapi26EpochDay = Utility.getEpochDay(LAST_HAPI_26_RECORD_FILE_CONSENSUS_END_MAINNET); // Persist last Hapi version 26 RecordFile domainBuilder diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/HistoricalAccountInfoMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/HistoricalAccountInfoMigrationTest.java index ec187986cfe..b2a454235d7 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/HistoricalAccountInfoMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/HistoricalAccountInfoMigrationTest.java @@ -26,7 +26,7 @@ import com.hedera.mirror.common.domain.entity.EntityType; import com.hedera.mirror.common.util.DomainUtils; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.repository.EntityRepository; import com.hedera.mirror.importer.util.Utility; import com.hederahashgraph.api.proto.java.AccountID; @@ -53,21 +53,21 @@ class HistoricalAccountInfoMigrationTest extends ImporterIntegrationTest { private final HistoricalAccountInfoMigration historicalAccountInfoMigration; private final EntityRepository entityRepository; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private String network; @BeforeEach void before() { - network = mirrorProperties.getNetwork(); - mirrorProperties.setImportHistoricalAccountInfo(true); - mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.MAINNET); + network = importerProperties.getNetwork(); + importerProperties.setImportHistoricalAccountInfo(true); + importerProperties.setNetwork(ImporterProperties.HederaNetwork.MAINNET); } @AfterEach void after() { - mirrorProperties.setImportHistoricalAccountInfo(false); - mirrorProperties.setNetwork(network); + importerProperties.setImportHistoricalAccountInfo(false); + importerProperties.setNetwork(network); } @Test @@ -138,42 +138,42 @@ void noChangesWhenRanAgain() throws Exception { @Test void disabled() throws Exception { - mirrorProperties.setImportHistoricalAccountInfo(false); + importerProperties.setImportHistoricalAccountInfo(false); historicalAccountInfoMigration.doMigrate(); assertThat(entityRepository.count()).isZero(); } @Test void notMainnet() throws Exception { - mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.DEMO); + importerProperties.setNetwork(ImporterProperties.HederaNetwork.DEMO); historicalAccountInfoMigration.doMigrate(); assertThat(entityRepository.count()).isZero(); } @Test void startDateAfter() throws Exception { - mirrorProperties.setStartDate(Instant.now()); + importerProperties.setStartDate(Instant.now()); historicalAccountInfoMigration.doMigrate(); assertThat(entityRepository.count()).isZero(); } @Test void startDateBefore() throws Exception { - mirrorProperties.setStartDate(HistoricalAccountInfoMigration.EXPORT_DATE.minusNanos(1)); + importerProperties.setStartDate(HistoricalAccountInfoMigration.EXPORT_DATE.minusNanos(1)); historicalAccountInfoMigration.doMigrate(); assertThat(entityRepository.count()).isEqualTo(ENTITY_COUNT + CONTRACT_COUNT); } @Test void startDateEquals() throws Exception { - mirrorProperties.setStartDate(HistoricalAccountInfoMigration.EXPORT_DATE); + importerProperties.setStartDate(HistoricalAccountInfoMigration.EXPORT_DATE); historicalAccountInfoMigration.doMigrate(); assertThat(entityRepository.count()).isEqualTo(ENTITY_COUNT + CONTRACT_COUNT); } @Test void startDateNull() throws Exception { - mirrorProperties.setStartDate(null); + importerProperties.setStartDate(null); historicalAccountInfoMigration.doMigrate(); assertThat(entityRepository.count()).isZero(); } diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/InitializeEntityBalanceMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/InitializeEntityBalanceMigrationTest.java index 4ffb4061df9..85261e6f8af 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/InitializeEntityBalanceMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/InitializeEntityBalanceMigrationTest.java @@ -29,7 +29,7 @@ import com.hedera.mirror.common.domain.transaction.ErrataType; import com.hedera.mirror.common.domain.transaction.RecordFile; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.repository.AccountBalanceFileRepository; import com.hedera.mirror.importer.repository.AccountBalanceRepository; @@ -64,7 +64,7 @@ class InitializeEntityBalanceMigrationTest extends ImporterIntegrationTest { private final CryptoTransferRepository cryptoTransferRepository; private final EntityRepository entityRepository; private final @Owner JdbcTemplate jdbcTemplate; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final RecordFileRepository recordFileRepository; private InitializeEntityBalanceMigration migration; private Entity account; @@ -80,7 +80,7 @@ class InitializeEntityBalanceMigrationTest extends ImporterIntegrationTest { void beforeEach() { timestamp = new AtomicLong(0L); migration = new InitializeEntityBalanceMigration( - jdbcOperations, mirrorProperties, accountBalanceFileRepository, recordFileRepository); + jdbcOperations, importerProperties, accountBalanceFileRepository, recordFileRepository); } @Test diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/MergeDuplicateBlocksMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/MergeDuplicateBlocksMigrationTest.java index 73c49726734..88acd7bdf0f 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/MergeDuplicateBlocksMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/MergeDuplicateBlocksMigrationTest.java @@ -21,7 +21,7 @@ import com.hedera.mirror.common.domain.transaction.RecordFile; import com.hedera.mirror.common.domain.transaction.Transaction; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.repository.RecordFileRepository; import com.hedera.mirror.importer.repository.TransactionRepository; import lombok.RequiredArgsConstructor; @@ -36,7 +36,7 @@ class MergeDuplicateBlocksMigrationTest extends ImporterIntegrationTest { private static final long TIMESTAMP2 = 1675962001984524003L; private final MergeDuplicateBlocksMigration migration; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final RecordFileRepository recordFileRepository; private final TransactionRepository transactionRepository; @@ -57,7 +57,7 @@ void setupData() { @Test void notMainnet() throws Exception { // Given - mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.TESTNET); + importerProperties.setNetwork(ImporterProperties.HederaNetwork.TESTNET); // When migration.doMigrate(); @@ -74,7 +74,7 @@ void notMainnet() throws Exception { @Test void mainnet() throws Exception { // Given - mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.MAINNET); + importerProperties.setNetwork(ImporterProperties.HederaNetwork.MAINNET); // When migration.doMigrate(); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/RecalculatePendingRewardMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/RecalculatePendingRewardMigrationTest.java index 2de664ebed0..f0c5e5018e3 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/RecalculatePendingRewardMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/RecalculatePendingRewardMigrationTest.java @@ -23,8 +23,8 @@ import com.hedera.mirror.common.domain.entity.Entity; import com.hedera.mirror.common.util.DomainUtils; import com.hedera.mirror.importer.EnabledIfV1; -import com.hedera.mirror.importer.MirrorProperties; -import com.hedera.mirror.importer.MirrorProperties.HederaNetwork; +import com.hedera.mirror.importer.ImporterProperties; +import com.hedera.mirror.importer.ImporterProperties.HederaNetwork; import com.hedera.mirror.importer.TestUtils; import com.hedera.mirror.importer.util.Utility; import lombok.RequiredArgsConstructor; @@ -41,7 +41,7 @@ @TestPropertySource(properties = "spring.flyway.target=1.68.3") class RecalculatePendingRewardMigrationTest extends AbstractStakingMigrationTest { - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final RecalculatePendingRewardMigration migration; private long firstEpochDay; @@ -49,7 +49,7 @@ class RecalculatePendingRewardMigrationTest extends AbstractStakingMigrationTest @AfterEach void teardown() { - mirrorProperties.setNetwork(HederaNetwork.TESTNET); + importerProperties.setNetwork(HederaNetwork.TESTNET); } @Test @@ -62,7 +62,7 @@ void empty() { void otherNetwork() { // given setupNodeStakeForNetwork(HederaNetwork.MAINNET); - mirrorProperties.setNetwork(HederaNetwork.OTHER); + importerProperties.setNetwork(HederaNetwork.OTHER); var entity = domainBuilder .entity() .customize(e -> e.stakedNodeId(0L).stakePeriodStart(firstEpochDay)) @@ -349,7 +349,7 @@ private void persistEntities(Entity... entities) { } private void setupNodeStakeForNetwork(String network) { - mirrorProperties.setNetwork(network); + importerProperties.setNetwork(network); long firstNonZeroRewardTimestamp = FIRST_NONZERO_REWARD_RATE_TIMESTAMP.get(network); firstNonZeroRewardEpochDay = Utility.getEpochDay(firstNonZeroRewardTimestamp); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/RemoveInvalidEntityMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/RemoveInvalidEntityMigrationTest.java index 1a1b6dba843..4c9222b0443 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/RemoveInvalidEntityMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/RemoveInvalidEntityMigrationTest.java @@ -28,7 +28,7 @@ import com.hedera.mirror.importer.DisableRepeatableSqlMigration; import com.hedera.mirror.importer.EnabledIfV1; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.repository.TransactionRepository; import com.hederahashgraph.api.proto.java.ResponseCodeEnum; @@ -60,13 +60,13 @@ class RemoveInvalidEntityMigrationTest extends ImporterIntegrationTest { @Value("classpath:db/migration/v1/V1.31.2__remove_invalid_entities.sql") private final File migrationSql; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private final TransactionRepository transactionRepository; @BeforeEach void before() { - mirrorProperties.setStartDate(Instant.EPOCH); - mirrorProperties.setEndDate(Instant.EPOCH.plusSeconds(1)); + importerProperties.setStartDate(Instant.EPOCH); + importerProperties.setEndDate(Instant.EPOCH.plusSeconds(1)); } @Test diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/SyntheticCryptoTransferApprovalMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/SyntheticCryptoTransferApprovalMigrationTest.java index 3185413bf35..193ffcf1c57 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/SyntheticCryptoTransferApprovalMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/SyntheticCryptoTransferApprovalMigrationTest.java @@ -16,8 +16,8 @@ package com.hedera.mirror.importer.migration; -import static com.hedera.mirror.importer.MirrorProperties.HederaNetwork.MAINNET; -import static com.hedera.mirror.importer.MirrorProperties.HederaNetwork.TESTNET; +import static com.hedera.mirror.importer.ImporterProperties.HederaNetwork.MAINNET; +import static com.hedera.mirror.importer.ImporterProperties.HederaNetwork.TESTNET; import static com.hedera.mirror.importer.migration.SyntheticCryptoTransferApprovalMigration.LOWER_BOUND_TIMESTAMP; import static com.hedera.mirror.importer.migration.SyntheticCryptoTransferApprovalMigration.UPPER_BOUND_TIMESTAMP; import static org.assertj.core.api.Assertions.assertThat; @@ -34,7 +34,7 @@ import com.hedera.mirror.common.domain.transaction.RecordFile; import com.hedera.mirror.common.domain.transaction.Transaction; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.repository.CryptoTransferRepository; import com.hedera.mirror.importer.repository.TokenTransferRepository; import com.hedera.mirror.importer.repository.TransactionRepository; @@ -78,7 +78,7 @@ class SyntheticCryptoTransferApprovalMigrationTest extends ImporterIntegrationTe private final CryptoTransferRepository cryptoTransferRepository; private final TransactionRepository transactionRepository; private final TokenTransferRepository tokenTransferRepository; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private Entity currentKeyUnaffectedEntity; private Entity currentKeyAffectedEntity; private Entity noKeyEntity; @@ -87,14 +87,14 @@ class SyntheticCryptoTransferApprovalMigrationTest extends ImporterIntegrationTe @BeforeEach @SneakyThrows void setup() { - mirrorProperties.setNetwork(MAINNET); + importerProperties.setNetwork(MAINNET); migration.setExecuted(false); migration.setComplete(false); } @AfterEach void teardown() { - mirrorProperties.setNetwork(TESTNET); + importerProperties.setNetwork(TESTNET); } @Test diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/TokenAccountBalanceMigrationTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/TokenAccountBalanceMigrationTest.java index c3555036dc3..199b96bed43 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/TokenAccountBalanceMigrationTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/migration/TokenAccountBalanceMigrationTest.java @@ -29,7 +29,7 @@ import com.hedera.mirror.common.domain.token.TokenTransfer; import com.hedera.mirror.common.domain.token.TokenTypeEnum; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.config.Owner; import com.hedera.mirror.importer.repository.AccountBalanceFileRepository; import com.hedera.mirror.importer.repository.RecordFileRepository; @@ -61,7 +61,7 @@ class TokenAccountBalanceMigrationTest extends ImporterIntegrationTest { private final TokenAccountRepository tokenAccountRepository; private final TokenAccountHistoryRepository tokenAccountHistoryRepository; private final TokenTransferRepository tokenTransferRepository; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; private TokenAccountBalanceMigration tokenAccountBalanceMigration; private AccountBalanceFile accountBalanceFile1; @@ -78,7 +78,7 @@ class TokenAccountBalanceMigrationTest extends ImporterIntegrationTest { void beforeEach() { timestamp = new AtomicLong(domainBuilder.timestamp()); tokenAccountBalanceMigration = new TokenAccountBalanceMigration( - jdbcOperations, mirrorProperties, accountBalanceFileRepository, recordFileRepository); + jdbcOperations, importerProperties, accountBalanceFileRepository, recordFileRepository); } @Test diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/parser/balance/AccountBalanceFileParserTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/parser/balance/AccountBalanceFileParserTest.java index 778191934f5..45e88ad7b13 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/parser/balance/AccountBalanceFileParserTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/parser/balance/AccountBalanceFileParserTest.java @@ -23,7 +23,7 @@ import com.hedera.mirror.common.domain.balance.AccountBalanceFile; import com.hedera.mirror.common.domain.balance.TokenBalance; import com.hedera.mirror.importer.ImporterIntegrationTest; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.parser.StreamFileParser; import com.hedera.mirror.importer.repository.AccountBalanceFileRepository; import com.hedera.mirror.importer.repository.AccountBalanceRepository; @@ -46,7 +46,7 @@ class AccountBalanceFileParserTest extends ImporterIntegrationTest { private final AccountBalanceRepository accountBalanceRepository; private final TokenBalanceRepository tokenBalanceRepository; private final BalanceParserProperties parserProperties; - private final MirrorProperties mirrorProperties; + private final ImporterProperties importerProperties; @BeforeEach void setup() { @@ -127,8 +127,8 @@ void beforeStartDate() { @Test void errata() { // given - var network = mirrorProperties.getNetwork(); - mirrorProperties.setNetwork(MirrorProperties.HederaNetwork.MAINNET); + var network = importerProperties.getNetwork(); + importerProperties.setNetwork(ImporterProperties.HederaNetwork.MAINNET); AccountBalanceFile accountBalanceFile = accountBalanceFile(BAD_TIMESTAMP1); List items = accountBalanceFile.getItems().collectList().block(); @@ -138,7 +138,7 @@ void errata() { // then assertAccountBalanceFile(accountBalanceFile, items); assertThat(accountBalanceFile.getTimeOffset()).isEqualTo(-1); - mirrorProperties.setNetwork(network); + importerProperties.setNetwork(network); } void assertAccountBalanceFile(AccountBalanceFile accountBalanceFile, List accountBalances) { diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/CsvBalanceFileReaderTest.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/CsvBalanceFileReaderTest.java index a17f328cb8f..49ff761c338 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/CsvBalanceFileReaderTest.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/CsvBalanceFileReaderTest.java @@ -24,7 +24,7 @@ import com.hedera.mirror.common.domain.balance.AccountBalance; import com.hedera.mirror.common.domain.balance.AccountBalanceFile; import com.hedera.mirror.common.util.DomainUtils; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.TestUtils; import com.hedera.mirror.importer.domain.StreamFileData; import com.hedera.mirror.importer.domain.StreamFilename; @@ -52,7 +52,7 @@ abstract class CsvBalanceFileReaderTest { - protected final MirrorProperties mirrorProperties; + protected final ImporterProperties importerProperties; protected final BalanceParserProperties balanceParserProperties; protected final File balanceFile; protected final CsvBalanceFileReader balanceFileReader; @@ -69,12 +69,13 @@ abstract class CsvBalanceFileReaderTest { Class accountBalanceLineParserClass, String balanceFilePath, long expectedCount) { - mirrorProperties = new MirrorProperties(); + importerProperties = new ImporterProperties(); balanceParserProperties = new BalanceParserProperties(); balanceFile = TestUtils.getResource(balanceFilePath); parser = (AccountBalanceLineParser) ReflectUtils.newInstance( - accountBalanceLineParserClass, new Class[] {MirrorProperties.class}, new Object[] {mirrorProperties - }); + accountBalanceLineParserClass, + new Class[] {ImporterProperties.class}, + new Object[] {importerProperties}); balanceFileReader = (CsvBalanceFileReader) ReflectUtils.newInstance( balanceFileReaderClass, new Class[] {BalanceParserProperties.class, accountBalanceLineParserClass}, @@ -200,7 +201,7 @@ void readValidWhenFileHasBadTrailingLines() throws IOException { void readValidWhenFileHasLinesWithDifferentShardNum() throws IOException { List lines = FileUtils.readLines(balanceFile, CsvBalanceFileReader.CHARSET); FileUtils.writeLines(testFile, lines); - long otherShard = mirrorProperties.getShard() + 1; + long otherShard = importerProperties.getShard() + 1; FileUtils.writeStringToFile( testFile, String.format("\n%d,0,3,340\n%d,0,4,340\n", otherShard, otherShard), diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV1Test.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV1Test.java index 558e2312630..7c0b59df3a6 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV1Test.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV1Test.java @@ -20,7 +20,7 @@ import static org.junit.jupiter.api.Assertions.*; import com.hedera.mirror.common.domain.balance.AccountBalance; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.exception.InvalidDatasetException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -32,12 +32,12 @@ class AccountBalanceLineParserV1Test { private static final long timestamp = 1596340377922333444L; private AccountBalanceLineParserV1 parser; - private MirrorProperties mirrorProperties; + private ImporterProperties importerProperties; @BeforeEach void setup() { - mirrorProperties = new MirrorProperties(); - parser = new AccountBalanceLineParserV1(mirrorProperties); + importerProperties = new ImporterProperties(); + parser = new AccountBalanceLineParserV1(importerProperties); } @DisplayName("Parse account balance line") @@ -75,7 +75,7 @@ void parse(String line, boolean expectThrow, Long expectedRealm, Long expectedAc assertThat(accountBalance.getBalance()).isEqualTo(expectedBalance); assertThat(id).isNotNull(); - assertThat(id.getAccountId().getShard()).isEqualTo(mirrorProperties.getShard()); + assertThat(id.getAccountId().getShard()).isEqualTo(importerProperties.getShard()); assertThat(id.getAccountId().getRealm()).isEqualTo(expectedRealm); assertThat(id.getAccountId().getNum()).isEqualTo(expectedAccount); assertThat(id.getConsensusTimestamp()).isEqualTo(timestamp); diff --git a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV2Test.java b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV2Test.java index 791ea21e4db..a90f59a8f8f 100644 --- a/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV2Test.java +++ b/hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/line/AccountBalanceLineParserV2Test.java @@ -22,7 +22,7 @@ import com.google.common.base.Splitter; import com.hedera.mirror.common.domain.balance.AccountBalance; import com.hedera.mirror.common.domain.balance.TokenBalance; -import com.hedera.mirror.importer.MirrorProperties; +import com.hedera.mirror.importer.ImporterProperties; import com.hedera.mirror.importer.exception.InvalidDatasetException; import java.io.IOException; import java.util.List; @@ -39,12 +39,12 @@ class AccountBalanceLineParserV2Test { private static final long timestamp = 1596340377922333444L; private AccountBalanceLineParserV2 parser; - private MirrorProperties mirrorProperties; + private ImporterProperties importerProperties; @BeforeEach void setup() { - mirrorProperties = new MirrorProperties(); - parser = new AccountBalanceLineParserV2(mirrorProperties); + importerProperties = new ImporterProperties(); + parser = new AccountBalanceLineParserV2(importerProperties); } @DisplayName("Parse account balance line") @@ -122,11 +122,11 @@ void parse( actualId.getTokenId().getNum())); assertThat(actualId).isNotNull(); assertThat(actualId.getConsensusTimestamp()).isEqualTo(timestamp); - assertThat(actualId.getAccountId().getShard()).isEqualTo(mirrorProperties.getShard()); + assertThat(actualId.getAccountId().getShard()).isEqualTo(importerProperties.getShard()); assertThat(actualId.getAccountId().getRealm()).isEqualTo(expectedRealm); assertThat(actualId.getAccountId().getNum()).isEqualTo(expectedAccount); - assertThat(actualId.getTokenId().getShard()).isEqualTo(mirrorProperties.getShard()); + assertThat(actualId.getTokenId().getShard()).isEqualTo(importerProperties.getShard()); assertThat(actualId.getTokenId().getRealm()).isEqualTo(expectedRealm); } } else {