Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pki - migrate to junit 5 #6235

Merged
merged 7 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ private List<TransactionProcessingResult> trace(
.orElse(BlobGas.ZERO));

final WorldUpdater worldUpdater = chainUpdater.getNextUpdater();
tracer.traceStartTransaction(worldUpdater, transaction);
final TransactionProcessingResult result =
transactionProcessor.processTransaction(
blockchain,
Expand All @@ -225,16 +224,6 @@ private List<TransactionProcessingResult> trace(
false,
blobGasPrice);

long transactionGasUsed = transaction.getGasLimit() - result.getGasRemaining();
tracer.traceEndTransaction(
worldUpdater,
transaction,
result.isSuccessful(),
result.getOutput(),
result.getLogs(),
transactionGasUsed,
0);

results.add(result);
});

Expand Down
2 changes: 1 addition & 1 deletion besu/src/test/java/org/hyperledger/besu/PrivacyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class PrivacyTest {

private final Vertx vertx = Vertx.vertx();

@TempDir private static Path dataDir;
@TempDir private Path dataDir;

@AfterEach
public void cleanUp() {
Expand Down
1 change: 0 additions & 1 deletion crypto/algorithms/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ dependencies {
implementation 'org.hyperledger.besu:blake2bf'
implementation 'com.google.guava:guava'

testImplementation 'junit:junit'
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.junit.jupiter:junit-jupiter'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.security.spec.ECPoint;

import org.apache.tuweni.bytes.Bytes;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class ECPointUtilTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.apache.tuweni.bytes.Bytes;
import org.bouncycastle.util.encoders.Hex;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class HashTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.bouncycastle.asn1.x9.X9ECParameters;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

public class KeyPairTest {
public static final String ALGORITHM = SignatureAlgorithm.ALGORITHM;
Expand All @@ -39,7 +39,7 @@ public class KeyPairTest {
public static KeyPairGenerator keyPairGenerator;
public static ECDomainParameters curve;

@BeforeClass
@BeforeAll
public static void setUp() {
Security.addProvider(new BouncyCastleProvider());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import java.io.File;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class KeyPairUtilTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class SECP256K1Test {

Expand All @@ -39,15 +39,15 @@ public class SECP256K1Test {
protected static String suiteStartTime = null;
protected static String suiteName = null;

@BeforeClass
@BeforeAll
public static void setTestSuiteStartTime() {
suiteStartTime =
LocalDateTime.now(ZoneId.systemDefault())
.format(DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss"));
suiteName(SECP256K1Test.class);
}

@Before
@BeforeEach
public void setUp() {
secp256K1 = new SECP256K1();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@

import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class SECP256R1Test {

Expand Down Expand Up @@ -103,7 +103,7 @@ public class SECP256R1Test {
protected static String suiteStartTime = null;
protected static String suiteName = null;

@BeforeClass
@BeforeAll
public static void setTestSuiteStartTime() {
suiteStartTime =
LocalDateTime.now(ZoneId.systemDefault())
Expand All @@ -113,7 +113,7 @@ public static void setTestSuiteStartTime() {
SignatureAlgorithmFactory.setInstance(SignatureAlgorithmType.create("secp256r1"));
}

@Before
@BeforeEach
public void setUp() {
secp256R1 = new SECP256R1();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import org.bouncycastle.asn1.sec.SECNamedCurves;
import org.bouncycastle.asn1.x9.X9ECParameters;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

public class SECPPrivateKeyTest {
public static final String ALGORITHM = SignatureAlgorithm.ALGORITHM;
Expand All @@ -40,7 +40,7 @@ public class SECPPrivateKeyTest {
protected static String suiteName = null;
public static ECDomainParameters curve;

@BeforeClass
@BeforeAll
public static void setUp() {
suiteStartTime =
LocalDateTime.now(ZoneId.systemDefault())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
import org.bouncycastle.asn1.sec.SECNamedCurves;
import org.bouncycastle.asn1.x9.X9ECParameters;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class SECPPublicKeyTest {
public static final String ALGORITHM = SignatureAlgorithm.ALGORITHM;
public static final String CURVE_NAME = "secp256k1";

public ECDomainParameters curve;

@Before
@BeforeEach
public void setUp() {
final X9ECParameters params = SECNamedCurves.getByName(CURVE_NAME);
curve = new ECDomainParameters(params.getCurve(), params.getG(), params.getN(), params.getH());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
import org.bouncycastle.asn1.sec.SECNamedCurves;
import org.bouncycastle.asn1.x9.X9ECParameters;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

public class SECPSignatureTest {
public static final String CURVE_NAME = "secp256k1";

public static BigInteger curveOrder;

@BeforeClass
@BeforeAll
public static void setUp() {
final X9ECParameters params = SECNamedCurves.getByName(CURVE_NAME);
final ECDomainParameters curve =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class SignatureAlgorithmFactoryTest {

@Before
@BeforeEach
public void setUp() {
SignatureAlgorithmFactory.resetInstance();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class SignatureAlgorithmTypeTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.math.BigInteger;

import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Adapted from the pc_ecc (Apache 2 License) implementation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.math.BigInteger;

import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Adapted from the pc_ecc (Apache 2 License) implementation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.math.BigInteger;

import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Adapted from the pc_ecc (Apache 2 License) implementation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.math.BigInteger;

import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Adapted from the pc_ecc (Apache 2 License) implementation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Adapted from the pc_ecc (Apache 2 License) implementation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.math.BigInteger;

import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Adapted from the pc_ecc (Apache 2 License) implementation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.math.BigInteger;

import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Adapted from the pc_ecc (Apache 2 License) implementation:
Expand Down
2 changes: 0 additions & 2 deletions docker/openjdk-17-debug/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ ENV BESU_GRAPHQL_HTTP_HOST 0.0.0.0
ENV BESU_METRICS_HOST 0.0.0.0
ENV BESU_JMX_HOST 0.0.0.0
ENV BESU_PID_PATH "/tmp/pid"
ENV BESU_HOST_ALLOWLIST "*"

#debug options for maximum observability
ENV BESU_LOGGING "INFO"
ENV BESU_RPC_HTTP_API "ETH,NET,TRACE,DEBUG,ADMIN,TXPOOL"
ENV JDWP_OPTS "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
ENV JAVA_OPTS "${JDWP_OPTS} "

Expand Down
3 changes: 1 addition & 2 deletions pki/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ dependencies {
implementation 'io.tmio:tuweni-bytes'
implementation 'org.bouncycastle:bcpkix-jdk18on'

testImplementation 'junit:junit'
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.mockito:mockito-junit-jupiter'

testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}
Expand Down
Loading
Loading