forked from Qortal/qortal
Migration to Java 11
Updated pom.xml. Updated dependencies, including various minor code mods, esp. bitcoin-related. Starts up and talks to Java 8 nodes! Dev environment should be at least Eclipse 4.11 with m2e 1.9.1+
This commit is contained in:
parent
b95eea6763
commit
568a1f8a30
54
pom.xml
54
pom.xml
@ -6,20 +6,23 @@
|
|||||||
<version>0.9</version>
|
<version>0.9</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<bitcoin.version>0.15.4</bitcoin.version>
|
||||||
<bouncycastle.version>1.61</bouncycastle.version>
|
<bouncycastle.version>1.63</bouncycastle.version>
|
||||||
<dagger.version>1.2.2</dagger.version>
|
|
||||||
<hsqldb.version>2.5.0</hsqldb.version>
|
|
||||||
<sqltool.version>2.4.1</sqltool.version>
|
|
||||||
<jetty.version>9.4.17.v20190418</jetty.version>
|
|
||||||
<jersey.version>2.27</jersey.version>
|
|
||||||
<log4j.version>2.11.0</log4j.version>
|
|
||||||
<slf4j.version>1.7.12</slf4j.version>
|
|
||||||
<swagger-api.version>2.0.6</swagger-api.version>
|
|
||||||
<swagger-ui.version>3.19.0</swagger-ui.version>
|
|
||||||
<felix-bundle-plugin.version>3.5.0</felix-bundle-plugin.version>
|
|
||||||
<package-info-maven-plugin.version>1.1.0</package-info-maven-plugin.version>
|
|
||||||
<build.timestamp>${maven.build.timestamp}</build.timestamp>
|
<build.timestamp>${maven.build.timestamp}</build.timestamp>
|
||||||
|
<commons-net.version>3.6</commons-net.version>
|
||||||
|
<commons-text.version>1.8</commons-text.version>
|
||||||
|
<dagger.version>1.2.2</dagger.version>
|
||||||
|
<guava.version>28.1-jre</guava.version>
|
||||||
|
<hsqldb.version>2.5.0</hsqldb.version>
|
||||||
|
<hsqldb-sqltool.version>2.5.0</hsqldb-sqltool.version>
|
||||||
|
<jersey.version>2.29.1</jersey.version>
|
||||||
|
<jetty.version>9.4.20.v20190813</jetty.version>
|
||||||
|
<log4j.version>2.12.1</log4j.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<slf4j.version>1.7.12</slf4j.version>
|
||||||
|
<swagger-api.version>2.0.9</swagger-api.version>
|
||||||
|
<swagger-ui.version>3.23.8</swagger-ui.version>
|
||||||
|
<package-info-maven-plugin.version>1.1.0</package-info-maven-plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src/main/java</sourceDirectory>
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
@ -32,11 +35,18 @@
|
|||||||
</resources>
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<version>3.5.1</version>
|
<artifactId>versions-maven-plugin</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<generateBackupPoms>false</generateBackupPoms>
|
||||||
<target>1.8</target>
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.0</version>
|
||||||
|
<configuration>
|
||||||
|
<release>11</release>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- unpack swagger-ui to target folder -->
|
<!-- unpack swagger-ui to target folder -->
|
||||||
@ -309,7 +319,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hsqldb</groupId>
|
<groupId>org.hsqldb</groupId>
|
||||||
<artifactId>sqltool</artifactId>
|
<artifactId>sqltool</artifactId>
|
||||||
<version>${sqltool.version}</version>
|
<version>${hsqldb-sqltool.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- CIYAM AT (automated transactions) -->
|
<!-- CIYAM AT (automated transactions) -->
|
||||||
@ -322,7 +332,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bitcoinj</groupId>
|
<groupId>org.bitcoinj</groupId>
|
||||||
<artifactId>bitcoinj-core</artifactId>
|
<artifactId>bitcoinj-core</artifactId>
|
||||||
<version>0.14.7</version>
|
<version>${bitcoin.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Utilities -->
|
<!-- Utilities -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -333,7 +343,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-text</artifactId>
|
<artifactId>commons-text</artifactId>
|
||||||
<version>1.4</version>
|
<version>${commons-text.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- For bitset/bitmap compression -->
|
<!-- For bitset/bitmap compression -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -356,12 +366,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-net</groupId>
|
<groupId>commons-net</groupId>
|
||||||
<artifactId>commons-net</artifactId>
|
<artifactId>commons-net</artifactId>
|
||||||
<version>3.3</version>
|
<version>${commons-net.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>25.0-jre</version>
|
<version>${guava.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Logging: log4j2 -->
|
<!-- Logging: log4j2 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -226,7 +226,7 @@ public class BTC {
|
|||||||
protected Wallet createEmptyWallet() {
|
protected Wallet createEmptyWallet() {
|
||||||
ECKey dummyKey = new ECKey();
|
ECKey dummyKey = new ECKey();
|
||||||
|
|
||||||
KeyChainGroup keyChainGroup = new KeyChainGroup(params);
|
KeyChainGroup keyChainGroup = KeyChainGroup.createBasic(params);
|
||||||
keyChainGroup.importKeys(dummyKey);
|
keyChainGroup.importKeys(dummyKey);
|
||||||
|
|
||||||
Wallet wallet = new Wallet(params, keyChainGroup);
|
Wallet wallet = new Wallet(params, keyChainGroup);
|
||||||
@ -242,12 +242,12 @@ public class BTC {
|
|||||||
WalletCoinsReceivedEventListener coinsReceivedListener = new WalletCoinsReceivedEventListener() {
|
WalletCoinsReceivedEventListener coinsReceivedListener = new WalletCoinsReceivedEventListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||||
System.out.println("Coins received via transaction " + tx.getHashAsString());
|
System.out.println("Coins received via transaction " + tx.getTxId().toString());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
wallet.addCoinsReceivedEventListener(coinsReceivedListener);
|
wallet.addCoinsReceivedEventListener(coinsReceivedListener);
|
||||||
|
|
||||||
Address address = Address.fromBase58(params, base58Address);
|
Address address = Address.fromString(params, base58Address);
|
||||||
wallet.addWatchedAddress(address, startTime);
|
wallet.addWatchedAddress(address, startTime);
|
||||||
|
|
||||||
StoredBlock checkpoint = manager.getCheckpointBefore(startTime);
|
StoredBlock checkpoint = manager.getCheckpointBefore(startTime);
|
||||||
|
@ -385,7 +385,6 @@ public class HSQLDBRepository implements Repository {
|
|||||||
* @return ResultSet, or null if there are no found rows
|
* @return ResultSet, or null if there are no found rows
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("resource")
|
|
||||||
public ResultSet checkedExecute(String sql, Object... objects) throws SQLException {
|
public ResultSet checkedExecute(String sql, Object... objects) throws SQLException {
|
||||||
PreparedStatement preparedStatement = this.prepareStatement(sql);
|
PreparedStatement preparedStatement = this.prepareStatement(sql);
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package org.qora.transaction;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.math.MathContext;
|
import java.math.MathContext;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -347,7 +348,7 @@ public abstract class Transaction {
|
|||||||
if (recommendedFee.compareTo(BlockChain.getInstance().getUnitFee()) <= 0) {
|
if (recommendedFee.compareTo(BlockChain.getInstance().getUnitFee()) <= 0) {
|
||||||
recommendedFee = BlockChain.getInstance().getUnitFee();
|
recommendedFee = BlockChain.getInstance().getUnitFee();
|
||||||
} else {
|
} else {
|
||||||
recommendedFee = recommendedFee.setScale(0, BigDecimal.ROUND_UP);
|
recommendedFee = recommendedFee.setScale(0, RoundingMode.CEILING);
|
||||||
}
|
}
|
||||||
|
|
||||||
return recommendedFee.setScale(8);
|
return recommendedFee.setScale(8);
|
||||||
|
@ -13,6 +13,7 @@ import org.bitcoinj.core.Address;
|
|||||||
import org.bitcoinj.core.Coin;
|
import org.bitcoinj.core.Coin;
|
||||||
import org.bitcoinj.core.ECKey;
|
import org.bitcoinj.core.ECKey;
|
||||||
import org.bitcoinj.core.InsufficientMoneyException;
|
import org.bitcoinj.core.InsufficientMoneyException;
|
||||||
|
import org.bitcoinj.core.LegacyAddress;
|
||||||
import org.bitcoinj.core.NetworkParameters;
|
import org.bitcoinj.core.NetworkParameters;
|
||||||
import org.bitcoinj.core.Sha256Hash;
|
import org.bitcoinj.core.Sha256Hash;
|
||||||
import org.bitcoinj.core.Transaction;
|
import org.bitcoinj.core.Transaction;
|
||||||
@ -24,6 +25,7 @@ import org.bitcoinj.crypto.TransactionSignature;
|
|||||||
import org.bitcoinj.kits.WalletAppKit;
|
import org.bitcoinj.kits.WalletAppKit;
|
||||||
import org.bitcoinj.params.TestNet3Params;
|
import org.bitcoinj.params.TestNet3Params;
|
||||||
import org.bitcoinj.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
|
import org.bitcoinj.script.Script.ScriptType;
|
||||||
import org.bitcoinj.script.ScriptBuilder;
|
import org.bitcoinj.script.ScriptBuilder;
|
||||||
import org.bitcoinj.script.ScriptChunk;
|
import org.bitcoinj.script.ScriptChunk;
|
||||||
import org.bitcoinj.script.ScriptOpCodes;
|
import org.bitcoinj.script.ScriptOpCodes;
|
||||||
@ -120,11 +122,11 @@ public class BTCACCTTests {
|
|||||||
kit.wallet().importKey(recipientKey);
|
kit.wallet().importKey(recipientKey);
|
||||||
|
|
||||||
byte[] senderPubKey = senderKey.getPubKey();
|
byte[] senderPubKey = senderKey.getPubKey();
|
||||||
System.out.println("Sender address: " + senderKey.toAddress(params).toBase58());
|
System.out.println("Sender address: " + Address.fromKey(params, senderKey, ScriptType.P2PKH).toString());
|
||||||
System.out.println("Sender pubkey: " + HashCode.fromBytes(senderPubKey).toString());
|
System.out.println("Sender pubkey: " + HashCode.fromBytes(senderPubKey).toString());
|
||||||
|
|
||||||
byte[] recipientPubKey = recipientKey.getPubKey();
|
byte[] recipientPubKey = recipientKey.getPubKey();
|
||||||
System.out.println("Recipient address: " + recipientKey.toAddress(params).toBase58());
|
System.out.println("Recipient address: " + Address.fromKey(params, recipientKey, ScriptType.P2PKH).toString());
|
||||||
System.out.println("Recipient pubkey: " + HashCode.fromBytes(recipientPubKey).toString());
|
System.out.println("Recipient pubkey: " + HashCode.fromBytes(recipientPubKey).toString());
|
||||||
|
|
||||||
byte[] redeemScriptBytes = buildRedeemScript(secret, senderPubKey, recipientPubKey, lockTime);
|
byte[] redeemScriptBytes = buildRedeemScript(secret, senderPubKey, recipientPubKey, lockTime);
|
||||||
@ -132,20 +134,20 @@ public class BTCACCTTests {
|
|||||||
|
|
||||||
byte[] redeemScriptHash = hash160(redeemScriptBytes);
|
byte[] redeemScriptHash = hash160(redeemScriptBytes);
|
||||||
|
|
||||||
Address p2shAddress = Address.fromP2SHHash(params, redeemScriptHash);
|
Address p2shAddress = LegacyAddress.fromScriptHash(params, redeemScriptHash);
|
||||||
System.out.println("P2SH address: " + p2shAddress.toBase58());
|
System.out.println("P2SH address: " + p2shAddress.toString());
|
||||||
|
|
||||||
// Send amount to P2SH address
|
// Send amount to P2SH address
|
||||||
Transaction fundingTransaction = buildFundingTransaction(params, Sha256Hash.wrap(prevTxHash), prevTxOutputIndex, prevTxBalance, senderKey,
|
Transaction fundingTransaction = buildFundingTransaction(params, Sha256Hash.wrap(prevTxHash), prevTxOutputIndex, prevTxBalance, senderKey,
|
||||||
sendValue.add(fee), redeemScriptHash);
|
sendValue.add(fee), redeemScriptHash);
|
||||||
|
|
||||||
System.out.println("Sending " + sendValue.add(fee).toPlainString() + " to " + p2shAddress.toBase58());
|
System.out.println("Sending " + sendValue.add(fee).toPlainString() + " to " + p2shAddress.toString());
|
||||||
if (!usePreviousFundingTx)
|
if (!usePreviousFundingTx)
|
||||||
broadcastWithConfirmation(kit, fundingTransaction);
|
broadcastWithConfirmation(kit, fundingTransaction);
|
||||||
|
|
||||||
if (doRefundNotRedeem) {
|
if (doRefundNotRedeem) {
|
||||||
// Refund
|
// Refund
|
||||||
System.out.println("Refunding " + sendValue.toPlainString() + " back to " + senderKey.toAddress(params));
|
System.out.println("Refunding " + sendValue.toPlainString() + " back to " + Address.fromKey(params, senderKey, ScriptType.P2PKH).toString());
|
||||||
|
|
||||||
now = System.currentTimeMillis() / 1000L;
|
now = System.currentTimeMillis() / 1000L;
|
||||||
long refundLockTime = now - 60 * 30; // 30 minutes in the past, needs to before 'now' and before "median block time" (median of previous 11 block
|
long refundLockTime = now - 60 * 30; // 30 minutes in the past, needs to before 'now' and before "median block time" (median of previous 11 block
|
||||||
@ -158,7 +160,7 @@ public class BTCACCTTests {
|
|||||||
broadcastWithConfirmation(kit, refundTransaction);
|
broadcastWithConfirmation(kit, refundTransaction);
|
||||||
} else {
|
} else {
|
||||||
// Redeem
|
// Redeem
|
||||||
System.out.println("Redeeming " + sendValue.toPlainString() + " to " + recipientKey.toAddress(params));
|
System.out.println("Redeeming " + sendValue.toPlainString() + " to " + Address.fromKey(params, recipientKey, ScriptType.P2PKH).toString());
|
||||||
|
|
||||||
TransactionOutPoint fundingOutPoint = new TransactionOutPoint(params, 0, fundingTransaction);
|
TransactionOutPoint fundingOutPoint = new TransactionOutPoint(params, 0, fundingTransaction);
|
||||||
Transaction redeemTransaction = buildRedeemTransaction(params, fundingOutPoint, recipientKey, sendValue, secret, redeemScriptBytes);
|
Transaction redeemTransaction = buildRedeemTransaction(params, fundingOutPoint, recipientKey, sendValue, secret, redeemScriptBytes);
|
||||||
@ -168,7 +170,7 @@ public class BTCACCTTests {
|
|||||||
kit.wallet().cleanup();
|
kit.wallet().cleanup();
|
||||||
|
|
||||||
for (Transaction transaction : kit.wallet().getTransactionPool(Pool.PENDING).values())
|
for (Transaction transaction : kit.wallet().getTransactionPool(Pool.PENDING).values())
|
||||||
System.out.println("Pending tx: " + transaction.getHashAsString());
|
System.out.println("Pending tx: " + transaction.getTxId().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final byte[] redeemScript1 = HashCode.fromString("76a820").asBytes();
|
private static final byte[] redeemScript1 = HashCode.fromString("76a820").asBytes();
|
||||||
@ -211,11 +213,11 @@ public class BTCACCTTests {
|
|||||||
// Fixed amount to P2SH
|
// Fixed amount to P2SH
|
||||||
fundingTransaction.addOutput(value, ScriptBuilder.createP2SHOutputScript(redeemScriptHash));
|
fundingTransaction.addOutput(value, ScriptBuilder.createP2SHOutputScript(redeemScriptHash));
|
||||||
// Change to sender
|
// Change to sender
|
||||||
fundingTransaction.addOutput(balance.minus(value).minus(fee), ScriptBuilder.createOutputScript(sigKey.toAddress(params)));
|
fundingTransaction.addOutput(balance.minus(value).minus(fee), ScriptBuilder.createOutputScript(Address.fromKey(params, sigKey, ScriptType.P2PKH)));
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
// We create fake "to address" scriptPubKey for prev tx so our spending input is P2PKH type
|
// We create fake "to address" scriptPubKey for prev tx so our spending input is P2PKH type
|
||||||
Script fakeScriptPubKey = ScriptBuilder.createOutputScript(sigKey.toAddress(params));
|
Script fakeScriptPubKey = ScriptBuilder.createOutputScript(Address.fromKey(params, sigKey, ScriptType.P2PKH));
|
||||||
TransactionOutPoint prevOut = new TransactionOutPoint(params, outputIndex, prevTxHash);
|
TransactionOutPoint prevOut = new TransactionOutPoint(params, outputIndex, prevTxHash);
|
||||||
fundingTransaction.addSignedInput(prevOut, fakeScriptPubKey, sigKey);
|
fundingTransaction.addSignedInput(prevOut, fakeScriptPubKey, sigKey);
|
||||||
|
|
||||||
@ -228,7 +230,7 @@ public class BTCACCTTests {
|
|||||||
redeemTransaction.setVersion(2);
|
redeemTransaction.setVersion(2);
|
||||||
|
|
||||||
// Outputs
|
// Outputs
|
||||||
redeemTransaction.addOutput(value, ScriptBuilder.createOutputScript(recipientKey.toAddress(params)));
|
redeemTransaction.addOutput(value, ScriptBuilder.createOutputScript(Address.fromKey(params, recipientKey, ScriptType.P2PKH)));
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
byte[] recipientPubKey = recipientKey.getPubKey();
|
byte[] recipientPubKey = recipientKey.getPubKey();
|
||||||
@ -265,7 +267,7 @@ public class BTCACCTTests {
|
|||||||
refundTransaction.setVersion(2);
|
refundTransaction.setVersion(2);
|
||||||
|
|
||||||
// Outputs
|
// Outputs
|
||||||
refundTransaction.addOutput(value, ScriptBuilder.createOutputScript(senderKey.toAddress(params)));
|
refundTransaction.addOutput(value, ScriptBuilder.createOutputScript(Address.fromKey(params, senderKey, ScriptType.P2PKH)));
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
byte[] recipientPubKey = senderKey.getPubKey();
|
byte[] recipientPubKey = senderKey.getPubKey();
|
||||||
@ -299,7 +301,7 @@ public class BTCACCTTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void broadcastWithConfirmation(WalletAppKit kit, Transaction transaction) {
|
private void broadcastWithConfirmation(WalletAppKit kit, Transaction transaction) {
|
||||||
System.out.println("Broadcasting tx: " + transaction.getHashAsString());
|
System.out.println("Broadcasting tx: " + transaction.getTxId().toString());
|
||||||
System.out.println("TX hex: " + HashCode.fromBytes(transaction.bitcoinSerialize()).toString());
|
System.out.println("TX hex: " + HashCode.fromBytes(transaction.bitcoinSerialize()).toString());
|
||||||
|
|
||||||
System.out.println("Number of connected peers: " + kit.peerGroup().numConnectedPeers());
|
System.out.println("Number of connected peers: " + kit.peerGroup().numConnectedPeers());
|
||||||
@ -312,7 +314,7 @@ public class BTCACCTTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// wait for confirmation
|
// wait for confirmation
|
||||||
System.out.println("Waiting for confirmation of tx: " + transaction.getHashAsString());
|
System.out.println("Waiting for confirmation of tx: " + transaction.getTxId().toString());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
transaction.getConfidence().getDepthFuture(1).get();
|
transaction.getConfidence().getDepthFuture(1).get();
|
||||||
@ -320,7 +322,7 @@ public class BTCACCTTests {
|
|||||||
throw new RuntimeException("Transaction confirmation failed", e);
|
throw new RuntimeException("Transaction confirmation failed", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Confirmed tx: " + transaction.getHashAsString());
|
System.out.println("Confirmed tx: " + transaction.getTxId().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convert int to little-endian byte array */
|
/** Convert int to little-endian byte array */
|
||||||
|
@ -78,6 +78,7 @@ public class ByteArrayTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@SuppressWarnings("unlikely-arg-type")
|
||||||
public void testCompareBoxedWithPrimitive() {
|
public void testCompareBoxedWithPrimitive() {
|
||||||
byte[] testValue = testValues.get(0);
|
byte[] testValue = testValues.get(0);
|
||||||
ByteArray ba1 = new ByteArray(testValue);
|
ByteArray ba1 = new ByteArray(testValue);
|
||||||
@ -90,6 +91,7 @@ public class ByteArrayTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@SuppressWarnings("unlikely-arg-type")
|
||||||
public void testMapContainsKey() {
|
public void testMapContainsKey() {
|
||||||
Map<ByteArray, String> testMap = new HashMap<>();
|
Map<ByteArray, String> testMap = new HashMap<>();
|
||||||
fillMap(testMap);
|
fillMap(testMap);
|
||||||
|
@ -34,7 +34,7 @@ public class ApiCommon extends Common {
|
|||||||
|
|
||||||
public static Object buildResource(Class<?> resourceClass) {
|
public static Object buildResource(Class<?> resourceClass) {
|
||||||
try {
|
try {
|
||||||
Object resource = resourceClass.newInstance();
|
Object resource = resourceClass.getDeclaredConstructor().newInstance();
|
||||||
|
|
||||||
Field requestField = resourceClass.getDeclaredField("request");
|
Field requestField = resourceClass.getDeclaredField("request");
|
||||||
requestField.setAccessible(true);
|
requestField.setAccessible(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user