conflict_resolution
stringlengths
27
16k
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.AplException; ======= import com.apollocurrency.aplwallet.apl.core.converter.rest.IteratorToStreamConverter; >>>>>>> import com.apollocurrency.aplwallet.apl.core.converter.rest.IteratorToStreamConverter; import com.apollocurrency.aplwallet.apl.core.app.AplException; <<<<<<< private final TransactionBuilder transactionBuilder; private final TransactionSerializer transactionSerializer; ======= private final IteratorToStreamConverter<UnconfirmedTransaction> streamConverter; >>>>>>> private final TransactionBuilder transactionBuilder; private final TransactionSerializer transactionSerializer; private final IteratorToStreamConverter<UnconfirmedTransaction> streamConverter;
<<<<<<< import com.apollocurrency.aplwallet.apl.updater.decryption.RSAUtil; import javax.enterprise.inject.Vetoed; import org.apache.commons.lang3.ArrayUtils; ======= import java.util.stream.Stream; //TODO: how to read from resources // ClassLoader classloader = Thread.currentThread().getContextClassLoader(); // try (InputStream is = classloader.getResourceAsStream("conf/updater.properties")) { // // rerad from is; // } >>>>>>> import javax.enterprise.inject.Vetoed; import org.apache.commons.lang3.ArrayUtils; import java.util.stream.Stream;
<<<<<<< @JsonPropertyOrder({"height", "maxNumberOfTransactions", "maxNumberOfChildAccounts", "blockTime", "maxBlockTimeLimit", "minBlockTimeLimit", "maxBalance", "shardingSettings", "consensusSettings", "transactionFeeSettings", "featuresHeightRequirement"}) ======= @JsonPropertyOrder({"height", "maxNumberOfTransactions", "maxArbitraryMessageLength", "blockTime", "maxBlockTimeLimit", "minBlockTimeLimit", "maxBalance", "shardingSettings", "consensusSettings", "featuresHeightRequirement"}) >>>>>>> @JsonPropertyOrder({"height", "maxNumberOfTransactions", "maxArbitraryMessageLength", "maxNumberOfChildAccounts", "blockTime", "maxBlockTimeLimit", "minBlockTimeLimit", "maxBalance", "shardingSettings", "consensusSettings", "featuresHeightRequirement"}) <<<<<<< @Getter private final int maxNumberOfChildAccounts; @Getter @Setter ======= private int maxArbitraryMessageLength; >>>>>>> private int maxArbitraryMessageLength; @Getter private final int maxNumberOfChildAccounts; @Getter @Setter <<<<<<< * @param maxNumberOfChildAccounts ======= * @param maxArbitraryMessageLength >>>>>>> * @param maxArbitraryMessageLength * @param maxNumberOfChildAccounts <<<<<<< @JsonProperty("maxNumberOfChildAccount") int maxNumberOfChildAccounts, ======= @JsonProperty("maxArbitraryMessageLength") int maxArbitraryMessageLength, >>>>>>> @JsonProperty("maxArbitraryMessageLength") int maxArbitraryMessageLength, @JsonProperty("maxNumberOfChildAccount") int maxNumberOfChildAccounts, <<<<<<< this(height, maxNumberOfTransactions, maxNumberOfChildAccounts, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, null, null, null); ======= this(height, maxNumberOfTransactions, maxArbitraryMessageLength, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, null, null); >>>>>>> this(height, maxNumberOfTransactions, maxArbitraryMessageLength, maxNumberOfChildAccounts, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, null, null); <<<<<<< * @param maxNumberOfChildAccounts ======= * @param maxArbitraryMessageLength >>>>>>> * @param maxArbitraryMessageLength * @param maxNumberOfChildAccounts <<<<<<< int maxNumberOfChildAccounts, ======= int maxArbitraryMessageLength, >>>>>>> int maxArbitraryMessageLength, int maxNumberOfChildAccounts, <<<<<<< ConsensusSettings consensusSettings, TransactionFeeSettings transactionFeeSettings ) { ======= ConsensusSettings consensusSettings ) { >>>>>>> ConsensusSettings consensusSettings, TransactionFeeSettings transactionFeeSettings ) { <<<<<<< this.maxNumberOfChildAccounts = maxNumberOfChildAccounts; ======= this.maxArbitraryMessageLength = Math.max(MIN_VALUE_FOR_MAX_ARBITRARY_MESSAGE_LENGTH, maxArbitraryMessageLength); >>>>>>> this.maxArbitraryMessageLength = Math.max(MIN_VALUE_FOR_MAX_ARBITRARY_MESSAGE_LENGTH, maxArbitraryMessageLength); this.maxNumberOfChildAccounts = maxNumberOfChildAccounts; <<<<<<< public BlockchainProperties(int height, int maxNumberOfTransactions, int blockTime, int maxBlockTimeLimit, int minBlockTimeLimit, long maxBalance, ShardingSettings shardingSettings) { this(height, maxNumberOfTransactions, 1, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, shardingSettings, null, null); ======= public BlockchainProperties(int height, int maxNumberOfTransactions, int maxArbitraryMessageLength, int blockTime, int maxBlockTimeLimit, int minBlockTimeLimit, long maxBalance, ShardingSettings shardingSettings) { this(height, maxNumberOfTransactions, maxArbitraryMessageLength, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, shardingSettings, null); >>>>>>> public BlockchainProperties(int height, int maxNumberOfTransactions, int maxArbitraryMessageLength, int blockTime, int maxBlockTimeLimit, int minBlockTimeLimit, long maxBalance, ShardingSettings shardingSettings) { this(height, maxNumberOfTransactions, maxArbitraryMessageLength, 1, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, shardingSettings, null, null); <<<<<<< this(height, maxNumberOfTransactions, 1, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, null, consensusSettings, null); } public BlockchainProperties(int height, int maxNumberOfTransactions, int blockTime, int maxBlockTimeLimit, int minBlockTimeLimit, long maxBalance, ShardingSettings shardingSettings, ConsensusSettings consensusSettings) { this(height, maxNumberOfTransactions, 1, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, shardingSettings, consensusSettings, null); ======= this(height, maxNumberOfTransactions, maxArbitraryMessageLength, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, null, consensusSettings); >>>>>>> this(height, maxNumberOfTransactions, maxArbitraryMessageLength, 1, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, null, consensusSettings, null); } public BlockchainProperties(int height, int maxNumberOfTransactions, int maxArbitraryMessageLength, int blockTime, int maxBlockTimeLimit, int minBlockTimeLimit, long maxBalance, ShardingSettings shardingSettings, ConsensusSettings consensusSettings) { this(height, maxNumberOfTransactions, maxArbitraryMessageLength, 1, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, shardingSettings, consensusSettings, null); <<<<<<< return Objects.hash(height, maxNumberOfTransactions, maxNumberOfChildAccounts, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, shardingSettings, consensusSettings, transactionFeeSettings); ======= return Objects.hash(height, maxNumberOfTransactions, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, shardingSettings, consensusSettings); } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public int getMaxNumberOfTransactions() { return maxNumberOfTransactions; } public void setMaxNumberOfTransactions(int maxNumberOfTransactions) { this.maxNumberOfTransactions = maxNumberOfTransactions; } public int getMaxArbitraryMessageLength() { return maxArbitraryMessageLength; } public void setMaxArbitraryMessageLength(int maxArbitraryMessageLength) { this.maxArbitraryMessageLength = maxArbitraryMessageLength; } public int getMaxEncryptedMessageLength() { return maxArbitraryMessageLength + MAX_ENCRYPTED_MESSAGE_HEADER_LENGTH; } public int getBlockTime() { return blockTime; } public void setBlockTime(int blockTime) { this.blockTime = blockTime; } public long getMaxBalance() { return maxBalance; } public void setMaxBalance(long maxBalance) { this.maxBalance = maxBalance; >>>>>>> return Objects.hash(height, maxNumberOfTransactions, maxArbitraryMessageLength, maxNumberOfChildAccounts, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, shardingSettings, consensusSettings, transactionFeeSettings); } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public int getMaxNumberOfTransactions() { return maxNumberOfTransactions; } public void setMaxNumberOfTransactions(int maxNumberOfTransactions) { this.maxNumberOfTransactions = maxNumberOfTransactions; } public int getMaxArbitraryMessageLength() { return maxArbitraryMessageLength; } public void setMaxArbitraryMessageLength(int maxArbitraryMessageLength) { this.maxArbitraryMessageLength = maxArbitraryMessageLength; } public int getMaxEncryptedMessageLength() { return maxArbitraryMessageLength + MAX_ENCRYPTED_MESSAGE_HEADER_LENGTH; } public int getBlockTime() { return blockTime; } public void setBlockTime(int blockTime) { this.blockTime = blockTime; } public long getMaxBalance() { return maxBalance; } public void setMaxBalance(long maxBalance) { this.maxBalance = maxBalance; <<<<<<< return new BlockchainProperties(height, maxNumberOfTransactions, maxNumberOfChildAccounts, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, shardingSettings.copy(), consensusSettings.copy(), transactionFeeSettings.copy()); ======= return new BlockchainProperties(height, maxNumberOfTransactions, maxArbitraryMessageLength, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, shardingSettings.copy(), consensusSettings.copy()); >>>>>>> return new BlockchainProperties(height, maxNumberOfTransactions, maxArbitraryMessageLength, maxNumberOfChildAccounts, blockTime, maxBlockTimeLimit, minBlockTimeLimit, maxBalance, shardingSettings.copy(), consensusSettings.copy(), transactionFeeSettings.copy()); <<<<<<< ", maxNumberOfChildAccount=" + maxNumberOfChildAccounts + ======= ", maxArbitraryMessageLength=" + maxArbitraryMessageLength + >>>>>>> ", maxArbitraryMessageLength=" + maxArbitraryMessageLength + ", maxNumberOfChildAccount=" + maxNumberOfChildAccounts +
<<<<<<< public List<UserEthDepositInfo> getUserFilledDeposits(String user) throws AplException.ExecutiveProcessException { return dexSmartContractService.getUserFilledDeposits(user); } public List<UserEthDepositInfo> getUserFilledOrders(String user) throws AplException.ExecutiveProcessException { return dexSmartContractService.getUserFilledOrders(user); } ======= public boolean isExpired(Transaction tx) { return timeService.getEpochTime() > tx.getExpiration(); } >>>>>>> public boolean isExpired(Transaction tx) { return timeService.getEpochTime() > tx.getExpiration(); } public List<UserEthDepositInfo> getUserFilledDeposits(String user) throws AplException.ExecutiveProcessException { return dexSmartContractService.getUserFilledDeposits(user); } public List<UserEthDepositInfo> getUserFilledOrders(String user) throws AplException.ExecutiveProcessException { return dexSmartContractService.getUserFilledOrders(user); }
<<<<<<< import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; ======= import com.apollocurrency.aplwallet.apl.core.signature.Signature; import com.apollocurrency.aplwallet.apl.core.transaction.Payment; >>>>>>> import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; import com.apollocurrency.aplwallet.apl.core.signature.Signature; import com.apollocurrency.aplwallet.apl.core.transaction.Payment; <<<<<<< import com.apollocurrency.aplwallet.apl.core.transaction.messages.PrunableLoadingService; import com.apollocurrency.aplwallet.apl.core.utils.Convert2; ======= import com.apollocurrency.aplwallet.apl.core.utils.Convert2; >>>>>>> import com.apollocurrency.aplwallet.apl.core.transaction.messages.PrunableLoadingService; import com.apollocurrency.aplwallet.apl.core.utils.Convert2; import com.apollocurrency.aplwallet.apl.core.utils.Convert2;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.account.model.Account; import com.apollocurrency.aplwallet.apl.core.account.service.AccountService; import com.apollocurrency.aplwallet.apl.core.app.Block; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.account.model.Account; import com.apollocurrency.aplwallet.apl.core.account.service.AccountService; import com.apollocurrency.aplwallet.apl.core.app.Block; <<<<<<< private AccountService accountService; ======= private BlockchainConfig blockchainConfig; >>>>>>> private BlockchainConfig blockchainConfig; private AccountService accountService; <<<<<<< IDexMatcherInterface dexMatcherService, DexTradeDao dexTradeDao, PhasingApprovedResultTable phasingApprovedResultTable, MandatoryTransactionDao mandatoryTransactionDao, AccountService accountService) { ======= IDexMatcherInterface dexMatcherService, PhasingApprovedResultTable phasingApprovedResultTable, MandatoryTransactionDao mandatoryTransactionDao, BlockchainConfig blockchainConfig, @CacheProducer @CacheType(DexOrderFreezingCacheConfig.CACHE_NAME) Cache<Long, OrderFreezing> cache) { >>>>>>> IDexMatcherInterface dexMatcherService, PhasingApprovedResultTable phasingApprovedResultTable, MandatoryTransactionDao mandatoryTransactionDao, AccountService accountService, BlockchainConfig blockchainConfig, @CacheProducer @CacheType(DexOrderFreezingCacheConfig.CACHE_NAME) Cache<Long, OrderFreezing> cache) { <<<<<<< this.accountService = accountService; ======= this.orderFreezingCache = (LoadingCache<Long, OrderFreezing>) cache; this.blockchainConfig = blockchainConfig; >>>>>>> this.orderFreezingCache = (LoadingCache<Long, OrderFreezing>) cache; this.blockchainConfig = blockchainConfig; this.accountService = accountService; <<<<<<< public void finishExchange(long transactionId, long orderId) { DexOrder order = closeOrder(orderId); ExchangeContract exchangeContract = getDexContractByOrderId(order.getId()); if (exchangeContract == null) { exchangeContract = getDexContractByCounterOrderId(order.getId()); } Block lastBlock = blockchain.getLastBlock(); DexTradeEntry dexTradeEntry = DexTradeEntry.builder() .transactionID(transactionId) .senderOfferID(exchangeContract.getSender()) .receiverOfferID(exchangeContract.getRecipient()) .senderOfferType((byte) order.getType().ordinal()) .senderOfferCurrency((byte) order.getOrderCurrency().ordinal()) .senderOfferAmount(order.getOrderAmount()) .pairCurrency((byte) order.getPairCurrency().ordinal()) .pairRate(order.getPairRate()) .finishTime(lastBlock.getTimestamp()) .height(lastBlock.getHeight()) .build(); saveDexTradeEntry(dexTradeEntry); } public boolean flushSecureStorage(Long accountID, String passPhrase) { return secureStorageService.flushAccountKeys( accountID, passPhrase); ======= public boolean flushSecureStorage(Long accountID, String passPhrase) { return secureStorageService.flushAccountKeys( accountID, passPhrase); >>>>>>> public boolean flushSecureStorage(Long accountID, String passPhrase) { return secureStorageService.flushAccountKeys( accountID, passPhrase);
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.AplException; import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; ======= import com.apollocurrency.aplwallet.apl.core.app.AplException; import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.monetary.MonetarySystem; import com.apollocurrency.aplwallet.apl.core.monetary.MonetarySystemExchange; >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.AplException; import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.monetary.MonetarySystem; import com.apollocurrency.aplwallet.apl.core.monetary.MonetarySystemExchange; import com.apollocurrency.aplwallet.apl.core.app.AplException; import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; <<<<<<< import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionValidator; ======= import com.apollocurrency.aplwallet.apl.core.transaction.ShufflingTransaction; >>>>>>> import com.apollocurrency.aplwallet.apl.core.transaction.ShufflingTransaction; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionValidator;
<<<<<<< assertEquals(14, count); long countLong = dao.getTransactionCount(null, 0, 8000); assertEquals(7, countLong); ======= assertEquals(15, count); >>>>>>> assertEquals(15, count); long countLong = dao.getTransactionCount(null, 0, 8000); assertEquals(7, countLong);
<<<<<<< import javax.annotation.security.PermitAll; import javax.annotation.security.RolesAllowed; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import java.util.Map; import java.util.Objects; ======= >>>>>>>
<<<<<<< public UpdateTransaction sendUpdateTransaction(String url, String secretPhrase, long feeATM, int level, String updateUrl, Version version, Architecture architecture, Platform platform, String hash, String signature, int deadline) throws IOException { Map<String, String> parameters = new HashMap<>(); parameters.put("requestType", "sendUpdateTransaction"); parameters.put("secretPhrase", secretPhrase); parameters.put("feeATM", String.valueOf(feeATM)); parameters.put("deadline", String.valueOf(deadline)); parameters.put("version", version.toString()); parameters.put("architecture", architecture.toString()); parameters.put("platform", platform.toString()); parameters.put("signature", signature); parameters.put("hash", hash); parameters.put("url", updateUrl); parameters.put("level", String.valueOf(level)); String json = postJson(createURI(url), parameters, ""); return MAPPER.readValue(json, UpdateTransaction.class); } ======= public String startForging(String url, String secretPhrase) throws IOException { return sendForgingRequest(url, secretPhrase, "startForging", null); } private String sendForgingRequest(String url, String secretPhrase, String requestType,String adminPassword) throws IOException { Map<String, String> parameters = new HashMap<>(); parameters.put("requestType", requestType); if (secretPhrase != null) { parameters.put("secretPhrase", secretPhrase); } if (adminPassword != null) { parameters.put("adminPassword", adminPassword); } String json = postJson(createURI(url), parameters, ""); return json; } public List<ForgingDetails> getForging(String url, String secretPhrase, String adminPassword) throws IOException { String json = sendForgingRequest(url, secretPhrase, "getForging", adminPassword); JsonNode root = MAPPER.readTree(json); JsonNode gereratorsArray = root.get("generators"); return MAPPER.readValue(gereratorsArray.toString(), new TypeReference<List<ForgingDetails>>() {}); } public String stopForging(String url, String secretPhrase) throws IOException { return sendForgingRequest(url, secretPhrase, "stopForging", null); } public NextGenerators getNextGenerators(String url, Long limit) throws IOException { Map<String, String> parameters = new HashMap<>(); parameters.put("requestType", "getNextBlockGenerators"); parameters.put("limit", limit.toString()); String json = getJson(createURI(url), parameters); return MAPPER.readValue(json, NextGenerators.class); } >>>>>>> public String startForging(String url, String secretPhrase) throws IOException { return sendForgingRequest(url, secretPhrase, "startForging", null); } private String sendForgingRequest(String url, String secretPhrase, String requestType,String adminPassword) throws IOException { Map<String, String> parameters = new HashMap<>(); parameters.put("requestType", requestType); if (secretPhrase != null) { parameters.put("secretPhrase", secretPhrase); } if (adminPassword != null) { parameters.put("adminPassword", adminPassword); } String json = postJson(createURI(url), parameters, ""); return json; } public List<ForgingDetails> getForging(String url, String secretPhrase, String adminPassword) throws IOException { String json = sendForgingRequest(url, secretPhrase, "getForging", adminPassword); JsonNode root = MAPPER.readTree(json); JsonNode gereratorsArray = root.get("generators"); return MAPPER.readValue(gereratorsArray.toString(), new TypeReference<List<ForgingDetails>>() {}); } public String stopForging(String url, String secretPhrase) throws IOException { return sendForgingRequest(url, secretPhrase, "stopForging", null); } public NextGenerators getNextGenerators(String url, Long limit) throws IOException { Map<String, String> parameters = new HashMap<>(); parameters.put("requestType", "getNextBlockGenerators"); parameters.put("limit", limit.toString()); String json = getJson(createURI(url), parameters); return MAPPER.readValue(json, NextGenerators.class); } public UpdateTransaction sendUpdateTransaction(String url, String secretPhrase, long feeATM, int level, String updateUrl, Version version, Architecture architecture, Platform platform, String hash, String signature, int deadline) throws IOException { Map<String, String> parameters = new HashMap<>(); parameters.put("requestType", "sendUpdateTransaction"); parameters.put("secretPhrase", secretPhrase); parameters.put("feeATM", String.valueOf(feeATM)); parameters.put("deadline", String.valueOf(deadline)); parameters.put("version", version.toString()); parameters.put("architecture", architecture.toString()); parameters.put("platform", platform.toString()); parameters.put("signature", signature); parameters.put("hash", hash); parameters.put("url", updateUrl); parameters.put("level", String.valueOf(level)); String json = postJson(createURI(url), parameters, ""); return MAPPER.readValue(json, UpdateTransaction.class); }
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.AplException; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.AplException; <<<<<<< import com.apollocurrency.aplwallet.apl.core.db.DbClause; import com.apollocurrency.aplwallet.apl.core.db.DbIterator; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.state.account.Account; import com.apollocurrency.aplwallet.apl.core.entity.state.account.AccountControlPhasing; import com.apollocurrency.aplwallet.apl.core.entity.state.account.AccountControlType; import com.apollocurrency.aplwallet.apl.core.entity.state.account.LedgerEvent; import com.apollocurrency.aplwallet.apl.core.entity.state.asset.Asset; import com.apollocurrency.aplwallet.apl.core.entity.state.currency.Currency; ======= import com.apollocurrency.aplwallet.apl.core.db.DbClause; import com.apollocurrency.aplwallet.apl.core.db.DbIterator; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.state.account.Account; import com.apollocurrency.aplwallet.apl.core.entity.state.account.AccountControlPhasing; import com.apollocurrency.aplwallet.apl.core.entity.state.account.AccountControlType; import com.apollocurrency.aplwallet.apl.core.entity.state.account.LedgerEvent; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.DbClause; import com.apollocurrency.aplwallet.apl.core.db.DbIterator; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.state.account.Account; import com.apollocurrency.aplwallet.apl.core.entity.state.account.AccountControlPhasing; import com.apollocurrency.aplwallet.apl.core.entity.state.account.AccountControlType; import com.apollocurrency.aplwallet.apl.core.entity.state.account.LedgerEvent; import com.apollocurrency.aplwallet.apl.core.db.DbClause; import com.apollocurrency.aplwallet.apl.core.db.DbIterator; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.state.account.Account; import com.apollocurrency.aplwallet.apl.core.entity.state.account.AccountControlPhasing; import com.apollocurrency.aplwallet.apl.core.entity.state.account.AccountControlType; import com.apollocurrency.aplwallet.apl.core.entity.state.account.LedgerEvent; import com.apollocurrency.aplwallet.apl.core.entity.state.asset.Asset; import com.apollocurrency.aplwallet.apl.core.entity.state.currency.Currency; <<<<<<< import com.apollocurrency.aplwallet.apl.core.model.PhasingCreator; import com.apollocurrency.aplwallet.apl.core.model.PhasingParams; import com.apollocurrency.aplwallet.apl.core.model.TransactionDbInfo; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; import com.apollocurrency.aplwallet.apl.core.service.state.PhasingPollService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountControlPhasingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountService; import com.apollocurrency.aplwallet.apl.core.service.state.asset.AssetService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyService; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; ======= import com.apollocurrency.aplwallet.apl.core.model.PhasingCreator; import com.apollocurrency.aplwallet.apl.core.model.TransactionDbInfo; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; import com.apollocurrency.aplwallet.apl.core.service.state.PhasingPollService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountControlPhasingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountService; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionType; >>>>>>> import com.apollocurrency.aplwallet.apl.core.model.PhasingCreator; import com.apollocurrency.aplwallet.apl.core.model.TransactionDbInfo; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; import com.apollocurrency.aplwallet.apl.core.service.state.PhasingPollService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountControlPhasingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountService; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionType; import com.apollocurrency.aplwallet.apl.core.model.PhasingCreator; import com.apollocurrency.aplwallet.apl.core.model.PhasingParams; import com.apollocurrency.aplwallet.apl.core.model.TransactionDbInfo; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; import com.apollocurrency.aplwallet.apl.core.service.state.PhasingPollService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountControlPhasingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountService; import com.apollocurrency.aplwallet.apl.core.service.state.asset.AssetService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyService; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes;
<<<<<<< private static CurrencyExchangeOfferFacade currencyExchangeOfferFacade; ======= private static AssetTransferService assetTransferService; >>>>>>> private static AssetTransferService assetTransferService; private static CurrencyExchangeOfferFacade currencyExchangeOfferFacade; <<<<<<< public static synchronized CurrencyExchangeOfferFacade lookupCurrencyExchangeOfferFacade() { if (currencyExchangeOfferFacade == null) { currencyExchangeOfferFacade = CDI.current().select(CurrencyExchangeOfferFacade.class).get(); } return currencyExchangeOfferFacade; } ======= public static synchronized AssetTransferService lookupAssetTransferService() { if (assetTransferService == null) { assetTransferService = CDI.current().select(AssetTransferService.class).get(); } return assetTransferService; } >>>>>>> public static synchronized AssetTransferService lookupAssetTransferService() { if (assetTransferService == null) { assetTransferService = CDI.current().select(AssetTransferService.class).get(); } return assetTransferService; } public static synchronized CurrencyExchangeOfferFacade lookupCurrencyExchangeOfferFacade() { if (currencyExchangeOfferFacade == null) { currencyExchangeOfferFacade = CDI.current().select(CurrencyExchangeOfferFacade.class).get(); } return currencyExchangeOfferFacade; }
<<<<<<< import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; ======= import static org.slf4j.LoggerFactory.getLogger; >>>>>>> import static org.slf4j.LoggerFactory.getLogger; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; <<<<<<< private static TransactionalDataSource lookupDataSource() { if (databaseManager == null) databaseManager = CDI.current().select(DatabaseManager.class).get(); return databaseManager.getDataSource(); } public static DbIterator<Poll> getVotedPollsByAccount(long accountId, int from, int to) { ======= public static DbIterator<Poll> getVotedPollsByAccount(long accountId, int from, int to) throws AplException.NotValidException { >>>>>>> private static TransactionalDataSource lookupDataSource() { if (databaseManager == null) { databaseManager = CDI.current().select(DatabaseManager.class).get(); } return databaseManager.getDataSource(); } public static DbIterator<Poll> getVotedPollsByAccount(long accountId, int from, int to) throws AplException.NotValidException { <<<<<<< connection = lookupDataSource().getConnection(); PreparedStatement pollStatement = connection.prepareStatement( "SELECT * FROM poll WHERE id IN" + " (SELECT bytes_to_long(attachment_bytes, 1) FROM transaction WHERE " + "sender_id = ? AND type = ? AND subtype = ? " + "ORDER BY block_timestamp DESC, transaction_index DESC" + DbUtils.limitsClause(from, to) + ")"); int i = 0; pollStatement.setLong(++i, accountId); pollStatement.setByte(++i, TransactionType.Messaging.VOTE_CASTING.getType()); pollStatement.setByte(++i, TransactionType.Messaging.VOTE_CASTING.getSubtype()); DbUtils.setLimits(++i, pollStatement, from, to); return pollTable.getManyBy(connection, pollStatement, false); ======= connection = Db.getDb().getConnection(); // extract voted poll ids from attachment try (PreparedStatement pstmt = connection.prepareStatement( "(SELECT attachment_bytes FROM transaction " + "WHERE sender_id = ? AND type = ? AND subtype = ? " + "ORDER BY block_timestamp DESC, transaction_index DESC" + DbUtils.limitsClause(from, to))) { int i = 0; pstmt.setLong(++i, accountId); pstmt.setByte(++i, TransactionType.Messaging.VOTE_CASTING.getType()); pstmt.setByte(++i, TransactionType.Messaging.VOTE_CASTING.getSubtype()); DbUtils.setLimits(++i, pstmt, from, to); List<Long> ids = new ArrayList<>(); try (ResultSet rs = pstmt.executeQuery()) { while (rs.next()) { byte[] bytes = rs.getBytes("attachment_bytes"); ByteBuffer buffer = ByteBuffer.allocate(bytes.length); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.put(bytes); long pollId = new Attachment.MessagingVoteCasting(buffer).getPollId(); ids.add(pollId); } } PreparedStatement pollStatement = connection.prepareStatement( "SELECT * FROM poll WHERE id IN (SELECT * FROM table(x bigint = ? ))"); pollStatement.setObject(1, ids.toArray()); return pollTable.getManyBy(connection, pollStatement, false); } >>>>>>> connection = lookupDataSource().getConnection(); // extract voted poll ids from attachment try (PreparedStatement pstmt = connection.prepareStatement( "(SELECT attachment_bytes FROM transaction " + "WHERE sender_id = ? AND type = ? AND subtype = ? " + "ORDER BY block_timestamp DESC, transaction_index DESC" + DbUtils.limitsClause(from, to))) { int i = 0; pstmt.setLong(++i, accountId); pstmt.setByte(++i, TransactionType.Messaging.VOTE_CASTING.getType()); pstmt.setByte(++i, TransactionType.Messaging.VOTE_CASTING.getSubtype()); DbUtils.setLimits(++i, pstmt, from, to); List<Long> ids = new ArrayList<>(); try (ResultSet rs = pstmt.executeQuery()) { while (rs.next()) { byte[] bytes = rs.getBytes("attachment_bytes"); ByteBuffer buffer = ByteBuffer.allocate(bytes.length); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.put(bytes); long pollId = new Attachment.MessagingVoteCasting(buffer).getPollId(); ids.add(pollId); } } PreparedStatement pollStatement = connection.prepareStatement( "SELECT * FROM poll WHERE id IN (SELECT * FROM table(x bigint = ? ))"); pollStatement.setObject(1, ids.toArray()); return pollTable.getManyBy(connection, pollStatement, false); }
<<<<<<< import com.google.common.base.Preconditions; import lombok.Getter; ======= import com.apollocurrency.aplwallet.apl.util.annotation.DatabaseSpecificDml; import com.apollocurrency.aplwallet.apl.util.annotation.DmlMarker; import com.apollocurrency.aplwallet.apl.util.injectable.PropertiesHolder; import com.google.common.cache.Cache; import lombok.Getter; import lombok.Setter; >>>>>>> import com.apollocurrency.aplwallet.apl.util.annotation.DatabaseSpecificDml; import com.apollocurrency.aplwallet.apl.util.annotation.DmlMarker; import com.apollocurrency.aplwallet.apl.util.injectable.PropertiesHolder; import com.google.common.base.Preconditions; import lombok.Getter; import lombok.Setter; <<<<<<< ======= private void addToGuaranteedBalanceATM(long amountATM) { if (amountATM <= 0) { return; } int blockchainHeight = blockchain.getHeight(); TransactionalDataSource dataSource = databaseManager.getDataSource(); try (Connection con = dataSource.getConnection(); PreparedStatement pstmtSelect = con.prepareStatement("SELECT additions FROM account_guaranteed_balance " + "WHERE account_id = ? and height = ?"); @DatabaseSpecificDml(DmlMarker.MERGE) PreparedStatement pstmtUpdate = con.prepareStatement("MERGE INTO account_guaranteed_balance (account_id, " + " additions, height) KEY (account_id, height) VALUES(?, ?, ?)")) { pstmtSelect.setLong(1, this.id); pstmtSelect.setInt(2, blockchainHeight); try (ResultSet rs = pstmtSelect.executeQuery()) { long additions = amountATM; if (rs.next()) { additions = Math.addExact(additions, rs.getLong("additions")); } pstmtUpdate.setLong(1, this.id); pstmtUpdate.setLong(2, additions); pstmtUpdate.setInt(3, blockchainHeight); pstmtUpdate.executeUpdate(); } } catch (SQLException e) { throw new RuntimeException(e.toString(), e); } } >>>>>>>
<<<<<<< private GenesisImporter genesisImporter; ======= >>>>>>> private GenesisImporter genesisImporter; <<<<<<< public ShardImporter(ShardDao shardDao, BlockchainConfig blockchainConfig, GenesisImporter genesisImporter, Blockchain blockchain, DerivedTablesRegistry derivedTablesRegistry, CsvImporter csvImporter, Zip zipComponent, DownloadableFilesManager downloadableFilesManager, AplAppStatus aplAppStatus) { ======= public ShardImporter(ShardDao shardDao, BlockchainConfig blockchainConfig, Blockchain blockchain, DerivedTablesRegistry derivedTablesRegistry, CsvImporter csvImporter, Zip zipComponent, DataTagDao dataTagDao, DownloadableFilesManager downloadableFilesManager, AplAppStatus aplAppStatus) { >>>>>>> public ShardImporter(ShardDao shardDao, BlockchainConfig blockchainConfig, GenesisImporter genesisImporter, Blockchain blockchain, DerivedTablesRegistry derivedTablesRegistry, CsvImporter csvImporter, Zip zipComponent, DataTagDao dataTagDao, DownloadableFilesManager downloadableFilesManager, AplAppStatus aplAppStatus) { <<<<<<< this.genesisImporter = genesisImporter; ======= >>>>>>> this.genesisImporter = genesisImporter; <<<<<<< genesisImporter.importGenesisJson(false); ======= importGenesis(false); >>>>>>> genesisImporter.importGenesisJson(false); <<<<<<< genesisImporter.importGenesisJson(true); // import genesis public Keys ONLY (NO balances) - 049,842% ======= importGenesis(true); // import genesis public Keys ONLY (NO balances) - 049,842% >>>>>>> genesisImporter.importGenesisJson(true); // import genesis public Keys ONLY (NO balances) - 049,842%
<<<<<<< public class DGSFeedbackTable extends VersionedValuesDbTable<DGSPurchase/*, DGSFeedback*/> { private static final LongKeyFactory<DGSPurchase> KEY_FACTORY = new LongKeyFactory<>("id") { ======= public class DGSFeedbackTable extends VersionedValuesDbTable<DGSFeedback> { private static final LongKeyFactory<DGSFeedback> KEY_FACTORY = new LongKeyFactory<DGSFeedback>("id") { >>>>>>> public class DGSFeedbackTable extends VersionedValuesDbTable<DGSFeedback> { private static final LongKeyFactory<DGSFeedback> KEY_FACTORY = new LongKeyFactory<DGSFeedback>("id") { <<<<<<< public void save(Connection con, DGSPurchase purchase/*, DGSFeedback feedback, int height*/) throws SQLException { ======= protected void save(Connection con, DGSFeedback feedback) throws SQLException { >>>>>>> public void save(Connection con, DGSFeedback feedback) throws SQLException { <<<<<<< pstmt.setLong(++i, purchase.getId()); // i = EncryptedDataUtil.setEncryptedData(pstmt, feedback.getFeedbackEncryptedData(), ++i); i = EncryptedDataUtil.setEncryptedData(pstmt, purchase.getDgsFeedbacks().get(0).getFeedbackEncryptedData(), ++i); // pstmt.setInt(i, height); ======= pstmt.setLong(++i, feedback.getPurchaseId()); i = EncryptedDataUtil.setEncryptedData(pstmt, feedback.getFeedbackEncryptedData(), ++i); pstmt.setInt(i, feedback.getHeight()); >>>>>>> pstmt.setLong(++i, feedback.getPurchaseId()); // i = EncryptedDataUtil.setEncryptedData(pstmt, feedback.getFeedbackEncryptedData(), ++i); i = EncryptedDataUtil.setEncryptedData(pstmt, feedback.getFeedbackEncryptedData(), ++i); // pstmt.setInt(i, feedback.getHeight());
<<<<<<< ======= import javax.inject.Inject; import java.io.IOException; import java.nio.file.Path; import java.util.Set; >>>>>>> <<<<<<< import java.io.IOException; import java.nio.file.Path; import javax.inject.Inject; @Disabled ======= >>>>>>> import java.io.IOException; import java.nio.file.Path; import java.util.Set; import javax.inject.Inject; <<<<<<< DerivedDbTablesRegistryImpl.class,FullTextConfigImpl.class, LuceneFullTextSearchEngine.class, FullTextSearchServiceImpl.class, BlockchainConfigUpdater.class) .addBeans(MockBean.of(blockchainConfig, BlockchainConfig.class)) ======= TaggedDataServiceImpl.class, GlobalSyncImpl.class, TaggedDataDao.class, DataTagDao.class, KeyFactoryProducer.class, TaggedDataTimestampDao.class, TaggedDataExtendDao.class, FullTextConfigImpl.class, DerivedDbTablesRegistryImpl.class, EpochTime.class, BlockDaoImpl.class, TransactionDaoImpl.class) >>>>>>> TaggedDataServiceImpl.class, GlobalSyncImpl.class, TaggedDataDao.class, DataTagDao.class, KeyFactoryProducer.class, TaggedDataTimestampDao.class, TaggedDataExtendDao.class, FullTextConfigImpl.class, DerivedDbTablesRegistryImpl.class, EpochTime.class, BlockDaoImpl.class, TransactionDaoImpl.class) <<<<<<< private static PropertiesHolder propertiesHolder; @Inject private PropertyProducer propertyProducer; @Inject private FullTextSearchService searchService; @Inject private LuceneFullTextSearchEngine fullTextSearchEngine; ======= @Inject FullTextSearchService ftl; public FullTextSearchServiceTest() throws IOException {} >>>>>>> @Inject FullTextSearchService ftl; public FullTextSearchServiceTest() throws IOException {} <<<<<<< void setUp() { propertyProducer = new PropertyProducer(propertiesHolder); // textConfigProducer = new FullTextConfigProducer(); // searchService = new FullTextSearchServiceImpl(fullTextSearchEngine, ; ======= void setUp() throws Exception { ftl.init(); >>>>>>> void setUp() throws Exception { ftl.init();
<<<<<<< TwoFactorAuthTestData td = new TwoFactorAuthTestData(); doReturn(true).when(repository).add(any(TwoFactorAuthEntity.class)); TwoFactorAuthDetails twoFactorAuthDetails = service.enable(td.NEW_ENTITY.getAccount()); TwoFactorAuthUtil.verifySecretCode(twoFactorAuthDetails, Convert.defaultRsAccount(td.NEW_ENTITY.getAccount())); ======= TwoFactorAuthTestData td = new TwoFactorAuthTestData(); // doReturn(true).when(repository).add(any(TwoFactorAuthEntity.class)); doReturn(true).when(targetFileRepository).add(any(TwoFactorAuthEntity.class)); TwoFactorAuthDetails twoFactorAuthDetails = service.enable(td.ENTITY3.getAccount()); TwoFactorAuthUtil.verifySecretCode(twoFactorAuthDetails, Convert.defaultRsAccount(td.ENTITY3.getAccount())); >>>>>>> TwoFactorAuthTestData td = new TwoFactorAuthTestData(); doReturn(true).when(targetFileRepository).add(any(TwoFactorAuthEntity.class)); TwoFactorAuthDetails twoFactorAuthDetails = service.enable(td.NEW_ENTITY.getAccount()); TwoFactorAuthUtil.verifySecretCode(twoFactorAuthDetails, Convert.defaultRsAccount(td.NEW_ENTITY.getAccount())); <<<<<<< TwoFactorAuthTestData td = new TwoFactorAuthTestData(); doReturn(td.ENTITY1).when(repository).get(td.ACC_1.getId()); ======= TwoFactorAuthTestData td = new TwoFactorAuthTestData(); // doReturn(td.ENTITY1).when(repository).get(td.ACCOUNT1.getId()); doReturn(td.ENTITY1).when(targetFileRepository).get(td.ACCOUNT1.getId()); >>>>>>> TwoFactorAuthTestData td = new TwoFactorAuthTestData(); doReturn(td.ENTITY1).when(targetFileRepository).get(td.ACC_1.getId()); <<<<<<< TwoFactorAuthTestData td = new TwoFactorAuthTestData(); doReturn(td.ENTITY2).when(repository).get(td.ACC_2.getId()); ======= TwoFactorAuthTestData td = new TwoFactorAuthTestData(); // doReturn(td.ENTITY2).when(repository).get(td.ACCOUNT2.getId()); doReturn(td.ENTITY2).when(targetFileRepository).get(td.ACCOUNT2.getId()); >>>>>>> TwoFactorAuthTestData td = new TwoFactorAuthTestData(); doReturn(td.ENTITY2).when(targetFileRepository).get(td.ACC_2.getId()); <<<<<<< doReturn(td.ENTITY1).when(repository).get(td.ACC_1.getId()); ======= // doReturn(td.ENTITY1).when(repository).get(td.ACCOUNT1.getId()); doReturn(td.ENTITY1).when(targetFileRepository).get(td.ACCOUNT1.getId()); >>>>>>> doReturn(td.ENTITY1).when(targetFileRepository).get(td.ACC_1.getId()); <<<<<<< verify(repository, times(1)).get(td.ACC_1.getId()); verify(repository, times(1)).delete(td.ACC_1.getId()); ======= // verify(repository, times(1)).get(td.ACCOUNT1.getId()); // verify(repository, times(1)).delete(td.ACCOUNT1.getId()); verify(targetFileRepository, times(1)).get(td.ACCOUNT1.getId()); verify(targetFileRepository, times(1)).delete(td.ACCOUNT1.getId()); >>>>>>> verify(targetFileRepository, times(1)).get(td.ACC_1.getId()); verify(targetFileRepository, times(1)).delete(td.ACC_1.getId()); <<<<<<< doReturn(td.ENTITY1).when(repository).get(td.ACC_1.getId()); ======= // doReturn(td.ENTITY1).when(repository).get(td.ACCOUNT1.getId()); doReturn(td.ENTITY1).when(targetFileRepository).get(td.ACCOUNT1.getId()); >>>>>>> doReturn(td.ENTITY1).when(targetFileRepository).get(td.ACC_1.getId()); <<<<<<< verify(repository, times(1)).get(td.ACC_1.getId()); ======= // verify(repository, times(1)).get(td.ACCOUNT1.getId()); verify(targetFileRepository, times(1)).get(td.ACCOUNT1.getId()); >>>>>>> verify(targetFileRepository, times(1)).get(td.ACC_1.getId()); <<<<<<< TwoFactorAuthTestData td = new TwoFactorAuthTestData(); doReturn(td.ENTITY1).when(repository).get(td.ACC_1.getId()); ======= TwoFactorAuthTestData td = new TwoFactorAuthTestData(); // doReturn(td.ENTITY1).when(repository).get(td.ACCOUNT1.getId()); doReturn(td.ENTITY1).when(targetFileRepository).get(td.ACCOUNT1.getId()); >>>>>>> TwoFactorAuthTestData td = new TwoFactorAuthTestData(); doReturn(td.ENTITY1).when(targetFileRepository).get(td.ACC_1.getId()); <<<<<<< verify(repository, times(1)).get(td.ACC_1.getId()); ======= // verify(repository, times(1)).get(td.ACCOUNT1.getId()); verify(targetFileRepository, times(1)).get(td.ACCOUNT1.getId()); >>>>>>> verify(targetFileRepository, times(1)).get(td.ACC_1.getId()); <<<<<<< verify(repository, times(1)).get(td.ACC_1.getId()); ======= // verify(repository, times(1)).get(td.ACCOUNT1.getId()); verify(targetFileRepository, times(1)).get(td.ACCOUNT1.getId()); >>>>>>> verify(targetFileRepository, times(1)).get(td.ACC_1.getId()); <<<<<<< TwoFactorAuthTestData td = new TwoFactorAuthTestData(); doReturn(td.ENTITY2.clone()).when(repository).get(td.ACC_2.getId()); ======= TwoFactorAuthTestData td = new TwoFactorAuthTestData(); // doReturn(td.ENTITY2.clone()).when(repository).get(td.ACCOUNT2.getId()); doReturn(td.ENTITY2.clone()).when(targetFileRepository).get(td.ACCOUNT2.getId()); >>>>>>> TwoFactorAuthTestData td = new TwoFactorAuthTestData(); doReturn(td.ENTITY2.clone()).when(targetFileRepository).get(td.ACC_2.getId()); <<<<<<< verify(repository, times(1)).get(td.ACC_2.getId()); ======= // verify(repository, times(1)).get(td.ACCOUNT2.getId()); verify(targetFileRepository, times(1)).get(td.ACCOUNT2.getId()); >>>>>>> verify(targetFileRepository, times(1)).get(td.ACC_2.getId()); <<<<<<< doReturn(clone).when(repository).get(td.ACC_2.getId()); doReturn(true).when(repository).update(clone); ======= // doReturn(clone).when(repository).get(td.ACCOUNT2.getId()); // doReturn(true).when(repository).update(clone); doReturn(clone).when(targetFileRepository).get(td.ACCOUNT2.getId()); doReturn(true).when(targetFileRepository).update(clone); >>>>>>> doReturn(clone).when(targetFileRepository).get(td.ACC_2.getId()); doReturn(true).when(targetFileRepository).update(clone); <<<<<<< verify(repository, times(1)).get(td.ACC_2.getId()); verify(repository, times(1)).update(clone); ======= // verify(repository, times(1)).get(td.ACCOUNT2.getId()); // verify(repository, times(1)).update(clone); verify(targetFileRepository, times(1)).get(td.ACCOUNT2.getId()); verify(targetFileRepository, times(1)).update(clone); >>>>>>> verify(targetFileRepository, times(1)).get(td.ACC_2.getId()); verify(targetFileRepository, times(1)).update(clone); <<<<<<< TwoFactorAuthTestData td = new TwoFactorAuthTestData(); doReturn(td.ENTITY1.clone()).when(repository).get(td.ACC_1.getId()); ======= TwoFactorAuthTestData td = new TwoFactorAuthTestData(); // doReturn(td.ENTITY1.clone()).when(repository).get(td.ACCOUNT1.getId()); doReturn(td.ENTITY1.clone()).when(targetFileRepository).get(td.ACCOUNT1.getId()); >>>>>>> TwoFactorAuthTestData td = new TwoFactorAuthTestData(); doReturn(td.ENTITY1.clone()).when(targetFileRepository).get(td.ACC_1.getId()); <<<<<<< verify(repository, times(1)).get(td.ACC_1.getId()); ======= // verify(repository, times(1)).get(td.ACCOUNT1.getId()); verify(targetFileRepository, times(1)).get(td.ACCOUNT1.getId()); >>>>>>> verify(targetFileRepository, times(1)).get(td.ACC_1.getId());
<<<<<<< .addBeans(MockBean.of(mock(TransactionVersionValidator.class), TransactionVersionValidator.class)) ======= .addBeans(MockBean.of(generatorService, GeneratorService.class)) >>>>>>> .addBeans(MockBean.of(generatorService, GeneratorService.class)) .addBeans(MockBean.of(mock(TransactionVersionValidator.class), TransactionVersionValidator.class))
<<<<<<< private static volatile TimeService timeService = CDI.current().select(TimeService.class).get(); ======= private static volatile EpochTime timeService = CDI.current().select(EpochTime.class).get(); private static TaskDispatchManager taskDispatchManager = CDI.current().select(TaskDispatchManager.class).get(); >>>>>>> private static volatile TimeService timeService = CDI.current().select(TimeService.class).get(); private static TaskDispatchManager taskDispatchManager = CDI.current().select(TaskDispatchManager.class).get();
<<<<<<< void init(DataSource dataSource, boolean initFullTextSearch) { this.basicDataSource = dataSource; ======= public void init(BasicDb db) { this.db = db; >>>>>>> void init(DataSource dataSource) { this.basicDataSource = dataSource; <<<<<<< protected DbVersion(DataSourceWrapper db, boolean initFullTextSearch) { init(db, initFullTextSearch); ======= protected DbVersion(BasicDb db) { init(db); >>>>>>> protected DbVersion(DataSourceWrapper db) { init(db);
<<<<<<< import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.util.Constants; ======= import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfigUpdater; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextSearchService; import com.apollocurrency.aplwallet.apl.util.Constants; >>>>>>> import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfigUpdater; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextSearchService; import com.apollocurrency.aplwallet.apl.util.Constants; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.util.Constants; <<<<<<< import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextSearchService; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextSearchService; <<<<<<< private static PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); private static BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); ======= private static PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); private static BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); private BlockchainConfigUpdater blockchainConfigUpdater; >>>>>>> private static PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); private static BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); private BlockchainConfigUpdater blockchainConfigUpdater; <<<<<<< private static TransactionalDataSource lookupDataSource() { if (databaseManager == null) { databaseManager = CDI.current().select(DatabaseManager.class).get(); } return databaseManager.getDataSource(); } ======= private BlockchainConfigUpdater lookupBlockhainConfigUpdater() { if (blockchainConfigUpdater == null) blockchainConfigUpdater = CDI.current().select(BlockchainConfigUpdater.class).get(); return blockchainConfigUpdater; } >>>>>>> private BlockchainConfigUpdater lookupBlockhainConfigUpdater() { if (blockchainConfigUpdater == null) blockchainConfigUpdater = CDI.current().select(BlockchainConfigUpdater.class).get(); return blockchainConfigUpdater; } private static TransactionalDataSource lookupDataSource() { if (databaseManager == null) { databaseManager = CDI.current().select(DatabaseManager.class).get(); } return databaseManager.getDataSource(); } <<<<<<< blockchainConfig.rollback(lastBLock.getHeight()); log.debug("Deleted blocks starting from height %s", height); ======= lookupBlockhainConfigUpdater().rollback(lastBLock.getHeight()); LOG.debug("Deleted blocks starting from height %s", height); >>>>>>> lookupBlockhainConfigUpdater().rollback(lastBLock.getHeight()); log.debug("Deleted blocks starting from height %s", height);
<<<<<<< import apl.crypto.Crypto; import apl.util.Convert; ======= import apl.TransactionType; import apl.Version; import apl.updater.Architecture; import apl.updater.Platform; >>>>>>> import apl.crypto.Crypto; import apl.util.Convert; import apl.TransactionType; import apl.Version; import apl.updater.Architecture; import apl.updater.Platform;
<<<<<<< ======= >>>>>>> <<<<<<< import com.apollocurrency.aplwallet.apl.addons.AddOns; import com.apollocurrency.aplwallet.apl.chainid.Chain; import com.apollocurrency.aplwallet.apl.chainid.ChainIdService; import com.apollocurrency.aplwallet.apl.chainid.ChainIdServiceImpl; import com.apollocurrency.aplwallet.apl.crypto.Crypto; import com.apollocurrency.aplwallet.apl.env.DirProvider; import com.apollocurrency.aplwallet.apl.env.RuntimeEnvironment; import com.apollocurrency.aplwallet.apl.env.RuntimeMode; import com.apollocurrency.aplwallet.apl.env.ServerStatus; import com.apollocurrency.aplwallet.apl.http.API; import com.apollocurrency.aplwallet.apl.http.APIProxy; import com.apollocurrency.aplwallet.apl.peer.Peers; import com.apollocurrency.aplwallet.apl.util.Convert; import com.apollocurrency.aplwallet.apl.util.ThreadPool; import com.apollocurrency.aplwallet.apl.util.Time; import org.h2.jdbc.JdbcSQLException; import org.json.simple.JSONObject; import org.slf4j.Logger; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.addons.AddOns; import com.apollocurrency.aplwallet.apl.chainid.Chain; import com.apollocurrency.aplwallet.apl.chainid.ChainIdService; import com.apollocurrency.aplwallet.apl.chainid.ChainIdServiceImpl; import com.apollocurrency.aplwallet.apl.crypto.Crypto; import com.apollocurrency.aplwallet.apl.env.DirProvider; import com.apollocurrency.aplwallet.apl.env.RuntimeEnvironment; import com.apollocurrency.aplwallet.apl.env.RuntimeMode; import com.apollocurrency.aplwallet.apl.env.ServerStatus; import com.apollocurrency.aplwallet.apl.http.API; import com.apollocurrency.aplwallet.apl.http.APIProxy; import com.apollocurrency.aplwallet.apl.peer.Peers; import com.apollocurrency.aplwallet.apl.util.Convert; import com.apollocurrency.aplwallet.apl.util.ThreadPool; import com.apollocurrency.aplwallet.apl.util.Time; import org.h2.jdbc.JdbcSQLException; import org.json.simple.JSONObject; import org.slf4j.Logger; <<<<<<< private static ChainIdService chainIdService; public static final Version VERSION = Version.from("1.21.9"); ======= public static final Version VERSION = Version.from("1.21.7"); >>>>>>> private static ChainIdService chainIdService; public static final Version VERSION = Version.from("1.21.9"); <<<<<<< if (Constants.isTestnet()) { ======= if (Constants.isTestnet) { >>>>>>> if (Constants.isTestnet()) {
<<<<<<< ======= import java.nio.file.Paths; import java.util.Properties; >>>>>>> <<<<<<< ProcessBuilder pb = new ProcessBuilder("./apl-start.sh");; p = pb.start(); //p.waitFor(); ======= ProcessBuilder pb = new ProcessBuilder("/bin/bash", "./apl-start.sh"); pb.start(); >>>>>>> ProcessBuilder pb = new ProcessBuilder("/bin/bash", "./apl-start.sh"); pb.start();
<<<<<<< import com.apollocurrency.aplwallet.apl.core.db.dao.ShardDao; import com.apollocurrency.aplwallet.apl.core.db.dao.ShardRecoveryDao; ======= import com.apollocurrency.aplwallet.apl.core.db.dao.ShardRecoveryDao; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.dao.ShardRecoveryDao; import com.apollocurrency.aplwallet.apl.core.db.dao.ShardDao; import com.apollocurrency.aplwallet.apl.core.db.dao.ShardRecoveryDao; <<<<<<< .addBeans(MockBean.of(databaseManager, DatabaseManager.class)) .addBeans(MockBean.of(shardDao, ShardDao.class)) .addBeans(MockBean.of(recoveryDao, ShardRecoveryDao.class)) ======= .addBeans(MockBean.of(recoveryDao, ShardRecoveryDao.class)) >>>>>>> .addBeans(MockBean.of(recoveryDao, ShardRecoveryDao.class)) .addBeans(MockBean.of(shardDao, ShardDao.class))
<<<<<<< private final PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); private final BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); private BlockchainConfigUpdater blockchainConfigUpdater; ======= // TODO: YL remove static instance later private static final PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); private static final BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); private DexService dexService; private BlockchainConfigUpdater blockchainConfigUpdater; >>>>>>> private final PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); private final BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); private DexService dexService; private BlockchainConfigUpdater blockchainConfigUpdater;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.db.DatabaseManager; ======= import com.apollocurrency.aplwallet.apl.TemporaryFolderExtension; import com.apollocurrency.aplwallet.apl.core.app.DatabaseManager; >>>>>>> import com.apollocurrency.aplwallet.apl.TemporaryFolderExtension; import com.apollocurrency.aplwallet.apl.core.db.DatabaseManager;
<<<<<<< ======= import com.apollocurrency.aplwallet.apl.core.account.Account; >>>>>>> <<<<<<< import com.apollocurrency.aplwallet.apl.core.account.model.Account; ======= import com.apollocurrency.aplwallet.apl.core.app.GenesisImporter; >>>>>>> import com.apollocurrency.aplwallet.apl.core.account.model.Account; <<<<<<< lookupAccountAssetService().addToAssetBalanceATU(senderAccount, getLedgerEvent(), transaction.getId(), attachment.getAssetId(), -attachment.getQuantityATU()); if (recipientAccount.getId() == Genesis.CREATOR_ID) { ======= senderAccount.addToAssetBalanceATU(getLedgerEvent(), transaction.getId(), attachment.getAssetId(), -attachment.getQuantityATU()); if (recipientAccount.getId() == GenesisImporter.CREATOR_ID) { >>>>>>> lookupAccountAssetService().addToAssetBalanceATU(senderAccount, getLedgerEvent(), transaction.getId(), attachment.getAssetId(), -attachment.getQuantityATU()); if (recipientAccount.getId() == GenesisImporter.CREATOR_ID) {
<<<<<<< import com.apollocurrency.aplwallet.api.dto.DexTradeInfoDto; import com.apollocurrency.aplwallet.api.dto.DexTradeInfoMinDto; ======= import static com.apollocurrency.aplwallet.apl.core.http.JSONResponses.incorrect; import static com.apollocurrency.aplwallet.apl.util.Constants.MAX_ORDER_DURATION_SEC; import static org.slf4j.LoggerFactory.getLogger; >>>>>>> import com.apollocurrency.aplwallet.api.dto.DexTradeInfoDto; <<<<<<< import java.math.BigDecimal; import java.math.BigInteger; import java.util.List; import java.util.Objects; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; import static com.apollocurrency.aplwallet.apl.core.http.JSONResponses.incorrect; import com.apollocurrency.aplwallet.apl.core.rest.converter.DexTradeEntryMinToDtoConverter; import com.apollocurrency.aplwallet.apl.core.rest.converter.DexTradeEntryToDtoConverter; import com.apollocurrency.aplwallet.apl.exchange.model.DexTradeEntry; import com.apollocurrency.aplwallet.apl.exchange.model.DexTradeEntryMin; import static com.apollocurrency.aplwallet.apl.util.Constants.MAX_ORDER_DURATION_SEC; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import java.util.Random; import org.checkerframework.checker.units.qual.A; import static org.slf4j.LoggerFactory.getLogger; ======= >>>>>>> import java.math.BigDecimal; import java.math.BigInteger; import java.util.List; import java.util.Objects; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; import static com.apollocurrency.aplwallet.apl.core.http.JSONResponses.incorrect; import com.apollocurrency.aplwallet.apl.core.rest.converter.DexTradeEntryMinToDtoConverter; import com.apollocurrency.aplwallet.apl.core.rest.converter.DexTradeEntryToDtoConverter; import com.apollocurrency.aplwallet.apl.exchange.model.DexTradeEntry; import com.apollocurrency.aplwallet.apl.exchange.model.DexTradeEntryMin; import static com.apollocurrency.aplwallet.apl.util.Constants.MAX_ORDER_DURATION_SEC; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import java.util.Random; import org.checkerframework.checker.units.qual.A; import static org.slf4j.LoggerFactory.getLogger;
<<<<<<< protected static PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); private static AccountService accountService; private static AccountPublicKeyService accountPublicKeyService; private static AccountLedgerService accountLedgerService; private static AccountAssetService accountAssetService; private static AccountCurrencyService accountCurrencyService; private static AccountInfoService accountInfoService; private static AccountLeaseService accountLeaseService; private static AccountPropertyService accountPropertyService; protected AccountPropertyService lookupAccountPropertyService(){ if (accountPropertyService == null){ accountPropertyService = CDI.current().select(AccountPropertyServiceImpl.class).get(); } return accountPropertyService; } protected AccountLeaseService lookupAccountLeaseService(){ if (accountLeaseService == null){ accountLeaseService = CDI.current().select(AccountLeaseServiceImpl.class).get(); } return accountLeaseService; } protected AccountInfoService lookupAccountInfoService(){ if (accountInfoService == null){ accountInfoService = CDI.current().select(AccountInfoServiceImpl.class).get(); } return accountInfoService; } protected AccountCurrencyService lookupAccountCurrencyService(){ if (accountCurrencyService == null){ accountCurrencyService = CDI.current().select(AccountCurrencyServiceImpl.class).get(); } return accountCurrencyService; } protected AccountAssetService lookupAccountAssetService(){ if ( accountAssetService == null){ accountAssetService = CDI.current().select(AccountAssetServiceImpl.class).get(); } return accountAssetService; } protected AccountLedgerService lookupAccountLedgerService(){ if ( accountLedgerService == null){ accountLedgerService = CDI.current().select(AccountLedgerServiceImpl.class).get(); } return accountLedgerService; } protected AccountService lookupAccountService(){ if ( accountService == null) { accountService = CDI.current().select(AccountServiceImpl.class).get(); } return accountService; } protected AccountPublicKeyService lookupAccountPublickKeyService(){ if ( accountPublicKeyService == null) { accountPublicKeyService = CDI.current().select(AccountPublicKeyServiceImpl.class).get(); } return accountPublicKeyService; } ======= protected static PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); private PeersService peers; protected PeersService lookupPeersService(){ if (peers == null) peers = CDI.current().select(PeersService.class).get(); return peers; } >>>>>>> protected static PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); private static AccountService accountService; private static AccountPublicKeyService accountPublicKeyService; private static AccountLedgerService accountLedgerService; private static AccountAssetService accountAssetService; private static AccountCurrencyService accountCurrencyService; private static AccountInfoService accountInfoService; private static AccountLeaseService accountLeaseService; private static AccountPropertyService accountPropertyService; private PeersService peers; protected PeersService lookupPeersService(){ if (peers == null) peers = CDI.current().select(PeersService.class).get(); return peers; } protected AccountPropertyService lookupAccountPropertyService(){ if (accountPropertyService == null){ accountPropertyService = CDI.current().select(AccountPropertyServiceImpl.class).get(); } return accountPropertyService; } protected AccountLeaseService lookupAccountLeaseService(){ if (accountLeaseService == null){ accountLeaseService = CDI.current().select(AccountLeaseServiceImpl.class).get(); } return accountLeaseService; } protected AccountInfoService lookupAccountInfoService(){ if (accountInfoService == null){ accountInfoService = CDI.current().select(AccountInfoServiceImpl.class).get(); } return accountInfoService; } protected AccountCurrencyService lookupAccountCurrencyService(){ if (accountCurrencyService == null){ accountCurrencyService = CDI.current().select(AccountCurrencyServiceImpl.class).get(); } return accountCurrencyService; } protected AccountAssetService lookupAccountAssetService(){ if ( accountAssetService == null){ accountAssetService = CDI.current().select(AccountAssetServiceImpl.class).get(); } return accountAssetService; } protected AccountLedgerService lookupAccountLedgerService(){ if ( accountLedgerService == null){ accountLedgerService = CDI.current().select(AccountLedgerServiceImpl.class).get(); } return accountLedgerService; } protected AccountService lookupAccountService(){ if ( accountService == null) { accountService = CDI.current().select(AccountServiceImpl.class).get(); } return accountService; } protected AccountPublicKeyService lookupAccountPublickKeyService(){ if ( accountPublicKeyService == null) { accountPublicKeyService = CDI.current().select(AccountPublicKeyServiceImpl.class).get(); } return accountPublicKeyService; }
<<<<<<< ======= import io.qameta.allure.Attachment; import okhttp3.MediaType; import okhttp3.MultipartBody; >>>>>>> import okhttp3.MediaType; import okhttp3.MultipartBody; <<<<<<< public static void addParameters(Enum parameter, Object value) { if (value instanceof String) reqestParam.put(parameter.toString(), (String) value); else if (value instanceof Integer || value instanceof Boolean) reqestParam.put(parameter.toString(), String.valueOf(value)); else if (value instanceof Enum) reqestParam.put(parameter.toString(), value.toString()); else reqestParam.put(parameter.toString(), value); ======= public static void addParameters(Enum parameter, Object value){ if (value instanceof String) reqestParam.put(parameter.toString(), value); else if (value instanceof Integer || value instanceof Boolean) reqestParam.put(parameter.toString(), String.valueOf(value)); else if (value instanceof Enum) reqestParam.put(parameter.toString(), value.toString()); else reqestParam.put(parameter.toString(), value); >>>>>>> public static void addParameters(Enum parameter, Object value) { if (value instanceof String) reqestParam.put(parameter.toString(), value); else if (value instanceof Integer || value instanceof Boolean) reqestParam.put(parameter.toString(), String.valueOf(value)); else if (value instanceof Enum) reqestParam.put(parameter.toString(), value.toString()); else reqestParam.put(parameter.toString(), value); <<<<<<< response = httpCallPost(); responseBody = response.body().string(); Assert.assertEquals(200, response.code()); //System.out.println(responseBody); if (TestBase.testInfo != null && TestBase.testInfo.getTags() != null && !TestBase.testInfo.getTags().contains("NEGATIVE")) { Assertions.assertFalse(responseBody.contains("errorDescription"), responseBody); Allure.addAttachment("Response Body", responseBody); } return (T) mapper.readValue(responseBody, clazz); } catch (Exception e) { return fail(responseBody + "\n" + e.getMessage()); ======= response = httpCallPost(); responseBody = response.body().string(); Assert.assertEquals(200, response.code()); //System.out.println(responseBody); if (TestBase.testInfo != null && TestBase.testInfo.getTags()!=null && !TestBase.testInfo.getTags().contains("NEGATIVE")) { Assertions.assertFalse(responseBody.contains("errorDescription"), responseBody); } if (TestBase.testInfo != null) { Allure.addAttachment("Response Body", responseBody); } return (T) mapper.readValue(responseBody, clazz); } catch (Exception e) { Allure.addAttachment("Response Body", responseBody); return fail(responseBody +"\n"+e.getMessage()); >>>>>>> response = httpCallPost(); responseBody = response.body().string(); Assert.assertEquals(200, response.code()); //System.out.println(responseBody); if (TestBase.testInfo != null && TestBase.testInfo.getTags() != null && !TestBase.testInfo.getTags().contains("NEGATIVE")) { Assertions.assertFalse(responseBody.contains("errorDescription"), responseBody); } if (TestBase.testInfo != null) { Allure.addAttachment("Response Body", responseBody); } return (T) mapper.readValue(responseBody, clazz); } catch (Exception e) { Allure.addAttachment("Response Body", responseBody); return fail(responseBody + "\n" + e.getMessage());
<<<<<<< import com.apollocurrency.aplwallet.apl.core.rest.endpoint.ServerInfoEndpoint; import com.apollocurrency.aplwallet.apl.core.rest.service.ServerInfoService; ======= import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; import com.apollocurrency.aplwallet.apl.core.chainid.ChainIdServiceImpl; >>>>>>> import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; import com.apollocurrency.aplwallet.apl.core.chainid.ChainIdServiceImpl; import com.apollocurrency.aplwallet.apl.core.rest.endpoint.ServerInfoEndpoint; import com.apollocurrency.aplwallet.apl.core.rest.service.ServerInfoService; <<<<<<< // core = CDI.current().select(AplCore.class).get(); core = new AplCore(); ======= core = new AplCore(CDI.current().select(BlockchainConfig.class).get()); >>>>>>> core = new AplCore(CDI.current().select(BlockchainConfig.class).get()); <<<<<<< ======= System.setProperty("apl.runtime.mode", args.serviceMode ? "service" : "user"); >>>>>>> <<<<<<< dirProvider = RuntimeEnvironment.getInstance().getDirProvider(); // We do not need it yet. this call creates unwanted error messages // if(RuntimeEnvironment.getInstance().isAdmin()){ // System.out.println("==== RUNNING WITH ADMIN/ROOT PRIVILEGES! ===="); // } ======= >>>>>>> dirProvider = RuntimeEnvironment.getInstance().getDirProvider(); // We do not need it yet. this call creates unwanted error messages // if(RuntimeEnvironment.getInstance().isAdmin()){ // System.out.println("==== RUNNING WITH ADMIN/ROOT PRIVILEGES! ===="); // } System.setProperty("apl.runtime.mode", args.serviceMode ? "service" : "user"); <<<<<<< propertiesLoader = new PropertiesLoader(dirProvider, args.isResourceIgnored(), args.configDir); //init logging logDir = dirProvider.getLogFileDir().getAbsolutePath(); ======= ConfigDirProvider configDirProvider = new ConfigDirProviderFactory().getInstance(args.serviceMode, Constants.APPLICATION_DIR_NAME); propertiesLoader = new PropertiesLoader(configDirProvider, args.isResourceIgnored(), args.configDir); // init application data dir provider EnvironmentVariables environmentVariables = new EnvironmentVariables(Constants.APPLICATION_DIR_NAME); dirProvider = createDirProvider(environmentVariables.merge(args), args.serviceMode); //init logging logDir = dirProvider.getLogsDir().toAbsolutePath().toString(); >>>>>>> ConfigDirProvider configDirProvider = new ConfigDirProviderFactory().getInstance(args.serviceMode, Constants.APPLICATION_DIR_NAME); propertiesLoader = new PropertiesLoader(configDirProvider, args.isResourceIgnored(), args.configDir); // init application data dir provider EnvironmentVariables environmentVariables = new EnvironmentVariables(Constants.APPLICATION_DIR_NAME); dirProvider = createDirProvider(environmentVariables.merge(args), args.serviceMode); //init logging logDir = dirProvider.getLogsDir().toAbsolutePath().toString();
<<<<<<< import javax.inject.Inject; import java.io.File; import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.List; ======= import com.apollocurrency.aplwallet.apl.core.account.PublicKeyTable; >>>>>>> <<<<<<< import com.apollocurrency.aplwallet.apl.core.db.dao.ShardRecoveryDao; import com.apollocurrency.aplwallet.apl.core.db.dao.TransactionIndexDao; ======= import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextConfig; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextConfig; import com.apollocurrency.aplwallet.apl.core.db.dao.ShardRecoveryDao; import com.apollocurrency.aplwallet.apl.core.db.dao.TransactionIndexDao; <<<<<<< TransactionTestData.class, PropertyProducer.class, ShardRecoveryDao.class, GlobalSyncImpl.class, ======= TransactionTestData.class, PropertyProducer.class, GlobalSyncImpl.class, FullTextConfig.class, >>>>>>> TransactionTestData.class, PropertyProducer.class, ShardRecoveryDao.class, GlobalSyncImpl.class, FullTextConfig.class,
<<<<<<< DexOrderDao.class, DexOrderTable.class, TransactionProcessor.class, DexSmartContractService.class, SecureStorageService.class, DexContractTable.class, MandatoryTransactionDao.class, DexOrderTransactionCreator.class, TimeService.class, DexContractDao.class, Blockchain.class, PhasingPollServiceImpl.class, IDexMatcherInterface.class, PhasingApprovedResultTable.class, BlockchainConfig.class, DexConfig.class, BlockchainImpl.class)) .addBeans(MockBean.of(mock(AccountService.class), AccountService.class, AccountServiceImpl.class)) .build(); ======= DexOrderDao.class, DexOrderTable.class, TransactionProcessor.class, DexSmartContractService.class, SecureStorageService.class, DexContractTable.class, MandatoryTransactionDao.class, DexOrderTransactionCreator.class, TimeService.class, DexContractDao.class, Blockchain.class, IDexMatcherInterface.class, PhasingApprovedResultTable.class, BlockchainConfig.class, DexConfig.class, BlockchainImpl.class)) .addBeans(MockBean.of(mock(PhasingPollService.class), PhasingPollService.class)) .build(); >>>>>>> DexOrderDao.class, DexOrderTable.class, TransactionProcessor.class, DexSmartContractService.class, SecureStorageService.class, DexContractTable.class, MandatoryTransactionDao.class, DexOrderTransactionCreator.class, TimeService.class, DexContractDao.class, Blockchain.class, IDexMatcherInterface.class, PhasingApprovedResultTable.class, BlockchainConfig.class, DexConfig.class, BlockchainImpl.class)) .addBeans(MockBean.of(mock(PhasingPollService.class), PhasingPollService.class)) .addBeans(MockBean.of(mock(AccountService.class), AccountService.class, AccountServiceImpl.class)) .build();
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.transaction.Messaging; import com.apollocurrency.aplwallet.apl.core.app.transaction.TransactionType; ======= import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.transaction.Messaging; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyMintService; ======= import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyExchangeOfferFacade; import com.apollocurrency.aplwallet.apl.core.service.state.exchange.ExchangeRequestService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyTransferService; >>>>>>> import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyExchangeOfferFacade; import com.apollocurrency.aplwallet.apl.core.service.state.exchange.ExchangeRequestService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyTransferService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyMintService; <<<<<<< private static CurrencyMintService currencyMintService; ======= private static AssetTransferService assetTransferService; private static CurrencyExchangeOfferFacade currencyExchangeOfferFacade; private static ExchangeRequestService exchangeRequestService; private static CurrencyTransferService currencyTransferService; >>>>>>> private static AssetTransferService assetTransferService; private static CurrencyExchangeOfferFacade currencyExchangeOfferFacade; private static ExchangeRequestService exchangeRequestService; private static CurrencyTransferService currencyTransferService; private static CurrencyMintService currencyMintService; <<<<<<< public static synchronized CurrencyMintService lookupCurrencyMintService() { if (currencyMintService == null) { currencyMintService = CDI.current().select(CurrencyMintService.class).get(); } return currencyMintService; } ======= public static synchronized AssetTransferService lookupAssetTransferService() { if (assetTransferService == null) { assetTransferService = CDI.current().select(AssetTransferService.class).get(); } return assetTransferService; } public static synchronized CurrencyExchangeOfferFacade lookupCurrencyExchangeOfferFacade() { if (currencyExchangeOfferFacade == null) { currencyExchangeOfferFacade = CDI.current().select(CurrencyExchangeOfferFacade.class).get(); } return currencyExchangeOfferFacade; } public static synchronized ExchangeRequestService lookupExchangeRequestService() { if (exchangeRequestService == null) { exchangeRequestService = CDI.current().select(ExchangeRequestService.class).get(); } return exchangeRequestService; } public static synchronized CurrencyTransferService lookupCurrencyTransferService() { if (currencyTransferService == null) { currencyTransferService = CDI.current().select(CurrencyTransferService.class).get(); } return currencyTransferService; } >>>>>>> public static synchronized AssetTransferService lookupAssetTransferService() { if (assetTransferService == null) { assetTransferService = CDI.current().select(AssetTransferService.class).get(); } return assetTransferService; } public static synchronized CurrencyExchangeOfferFacade lookupCurrencyExchangeOfferFacade() { if (currencyExchangeOfferFacade == null) { currencyExchangeOfferFacade = CDI.current().select(CurrencyExchangeOfferFacade.class).get(); } return currencyExchangeOfferFacade; } public static synchronized ExchangeRequestService lookupExchangeRequestService() { if (exchangeRequestService == null) { exchangeRequestService = CDI.current().select(ExchangeRequestService.class).get(); } return exchangeRequestService; } public static synchronized CurrencyTransferService lookupCurrencyTransferService() { if (currencyTransferService == null) { currencyTransferService = CDI.current().select(CurrencyTransferService.class).get(); } return currencyTransferService; } public static synchronized CurrencyMintService lookupCurrencyMintService() { if (currencyMintService == null) { currencyMintService = CDI.current().select(CurrencyMintService.class).get(); } return currencyMintService; }
<<<<<<< ======= import com.apollocurrency.aplwallet.apl.core.monetary.MonetarySystem; import com.apollocurrency.aplwallet.apl.core.service.appdata.TimeService; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; import com.apollocurrency.aplwallet.apl.core.service.state.AliasService; import com.apollocurrency.aplwallet.apl.core.service.state.PhasingPollService; import com.apollocurrency.aplwallet.apl.core.service.state.PollService; import com.apollocurrency.aplwallet.apl.core.service.state.ShufflingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountAssetService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountControlPhasingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountCurrencyService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountInfoService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountLeaseService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountPropertyService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountPublicKeyService; >>>>>>> import com.apollocurrency.aplwallet.apl.core.monetary.MonetarySystem; import com.apollocurrency.aplwallet.apl.core.service.appdata.TimeService; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; import com.apollocurrency.aplwallet.apl.core.service.state.AliasService; import com.apollocurrency.aplwallet.apl.core.service.state.PhasingPollService; import com.apollocurrency.aplwallet.apl.core.service.state.PollService; import com.apollocurrency.aplwallet.apl.core.service.state.ShufflingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountAssetService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountControlPhasingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountCurrencyService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountInfoService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountLeaseService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountPropertyService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountPublicKeyService; <<<<<<< ======= import com.apollocurrency.aplwallet.apl.core.service.state.asset.AssetDividendService; import com.apollocurrency.aplwallet.apl.core.service.state.asset.AssetService; import com.apollocurrency.aplwallet.apl.core.service.state.asset.AssetTransferService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyExchangeOfferFacade; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyMintService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyTransferService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.MonetaryCurrencyMintingService; import com.apollocurrency.aplwallet.apl.core.service.state.exchange.ExchangeRequestService; >>>>>>> import com.apollocurrency.aplwallet.apl.core.service.state.asset.AssetDividendService; import com.apollocurrency.aplwallet.apl.core.service.state.asset.AssetService; import com.apollocurrency.aplwallet.apl.core.service.state.asset.AssetTransferService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyExchangeOfferFacade; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyMintService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyTransferService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.MonetaryCurrencyMintingService; import com.apollocurrency.aplwallet.apl.core.service.state.exchange.ExchangeRequestService; <<<<<<< import lombok.Getter; ======= import com.apollocurrency.aplwallet.apl.exchange.transaction.DEX; import com.apollocurrency.aplwallet.apl.util.annotation.FeeMarker; import com.apollocurrency.aplwallet.apl.util.annotation.TransactionFee; import lombok.Setter; >>>>>>> import lombok.Getter; import com.apollocurrency.aplwallet.apl.exchange.transaction.DEX; import com.apollocurrency.aplwallet.apl.util.annotation.FeeMarker; import com.apollocurrency.aplwallet.apl.util.annotation.TransactionFee; import lombok.Setter;
<<<<<<< @PermitAll public Response getOffers( @Parameter(description = "Type of the offer. (BUY = 0 /SELL = 1)") @QueryParam("orderType") Byte orderType, @Parameter(description = "Criteria by Paired currency. (APL=0, ETH=1, PAX=2)") @QueryParam("pairCurrency") Byte pairCurrency, @Parameter(description = "Offer status. (Open = 0, Close = 2)") @QueryParam("status") Byte status, @Parameter(description = "User account id.") @QueryParam("accountId") String accountIdStr, @Parameter(description = "Return offers available for now. By default = false") @DefaultValue(value = "false") @QueryParam("isAvailableForNow") boolean isAvailableForNow, @Parameter(description = "Criteria by min prise.") @QueryParam("minAskPrice") BigDecimal minAskPrice, @Parameter(description = "Criteria by max prise.") @QueryParam("maxBidPrice") BigDecimal maxBidPrice, @Parameter(description = "Required order freezing status") @QueryParam("hasFrozenMoney") Boolean hasFrozenMoney, @Context HttpServletRequest req) throws NotFoundException { ======= public Response getOffers(@Parameter(description = "Type of the offer. (BUY = 0 /SELL = 1)") @QueryParam("orderType") Byte orderType, @Parameter(description = "Criteria by Paired currency. (APL=0, ETH=1, PAX=2)") @QueryParam("pairCurrency") Byte pairCurrency, @Parameter(description = "Offer status. (Open = 0, Close = 2)") @QueryParam("status") Byte status, @Parameter(description = "User account id.") @QueryParam("accountId") String accountIdStr, @Parameter(description = "Return offers available for now. By default = false") @DefaultValue(value = "false") @QueryParam("isAvailableForNow") boolean isAvailableForNow, @Parameter(description = "Criteria by min prise.") @QueryParam("minAskPrice") BigDecimal minAskPrice, @Parameter(description = "Criteria by max prise.") @QueryParam("maxBidPrice") BigDecimal maxBidPrice, @Parameter(description = "Required order freezing status") @QueryParam("hasFrozenMoney") Boolean hasFrozenMoney, @Parameter(description = "Sorted by (PAIR_RATE , DB_ID)") @DefaultValue(value = "PAIR_RATE") @QueryParam("sortBy") DexOrderSortBy sortBy, @Parameter(description = "Sorted order (ASC, DESC)") @DefaultValue(value = "ASC") @QueryParam("sortOrder") DBSortOrder sortOrder, @Context HttpServletRequest req) throws NotFoundException { >>>>>>> @PermitAll public Response getOffers(@Parameter(description = "Type of the offer. (BUY = 0 /SELL = 1)") @QueryParam("orderType") Byte orderType, @Parameter(description = "Criteria by Paired currency. (APL=0, ETH=1, PAX=2)") @QueryParam("pairCurrency") Byte pairCurrency, @Parameter(description = "Offer status. (Open = 0, Close = 2)") @QueryParam("status") Byte status, @Parameter(description = "User account id.") @QueryParam("accountId") String accountIdStr, @Parameter(description = "Return offers available for now. By default = false") @DefaultValue(value = "false") @QueryParam("isAvailableForNow") boolean isAvailableForNow, @Parameter(description = "Criteria by min prise.") @QueryParam("minAskPrice") BigDecimal minAskPrice, @Parameter(description = "Criteria by max prise.") @QueryParam("maxBidPrice") BigDecimal maxBidPrice, @Parameter(description = "Required order freezing status") @QueryParam("hasFrozenMoney") Boolean hasFrozenMoney, @Parameter(description = "Sorted by (PAIR_RATE , DB_ID)") @DefaultValue(value = "PAIR_RATE") @QueryParam("sortBy") DexOrderSortBy sortBy, @Parameter(description = "Sorted order (ASC, DESC)") @DefaultValue(value = "ASC") @QueryParam("sortOrder") DBSortOrder sortOrder, @Context HttpServletRequest req) throws NotFoundException { <<<<<<< @Operation(tags = {"dex"}, summary = "Get history", description = "getting history") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Exchange offers"), @ApiResponse(responseCode = "200", description = "Unexpected error") }) @PermitAll public Response getHistoday2( @Parameter(description = "Cryptocurrency identifier") @QueryParam("symbol") String symbol, @Parameter(description = "resolution") @QueryParam("resolution") String resolution, @Parameter(description = "from") @QueryParam("from") Integer from, @Parameter(description = "to") @QueryParam("to") Integer to, @Context HttpServletRequest req) throws NotFoundException { ======= @Operation(tags = {"dex"}, summary = "Retrieve eth/pax deposits for eth address", description = "Query eth node for deposits for specified eth address", responses = @ApiResponse(description = "List of deposits with offset ", responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = EthDepositsWithOffset.class)))) public Response getUserActiveDeposits(@Parameter(description = "Number of first N deposits, which should be skipped during fetching (useful for pagination)") @QueryParam("offset") @PositiveOrZero long offset, @Parameter(description = "Number of deposits to extract") @QueryParam("limit") @Min(1) @Max(100) long limit, @Parameter(description = "Eth address, for which active deposits should be extracted") @QueryParam(DexApiConstants.WALLET_ADDRESS) @NotBlank String walletAddress) { >>>>>>> @Operation(tags = {"dex"}, summary = "Retrieve eth/pax deposits for eth address", description = "Query eth node for deposits for specified eth address", responses = @ApiResponse(description = "List of deposits with offset ", responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = EthDepositsWithOffset.class)))) @PermitAll public Response getUserActiveDeposits(@Parameter(description = "Number of first N deposits, which should be skipped during fetching (useful for pagination)") @QueryParam("offset") @PositiveOrZero long offset, @Parameter(description = "Number of deposits to extract") @QueryParam("limit") @Min(1) @Max(100) long limit, @Parameter(description = "Eth address, for which active deposits should be extracted") @QueryParam(DexApiConstants.WALLET_ADDRESS) @NotBlank String walletAddress) { <<<<<<< @Operation(tags = {"dex"}, summary = "Get history", description = "getting history") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Exchange offers"), @ApiResponse(responseCode = "200", description = "Unexpected error") }) @PermitAll public Response getSymbols( @Parameter(description = "Cryptocurrency identifier") @QueryParam("symbol") String symbol, @Context HttpServletRequest req) throws NotFoundException { log.debug("getSymbols: fsym: {}", symbol ); TimeZone tz = Calendar.getInstance().getTimeZone(); SymbolsOutputDTO symbolsOutputDTO = new SymbolsOutputDTO(); symbolsOutputDTO.name = symbol; symbolsOutputDTO.exchange_traded = "Apollo DEX"; symbolsOutputDTO.exchange_listed = "Apollo DEX"; symbolsOutputDTO.timezone = tz.getID(); symbolsOutputDTO.minmov = 1; symbolsOutputDTO.minmov2 = 0; symbolsOutputDTO.pointvalue = 1; symbolsOutputDTO.session = "24x7"; symbolsOutputDTO.has_intraday = true; symbolsOutputDTO.has_no_volume = false; symbolsOutputDTO.has_daily = true; symbolsOutputDTO.description = symbol; symbolsOutputDTO.type = "cryptocurrency"; symbolsOutputDTO.has_daily = true; symbolsOutputDTO.has_empty_bars = true; symbolsOutputDTO.has_weekly_and_monthly = false; symbolsOutputDTO.supported_resolutions = new ArrayList<>();; symbolsOutputDTO.supported_resolutions.add("15"); symbolsOutputDTO.supported_resolutions.add("60"); symbolsOutputDTO.supported_resolutions.add("240"); symbolsOutputDTO.supported_resolutions.add("D"); symbolsOutputDTO.pricescale = 1000000000; symbolsOutputDTO.ticker = symbol; return Response.ok( symbolsOutputDTO ) .build(); ======= @Operation(tags = {"dex"}, summary = "Retrieve all versioned dex contracts for order", description = "Get all versions of dex contracts related to the specified order (including all contracts with STEP1 status and previous versions of processable contract) ", responses = @ApiResponse(description = "List of versioned contracts", responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExchangeContractDTO.class)))) public Response getAllVersionedContractsForOrder(@Parameter(description = "APL account id (RS, singed or unsigned int64/long) ") @QueryParam("accountId") String account, @Parameter(description = "Order id (signed/unsigned int64/long) ") @QueryParam("orderId") String order) { long accountId = Convert.parseAccountId(account); long orderId = Convert.parseLong(order); List<ExchangeContract> contracts = service.getVersionedContractsByAccountOrder(accountId, orderId); return Response.ok(contractConverter.convert(contracts)).build(); >>>>>>> @Operation(tags = {"dex"}, summary = "Retrieve all versioned dex contracts for order", description = "Get all versions of dex contracts related to the specified order (including all contracts with STEP1 status and previous versions of processable contract) ", responses = @ApiResponse(description = "List of versioned contracts", responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExchangeContractDTO.class)))) @PermitAll public Response getAllVersionedContractsForOrder(@Parameter(description = "APL account id (RS, singed or unsigned int64/long) ") @QueryParam("accountId") String account, @Parameter(description = "Order id (signed/unsigned int64/long) ") @QueryParam("orderId") String order) { long accountId = Convert.parseAccountId(account); long orderId = Convert.parseLong(order); List<ExchangeContract> contracts = service.getVersionedContractsByAccountOrder(accountId, orderId); return Response.ok(contractConverter.convert(contracts)).build();
<<<<<<< import com.apollocurrency.aplwallet.apl.core.db.DatabaseManager; import static org.slf4j.LoggerFactory.getLogger; ======= import com.apollocurrency.aplwallet.apl.core.app.DatabaseManager; import com.apollocurrency.aplwallet.apl.core.app.GlobalSync; import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; import com.apollocurrency.aplwallet.apl.core.db.DbUtils; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.crypto.Convert; import com.apollocurrency.aplwallet.apl.util.Listener; import com.apollocurrency.aplwallet.apl.util.Listeners; import com.apollocurrency.aplwallet.apl.util.injectable.PropertiesHolder; import org.slf4j.Logger; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.DatabaseManager; import com.apollocurrency.aplwallet.apl.core.app.GlobalSync; import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; import com.apollocurrency.aplwallet.apl.core.db.DbUtils; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.crypto.Convert; import com.apollocurrency.aplwallet.apl.util.Listener; import com.apollocurrency.aplwallet.apl.util.Listeners; import com.apollocurrency.aplwallet.apl.util.injectable.PropertiesHolder; import org.slf4j.Logger;
<<<<<<< ======= import com.apollocurrency.aplwallet.apl.core.app.Blockchain; import com.apollocurrency.aplwallet.apl.core.app.BlockchainProcessor; import com.apollocurrency.aplwallet.apl.core.app.BlockchainProcessorImpl; import com.apollocurrency.aplwallet.apl.core.app.GenesisImporter; >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.Blockchain; import com.apollocurrency.aplwallet.apl.core.app.BlockchainProcessor; import com.apollocurrency.aplwallet.apl.core.app.BlockchainProcessorImpl; import com.apollocurrency.aplwallet.apl.core.app.GenesisImporter; <<<<<<< import com.apollocurrency.aplwallet.apl.core.db.service.BlockChainInfoService; ======= import com.apollocurrency.aplwallet.apl.core.model.AplWalletKey; import com.apollocurrency.aplwallet.apl.core.model.ApolloFbWallet; import com.apollocurrency.aplwallet.apl.core.model.Balances; import com.apollocurrency.aplwallet.apl.core.utils.AccountGeneratorUtil; >>>>>>> import com.apollocurrency.aplwallet.apl.core.model.AplWalletKey; import com.apollocurrency.aplwallet.apl.core.model.ApolloFbWallet; import com.apollocurrency.aplwallet.apl.core.model.Balances; import com.apollocurrency.aplwallet.apl.core.utils.AccountGeneratorUtil; import com.apollocurrency.aplwallet.apl.core.db.service.BlockChainInfoService;
<<<<<<< private static final Logger LOG = getLogger(PropertiesHolder.class); ======= >>>>>>> <<<<<<< final StringBuffer sb = new StringBuffer("PropertiesHolder_DUMP : \n"); properties.forEach((k, v) -> { if (!k.equals("adminPassword")) { sb.append("\t'").append(k).append("'->").append(v).append(", "); } else { sb.append("\t'").append(k).append("'->").append("***").append(", "); } } ======= final StringBuilder sb = new StringBuilder("PropertiesHolder_DUMP : \n"); properties.forEach((k, v) -> sb.append('\'').append(k).append("'->").append(v).append(", ") >>>>>>> final StringBuilder sb = new StringBuilder("PropertiesHolder_DUMP : \n"); properties.forEach((k, v) -> { if (!k.equals("adminPassword")) { sb.append("\t'").append(k).append("'->").append(v).append(", "); } else { sb.append("\t'").append(k).append("'->").append("***").append(", "); } } <<<<<<< } public Properties getProperties() { return properties; ======= >>>>>>> } public Properties getProperties() { return properties;
<<<<<<< DefaultConfiguration dc = DefaultConfiguration.getInstance(); ConfigurationCopy cc = new ConfigurationCopy(dc); cc.set(Property.TSERV_CACHE_MANAGER_IMPL, LruBlockCacheManager.class.getName()); try { manager = BlockCacheManagerFactory.getInstance(cc); } catch (Exception e) { throw new RuntimeException("Error creating BlockCacheManager", e); } cc.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(100000)); cc.set(Property.TSERV_DATACACHE_SIZE, Long.toString(100000000)); cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(100000000)); manager.start(new BlockCacheConfiguration(cc)); LruBlockCache indexCache = (LruBlockCache) manager.getBlockCache(CacheType.INDEX); LruBlockCache dataCache = (LruBlockCache) manager.getBlockCache(CacheType.DATA); CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader("source-1", in, fileLength, conf, dataCache, indexCache, DefaultConfiguration.getInstance()); ======= LruBlockCache indexCache = new LruBlockCache(100000000, 100000); LruBlockCache dataCache = new LruBlockCache(100000000, 100000); CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader("source-1", in, fileLength, conf, dataCache, indexCache, AccumuloConfiguration.getDefaultConfiguration()); >>>>>>> DefaultConfiguration dc = DefaultConfiguration.getInstance(); ConfigurationCopy cc = new ConfigurationCopy(dc); cc.set(Property.TSERV_CACHE_MANAGER_IMPL, LruBlockCacheManager.class.getName()); try { manager = BlockCacheManagerFactory.getInstance(cc); } catch (Exception e) { throw new RuntimeException("Error creating BlockCacheManager", e); } cc.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(100000)); cc.set(Property.TSERV_DATACACHE_SIZE, Long.toString(100000000)); cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(100000000)); manager.start(new BlockCacheConfiguration(cc)); LruBlockCache indexCache = (LruBlockCache) manager.getBlockCache(CacheType.INDEX); LruBlockCache dataCache = (LruBlockCache) manager.getBlockCache(CacheType.DATA); CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader("source-1", in, fileLength, conf, dataCache, indexCache, DefaultConfiguration.getInstance()); <<<<<<< AccumuloConfiguration aconf = DefaultConfiguration.getInstance(); CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(in2, data.length, CachedConfiguration.getInstance(), aconf); ======= AccumuloConfiguration aconf = AccumuloConfiguration.getDefaultConfiguration(); CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader("source-1", in2, data.length, CachedConfiguration.getInstance(), aconf); >>>>>>> AccumuloConfiguration aconf = DefaultConfiguration.getInstance(); CachableBlockFile.Reader _cbr = new CachableBlockFile.Reader(in2, data.length, CachedConfiguration.getInstance(), aconf); <<<<<<< ConfigurationCopy result = new ConfigurationCopy(DefaultConfiguration.getInstance()); ======= ConfigurationCopy result = new ConfigurationCopy( AccumuloConfiguration.getDefaultConfiguration()); >>>>>>> ConfigurationCopy result = new ConfigurationCopy(DefaultConfiguration.getInstance()); <<<<<<< ConfigurationCopy sampleConf = new ConfigurationCopy(conf == null ? DefaultConfiguration.getInstance() : conf); ======= ConfigurationCopy sampleConf = new ConfigurationCopy( conf == null ? AccumuloConfiguration.getDefaultConfiguration() : conf); >>>>>>> ConfigurationCopy sampleConf = new ConfigurationCopy( conf == null ? DefaultConfiguration.getInstance() : conf); <<<<<<< ConfigurationCopy sampleConf = new ConfigurationCopy(conf == null ? DefaultConfiguration.getInstance() : conf); ======= ConfigurationCopy sampleConf = new ConfigurationCopy( conf == null ? AccumuloConfiguration.getDefaultConfiguration() : conf); >>>>>>> ConfigurationCopy sampleConf = new ConfigurationCopy( conf == null ? DefaultConfiguration.getInstance() : conf);
<<<<<<< import com.apollocurrency.aplwallet.apl.core.phasing.PhasingPollService; ======= import javax.enterprise.inject.Vetoed; >>>>>>> import javax.enterprise.inject.Vetoed; import com.apollocurrency.aplwallet.apl.core.phasing.PhasingPollService; <<<<<<< private static class GetAssetPhasedTransactionsHolder { private static final GetAssetPhasedTransactions INSTANCE = new GetAssetPhasedTransactions(); } public static GetAssetPhasedTransactions getInstance() { return GetAssetPhasedTransactionsHolder.INSTANCE; } private static PhasingPollService phasingPollService = CDI.current().select(PhasingPollService.class).get(); private GetAssetPhasedTransactions() { ======= public GetAssetPhasedTransactions() { >>>>>>> private static PhasingPollService phasingPollService = CDI.current().select(PhasingPollService.class).get(); private GetAssetPhasedTransactions() {
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.DatabaseManager; import com.apollocurrency.aplwallet.apl.core.db.FullTextTrigger; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; ======= import com.apollocurrency.aplwallet.apl.core.app.Db; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextSearchService; >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.DatabaseManager; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextSearchService; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; <<<<<<< private DatabaseManager databaseManager; ======= >>>>>>> private DatabaseManager databaseManager; <<<<<<< public DbMigrationExecutor(PropertiesHolder propertiesHolder, LegacyDbLocationsProvider dbLocationsProvider, DbInfoExtractor dbInfoExtractor, DatabaseManager databaseManager) { ======= public DbMigrationExecutor(PropertiesHolder propertiesHolder, LegacyDbLocationsProvider dbLocationsProvider, DbInfoExtractor dbInfoExtractor, FullTextSearchService fullTextSearchProvider) { >>>>>>> public DbMigrationExecutor(PropertiesHolder propertiesHolder, LegacyDbLocationsProvider dbLocationsProvider, DbInfoExtractor dbInfoExtractor, DatabaseManager databaseManager, FullTextSearchService fullTextSearchProvider) { <<<<<<< this.dbInfoExtractor = Objects.requireNonNull(dbInfoExtractor, "DatabaseManager info extractor cannot be null"); this.databaseManager = databaseManager; ======= this.dbInfoExtractor = Objects.requireNonNull(dbInfoExtractor, "Db info extractor cannot be null"); this.fullTextSearchProvider = Objects.requireNonNull(fullTextSearchProvider, "Fulltext search service cannot be null"); >>>>>>> this.dbInfoExtractor = Objects.requireNonNull(dbInfoExtractor, "Db info extractor cannot be null"); this.fullTextSearchProvider = Objects.requireNonNull(fullTextSearchProvider, "Fulltext search service cannot be null"); this.dbInfoExtractor = Objects.requireNonNull(dbInfoExtractor, "Db info extractor cannot be null"); this.databaseManager = databaseManager;
<<<<<<< private static CurrencyMintService currencyMintService; ======= private static PollService pollService; >>>>>>> private static PollService pollService; private static CurrencyMintService currencyMintService; <<<<<<< public static synchronized CurrencyMintService lookupCurrencyMintService() { if (currencyMintService == null) { currencyMintService = CDI.current().select(CurrencyMintService.class).get(); } return currencyMintService; } ======= public static synchronized PollService lookupPollService() { if (pollService == null) { pollService = CDI.current().select(PollService.class).get(); } return pollService; } >>>>>>> public static synchronized PollService lookupPollService() { if (pollService == null) { pollService = CDI.current().select(PollService.class).get(); } return pollService; } public static synchronized CurrencyMintService lookupCurrencyMintService() { if (currencyMintService == null) { currencyMintService = CDI.current().select(CurrencyMintService.class).get(); } return currencyMintService; }
<<<<<<< BigInteger goodHash = goodPeersMap.get(shardId).get(0).getHash(); if (checkShardDownloadedAlready(shardId, goodHash.toByteArray())) { fireShardPresentEvent(shardId); ======= byte[] goodHash = goodPeersMap.get(shardId).get(0).getHash(); if (checkShardDownloadedAlready(shardId, goodHash)) { fireShardPresnetEvent(shardId); >>>>>>> byte[] goodHash = goodPeersMap.get(shardId).get(0).getHash(); if (checkShardDownloadedAlready(shardId, goodHash)) { fireShardPresentEvent(shardId);
<<<<<<< import javax.enterprise.event.Event; ======= import java.util.Objects; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; >>>>>>> <<<<<<< import javax.management.MBeanServer; import javax.management.ObjectName; import java.lang.management.ManagementFactory; import java.util.Objects; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; ======= >>>>>>> import java.util.Objects; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException;
<<<<<<< import javax.servlet.http.HttpServletRequest; ======= import javax.enterprise.inject.Vetoed; >>>>>>> import javax.servlet.http.HttpServletRequest; import javax.enterprise.inject.Vetoed;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.account.Account; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.util.Constants; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.account.Account; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; <<<<<<< private static DatabaseManager databaseManager; // lazy init ======= private static BlockchainConfigUpdater blockchainConfigUpdater = CDI.current().select(BlockchainConfigUpdater.class).get(); >>>>>>> private static DatabaseManager databaseManager; // lazy init private static BlockchainConfigUpdater blockchainConfigUpdater = CDI.current().select(BlockchainConfigUpdater.class).get(); <<<<<<< TransactionalDataSource dataSource = lookupDataSource(); blockchainConfig.reset(); ======= blockchainConfigUpdater.reset(); >>>>>>> TransactionalDataSource dataSource = lookupDataSource(); blockchainConfigUpdater.reset();
<<<<<<< import com.apollocurrency.aplwallet.apl.core.db.DbClause; import com.apollocurrency.aplwallet.apl.core.db.DbIterator; import com.apollocurrency.aplwallet.apl.core.db.DbKey; import com.apollocurrency.aplwallet.apl.core.db.derived.EntityDbTable; import com.apollocurrency.aplwallet.apl.core.db.LongKeyFactory; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; ======= import com.apollocurrency.aplwallet.apl.core.db.*; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.*; import com.apollocurrency.aplwallet.apl.core.db.DbClause; import com.apollocurrency.aplwallet.apl.core.db.DbIterator; import com.apollocurrency.aplwallet.apl.core.db.DbKey; import com.apollocurrency.aplwallet.apl.core.db.derived.EntityDbTable; import com.apollocurrency.aplwallet.apl.core.db.LongKeyFactory; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource;
<<<<<<< private final ExchangeService exchangeService; ======= private final PollService pollService; >>>>>>> private final PollService pollService; private final ExchangeService exchangeService; <<<<<<< AssetService assetService, ExchangeService exchangeService ======= AssetService assetService, PollService pollService >>>>>>> AssetService assetService, PollService pollService, ExchangeService exchangeService <<<<<<< this.exchangeService = Objects.requireNonNull(exchangeService, "exchangeService is NULL"); ======= this.pollService = Objects.requireNonNull(pollService, "pollService is NULL"); >>>>>>> this.pollService = Objects.requireNonNull(pollService, "pollService is NULL"); this.exchangeService = Objects.requireNonNull(exchangeService, "exchangeService is NULL");
<<<<<<< import javax.enterprise.context.ApplicationScoped; ======= import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; >>>>>>> import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; <<<<<<< public DefaultBlockValidator() { // for weld } ======= @Inject public DefaultBlockValidator(BlockDb blockDb, BlockchainConfig blockchainConfig) { super(blockDb, blockchainConfig); } >>>>>>> @Inject public DefaultBlockValidator(BlockDb blockDb, BlockchainConfig blockchainConfig) { super(blockDb, blockchainConfig); } <<<<<<< void validateInstantBlock(Block block, Block previousBlock) throws BlockchainProcessor.BlockNotAcceptedException { if (block.getTransactions().size() <= AplGlobalObjects.getChainConfig().getCurrentConfig().getNumberOfTransactionsInAdaptiveBlock()) { ======= void validateInstantBlock(BlockImpl block, BlockImpl previousBlock) throws BlockchainProcessor.BlockNotAcceptedException { if (block.getTransactions().size() <= blockchainConfig.getCurrentConfig().getNumberOfTransactionsInAdaptiveBlock()) { >>>>>>> void validateInstantBlock(Block block, Block previousBlock) throws BlockchainProcessor.BlockNotAcceptedException { if (block.getTransactions().size() <= blockchainConfig.getCurrentConfig().getNumberOfTransactionsInAdaptiveBlock()) { <<<<<<< void validateRegularBlock(Block block, Block previousBlock) throws BlockchainProcessor.BlockNotAcceptedException { if (block.getTransactions().size() <= AplGlobalObjects.getChainConfig().getCurrentConfig().getNumberOfTransactionsInAdaptiveBlock() || block.getTimeout() != 0) { ======= void validateRegularBlock(BlockImpl block, BlockImpl previousBlock) throws BlockchainProcessor.BlockNotAcceptedException { if (block.getTransactions().size() <= blockchainConfig.getCurrentConfig().getNumberOfTransactionsInAdaptiveBlock() || block.getTimeout() != 0) { >>>>>>> void validateRegularBlock(Block block, Block previousBlock) throws BlockchainProcessor.BlockNotAcceptedException { if (block.getTransactions().size() <= blockchainConfig.getCurrentConfig().getNumberOfTransactionsInAdaptiveBlock() || block.getTimeout() != 0) {
<<<<<<< import javax.enterprise.inject.Vetoed; import javax.enterprise.inject.spi.CDI; import javax.servlet.http.HttpServletRequest; @Deprecated ======= >>>>>>> @Deprecated
<<<<<<< import com.apollocurrency.aplwallet.apl.core.rest.endpoint.ServerInfoController; import com.apollocurrency.aplwallet.apl.core.rest.filters.Secured2FA; import com.apollocurrency.aplwallet.apl.core.rest.filters.Secured2FAInterceptor; import com.apollocurrency.aplwallet.apl.core.rest.filters.SecurityInterceptor; ======= import com.apollocurrency.aplwallet.apl.core.rest.endpoint.NodeInfoController; >>>>>>> import com.apollocurrency.aplwallet.apl.core.rest.endpoint.NodeInfoController; <<<<<<< BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); aplCoreRuntime.init(runtimeMode, blockchainConfig, app.propertiesHolder); Convert2.init(blockchainConfig); ======= aplCoreRuntime.init(runtimeMode, CDI.current().select(BlockchainConfig.class).get(), app.propertiesHolder, app.taskDispatchManager); >>>>>>> BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); aplCoreRuntime.init(runtimeMode, blockchainConfig, app.propertiesHolder, app.taskDispatchManager); Convert2.init(blockchainConfig);
<<<<<<< import static com.apollocurrency.aplwallet.apl.core.shard.ShardConstants.BLOCK_INDEX_TABLE_NAME; import static com.apollocurrency.aplwallet.apl.core.shard.ShardConstants.BLOCK_TABLE_NAME; import static com.apollocurrency.aplwallet.apl.core.shard.ShardConstants.DEX_TRADE_TABLE_NAME; import static com.apollocurrency.aplwallet.apl.core.shard.ShardConstants.SHARD_TABLE_NAME; import static com.apollocurrency.aplwallet.apl.core.shard.ShardConstants.TRANSACTION_INDEX_TABLE_NAME; import static com.apollocurrency.aplwallet.apl.core.shard.ShardConstants.TRANSACTION_TABLE_NAME; import static org.slf4j.LoggerFactory.getLogger; ======= >>>>>>> import static com.apollocurrency.aplwallet.apl.core.shard.ShardConstants.BLOCK_INDEX_TABLE_NAME; import static com.apollocurrency.aplwallet.apl.core.shard.ShardConstants.BLOCK_TABLE_NAME; import static com.apollocurrency.aplwallet.apl.core.shard.ShardConstants.DEX_TRADE_TABLE_NAME; import static com.apollocurrency.aplwallet.apl.core.shard.ShardConstants.SHARD_TABLE_NAME; import static com.apollocurrency.aplwallet.apl.core.shard.ShardConstants.TRANSACTION_INDEX_TABLE_NAME; import static com.apollocurrency.aplwallet.apl.core.shard.ShardConstants.TRANSACTION_TABLE_NAME; import static org.slf4j.LoggerFactory.getLogger; <<<<<<< /** * {@inheritDoc} */ @Override public long exportDexTradeTable(int targetHeight, int batchLimit) { int processedCount; int totalCount = 0; // prepare connection + statement + writer TransactionalDataSource dataSource = this.databaseManager.getDataSource(); try (Connection con = dataSource.getConnection(); PreparedStatement pstmt = con.prepareStatement( "SELECT * FROM " + DEX_TRADE_TABLE_NAME + " WHERE db_id > ? AND height <= ? ORDER BY db_id LIMIT ?"); PreparedStatement countPstmt = con.prepareStatement("SELECT count(*) FROM " + DEX_TRADE_TABLE_NAME + " WHERE height <= ?"); CsvWriter csvWriter = new CsvWriterImpl(this.dataExportPath, Set.of("DB_ID")) ) { csvWriter.setOptions("fieldDelimiter="); // do not remove! it deletes double quotes around values in csv countPstmt.setInt(1, targetHeight); ResultSet countRs = countPstmt.executeQuery(); countRs.next(); int count = countRs.getInt(1); log.debug("Table = {},count - {} at height = {}", DEX_TRADE_TABLE_NAME, count, targetHeight); // process non empty tables only if (count > 0) { long from = 0; do { // do exporting into csv with pagination pstmt.setLong(1, from); pstmt.setInt(2, targetHeight); pstmt.setInt(3, batchLimit); CsvExportData csvExportData = csvWriter.append(DEX_TRADE_TABLE_NAME, pstmt.executeQuery()); processedCount = csvExportData.getProcessCount(); if (processedCount > 0) { from = (Long) csvExportData.getLastRow().get("DB_ID"); } totalCount += processedCount; } while (processedCount > 0); //keep processing while not found more rows log.trace("Table = {}, exported rows = {}", DEX_TRADE_TABLE_NAME, totalCount); } else { // skipped empty table log.debug("Skipped exporting Table = {}", DEX_TRADE_TABLE_NAME); } } catch (Exception e) { throw new RuntimeException("Exporting table exception " + DEX_TRADE_TABLE_NAME, e); } return totalCount; } private long exportTable(String table, String condition, MinMaxDbId minMaxDbId, Set<String> excludedColumns, StatementConfigurator statementConfigurator) { ======= private long exportTable(String table, String condition, MinMaxValue minMaxValue, Set<String> excludedColumns, StatementConfigurator statementConfigurator) { >>>>>>> /** * {@inheritDoc} */ @Override public long exportDexTradeTable(int targetHeight, int batchLimit) { int processedCount; int totalCount = 0; // prepare connection + statement + writer TransactionalDataSource dataSource = this.databaseManager.getDataSource(); try (Connection con = dataSource.getConnection(); PreparedStatement pstmt = con.prepareStatement( "SELECT * FROM " + DEX_TRADE_TABLE_NAME + " WHERE db_id > ? AND height <= ? ORDER BY db_id LIMIT ?"); PreparedStatement countPstmt = con.prepareStatement("SELECT count(*) FROM " + DEX_TRADE_TABLE_NAME + " WHERE height <= ?"); CsvWriter csvWriter = new CsvWriterImpl(this.dataExportPath, Set.of("DB_ID")) ) { csvWriter.setOptions("fieldDelimiter="); // do not remove! it deletes double quotes around values in csv countPstmt.setInt(1, targetHeight); ResultSet countRs = countPstmt.executeQuery(); countRs.next(); int count = countRs.getInt(1); log.debug("Table = {},count - {} at height = {}", DEX_TRADE_TABLE_NAME, count, targetHeight); // process non empty tables only if (count > 0) { long from = 0; do { // do exporting into csv with pagination pstmt.setLong(1, from); pstmt.setInt(2, targetHeight); pstmt.setInt(3, batchLimit); CsvExportData csvExportData = csvWriter.append(DEX_TRADE_TABLE_NAME, pstmt.executeQuery()); processedCount = csvExportData.getProcessCount(); if (processedCount > 0) { from = (Long) csvExportData.getLastRow().get("DB_ID"); } totalCount += processedCount; } while (processedCount > 0); //keep processing while not found more rows log.trace("Table = {}, exported rows = {}", DEX_TRADE_TABLE_NAME, totalCount); } else { // skipped empty table log.debug("Skipped exporting Table = {}", DEX_TRADE_TABLE_NAME); } } catch (Exception e) { throw new RuntimeException("Exporting table exception " + DEX_TRADE_TABLE_NAME, e); } return totalCount; } private long exportTable(String table, String condition, MinMaxValue minMaxValue, Set<String> excludedColumns, StatementConfigurator statementConfigurator) {
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.Blockchain; import com.apollocurrency.aplwallet.apl.core.app.BlockchainProcessor; import com.apollocurrency.aplwallet.apl.core.app.observer.events.TrimConfigUpdated; ======= import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; >>>>>>> <<<<<<< import javax.enterprise.event.Event; import javax.enterprise.util.AnnotationLiteral; import java.util.Properties; ======= >>>>>>> import javax.enterprise.event.Event; <<<<<<< import java.util.concurrent.atomic.AtomicBoolean; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; ======= import javax.enterprise.event.Event; >>>>>>> import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import com.apollocurrency.aplwallet.apl.core.shard.ShardService;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.model.ApprovedAndApprovalTxs; import com.apollocurrency.aplwallet.apl.core.peer.*; import com.apollocurrency.aplwallet.apl.core.peer.statcheck.FileDownloadDecision; ======= import com.apollocurrency.aplwallet.apl.core.peer.Peer; import com.apollocurrency.aplwallet.apl.core.peer.PeerNotConnectedException; import com.apollocurrency.aplwallet.apl.core.peer.PeerState; import com.apollocurrency.aplwallet.apl.core.peer.PeersService; import com.apollocurrency.aplwallet.apl.core.files.shards.ShardInfoDownloader; import com.apollocurrency.aplwallet.apl.core.files.shards.ShardsDownloadService; import com.apollocurrency.aplwallet.apl.core.files.statcheck.FileDownloadDecision; >>>>>>> import com.apollocurrency.aplwallet.apl.core.peer.Peer; import com.apollocurrency.aplwallet.apl.core.peer.PeerNotConnectedException; import com.apollocurrency.aplwallet.apl.core.peer.PeerState; import com.apollocurrency.aplwallet.apl.core.peer.PeersService; <<<<<<< import javax.enterprise.event.Event; import javax.enterprise.inject.spi.CDI; import javax.enterprise.util.AnnotationLiteral; import javax.inject.Inject; import javax.inject.Singleton; ======= >>>>>>> import javax.enterprise.event.Event; import javax.enterprise.inject.spi.CDI; import javax.enterprise.util.AnnotationLiteral; import javax.inject.Inject; import javax.inject.Singleton; <<<<<<< import java.sql.*; import java.util.*; import java.util.concurrent.*; ======= import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ThreadLocalRandom; import javax.enterprise.event.Event; import javax.enterprise.inject.spi.CDI; import javax.enterprise.util.AnnotationLiteral; import javax.inject.Inject; import javax.inject.Singleton; >>>>>>> import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ThreadLocalRandom; <<<<<<< private final ShardDownloader shardDownloader; private final ShardDao shardDao; ======= private final ShardsDownloadService shardDownloader; >>>>>>> private final ShardsDownloadService shardDownloader; private final ShardDao shardDao; <<<<<<< TaskDispatchManager taskDispatchManager, Event<List<Transaction>> txEvent, ShardDao shardDao) { ======= TaskDispatchManager taskDispatchManager, Event<List<Transaction>> txEvent) { >>>>>>> TaskDispatchManager taskDispatchManager, Event<List<Transaction>> txEvent, ShardDao shardDao) { <<<<<<< List<Transaction> phasedTransactions = phasingPollService.getFinishingTransactions(lookupBlockhain().getHeight() + 1); phasedTransactions.addAll(phasingPollService.getFinishingTransactionsByTime(getPhasingStartTime(previousBlock), previousBlock.getTimestamp())); ======= List<Transaction> phasedTransactions = phasingPollService.getFinishingTransactions(lookupBlockhain().getHeight() + 1); phasedTransactions.addAll(phasingPollService.getFinishingTransactionsByTime(previousBlock.getTimestamp(), blockTimestamp)); >>>>>>> List<Transaction> phasedTransactions = phasingPollService.getFinishingTransactions(lookupBlockhain().getHeight() + 1); phasedTransactions.addAll(phasingPollService.getFinishingTransactionsByTime(previousBlock.getTimestamp(), blockTimestamp));
<<<<<<< ======= import java.util.HashSet; import java.util.Iterator; >>>>>>> import java.util.HashSet; import java.util.Iterator; <<<<<<< import java.util.concurrent.CopyOnWriteArraySet; ======= import java.util.concurrent.TimeUnit; >>>>>>> import java.util.concurrent.TimeUnit; import java.util.concurrent.CopyOnWriteArraySet; <<<<<<< private volatile TransactionalDataSource currentTransactionalDataSource; // main/shard database ======= private TransactionalDataSource currentTransactionalDataSource; // main/shard database /** * Shard data sources cache loader */ private CacheLoader<Long, TransactionalDataSource> loader = new CacheLoader<>() { public TransactionalDataSource load(Long shardId) throws CacheLoader.InvalidCacheLoadException { log.debug("Put DS shardId = '{}' into cache...", shardId); TransactionalDataSource dataSource = createAndAddShard(shardId); if(dataSource == null){ throw new CacheLoader.InvalidCacheLoadException("Value can't be null"); } return dataSource; } }; /** * Listener to close + remove evicted shard data source */ private RemovalListener<Long, TransactionalDataSource> listener = dataSource -> { if (dataSource.wasEvicted()) { String cause = dataSource.getCause().name(); log.debug("Evicted DS, shutdown shardId = '{}', cause = {}", dataSource.getKey(), cause); dataSource.getValue().shutdown(); } }; >>>>>>> private volatile TransactionalDataSource currentTransactionalDataSource; // main/shard database /** * Shard data sources cache loader */ private CacheLoader<Long, TransactionalDataSource> loader = new CacheLoader<>() { public TransactionalDataSource load(Long shardId) throws CacheLoader.InvalidCacheLoadException { log.debug("Put DS shardId = '{}' into cache...", shardId); TransactionalDataSource dataSource = createAndAddShard(shardId); if(dataSource == null){ throw new CacheLoader.InvalidCacheLoadException("Value can't be null"); } return dataSource; } }; /** * Listener to close + remove evicted shard data source */ private RemovalListener<Long, TransactionalDataSource> listener = dataSource -> { if (dataSource.wasEvicted()) { String cause = dataSource.getCause().name(); log.debug("Evicted DS, shutdown shardId = '{}', cause = {}", dataSource.getKey(), cause); dataSource.getValue().shutdown(); } }; <<<<<<< private JdbiHandleFactory jdbiHandleFactory; private Set<Long> fullShardIds = new CopyOnWriteArraySet<>(); // store full shard ids private boolean available; // required for db hot swap private final Object lock = new Object(); // required to sync creation of shard datasources ======= >>>>>>> private JdbiHandleFactory jdbiHandleFactory; private Set<Long> fullShardIds = new CopyOnWriteArraySet<>(); // store full shard ids private boolean available; // required for db hot swap private final Object lock = new Object(); // required to sync creation of shard datasources <<<<<<< dataSource.update(dbVersion); log.debug("Init existing SHARD using db version'{}' ", dbVersion); ======= dataSource.init(dbVersion); log.debug("Init existing SHARD using db version'{}' in {} ms", dbVersion, System.currentTimeMillis() - start); >>>>>>> dataSource.update(dbVersion); log.debug("Init existing SHARD using db version'{}' in {} ms", dbVersion, System.currentTimeMillis() - start); <<<<<<< StringValidator.requireNonBlank(temporaryDatabaseName, "temporary database name"); waitAvailability(); ======= Objects.requireNonNull(temporaryDatabaseName, "temporary Database Name is NULL"); long start = System.currentTimeMillis(); >>>>>>> StringValidator.requireNonBlank(temporaryDatabaseName, "temporary database name"); waitAvailability(); long start = System.currentTimeMillis(); <<<<<<< public TransactionalDataSource getShardDataSourceById(long shardId) { waitAvailability(); ======= public /*synchronized*/ TransactionalDataSource getShardDataSourceById(long shardId) { // return connectedShardDataSourceMap.getUnchecked(shardId); >>>>>>> public /*synchronized*/ TransactionalDataSource getShardDataSourceById(long shardId) { waitAvailability(); // return connectedShardDataSourceMap.getUnchecked(shardId); <<<<<<< public TransactionalDataSource getOrCreateShardDataSourceById(Long shardId) { return getOrCreateShardDataSourceById(shardId, new ShardInitTableSchemaVersion()); ======= public synchronized TransactionalDataSource getOrCreateShardDataSourceById(Long shardId) { // if (shardId != null && connectedShardDataSourceMap.getIfPresent(shardId) == null) { // return connectedShardDataSourceMap.getUnchecked(shardId); if (shardId != null && connectedShardDataSourceMap.containsKey(shardId)) { return connectedShardDataSourceMap.get(shardId); } else { return createAndAddShard(shardId); } >>>>>>> public synchronized TransactionalDataSource getOrCreateShardDataSourceById(Long shardId) { /* if (shardId != null && connectedShardDataSourceMap.containsKey(shardId)) { return connectedShardDataSourceMap.get(shardId); } else { return createAndAddShard(shardId); } */ return getOrCreateShardDataSourceById(shardId, new ShardInitTableSchemaVersion()); <<<<<<< ======= public DatabaseManagerImpl() {} // never use it directly >>>>>>> public DatabaseManagerImpl() {} // never use it directly
<<<<<<< @Step public CreateTransactionResponse shufflingCreate( Wallet wallet, int registrationPeriod, int participantCount,int amount,String holding, int holdingType ) { addParameters(RequestType.requestType, shufflingCreate); addParameters(Parameters.wallet, wallet); if (holdingType > 0) { addParameters(Parameters.holding, holding); addParameters(Parameters.holdingType, holdingType); addParameters(Parameters.amount, amount); }else{ addParameters(Parameters.amount, amount+"00000000"); } addParameters(Parameters.registrationPeriod, registrationPeriod); addParameters(Parameters.participantCount, participantCount); addParameters(Parameters.feeATM, "100000000000"); addParameters(Parameters.deadline, 1440); return getInstanse(CreateTransactionResponse.class); } @AfterEach void testEnd() { this.testInfo = null; ======= @Step public CreateTransactionResponse shufflingVerify(Wallet wallet,String shuffling, String shufflingStateHash) { addParameters(RequestType.requestType, shufflingVerify); addParameters(Parameters.shuffling, shuffling); addParameters(Parameters.shufflingStateHash, shufflingStateHash); addParameters(Parameters.wallet, wallet); addParameters(Parameters.feeATM, "100000000000"); addParameters(Parameters.deadline, 1440); return getInstanse(CreateTransactionResponse.class); >>>>>>> @Step public CreateTransactionResponse shufflingCreate( Wallet wallet, int registrationPeriod, int participantCount,int amount,String holding, int holdingType ) { addParameters(RequestType.requestType, shufflingCreate); addParameters(Parameters.wallet, wallet); if (holdingType > 0) { addParameters(Parameters.holding, holding); addParameters(Parameters.holdingType, holdingType); addParameters(Parameters.amount, amount); }else{ addParameters(Parameters.amount, amount+"00000000"); } addParameters(Parameters.registrationPeriod, registrationPeriod); addParameters(Parameters.participantCount, participantCount); addParameters(Parameters.feeATM, "100000000000"); addParameters(Parameters.deadline, 1440); return getInstanse(CreateTransactionResponse.class); } public CreateTransactionResponse shufflingVerify(Wallet wallet,String shuffling, String shufflingStateHash) { addParameters(RequestType.requestType, shufflingVerify); addParameters(Parameters.shuffling, shuffling); addParameters(Parameters.shufflingStateHash, shufflingStateHash); addParameters(Parameters.wallet, wallet); addParameters(Parameters.feeATM, "100000000000"); addParameters(Parameters.deadline, 1440); return getInstanse(CreateTransactionResponse.class); } @AfterEach void testEnd() { this.testInfo = null;
<<<<<<< public static long freeSpace() { return new File("/").getFreeSpace(); } public static long webFileSize(String url) throws IOException { return new URL(url).openConnection().getContentLengthLong(); } public static byte[] hashFile(Path file, MessageDigest digest) throws IOException { try (DigestInputStream in = new DigestInputStream(Files.newInputStream(file), digest)) { byte[] block = new byte[READ_BUFFER_SIZE]; while (in.read(block) > 0) {} return in.getMessageDigest().digest(); } } ======= public static long countElementsOfDirectory(Path directory, Predicate<Path> predicate) throws IOException { try (Stream<Path> stream = Files.list(directory)) { return stream.filter(predicate).count(); } } >>>>>>> public static long freeSpace() { return new File("/").getFreeSpace(); } public static long webFileSize(String url) throws IOException { return new URL(url).openConnection().getContentLengthLong(); } public static byte[] hashFile(Path file, MessageDigest digest) throws IOException { try (DigestInputStream in = new DigestInputStream(Files.newInputStream(file), digest)) { byte[] block = new byte[READ_BUFFER_SIZE]; while (in.read(block) > 0) {} return in.getMessageDigest().digest(); } } public static long countElementsOfDirectory(Path directory, Predicate<Path> predicate) throws IOException { try (Stream<Path> stream = Files.list(directory)) { return stream.filter(predicate).count(); } }
<<<<<<< private AccountService accountService; ======= private DexConfig dexConfig; >>>>>>> private AccountService accountService; private DexConfig dexConfig; <<<<<<< this.accountService = accountService; ======= this.dexConfig = dexConfig; >>>>>>> this.accountService = accountService; this.dexConfig = dexConfig;
<<<<<<< ======= import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextSearchService; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextSearchService; <<<<<<< private static final Logger log = getLogger(EntityDbTable.class); public static PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); ======= private static final Logger LOG = getLogger(EntityDbTable.class); public static PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); >>>>>>> private static final Logger log = getLogger(EntityDbTable.class); public static PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); <<<<<<< log.debug("Creating search index on " + table + " (" + fullTextSearchColumns + ")"); FullTextTrigger.createIndex(con, "PUBLIC", table.toUpperCase(), fullTextSearchColumns.toUpperCase()); ======= LOG.debug("Creating search index on " + table + " (" + fullTextSearchColumns + ")"); fullText.createIndex(con, "PUBLIC", table.toUpperCase(), fullTextSearchColumns.toUpperCase()); >>>>>>> log.debug("Creating search index on " + table + " (" + fullTextSearchColumns + ")"); fullText.createIndex(con, "PUBLIC", table.toUpperCase(), fullTextSearchColumns.toUpperCase());
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.FundingMonitor; import com.apollocurrency.aplwallet.apl.core.app.Generator; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.FundingMonitor; import com.apollocurrency.aplwallet.apl.core.app.Generator; <<<<<<< import com.apollocurrency.aplwallet.apl.core.app.Shuffler; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.Shuffler; <<<<<<< import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Block; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; ======= import com.apollocurrency.aplwallet.apl.core.entity.appdata.funding.FundingMonitorInstance; import com.apollocurrency.aplwallet.apl.core.entity.appdata.funding.MonitoredAccount; import com.apollocurrency.aplwallet.apl.core.entity.appdata.GeneratorMemoryEntity; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Block; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; >>>>>>> import com.apollocurrency.aplwallet.apl.core.entity.appdata.funding.FundingMonitorInstance; import com.apollocurrency.aplwallet.apl.core.entity.appdata.funding.MonitoredAccount; import com.apollocurrency.aplwallet.apl.core.entity.appdata.GeneratorMemoryEntity; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Block; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Block; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; <<<<<<< import com.apollocurrency.aplwallet.apl.core.entity.state.shuffling.Shuffling; ======= import com.apollocurrency.aplwallet.apl.core.entity.state.shuffling.Shuffler; import com.apollocurrency.aplwallet.apl.core.entity.state.shuffling.Shuffling; >>>>>>> import com.apollocurrency.aplwallet.apl.core.entity.state.shuffling.Shuffling; import com.apollocurrency.aplwallet.apl.core.entity.state.shuffling.Shuffler; import com.apollocurrency.aplwallet.apl.core.entity.state.shuffling.Shuffling; <<<<<<< import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; ======= import com.apollocurrency.aplwallet.apl.core.service.appdata.funding.FundingMonitorService; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; >>>>>>> import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; import com.apollocurrency.aplwallet.apl.core.service.appdata.funding.FundingMonitorService; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; <<<<<<< import com.apollocurrency.aplwallet.apl.core.transaction.messages.PrunableLoadingService; import com.apollocurrency.aplwallet.apl.core.utils.Convert2; ======= import com.apollocurrency.aplwallet.apl.core.utils.Convert2; >>>>>>> import com.apollocurrency.aplwallet.apl.core.utils.Convert2; import com.apollocurrency.aplwallet.apl.core.transaction.messages.PrunableLoadingService; import com.apollocurrency.aplwallet.apl.core.utils.Convert2; <<<<<<< private static PrunableLoadingService prunableLoadingService = CDI.current().select(PrunableLoadingService.class).get(); private static TransactionSerializer transactionSerializer = CDI.current().select(TransactionSerializer.class).get(); ======= private static FundingMonitorService fundingMonitorService = CDI.current().select(FundingMonitorService.class).get(); >>>>>>> private static FundingMonitorService fundingMonitorService = CDI.current().select(FundingMonitorService.class).get(); private static PrunableLoadingService prunableLoadingService = CDI.current().select(PrunableLoadingService.class).get(); private static TransactionSerializer transactionSerializer = CDI.current().select(TransactionSerializer.class).get();
<<<<<<< ======= import javax.sql.DataSource; import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; import java.sql.SQLFeatureNotSupportedException; import java.sql.Statement; import java.util.Optional; import java.util.concurrent.TimeUnit; >>>>>>>
<<<<<<< ======= import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.jboss.resteasy.mock.MockDispatcherFactory; import org.jboss.resteasy.mock.MockHttpRequest; >>>>>>> <<<<<<< import static org.junit.jupiter.api.Assertions.*; ======= import static org.jboss.resteasy.mock.MockHttpRequest.get; import static org.jboss.resteasy.mock.MockHttpRequest.post; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; >>>>>>> import static org.junit.jupiter.api.Assertions.*; <<<<<<< /** * @author [email protected] */ public class NetworkControllerTest extends AbstractEndpointTest { ======= @Slf4j class NetworkControllerTest { >>>>>>> /** * @author [email protected] */ @Slf4j public class NetworkControllerTest extends AbstractEndpointTest { <<<<<<< ======= private void checkMandatoryParameterMissingErrorCode(MockHttpResponse response, int expectedErrorCode) throws IOException { assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); String content = response.getContentAsString(); print(content); Map result = mapper.readValue(content, Map.class); assertTrue(result.containsKey("newErrorCode"),"Missing param, it's an issue."); assertEquals(expectedErrorCode, result.get("newErrorCode")); } private MockHttpResponse sendGetRequest(String uri) throws URISyntaxException{ MockHttpRequest request = get(uri); request.accept(MediaType.APPLICATION_JSON); request.contentType(MediaType.APPLICATION_JSON_TYPE); MockHttpResponse response = new MockHttpResponse(); return sendHttpRequest(request, response); } private MockHttpResponse sendPostRequest(String uri, String body) throws URISyntaxException{ MockHttpRequest request = post(uri); request.accept(MediaType.TEXT_HTML); request.contentType(MediaType.APPLICATION_FORM_URLENCODED_TYPE); request.content(body.getBytes()); MockHttpResponse response = new MockHttpResponse(); return sendHttpRequest(request, response); } private MockHttpResponse sendHttpRequest(MockHttpRequest request, MockHttpResponse response) { dispatcher.invoke(request, response); return response; } private static void print(String format, Object... args){ log.debug(format, args); } >>>>>>>
<<<<<<< TKeyExtent _key60; // required long _val61; // required _key60 = new TKeyExtent(); _key60.read(iprot); _val61 = iprot.readI64(); struct.failedExtents.put(_key60, _val61); ======= TKeyExtent _key52; long _val53; _key52 = new TKeyExtent(); _key52.read(iprot); _val53 = iprot.readI64(); struct.failedExtents.put(_key52, _val53); >>>>>>> TKeyExtent _key60; long _val61; _key60 = new TKeyExtent(); _key60.read(iprot); _val61 = iprot.readI64(); struct.failedExtents.put(_key60, _val61); <<<<<<< TConstraintViolationSummary _elem64; // required _elem64 = new TConstraintViolationSummary(); _elem64.read(iprot); struct.violationSummaries.add(_elem64); ======= TConstraintViolationSummary _elem56; _elem56 = new TConstraintViolationSummary(); _elem56.read(iprot); struct.violationSummaries.add(_elem56); >>>>>>> TConstraintViolationSummary _elem64; _elem64 = new TConstraintViolationSummary(); _elem64.read(iprot); struct.violationSummaries.add(_elem64); <<<<<<< TKeyExtent _key67; // required org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode _val68; // required _key67 = new TKeyExtent(); _key67.read(iprot); _val68 = org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.findByValue(iprot.readI32()); struct.authorizationFailures.put(_key67, _val68); ======= TKeyExtent _key59; org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode _val60; _key59 = new TKeyExtent(); _key59.read(iprot); _val60 = org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.findByValue(iprot.readI32()); struct.authorizationFailures.put(_key59, _val60); >>>>>>> TKeyExtent _key67; org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode _val68; _key67 = new TKeyExtent(); _key67.read(iprot); _val68 = org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.findByValue(iprot.readI32()); struct.authorizationFailures.put(_key67, _val68); <<<<<<< TKeyExtent _key77; // required long _val78; // required _key77 = new TKeyExtent(); _key77.read(iprot); _val78 = iprot.readI64(); struct.failedExtents.put(_key77, _val78); ======= TKeyExtent _key69; long _val70; _key69 = new TKeyExtent(); _key69.read(iprot); _val70 = iprot.readI64(); struct.failedExtents.put(_key69, _val70); >>>>>>> TKeyExtent _key77; long _val78; _key77 = new TKeyExtent(); _key77.read(iprot); _val78 = iprot.readI64(); struct.failedExtents.put(_key77, _val78); <<<<<<< TConstraintViolationSummary _elem81; // required _elem81 = new TConstraintViolationSummary(); _elem81.read(iprot); struct.violationSummaries.add(_elem81); ======= TConstraintViolationSummary _elem73; _elem73 = new TConstraintViolationSummary(); _elem73.read(iprot); struct.violationSummaries.add(_elem73); >>>>>>> TConstraintViolationSummary _elem81; _elem81 = new TConstraintViolationSummary(); _elem81.read(iprot); struct.violationSummaries.add(_elem81); <<<<<<< TKeyExtent _key84; // required org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode _val85; // required _key84 = new TKeyExtent(); _key84.read(iprot); _val85 = org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.findByValue(iprot.readI32()); struct.authorizationFailures.put(_key84, _val85); ======= TKeyExtent _key76; org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode _val77; _key76 = new TKeyExtent(); _key76.read(iprot); _val77 = org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.findByValue(iprot.readI32()); struct.authorizationFailures.put(_key76, _val77); >>>>>>> TKeyExtent _key84; org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode _val85; _key84 = new TKeyExtent(); _key84.read(iprot); _val85 = org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.findByValue(iprot.readI32()); struct.authorizationFailures.put(_key84, _val85);
<<<<<<< apply("ALTER TABLE transaction ADD COLUMN IF NOT EXISTS sender_public_key BINARY(32)"); case 280: apply("ALTER TABLE shard ADD COLUMN IF NOT EXISTS zip_hash_crc VARBINARY"); case 281: return 281; ======= return 279; >>>>>>> apply("ALTER TABLE shard ADD COLUMN IF NOT EXISTS zip_hash_crc VARBINARY"); case 280: return 280;
<<<<<<< import java.awt.*; ======= >>>>>>> import java.awt.*; <<<<<<< import com.apollocurrency.aplwallet.apl.util.Version; //import com.apollocurrency.aplwallet.apl.core.app.Db; //import com.apollocurrency.aplwallet.apl.core.db.FullTextTrigger; //import com.apollocurrency.aplwallet.apl.core.db.model.OptionDAO; ======= import com.apollocurrency.aplwallet.apl.util.Version; >>>>>>> import com.apollocurrency.aplwallet.apl.util.Version; //import com.apollocurrency.aplwallet.apl.core.app.Db; //import com.apollocurrency.aplwallet.apl.core.db.FullTextTrigger; //import com.apollocurrency.aplwallet.apl.core.db.model.OptionDAO; <<<<<<< ======= //import netscape.javascript.JSObject; //import com.apollocurrency.aplwallet.apl.core.app.Db; //import com.apollocurrency.aplwallet.apl.core.db.FullTextTrigger; //import com.apollocurrency.aplwallet.apl.core.db.model.OptionDAO; >>>>>>> //import netscape.javascript.JSObject; //import com.apollocurrency.aplwallet.apl.core.app.Db; //import com.apollocurrency.aplwallet.apl.core.db.FullTextTrigger; //import com.apollocurrency.aplwallet.apl.core.db.model.OptionDAO;
<<<<<<< TaskDispatcher dispatcher = taskDispatchManager.getDispatcher(BACKGROUND_SERVICE_NAME); dispatcher.shutdown(); DefaultTaskDispatcher.shutdownExecutor("sendingService", sendingService, 2); ======= Tasks.shutdownExecutor("sendingService", sendingService, 2); >>>>>>> TaskDispatcher dispatcher = taskDispatchManager.getDispatcher(BACKGROUND_SERVICE_NAME); dispatcher.shutdown(); Tasks.shutdownExecutor("sendingService", sendingService, 2);
<<<<<<< ======= if (initFullTextSearch) { FullTextTrigger.init(); } >>>>>>> <<<<<<< ======= if (initFullTextSearch) { FullTextTrigger.init(); } >>>>>>> <<<<<<< apply("CREATE UNIQUE INDEX IF NOT EXISTS genesis_public_key_account_id_height_idx on genesis_public_key(account_id, height)"); case 250: apply("CREATE INDEX IF NOT EXISTS genesis_public_key_height_idx on genesis_public_key(height)"); case 251: ======= // create SHARDING meta-info inside main database apply("CREATE TABLE IF NOT EXISTS shard (key VARCHAR(100) not null)"); case 250: apply("CREATE UNIQUE INDEX shard_key_idx ON shard(key)"); case 251: // it's an example of previously created shard for checking purpose // apply("INSERT INTO shard(key) VALUES('000000001')"); return; case 252: >>>>>>> // create SHARDING meta-info inside main database apply("CREATE TABLE IF NOT EXISTS shard (key VARCHAR(100) not null)"); case 250: apply("CREATE UNIQUE INDEX shard_key_idx ON shard(key)"); // case 251: // it's an example of previously created shard for checking purpose // apply("INSERT INTO shard(key) VALUES('000000001')"); case 251: apply("CREATE UNIQUE INDEX IF NOT EXISTS genesis_public_key_account_id_height_idx on genesis_public_key(account_id, height)"); case 252: apply("CREATE INDEX IF NOT EXISTS genesis_public_key_height_idx on genesis_public_key(height)"); case 253:
<<<<<<< import com.apollocurrency.aplwallet.apl.core.account.model.Account; import com.apollocurrency.aplwallet.apl.core.account.service.AccountService; ======= import com.apollocurrency.aplwallet.apl.core.app.Block; import com.apollocurrency.aplwallet.apl.core.app.Blockchain; import com.apollocurrency.aplwallet.apl.core.app.Helper2FA; >>>>>>> import com.apollocurrency.aplwallet.apl.core.account.model.Account; import com.apollocurrency.aplwallet.apl.core.account.service.AccountService; import com.apollocurrency.aplwallet.apl.core.app.Block; import com.apollocurrency.aplwallet.apl.core.app.Blockchain; import com.apollocurrency.aplwallet.apl.core.app.Helper2FA; <<<<<<< private AccountService accountService; ======= private Blockchain blockchain; private PhasingPollService phasingPollService; private IDexMatcherInterface dexMatcherService; >>>>>>> private Blockchain blockchain; private PhasingPollService phasingPollService; private IDexMatcherInterface dexMatcherService; private AccountService accountService; <<<<<<< public DexService(EthereumWalletService ethereumWalletService, DexOfferDao dexOfferDao, DexOfferTable dexOfferTable, TransactionProcessorImpl transactionProcessor, DexSmartContractService dexSmartContractService, SecureStorageServiceImpl secureStorageService, DexContractTable dexContractTable, DexOfferTransactionCreator dexOfferTransactionCreator, TimeService timeService, DexTradeDao dexTradeDao, AccountService accountService) { ======= public DexService(EthereumWalletService ethereumWalletService, DexOrderDao dexOrderDao, DexOrderTable dexOrderTable, TransactionProcessor transactionProcessor, DexSmartContractService dexSmartContractService, SecureStorageService secureStorageService, DexContractTable dexContractTable, DexOrderTransactionCreator dexOrderTransactionCreator, TimeService timeService, DexContractDao dexContractDao, Blockchain blockchain, PhasingPollServiceImpl phasingPollService, IDexMatcherInterface dexMatcherService, DexTradeDao dexTradeDao, PhasingApprovedResultTable phasingApprovedResultTable, MandatoryTransactionDao mandatoryTransactionDao) { >>>>>>> public DexService(EthereumWalletService ethereumWalletService, DexOrderDao dexOrderDao, DexOrderTable dexOrderTable, TransactionProcessor transactionProcessor, DexSmartContractService dexSmartContractService, SecureStorageService secureStorageService, DexContractTable dexContractTable, DexOrderTransactionCreator dexOrderTransactionCreator, TimeService timeService, DexContractDao dexContractDao, Blockchain blockchain, PhasingPollServiceImpl phasingPollService, IDexMatcherInterface dexMatcherService, DexTradeDao dexTradeDao, PhasingApprovedResultTable phasingApprovedResultTable, MandatoryTransactionDao mandatoryTransactionDao, AccountService accountService) { <<<<<<< this.accountService = accountService; ======= this.dexContractDao = dexContractDao; this.blockchain = blockchain; this.phasingPollService = phasingPollService; this.dexMatcherService = dexMatcherService; this.phasingApprovedResultTable = phasingApprovedResultTable; this.mandatoryTransactionDao = mandatoryTransactionDao; >>>>>>> this.dexContractDao = dexContractDao; this.blockchain = blockchain; this.phasingPollService = phasingPollService; this.dexMatcherService = dexMatcherService; this.phasingApprovedResultTable = phasingApprovedResultTable; this.mandatoryTransactionDao = mandatoryTransactionDao; this.accountService = accountService; <<<<<<< public DexOffer getOfferById(Long id){ return dexOfferDao.getById(id); } @Transactional public List<DexTradeEntry> getTradeInfoForPeriod( Integer start, Integer finish, Byte pairCurrency, Integer offset, Integer limit) { return dexTradeDao.getDexEntriesForInterval(start, finish, pairCurrency, offset, limit); ======= public List<DexTradeEntry> getTradeInfoForPeriod(Integer start, Integer finish, Byte pairCurrency, Integer offset, Integer limit) { return dexTradeDao.getDexEntriesForInterval(start, finish, pairCurrency, offset, limit); >>>>>>> public List<DexTradeEntry> getTradeInfoForPeriod(Integer start, Integer finish, Byte pairCurrency, Integer offset, Integer limit) { return dexTradeDao.getDexEntriesForInterval(start, finish, pairCurrency, offset, limit); <<<<<<< Account account = accountService.getAccount(offer.getAccountId()); accountService.addToUnconfirmedBalanceATM(account, LedgerEvent.DEX_REFUND_FROZEN_MONEY, offer.getTransactionId(), offer.getOfferAmount()); ======= Account account = Account.getAccount(order.getAccountId()); account.addToUnconfirmedBalanceATM(LedgerEvent.DEX_REFUND_FROZEN_MONEY, order.getId(), order.getOrderAmount()); } public String refundEthPaxFrozenMoney(String passphrase, DexOrder order) throws AplException.ExecutiveProcessException { DexCurrencyValidator.checkHaveFreezeOrRefundEthOrPax(order); //Check if deposit exist. String ethAddress = DexCurrencyValidator.isEthOrPaxAddress(order.getFromAddress()) ? order.getFromAddress() : order.getToAddress(); if (!dexSmartContractService.isDepositForOrderExist(ethAddress, order.getId())) { log.warn("Eth/Pax deposit is not exist. Perhaps refund process was called before. OrderId: {}", order.getId()); return ""; } String txHash = dexSmartContractService.withdraw(passphrase, order.getAccountId(), order.getFromAddress(), new BigInteger(Long.toUnsignedString(order.getId())), null); if (txHash == null) { throw new AplException.ExecutiveProcessException("Exception in the process of freezing money."); } return txHash; >>>>>>> Account account = accountService.getAccount(order.getAccountId()); accountService.addToUnconfirmedBalanceATM(account, LedgerEvent.DEX_REFUND_FROZEN_MONEY, order.getId(), order.getOrderAmount()); } public String refundEthPaxFrozenMoney(String passphrase, DexOrder order) throws AplException.ExecutiveProcessException { DexCurrencyValidator.checkHaveFreezeOrRefundEthOrPax(order); //Check if deposit exist. String ethAddress = DexCurrencyValidator.isEthOrPaxAddress(order.getFromAddress()) ? order.getFromAddress() : order.getToAddress(); if (!dexSmartContractService.isDepositForOrderExist(ethAddress, order.getId())) { log.warn("Eth/Pax deposit is not exist. Perhaps refund process was called before. OrderId: {}", order.getId()); return ""; } String txHash = dexSmartContractService.withdraw(passphrase, order.getAccountId(), order.getFromAddress(), new BigInteger(Long.toUnsignedString(order.getId())), null); if (txHash == null) { throw new AplException.ExecutiveProcessException("Exception in the process of freezing money."); } return txHash;
<<<<<<< import javax.enterprise.inject.Vetoed; ======= import javax.enterprise.inject.spi.CDI; import javax.servlet.http.HttpServletRequest; >>>>>>> import javax.enterprise.inject.Vetoed; import javax.enterprise.inject.spi.CDI; import javax.servlet.http.HttpServletRequest;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.account.AccountLedger; import com.apollocurrency.aplwallet.apl.core.transaction.Messaging; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionType; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; ======= import static org.slf4j.LoggerFactory.getLogger; >>>>>>> import com.apollocurrency.aplwallet.apl.core.account.AccountLedger; import com.apollocurrency.aplwallet.apl.core.transaction.Messaging; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionType; import com.apollocurrency.aplwallet.apl.core.transaction.PrunableTransaction; import com.apollocurrency.aplwallet.apl.core.transaction.messages.Prunable; import com.apollocurrency.aplwallet.apl.core.transaction.messages.AbstractAppendix; import com.apollocurrency.aplwallet.apl.core.transaction.messages.Appendix; import com.apollocurrency.aplwallet.apl.core.transaction.messages.MessagingPhasingVoteCasting; import static org.slf4j.LoggerFactory.getLogger; <<<<<<< ======= import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextSearchService; import com.apollocurrency.aplwallet.apl.util.Constants; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; <<<<<<< import com.apollocurrency.aplwallet.apl.core.transaction.PrunableTransaction; import com.apollocurrency.aplwallet.apl.core.transaction.messages.Prunable; import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; import com.apollocurrency.aplwallet.apl.core.transaction.messages.AbstractAppendix; import com.apollocurrency.aplwallet.apl.core.transaction.messages.Appendix; import com.apollocurrency.aplwallet.apl.core.transaction.messages.MessagingPhasingVoteCasting; ======= import com.apollocurrency.aplwallet.apl.core.app.transaction.PrunableTransaction; import com.apollocurrency.aplwallet.apl.core.app.transaction.messages.AbstractAppendix; import com.apollocurrency.aplwallet.apl.core.app.transaction.messages.Appendix; import com.apollocurrency.aplwallet.apl.core.app.transaction.messages.Attachment; import com.apollocurrency.aplwallet.apl.core.app.transaction.messages.Prunable; import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; >>>>>>> import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; <<<<<<< private static volatile EpochTime timeService = CDI.current().select(EpochTime.class).get(); private static DatabaseManager databaseManager; ======= private static volatile Time.EpochTime timeService = CDI.current().select(Time.EpochTime.class).get(); private static DatabaseManager databaseManager; >>>>>>> private static volatile EpochTime timeService = CDI.current().select(EpochTime.class).get(); private static DatabaseManager databaseManager; <<<<<<< log.debug("Deleted blocks starting from height %s", height); ======= log.debug("Deleted blocks starting from height %s", height); >>>>>>> log.debug("Deleted blocks starting from height %s", height); <<<<<<< log.debug("Dropping all full text search indexes"); FullTextTrigger.dropAll(con); ======= log.debug("Dropping all full text search indexes"); lookupFullTextSearchProvider().dropAll(con); >>>>>>> log.debug("Dropping all full text search indexes"); lookupFullTextSearchProvider().dropAll(con);
<<<<<<< import javax.enterprise.inject.spi.CDI; import javax.inject.Inject; import com.apollocurrency.aplwallet.apl.core.app.messages.AbstractAppendix; import com.apollocurrency.aplwallet.apl.core.app.messages.Appendix; import com.apollocurrency.aplwallet.apl.core.app.messages.Attachment; import com.apollocurrency.aplwallet.apl.core.app.messages.EncryptToSelfMessage; import com.apollocurrency.aplwallet.apl.core.app.messages.EncryptedMessage; import com.apollocurrency.aplwallet.apl.core.app.messages.Message; import com.apollocurrency.aplwallet.apl.core.app.messages.Phasing; import com.apollocurrency.aplwallet.apl.core.app.messages.PrunableEncryptedMessage; import com.apollocurrency.aplwallet.apl.core.app.messages.PrunablePlainMessage; import com.apollocurrency.aplwallet.apl.core.app.messages.PublicKeyAnnouncement; import com.apollocurrency.aplwallet.apl.util.AplException; ======= import javax.enterprise.inject.spi.CDI; >>>>>>> import javax.enterprise.inject.spi.CDI; import javax.inject.Inject; import com.apollocurrency.aplwallet.apl.core.app.messages.AbstractAppendix; import com.apollocurrency.aplwallet.apl.core.app.messages.Appendix; import com.apollocurrency.aplwallet.apl.core.app.messages.Attachment; import com.apollocurrency.aplwallet.apl.core.app.messages.EncryptToSelfMessage; import com.apollocurrency.aplwallet.apl.core.app.messages.EncryptedMessage; import com.apollocurrency.aplwallet.apl.core.app.messages.Message; import com.apollocurrency.aplwallet.apl.core.app.messages.Phasing; import com.apollocurrency.aplwallet.apl.core.app.messages.PrunableEncryptedMessage; import com.apollocurrency.aplwallet.apl.core.app.messages.PrunablePlainMessage; import com.apollocurrency.aplwallet.apl.core.app.messages.PublicKeyAnnouncement; import javax.enterprise.inject.spi.CDI;
<<<<<<< private GeneratorService generatorService; ======= private FundingMonitorService fundingMonitorService; >>>>>>> private FundingMonitorService fundingMonitorService; private GeneratorService generatorService; <<<<<<< public GeneratorService lookupGeneratorService() { if (generatorService == null) { generatorService = CDI.current().select(GeneratorService.class).get(); } return generatorService; } ======= public FundingMonitorService lookupFundingMonitorService() { if (fundingMonitorService == null) { fundingMonitorService = CDI.current().select(FundingMonitorService.class).get(); } return fundingMonitorService; } >>>>>>> public FundingMonitorService lookupFundingMonitorService() { if (fundingMonitorService == null) { fundingMonitorService = CDI.current().select(FundingMonitorService.class).get(); } return fundingMonitorService; } public GeneratorService lookupGeneratorService() { if (generatorService == null) { generatorService = CDI.current().select(GeneratorService.class).get(); } return generatorService; }
<<<<<<< import org.apache.http.params.CoreConnectionPNames; ======= import org.apache.http.params.CoreConnectionPNames; import org.assertj.core.api.SoftAssertions; >>>>>>> import org.apache.http.params.CoreConnectionPNames; import org.assertj.core.api.SoftAssertions; <<<<<<< ======= public SoftAssertions softAssertions = new SoftAssertions(); >>>>>>> public SoftAssertions softAssertions = new SoftAssertions(); <<<<<<< private static void importSecretFileSetUp(String pathToSecretFile, String pass) { try { String path = "/rest/keyStore/upload"; given().log().all() ======= @ResourceLock(value = SYSTEM_PROPERTIES, mode = READ) protected synchronized static void importSecretFileSetUp(String pathToSecretFile, String pass) { try { String path = "/rest/keyStore/upload"; given().log().all() >>>>>>> @ResourceLock(value = SYSTEM_PROPERTIES, mode = READ) protected synchronized static void importSecretFileSetUp(String pathToSecretFile, String pass) { try { String path = "/rest/keyStore/upload"; given().log().all() <<<<<<< private static CreateTransactionResponse sendMoneySetUp(Wallet wallet, String recipient, int moneyAmount) { HashMap<String, String> param = new HashMap(); param = restHelper.addWalletParameters(param,wallet); param.put(ReqType.REQUEST_TYPE,ReqType.SEND_MONEY); param.put(ReqParam.RECIPIENT, recipient); param.put(ReqParam.AMOUNT_ATM, moneyAmount + "000000000"); param.put(ReqParam.FEE, "500000000"); param.put(ReqParam.DEADLINE, "1440"); String path = "/apl"; return given().log().all() .spec(restHelper.getPreconditionSpec()) .contentType(ContentType.URLENC) .formParams(param) .when() .post(path) .then() .assertThat().statusCode(200) .extract().body().jsonPath() .getObject("",CreateTransactionResponse.class); ======= protected synchronized static CreateTransactionResponse sendMoneySetUp(Wallet wallet, String recipient, int moneyAmount) { HashMap<String, String> param = new HashMap(); param = restHelper.addWalletParameters(param,wallet); param.put(ReqType.REQUEST_TYPE,ReqType.SEND_MONEY); param.put(ReqParam.RECIPIENT, recipient); param.put(ReqParam.AMOUNT_ATM, moneyAmount + "000000000"); param.put(ReqParam.FEE, "500000000"); param.put(ReqParam.DEADLINE, "1440"); String path = "/apl"; return given().log().all() .spec(restHelper.getPreconditionSpec()) .contentType(ContentType.URLENC) .formParams(param) .when() .post(path) .then() .assertThat().statusCode(200) .extract().body().jsonPath() .getObject("",CreateTransactionResponse.class); >>>>>>> protected synchronized static CreateTransactionResponse sendMoneySetUp(Wallet wallet, String recipient, int moneyAmount) { HashMap<String, String> param = new HashMap(); param = restHelper.addWalletParameters(param,wallet); param.put(ReqType.REQUEST_TYPE,ReqType.SEND_MONEY); param.put(ReqParam.RECIPIENT, recipient); param.put(ReqParam.AMOUNT_ATM, moneyAmount + "000000000"); param.put(ReqParam.FEE, "500000000"); param.put(ReqParam.DEADLINE, "1440"); String path = "/apl"; return given().log().all() .spec(restHelper.getPreconditionSpec()) .contentType(ContentType.URLENC) .formParams(param) .when() .post(path) .then() .assertThat().statusCode(200) .extract().body().jsonPath() .getObject("",CreateTransactionResponse.class); <<<<<<< private static BalanceDTO getBalanceSetUP(Wallet wallet) { HashMap<String, String> param = new HashMap(); param.put(ReqType.REQUEST_TYPE, ReqType.GET_BALANCE); param = restHelper.addWalletParameters(param, wallet); String path = "/apl"; return given().log().all() .spec(restHelper.getPreconditionSpec()) .contentType(ContentType.URLENC) .formParams(param) .when() .get(path) .then() .extract().body().jsonPath() .getObject("",BalanceDTO.class); ======= protected synchronized static BalanceDTO getBalanceSetUP(Wallet wallet) { HashMap<String, String> param = new HashMap(); param.put(ReqType.REQUEST_TYPE, ReqType.GET_BALANCE); param = restHelper.addWalletParameters(param, wallet); String path = "/apl"; return given().log().all() .spec(restHelper.getPreconditionSpec()) .contentType(ContentType.URLENC) .formParams(param) .when() .get(path) .then() .extract().body().jsonPath() .getObject("",BalanceDTO.class); >>>>>>> protected synchronized static BalanceDTO getBalanceSetUP(Wallet wallet) { HashMap<String, String> param = new HashMap(); param.put(ReqType.REQUEST_TYPE, ReqType.GET_BALANCE); param = restHelper.addWalletParameters(param, wallet); String path = "/apl"; return given().log().all() .spec(restHelper.getPreconditionSpec()) .contentType(ContentType.URLENC) .formParams(param) .when() .get(path) .then() .extract().body().jsonPath() .getObject("",BalanceDTO.class); <<<<<<< param.put(ReqType.REQUEST_TYPE,ReqType.GET_FORGING); param.put(ReqParam.ADMIN_PASSWORD, getTestConfiguration().getAdminPass()); path = "/apl"; try { ForgingResponse forgingResponse = given().config(config).log().all() ======= param.put(ReqType.REQUEST_TYPE,ReqType.GET_FORGING); param.put(Parameters.adminPassword.toString(), getTestConfiguration().getAdminPass()); path = "/apl"; try { ForgingResponse forgingResponse = given().config(config).log().all() >>>>>>> param.put(ReqType.REQUEST_TYPE,ReqType.GET_FORGING); param.put(ReqParam.ADMIN_PASSWORD, getTestConfiguration().getAdminPass()); path = "/apl"; try { ForgingResponse forgingResponse = given().config(config).log().all()
<<<<<<< ======= import com.apollocurrency.aplwallet.apl.core.account.Account; import com.apollocurrency.aplwallet.apl.core.account.AccountTable; import com.apollocurrency.aplwallet.apl.core.account.GenesisPublicKeyTable; import com.apollocurrency.aplwallet.apl.core.account.PublicKeyTable; >>>>>>> <<<<<<< ======= import com.apollocurrency.aplwallet.apl.core.app.GlobalSync; >>>>>>> <<<<<<< import static com.apollocurrency.aplwallet.apl.data.IndexTestData.TRANSACTION_INDEX_0; import static com.apollocurrency.aplwallet.apl.data.IndexTestData.TRANSACTION_INDEX_1; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; ======= import static com.apollocurrency.aplwallet.apl.data.IndexTestData.TRANSACTION_INDEX_0; import static com.apollocurrency.aplwallet.apl.data.IndexTestData.TRANSACTION_INDEX_1; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; >>>>>>> import static com.apollocurrency.aplwallet.apl.data.IndexTestData.TRANSACTION_INDEX_0; import static com.apollocurrency.aplwallet.apl.data.IndexTestData.TRANSACTION_INDEX_1; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock;
<<<<<<< private final TransactionTypeFactory transactionTypeFactory; ======= private final GeneratorService generatorService; >>>>>>> private final GeneratorService generatorService; private final TransactionTypeFactory transactionTypeFactory; <<<<<<< ShufflingService shufflingService, TransactionTypeFactory transactionTypeFactory ======= ShufflingService shufflingService, GeneratorService generatorService >>>>>>> ShufflingService shufflingService, TransactionTypeFactory transactionTypeFactory ShufflingService shufflingService, GeneratorService generatorService <<<<<<< this.transactionTypeFactory = Objects.requireNonNull(transactionTypeFactory, "Transaction type factory is NULL"); ======= this.generatorService = Objects.requireNonNull( generatorService, "generatorService is NULL"); >>>>>>> this.generatorService = Objects.requireNonNull( generatorService, "generatorService is NULL"); this.transactionTypeFactory = Objects.requireNonNull(transactionTypeFactory, "Transaction type factory is NULL");
<<<<<<< this.accountService = accountService; ======= this.dexConfig = dexConfig; >>>>>>> this.accountService = accountService; this.dexConfig = dexConfig;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; ======= import com.apollocurrency.aplwallet.apl.core.transaction.ShufflingTransaction; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionType; >>>>>>> import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; import com.apollocurrency.aplwallet.apl.core.transaction.ShufflingTransaction; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionType;
<<<<<<< BlockchainConfig blockchainConfig = mock(BlockchainConfig.class); PropertiesHolder propertiesHolder = mock(PropertiesHolder.class); NtpTimeConfig ntpTimeConfig = new NtpTimeConfig(); TimeService timeService = new TimeServiceImpl(ntpTimeConfig.time()); PeersService peersService = mock(PeersService.class); GeneratorService generatorService = mock(GeneratorService.class); TransactionTestData td = new TransactionTestData(); ======= private BlockchainConfig blockchainConfig = mock(BlockchainConfig.class); private PropertiesHolder propertiesHolder = mock(PropertiesHolder.class); private NtpTimeConfig ntpTimeConfig = new NtpTimeConfig(); private TimeService timeService = new TimeServiceImpl(ntpTimeConfig.time()); private PeersService peersService = mock(PeersService.class); private GeneratorService generatorService = mock(GeneratorService.class); private BlockSerializer blockSerializer = mock(BlockSerializer.class); >>>>>>> BlockchainConfig blockchainConfig = mock(BlockchainConfig.class); PropertiesHolder propertiesHolder = mock(PropertiesHolder.class); NtpTimeConfig ntpTimeConfig = new NtpTimeConfig(); TimeService timeService = new TimeServiceImpl(ntpTimeConfig.time()); PeersService peersService = mock(PeersService.class); GeneratorService generatorService = mock(GeneratorService.class); TransactionTestData td = new TransactionTestData(); BlockSerializer blockSerializer = mock(BlockSerializer.class); <<<<<<< TaggedDataDao.class, AppendixApplierRegistry.class, AppendixValidatorRegistry.class, TransactionRowMapper.class, TransactionBuilder.class, ======= TaggedDataTable.class, >>>>>>> TaggedDataDao.class, AppendixApplierRegistry.class, AppendixValidatorRegistry.class, TransactionRowMapper.class, TransactionBuilder.class, TaggedDataTable.class, <<<<<<< .addBeans(MockBean.of(mock(PrunableLoadingService.class), PrunableLoadingService.class)) .addBeans(MockBean.of(mock(CurrencyService.class), CurrencyService.class)) .addBeans(MockBean.of(td.getTransactionTypeFactory(), TransactionTypeFactory.class)) .addBeans(MockBean.of(mock(TransactionVersionValidator.class), TransactionVersionValidator.class)) ======= .addBeans(MockBean.of(blockSerializer, BlockSerializer.class)) >>>>>>> .addBeans(MockBean.of(mock(PrunableLoadingService.class), PrunableLoadingService.class)) .addBeans(MockBean.of(mock(CurrencyService.class), CurrencyService.class)) .addBeans(MockBean.of(td.getTransactionTypeFactory(), TransactionTypeFactory.class)) .addBeans(MockBean.of(mock(TransactionVersionValidator.class), TransactionVersionValidator.class)) .addBeans(MockBean.of(blockSerializer, BlockSerializer.class))
<<<<<<< import com.apollocurrency.aplwallet.api.dto.BaseDTO; ======= >>>>>>> import com.apollocurrency.aplwallet.api.dto.BaseDTO; <<<<<<< import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.UUID; import javax.enterprise.inject.spi.CDI; ======= >>>>>>> <<<<<<< .recursiveScanPackages(BaseDTO.class) ======= .recursiveScanPackages(AccountService.class) >>>>>>> .recursiveScanPackages(AccountService.class) .recursiveScanPackages(BaseDTO.class)
<<<<<<< import com.apollocurrency.aplwallet.apl.core.monetary.Exchange; ======= import com.apollocurrency.aplwallet.apl.core.monetary.ExchangeRequest; >>>>>>> import com.apollocurrency.aplwallet.apl.core.monetary.ExchangeRequest; import com.apollocurrency.aplwallet.apl.core.monetary.Exchange; <<<<<<< import com.apollocurrency.aplwallet.apl.core.service.state.exchange.ExchangeRequestService; ======= import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyExchangeOfferFacade; import com.apollocurrency.aplwallet.apl.core.service.state.echange.ExchangeService; >>>>>>> import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyExchangeOfferFacade; import com.apollocurrency.aplwallet.apl.core.service.state.echange.ExchangeService; import com.apollocurrency.aplwallet.apl.core.service.state.exchange.ExchangeRequestService; <<<<<<< private final ExchangeRequestService exchangeRequestService; ======= private final AssetTransferService assetTransferService; private final CurrencyExchangeOfferFacade currencyExchangeOfferFacade; private final ExchangeService exchangeService; >>>>>>> private final AssetTransferService assetTransferService; private final CurrencyExchangeOfferFacade currencyExchangeOfferFacade; private final ExchangeService exchangeService; private final ExchangeRequestService exchangeRequestService; <<<<<<< PollService pollService, ExchangeRequestService exchangeRequestService ======= PollService pollService, AssetTransferService assetTransferService, CurrencyExchangeOfferFacade currencyExchangeOfferFacade, ExchangeService exchangeService >>>>>>> PollService pollService, AssetTransferService assetTransferService, CurrencyExchangeOfferFacade currencyExchangeOfferFacade, ExchangeService exchangeService, ExchangeRequestService exchangeRequestService <<<<<<< this.exchangeRequestService = Objects.requireNonNull(exchangeRequestService, "exchangeRequestService is NULL"); ======= this.assetTransferService = Objects.requireNonNull(assetTransferService, "assetTransferService is NULL"); this.currencyExchangeOfferFacade = Objects.requireNonNull(currencyExchangeOfferFacade, "currencyExchangeOfferFacade is NULL"); this.exchangeService = Objects.requireNonNull(exchangeService, "exchangeService is NULL"); >>>>>>> this.assetTransferService = Objects.requireNonNull(assetTransferService, "assetTransferService is NULL"); this.currencyExchangeOfferFacade = Objects.requireNonNull(currencyExchangeOfferFacade, "currencyExchangeOfferFacade is NULL"); this.exchangeService = Objects.requireNonNull(exchangeService, "exchangeService is NULL"); this.exchangeRequestService = Objects.requireNonNull(exchangeRequestService, "exchangeRequestService is NULL"); <<<<<<< dto.numberOfOffers = CurrencyBuyOffer.getCount(); dto.numberOfExchangeRequests = exchangeRequestService.getCount(); dto.numberOfExchanges = Exchange.getCount(); ======= dto.numberOfOffers = currencyExchangeOfferFacade.getCurrencyBuyOfferService().getCount(); dto.numberOfExchangeRequests = ExchangeRequest.getCount(); dto.numberOfExchanges = exchangeService.getCount(); >>>>>>> dto.numberOfOffers = currencyExchangeOfferFacade.getCurrencyBuyOfferService().getCount(); dto.numberOfExchangeRequests = exchangeRequestService.getCount(); dto.numberOfExchanges = exchangeService.getCount();
<<<<<<< public static TServerSocket getServerSocket(int port, int timeout, InetAddress address, SslConnectionParams params) throws TTransportException { if (params.useJsse()) { return TSSLTransportFactory.getServerSocket(port, timeout, params.isClientAuth(), address); } else { return TSSLTransportFactory.getServerSocket(port, timeout, address, params.getTTransportParams()); } } public static void close() { ThriftTransportPool.close(); } public static TTransport createClientTransport(HostAndPort address, int timeout, SslConnectionParams sslParams) throws TTransportException { boolean success = false; TTransport transport = null; try { if (sslParams != null) { // TSSLTransportFactory handles timeout 0 -> forever natively if (sslParams.useJsse()) { transport = TSSLTransportFactory.getClientSocket(address.getHostText(), address.getPort(), timeout); } else { transport = TSSLTransportFactory.getClientSocket(address.getHostText(), address.getPort(), timeout, sslParams.getTTransportParams()); } // TSSLTransportFactory leaves transports open, so no need to open here } else if (timeout == 0) { transport = new TSocket(address.getHostText(), address.getPort()); transport.open(); } else { try { transport = TTimeoutTransport.create(address, timeout); } catch (IOException ex) { throw new TTransportException(ex); } transport.open(); } transport = ThriftUtil.transportFactory().getTransport(transport); success = true; } finally { if (!success && transport != null) { transport.close(); } } return transport; } ======= >>>>>>> public static TServerSocket getServerSocket(int port, int timeout, InetAddress address, SslConnectionParams params) throws TTransportException { if (params.useJsse()) { return TSSLTransportFactory.getServerSocket(port, timeout, params.isClientAuth(), address); } else { return TSSLTransportFactory.getServerSocket(port, timeout, address, params.getTTransportParams()); } } public static TTransport createClientTransport(HostAndPort address, int timeout, SslConnectionParams sslParams) throws TTransportException { boolean success = false; TTransport transport = null; try { if (sslParams != null) { // TSSLTransportFactory handles timeout 0 -> forever natively if (sslParams.useJsse()) { transport = TSSLTransportFactory.getClientSocket(address.getHostText(), address.getPort(), timeout); } else { transport = TSSLTransportFactory.getClientSocket(address.getHostText(), address.getPort(), timeout, sslParams.getTTransportParams()); } // TSSLTransportFactory leaves transports open, so no need to open here } else if (timeout == 0) { transport = new TSocket(address.getHostText(), address.getPort()); transport.open(); } else { try { transport = TTimeoutTransport.create(address, timeout); } catch (IOException ex) { throw new TTransportException(ex); } transport.open(); } transport = ThriftUtil.transportFactory().getTransport(transport); success = true; } finally { if (!success && transport != null) { transport.close(); } } return transport; }
<<<<<<< import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyTransferService; ======= import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyExchangeOfferFacade; import com.apollocurrency.aplwallet.apl.core.service.state.exchange.ExchangeRequestService; >>>>>>> import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyExchangeOfferFacade; import com.apollocurrency.aplwallet.apl.core.service.state.exchange.ExchangeRequestService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyTransferService; <<<<<<< private static CurrencyTransferService currencyTransferService; ======= private static AssetTransferService assetTransferService; private static CurrencyExchangeOfferFacade currencyExchangeOfferFacade; private static ExchangeRequestService exchangeRequestService; >>>>>>> private static AssetTransferService assetTransferService; private static CurrencyExchangeOfferFacade currencyExchangeOfferFacade; private static ExchangeRequestService exchangeRequestService; private static CurrencyTransferService currencyTransferService; <<<<<<< public static synchronized CurrencyTransferService lookupCurrencyTransferService() { if (currencyTransferService == null) { currencyTransferService = CDI.current().select(CurrencyTransferService.class).get(); } return currencyTransferService; } ======= public static synchronized AssetTransferService lookupAssetTransferService() { if (assetTransferService == null) { assetTransferService = CDI.current().select(AssetTransferService.class).get(); } return assetTransferService; } public static synchronized CurrencyExchangeOfferFacade lookupCurrencyExchangeOfferFacade() { if (currencyExchangeOfferFacade == null) { currencyExchangeOfferFacade = CDI.current().select(CurrencyExchangeOfferFacade.class).get(); } return currencyExchangeOfferFacade; } public static synchronized ExchangeRequestService lookupExchangeRequestService() { if (exchangeRequestService == null) { exchangeRequestService = CDI.current().select(ExchangeRequestService.class).get(); } return exchangeRequestService; } >>>>>>> public static synchronized AssetTransferService lookupAssetTransferService() { if (assetTransferService == null) { assetTransferService = CDI.current().select(AssetTransferService.class).get(); } return assetTransferService; } public static synchronized CurrencyExchangeOfferFacade lookupCurrencyExchangeOfferFacade() { if (currencyExchangeOfferFacade == null) { currencyExchangeOfferFacade = CDI.current().select(CurrencyExchangeOfferFacade.class).get(); } return currencyExchangeOfferFacade; } public static synchronized ExchangeRequestService lookupExchangeRequestService() { if (exchangeRequestService == null) { exchangeRequestService = CDI.current().select(ExchangeRequestService.class).get(); } return exchangeRequestService; } public static synchronized CurrencyTransferService lookupCurrencyTransferService() { if (currencyTransferService == null) { currencyTransferService = CDI.current().select(CurrencyTransferService.class).get(); } return currencyTransferService; }
<<<<<<< import io.firstbridge.cryptolib.CryptoParams; import io.firstbridge.cryptolib.ElGamalCrypto; import io.firstbridge.cryptolib.ElGamalKeyPair; import io.firstbridge.cryptolib.impl.ecc.ElGamalCryptoImpl; ======= import io.firstbridge.cryptolib.FBCryptoParams; import io.firstbridge.cryptolib.dataformat.FBElGamalKeyPair; import io.firstbridge.cryptolib.impl.AsymJCEElGamalImpl; import org.junit.jupiter.api.Test; >>>>>>> import io.firstbridge.cryptolib.CryptoParams; import io.firstbridge.cryptolib.ElGamalCrypto; import io.firstbridge.cryptolib.ElGamalKeyPair; import io.firstbridge.cryptolib.impl.ecc.ElGamalCryptoImpl; import org.junit.jupiter.api.Test; <<<<<<< ======= >>>>>>>
<<<<<<< import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyZeroInteractions; ======= >>>>>>> <<<<<<< import java.util.List; import java.util.Random; ======= >>>>>>> import java.util.List; import java.util.Random; <<<<<<< fireBlockPushed(5000); fireBlockPushed(6000); assertEquals(2, observer.getTrimHeights().size()); trimEvent.select(new AnnotationLiteral<TrimConfigUpdated>() {}).fire(new TrimConfig(false, true)); ======= fireBlockAccepted(5000); fireBlockAccepted(6000); trimEvent.select(new AnnotationLiteral<TrimConfigUpdated>() { }).fire(new TrimConfig(false, true)); >>>>>>> fireBlockPushed(5000); fireBlockPushed(6000); assertEquals(2, observer.getTrimHeights().size()); trimEvent.select(new AnnotationLiteral<TrimConfigUpdated>() { }).fire(new TrimConfig(false, true)); <<<<<<< verify(trimService, times(1)).isTrimming(); trimEvent.select(new AnnotationLiteral<TrimConfigUpdated>() {}).fire(new TrimConfig(true, false)); // waitTrim(List.of(5190)); ======= verifyNoMoreInteractions(trimService); trimEvent.select(new AnnotationLiteral<TrimConfigUpdated>() { }).fire(new TrimConfig(true, false)); waitTrim(List.of(6000)); >>>>>>> verify(trimService, times(1)).isTrimming(); trimEvent.select(new AnnotationLiteral<TrimConfigUpdated>() { }).fire(new TrimConfig(true, false)); // waitTrim(List.of(5190));
<<<<<<< import com.apollocurrency.aplwallet.apl.core.db.derived.VersionedEntityDbTable; ======= import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.core.db.VersionedEntityDbTable; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.core.db.derived.VersionedEntityDbTable;
<<<<<<< //Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable); ======= Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable, null); >>>>>>> //Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable, null); <<<<<<< //Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable); ======= Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable, null); >>>>>>> //Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable, null); <<<<<<< //Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable); ======= Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable, null); >>>>>>> //Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable, null); <<<<<<< //Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable); ======= Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable, null); >>>>>>> //Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable, null); <<<<<<< //Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable); ======= Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable, null); >>>>>>> //Account.init(extension.getDatabaseManager(), new PropertiesHolder(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, null, accountTable, null);
<<<<<<< import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.TransactionImpl; import com.apollocurrency.aplwallet.apl.core.app.AplException; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionType; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.TransactionImpl; import com.apollocurrency.aplwallet.apl.core.app.AplException; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionType; <<<<<<< private TransactionType transactionType() { if (transactionType == null) { throw new IllegalStateException("Transaction type was not set"); } return transactionType; ======= @Override public void apply(Transaction transaction, Account senderAccount, Account recipientAccount) { getTransactionType().apply(transaction, senderAccount, recipientAccount); >>>>>>> private TransactionType transactionType() { if (transactionType == null) { throw new IllegalStateException("Transaction type was not set"); } return transactionType; <<<<<<< ======= public int getFinishValidationHeight(Transaction transaction) { return isPhased(transaction) ? transaction.getPhasing().getFinishHeight() - 1 : lookupBlockchain().getHeight(); } @Override public String toString() { return "Attachment[" + getClass().getSimpleName() + ":" + getTransactionType().getName() + "]"; } >>>>>>> public int getFinishValidationHeight(Transaction transaction) { return isPhased(transaction) ? transaction.getPhasing().getFinishHeight() - 1 : lookupBlockchain().getHeight(); } @Override public String toString() { return "Attachment[" + getClass().getSimpleName() + ":" + getTransactionType().getName() + "]"; }
<<<<<<< public TemporaryFolder folder = new TemporaryFolder(); ======= private static final Logger log = Logger.getLogger(MiniAccumuloClusterStartStopTest.class); private File baseDir = new File(System.getProperty("user.dir") + "/target/mini-tests/" + this.getClass().getName()); private MiniAccumuloCluster accumulo; @Rule public TestName testName = new TestName(); >>>>>>> private static final Logger log = Logger.getLogger(MiniAccumuloClusterStartStopTest.class); private File baseDir = new File(System.getProperty("user.dir") + "/target/mini-tests/" + this.getClass().getName()); private MiniAccumuloCluster accumulo; @Rule public TestName testName = new TestName(); <<<<<<< public void multipleStartsDoesntThrowAnException() throws Exception { MiniAccumuloCluster accumulo = new MiniAccumuloCluster(folder.getRoot(), "superSecret"); ======= public void multipleStartsThrowsAnException() throws Exception { >>>>>>> public void multipleStartsDoesntThrowAnException() throws Exception {
<<<<<<< TransactionTypeFactory transactionTypeFactory = CDI.current().select(TransactionTypeFactory.class).get(); ======= BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); >>>>>>> BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); TransactionTypeFactory transactionTypeFactory = CDI.current().select(TransactionTypeFactory.class).get();
<<<<<<< import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; ======= import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.state.account.Account; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; >>>>>>> import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.state.account.Account; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; <<<<<<< import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountControlPhasingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountPublicKeyService; ======= import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountControlPhasingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountPublicKeyService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountService; import com.apollocurrency.aplwallet.apl.core.signature.Credential; import com.apollocurrency.aplwallet.apl.core.signature.KeyValidator; import com.apollocurrency.aplwallet.apl.core.signature.MultiSigCredential; import com.apollocurrency.aplwallet.apl.core.signature.SignatureCredential; import com.apollocurrency.aplwallet.apl.core.signature.SignatureToolFactory; import com.apollocurrency.aplwallet.apl.core.signature.SignatureVerifier; >>>>>>> import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountControlPhasingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountPublicKeyService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountControlPhasingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountPublicKeyService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountService; import com.apollocurrency.aplwallet.apl.core.signature.Credential; import com.apollocurrency.aplwallet.apl.core.signature.KeyValidator; import com.apollocurrency.aplwallet.apl.core.signature.MultiSigCredential; import com.apollocurrency.aplwallet.apl.core.signature.SignatureCredential; import com.apollocurrency.aplwallet.apl.core.signature.SignatureToolFactory; import com.apollocurrency.aplwallet.apl.core.signature.SignatureVerifier; <<<<<<< import com.apollocurrency.aplwallet.apl.core.transaction.messages.PrunableLoadingService; ======= import com.apollocurrency.aplwallet.apl.core.utils.Convert2; >>>>>>> import com.apollocurrency.aplwallet.apl.core.transaction.messages.PrunableLoadingService; import com.apollocurrency.aplwallet.apl.core.utils.Convert2; <<<<<<< import com.apollocurrency.aplwallet.apl.crypto.Crypto; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.crypto.Crypto; <<<<<<< private final BlockchainConfig blockchainConfig; private final PhasingPollService phasingPollService; private final Blockchain blockchain; private final FeeCalculator feeCalculator; private final AccountPublicKeyService accountPublicKeyService; private final AccountControlPhasingService accountControlPhasingService; private final PrunableLoadingService prunableService; ======= private final BlockchainConfig blockchainConfig; private final PhasingPollService phasingPollService; private final Blockchain blockchain; private final FeeCalculator feeCalculator; private final AccountControlPhasingService accountControlPhasingService; private final AccountService accountService; private final AccountPublicKeyService accountPublicKeyService; private final TransactionVersionValidator transactionVersionValidator; private final KeyValidator keyValidator; >>>>>>> private final BlockchainConfig blockchainConfig; private final PhasingPollService phasingPollService; private final Blockchain blockchain; private final FeeCalculator feeCalculator; private final AccountPublicKeyService accountPublicKeyService; private final AccountControlPhasingService accountControlPhasingService; private final PrunableLoadingService prunableService; private final BlockchainConfig blockchainConfig; private final PhasingPollService phasingPollService; private final Blockchain blockchain; private final FeeCalculator feeCalculator; private final AccountControlPhasingService accountControlPhasingService; private final AccountService accountService; private final AccountPublicKeyService accountPublicKeyService; private final TransactionVersionValidator transactionVersionValidator; private final KeyValidator keyValidator; <<<<<<< Blockchain blockchain, FeeCalculator feeCalculator, AccountPublicKeyService accountPublicKeyService, AccountControlPhasingService accountControlPhasingService, PrunableLoadingService prunableService) { ======= Blockchain blockchain, FeeCalculator feeCalculator, TransactionVersionValidator transactionVersionValidator, AccountControlPhasingService accountControlPhasingService, AccountService accountService, AccountPublicKeyService accountPublicKeyService ) { >>>>>>> Blockchain blockchain, FeeCalculator feeCalculator, AccountPublicKeyService accountPublicKeyService, AccountControlPhasingService accountControlPhasingService, TransactionVersionValidator transactionVersionValidator, PrunableLoadingService prunableService) { <<<<<<< this.prunableService = prunableService; ======= this.accountService = accountService; this.transactionVersionValidator = transactionVersionValidator; this.accountPublicKeyService = accountPublicKeyService; this.keyValidator = new PublicKeyValidator(accountPublicKeyService); >>>>>>> this.prunableService = prunableService; this.accountService = accountService; this.transactionVersionValidator = transactionVersionValidator; this.accountPublicKeyService = accountPublicKeyService; this.keyValidator = new PublicKeyValidator(accountPublicKeyService); <<<<<<< TransactionTypes.TransactionTypeSpec typeSpec = type.getSpec(); if (transaction.getTimestamp() == 0 ? (deadline != 0 || feeATM != 0) : (deadline < 1 || feeATM <= 0) ======= if (transaction.getTimestamp() == 0 ? (deadline != 0 || feeATM != 0) : (deadline < 1 || feeATM < 0) >>>>>>> TransactionTypes.TransactionTypeSpec typeSpec = type.getSpec(); if (transaction.getTimestamp() == 0 ? (deadline != 0 || feeATM != 0) : (deadline < 1 || feeATM < 0) <<<<<<< public boolean verifySignature(Transaction transaction) { return checkSignature(transaction) && accountPublicKeyService.setOrVerifyPublicKey(transaction.getSenderId(), transaction.getSenderPublicKey()); } public boolean checkSignature(Transaction transaction) { boolean hasValidSignature = transaction.hasValidSignature(); if (!hasValidSignature) { hasValidSignature = transaction.getSignature() != null && Crypto.verify(transaction.getSignature(), transaction.getUnsignedBytes(), transaction.getSenderPublicKey()); if (hasValidSignature) { transaction.withValidSignature(); } } return hasValidSignature; } ======= public int getActualTransactionVersion() { return transactionVersionValidator.getActualVersion(); } public boolean isValidVersion(int transactionVersion) { return transactionVersionValidator.isValidVersion(transactionVersion); } public void checkVersion(int transactionVersion) { transactionVersionValidator.checkVersion(transactionVersion); } public boolean verifySignature(Transaction transaction) { Account sender = accountService.getAccount(transaction.getSenderId()); if (sender == null) { log.error("Sender account not found, senderId={}", transaction.getSenderId()); return false; } @ParentChildSpecific(ParentMarker.MULTI_SIGNATURE) Credential signatureCredential; SignatureVerifier signatureVerifier = SignatureToolFactory.selectValidator(transaction.getVersion()).orElseThrow(UnsupportedTransactionVersion::new); if (log.isTraceEnabled()) { log.trace("#MULTI_SIG# verify signature validator class={}", signatureVerifier.getClass().getName()); } if (sender.isChild()) { //multi-signature if (transaction.getVersion() < 2) { log.error("Inconsistent transaction fields, the value of the sender property 'parent' doesn't match the transaction version."); return false; } signatureCredential = new MultiSigCredential(2, accountService.getPublicKeyByteArray(sender.getParentId()), transaction.getSenderPublicKey() ); } else { //only one signer if (transaction.getVersion() < 2) { signatureCredential = new SignatureCredential(transaction.getSenderPublicKey()); } else { signatureCredential = new MultiSigCredential(transaction.getSenderPublicKey()); } } if (log.isTraceEnabled()) { log.trace("#MULTI_SIG# verify credential={}", signatureCredential); } if (!signatureCredential.validateCredential(keyValidator)) { return false; } if (transaction.getSignature() != null && transaction.getSignature().isVerified()) { return true; } else { if (log.isTraceEnabled()) { log.trace("#MULTI_SIG# verify signature={} publicKey={} document={}", Convert.toHexString(transaction.getSignature().bytes()), signatureCredential, Convert.toHexString(transaction.getUnsignedBytes())); } return signatureVerifier.verify( transaction.getUnsignedBytes(), transaction.getSignature(), signatureCredential ); } } private static class PublicKeyValidator implements KeyValidator { private final AccountPublicKeyService accountPublicKeyService; public PublicKeyValidator(AccountPublicKeyService accountPublicKeyService) { this.accountPublicKeyService = accountPublicKeyService; } @Override public boolean validate(byte[] publicKey) { if (log.isTraceEnabled()) { log.trace("#MULTI_SIG# public key validation account={}", Convert2.rsAccount(AccountService.getId(publicKey))); } if (!accountPublicKeyService.setOrVerifyPublicKey(AccountService.getId(publicKey), publicKey)) { log.error("Public Key Verification failed: pk={}", Convert.toHexString(publicKey)); return false; } return true; } } >>>>>>> public boolean verifySignature(Transaction transaction) { return checkSignature(transaction) && accountPublicKeyService.setOrVerifyPublicKey(transaction.getSenderId(), transaction.getSenderPublicKey()); } public boolean checkSignature(Transaction transaction) { boolean hasValidSignature = transaction.hasValidSignature(); if (!hasValidSignature) { hasValidSignature = transaction.getSignature() != null && Crypto.verify(transaction.getSignature(), transaction.getUnsignedBytes(), transaction.getSenderPublicKey()); if (hasValidSignature) { transaction.withValidSignature(); } } return hasValidSignature; } public int getActualTransactionVersion() { return transactionVersionValidator.getActualVersion(); } public boolean isValidVersion(int transactionVersion) { return transactionVersionValidator.isValidVersion(transactionVersion); } public void checkVersion(int transactionVersion) { transactionVersionValidator.checkVersion(transactionVersion); } public boolean verifySignature(Transaction transaction) { Account sender = accountService.getAccount(transaction.getSenderId()); if (sender == null) { log.error("Sender account not found, senderId={}", transaction.getSenderId()); return false; } @ParentChildSpecific(ParentMarker.MULTI_SIGNATURE) Credential signatureCredential; SignatureVerifier signatureVerifier = SignatureToolFactory.selectValidator(transaction.getVersion()).orElseThrow(UnsupportedTransactionVersion::new); if (log.isTraceEnabled()) { log.trace("#MULTI_SIG# verify signature validator class={}", signatureVerifier.getClass().getName()); } if (sender.isChild()) { //multi-signature if (transaction.getVersion() < 2) { log.error("Inconsistent transaction fields, the value of the sender property 'parent' doesn't match the transaction version."); return false; } signatureCredential = new MultiSigCredential(2, accountService.getPublicKeyByteArray(sender.getParentId()), transaction.getSenderPublicKey() ); } else { //only one signer if (transaction.getVersion() < 2) { signatureCredential = new SignatureCredential(transaction.getSenderPublicKey()); } else { signatureCredential = new MultiSigCredential(transaction.getSenderPublicKey()); } } if (log.isTraceEnabled()) { log.trace("#MULTI_SIG# verify credential={}", signatureCredential); } if (!signatureCredential.validateCredential(keyValidator)) { return false; } if (transaction.getSignature() != null && transaction.getSignature().isVerified()) { return true; } else { if (log.isTraceEnabled()) { log.trace("#MULTI_SIG# verify signature={} publicKey={} document={}", Convert.toHexString(transaction.getSignature().bytes()), signatureCredential, Convert.toHexString(transaction.getUnsignedBytes())); } return signatureVerifier.verify( transaction.getUnsignedBytes(), transaction.getSignature(), signatureCredential ); } } private static class PublicKeyValidator implements KeyValidator { private final AccountPublicKeyService accountPublicKeyService; public PublicKeyValidator(AccountPublicKeyService accountPublicKeyService) { this.accountPublicKeyService = accountPublicKeyService; } @Override public boolean validate(byte[] publicKey) { if (log.isTraceEnabled()) { log.trace("#MULTI_SIG# public key validation account={}", Convert2.rsAccount(AccountService.getId(publicKey))); } if (!accountPublicKeyService.setOrVerifyPublicKey(AccountService.getId(publicKey), publicKey)) { log.error("Public Key Verification failed: pk={}", Convert.toHexString(publicKey)); return false; } return true; } }
<<<<<<< import com.apollocurrency.aplwallet.apl.core.service.appdata.TimeService; import com.apollocurrency.aplwallet.apl.core.service.appdata.impl.TimeServiceImpl; ======= import com.apollocurrency.aplwallet.apl.core.service.appdata.DatabaseManager; >>>>>>> import com.apollocurrency.aplwallet.apl.core.service.appdata.TimeService; import com.apollocurrency.aplwallet.apl.core.service.appdata.impl.TimeServiceImpl; import com.apollocurrency.aplwallet.apl.core.service.appdata.DatabaseManager; <<<<<<< .addBeans(MockBean.of(Mockito.mock(TimeService.class), TimeService.class, TimeServiceImpl.class)) .addBeans(MockBean.of(Mockito.mock(PropertiesHolder.class), PropertiesHolder.class)) .addBeans(MockBean.of(Mockito.mock(PrunableMessageService.class), PrunableMessageService.class, PrunableMessageServiceImpl.class)) ======= .addBeans(MockBean.of(databaseManager, DatabaseManager.class)) >>>>>>> .addBeans(MockBean.of(Mockito.mock(TimeService.class), TimeService.class, TimeServiceImpl.class)) .addBeans(MockBean.of(Mockito.mock(PropertiesHolder.class), PropertiesHolder.class)) .addBeans(MockBean.of(Mockito.mock(PrunableMessageService.class), PrunableMessageService.class, PrunableMessageServiceImpl.class)) .addBeans(MockBean.of(databaseManager, DatabaseManager.class))
<<<<<<< public PublicKey loadPublicKey(DbKey dbKey, int height) { PublicKey publicKey = getPublicKey(dbKey, height); ======= public PublicKey loadPublicKeyFromDb(DbKey dbKey, int height) { PublicKey publicKey = publicKeyTable.get(dbKey, height); >>>>>>> public PublicKey loadPublicKeyFromDb(DbKey dbKey, int height) { PublicKey publicKey = getPublicKey(dbKey, height); <<<<<<< } else if (publicKey.getHeight() >= blockChainInfoService.getHeight() - 1) { PublicKey dbPublicKey = loadPublicKey(account.getDbKey()); ======= } else if (publicKey.getHeight() >= blockchain.getHeight() - 1) { PublicKey dbPublicKey = loadPublicKeyFromDb(account.getDbKey()); >>>>>>> } else if (publicKey.getHeight() >= blockChainInfoService.getHeight() - 1) { PublicKey dbPublicKey = loadPublicKeyFromDb(account.getDbKey());
<<<<<<< return authString == null ? Authorizations.EMPTY : new Authorizations(authString.getBytes()); ======= return authString == null ? Constants.NO_AUTHS : new Authorizations(authString.getBytes(Constants.UTF8)); >>>>>>> return authString == null ? Authorizations.EMPTY : new Authorizations(authString.getBytes(Constants.UTF8)); <<<<<<< Text cf = new Text(idx < 0 ? Base64.decodeBase64(col.getBytes(Constants.UTF8)) : Base64.decodeBase64(col.substring(0, idx).getBytes(Constants.UTF8))); Text cq = idx < 0 ? null : new Text(Base64.decodeBase64(col.substring(idx + 1).getBytes())); ======= Text cf = new Text(idx < 0 ? Base64.decodeBase64(col.getBytes(Constants.UTF8)) : Base64.decodeBase64(col.substring(0, idx).getBytes(Constants.UTF8))); Text cq = idx < 0 ? null : new Text(Base64.decodeBase64(col.substring(idx + 1).getBytes(Constants.UTF8))); >>>>>>> Text cf = new Text(idx < 0 ? Base64.decodeBase64(col.getBytes(Constants.UTF8)) : Base64.decodeBase64(col.substring(0, idx).getBytes(Constants.UTF8))); Text cq = idx < 0 ? null : new Text(Base64.decodeBase64(col.substring(idx + 1).getBytes(Constants.UTF8))); <<<<<<< ======= /** * Gets a list of the iterator settings (for iterators to apply to a scanner) from this configuration. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @return a list of iterators * @since 1.5.0 * @see #addIterator(Class, Configuration, IteratorSetting) */ public static List<IteratorSetting> getIterators(Class<?> implementingClass, Configuration conf) { String iterators = conf.get(enumToConfKey(implementingClass, ScanOpts.ITERATORS)); // If no iterators are present, return an empty list if (iterators == null || iterators.isEmpty()) return new ArrayList<IteratorSetting>(); // Compose the set of iterators encoded in the job configuration StringTokenizer tokens = new StringTokenizer(iterators, StringUtils.COMMA_STR); List<IteratorSetting> list = new ArrayList<IteratorSetting>(); try { while (tokens.hasMoreTokens()) { String itstring = tokens.nextToken(); ByteArrayInputStream bais = new ByteArrayInputStream(Base64.decodeBase64(itstring.getBytes(Constants.UTF8))); list.add(new IteratorSetting(new DataInputStream(bais))); bais.close(); } } catch (IOException e) { throw new IllegalArgumentException("couldn't decode iterator settings"); } return list; } >>>>>>>
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.Fee; import com.apollocurrency.aplwallet.apl.core.app.Transaction; ======= import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.TransactionImpl; >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.Fee; import com.apollocurrency.aplwallet.apl.core.app.Transaction; import com.apollocurrency.aplwallet.apl.core.service.blockchain.Blockchain; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.TransactionImpl; <<<<<<< import com.apollocurrency.aplwallet.apl.core.model.account.LedgerEvent; ======= import com.apollocurrency.aplwallet.apl.core.entity.state.account.LedgerEvent; import com.apollocurrency.aplwallet.apl.core.monetary.MonetarySystem; import com.apollocurrency.aplwallet.apl.core.service.appdata.TimeService; import com.apollocurrency.aplwallet.apl.core.service.state.AliasService; import com.apollocurrency.aplwallet.apl.core.service.state.PhasingPollService; import com.apollocurrency.aplwallet.apl.core.service.state.PollService; import com.apollocurrency.aplwallet.apl.core.service.state.ShufflingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountAssetService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountControlPhasingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountCurrencyService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountInfoService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountLeaseService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountPropertyService; >>>>>>> import com.apollocurrency.aplwallet.apl.core.model.account.LedgerEvent; import com.apollocurrency.aplwallet.apl.core.entity.state.account.LedgerEvent; import com.apollocurrency.aplwallet.apl.core.monetary.MonetarySystem; import com.apollocurrency.aplwallet.apl.core.service.appdata.TimeService; import com.apollocurrency.aplwallet.apl.core.service.state.AliasService; import com.apollocurrency.aplwallet.apl.core.service.state.PhasingPollService; import com.apollocurrency.aplwallet.apl.core.service.state.PollService; import com.apollocurrency.aplwallet.apl.core.service.state.ShufflingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountAssetService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountControlPhasingService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountCurrencyService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountInfoService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountLeaseService; import com.apollocurrency.aplwallet.apl.core.service.state.account.AccountPropertyService;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; ======= import com.apollocurrency.aplwallet.apl.core.transaction.Payment; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionType; >>>>>>> import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; import com.apollocurrency.aplwallet.apl.core.transaction.Payment; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionType;
<<<<<<< ======= import java.nio.channels.ClosedChannelException; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; >>>>>>> <<<<<<< private final PropertiesHolder propertiesHolder; private AccountService accountService; private PeerInfo pi = new PeerInfo(); ======= private final PeersService peers; private final PeerInfo pi = new PeerInfo(); >>>>>>> private AccountService accountService; private final PeersService peers; private PeerInfo pi = new PeerInfo(); <<<<<<< PropertiesHolder propertiesHolder, PeerServlet peerServlet, AccountService accountService ======= PeerServlet peerServlet, PeersService peers >>>>>>> PeerServlet peerServlet, AccountService accountService, PeersService peers