diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/main/java/linea/plugin/acc/test/utils/MemoryAppender.java b/besu-plugins/linea-sequencer/acceptance-tests/src/main/java/linea/plugin/acc/test/utils/MemoryAppender.java index f81a2fce..8bb4958b 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/main/java/linea/plugin/acc/test/utils/MemoryAppender.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/main/java/linea/plugin/acc/test/utils/MemoryAppender.java @@ -17,7 +17,6 @@ package linea.plugin.acc.test.utils; import java.io.ByteArrayOutputStream; import java.io.Serializable; import java.nio.charset.StandardCharsets; - import lombok.SneakyThrows; import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.Core; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/BlockGasLimitTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/BlockGasLimitTest.java index b1decd2c..848a066e 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/BlockGasLimitTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/BlockGasLimitTest.java @@ -16,7 +16,6 @@ package linea.plugin.acc.test; import java.math.BigInteger; import java.util.List; - import org.hyperledger.besu.tests.acceptance.dsl.account.Accounts; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/EcDataLimitsTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/EcDataLimitsTest.java index 52bb7c17..a8907fc1 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/EcDataLimitsTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/EcDataLimitsTest.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.Map; import java.util.function.BiFunction; import java.util.stream.Stream; - import linea.plugin.acc.test.tests.web3j.generated.EcAdd; import linea.plugin.acc.test.tests.web3j.generated.EcMul; import linea.plugin.acc.test.tests.web3j.generated.EcPairing; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/ExamplePragueTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/ExamplePragueTest.java index c78cd8f2..05beb1c1 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/ExamplePragueTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/ExamplePragueTest.java @@ -15,7 +15,6 @@ package linea.plugin.acc.test; import java.math.BigInteger; - import org.hyperledger.besu.tests.acceptance.dsl.account.Accounts; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/ExcludedPrecompilesTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/ExcludedPrecompilesTest.java index 206ebe3d..10d9fa9d 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/ExcludedPrecompilesTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/ExcludedPrecompilesTest.java @@ -21,7 +21,6 @@ import java.math.BigInteger; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; - import linea.plugin.acc.test.tests.web3j.generated.ExcludedPrecompiles; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/LineaPluginTestBase.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/LineaPluginTestBase.java index 59b59a90..8a14604d 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/LineaPluginTestBase.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/LineaPluginTestBase.java @@ -20,6 +20,9 @@ import static net.consensys.linea.metrics.LineaMetricCategory.SEQUENCER_PROFITAB import static net.consensys.linea.metrics.LineaMetricCategory.TX_POOL_PROFITABILITY; import static org.assertj.core.api.Assertions.*; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.IOException; import java.math.BigInteger; import java.net.URI; @@ -36,10 +39,6 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; import linea.plugin.acc.test.tests.web3j.generated.AcceptanceTestToken; import linea.plugin.acc.test.tests.web3j.generated.DummyAdder; import linea.plugin.acc.test.tests.web3j.generated.EcAdd; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/LineaPluginTestBasePrague.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/LineaPluginTestBasePrague.java index f917924a..80268dbc 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/LineaPluginTestBasePrague.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/LineaPluginTestBasePrague.java @@ -15,14 +15,13 @@ package linea.plugin.acc.test; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.util.Collection; import java.util.List; import java.util.Set; import java.util.stream.Collectors; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.hyperledger.besu.consensus.clique.CliqueExtraData; import org.hyperledger.besu.datatypes.Address; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/ProfitableTransactionTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/ProfitableTransactionTest.java index ca2cf265..ae5b339a 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/ProfitableTransactionTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/ProfitableTransactionTest.java @@ -16,7 +16,6 @@ package linea.plugin.acc.test; import java.math.BigInteger; import java.util.List; - import org.bouncycastle.crypto.digests.KeccakDigest; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.tests.acceptance.dsl.account.Account; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TestCommandLineOptionsBuilder.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TestCommandLineOptionsBuilder.java index 138ca23e..1a99fb71 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TestCommandLineOptionsBuilder.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TestCommandLineOptionsBuilder.java @@ -19,7 +19,6 @@ import static linea.plugin.acc.test.LineaPluginTestBase.getResourcePath; import java.util.ArrayList; import java.util.List; import java.util.Properties; - import org.web3j.tx.gas.DefaultGasProvider; /** This class is used to build a list of command line options for testing. */ diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionCallDataSizeLimitTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionCallDataSizeLimitTest.java index ba14f97e..3fb063ce 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionCallDataSizeLimitTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionCallDataSizeLimitTest.java @@ -19,7 +19,6 @@ import static org.assertj.core.api.Assertions.assertThat; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; - import linea.plugin.acc.test.tests.web3j.generated.SimpleStorage; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.tests.acceptance.dsl.account.Account; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionGasLimitTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionGasLimitTest.java index 41b46ca2..88db3bd0 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionGasLimitTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionGasLimitTest.java @@ -19,7 +19,6 @@ import static org.assertj.core.api.Assertions.assertThat; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; - import linea.plugin.acc.test.tests.web3j.generated.SimpleStorage; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.tests.acceptance.dsl.account.Account; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionPoolDenialTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionPoolDenialTest.java index 3e539db6..62dd10c8 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionPoolDenialTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionPoolDenialTest.java @@ -20,7 +20,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.math.BigInteger; import java.util.List; import java.util.stream.IntStream; - import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.tests.acceptance.dsl.account.Accounts; import org.junit.jupiter.api.Test; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionTraceLimitOverflowTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionTraceLimitOverflowTest.java index 6965173e..2249c8d9 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionTraceLimitOverflowTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionTraceLimitOverflowTest.java @@ -17,7 +17,6 @@ package linea.plugin.acc.test; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; - import linea.plugin.acc.test.tests.web3j.generated.DummyAdder; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.tests.acceptance.dsl.account.Account; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionTraceLimitTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionTraceLimitTest.java index 30b32b9c..b02a1e6e 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionTraceLimitTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/TransactionTraceLimitTest.java @@ -17,7 +17,6 @@ package linea.plugin.acc.test; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; - import linea.plugin.acc.test.tests.web3j.generated.DummyAdder; import org.hyperledger.besu.tests.acceptance.dsl.account.Accounts; import org.junit.jupiter.api.Test; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/extradata/ExtraDataPricingTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/extradata/ExtraDataPricingTest.java index fce533ba..02bca7f7 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/extradata/ExtraDataPricingTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/extradata/ExtraDataPricingTest.java @@ -21,7 +21,6 @@ import static org.assertj.core.api.Assertions.assertThat; import java.io.IOException; import java.math.BigInteger; import java.util.List; - import linea.plugin.acc.test.LineaPluginTestBase; import linea.plugin.acc.test.TestCommandLineOptionsBuilder; import org.apache.tuweni.bytes.Bytes32; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/extradata/ExtraDataPricingTestWithoutSetMinGasPrice.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/extradata/ExtraDataPricingTestWithoutSetMinGasPrice.java index 7856c40a..72b70b43 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/extradata/ExtraDataPricingTestWithoutSetMinGasPrice.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/extradata/ExtraDataPricingTestWithoutSetMinGasPrice.java @@ -17,7 +17,6 @@ package linea.plugin.acc.test.extradata; import static org.assertj.core.api.Assertions.assertThat; import java.util.List; - import linea.plugin.acc.test.TestCommandLineOptionsBuilder; import org.hyperledger.besu.tests.acceptance.dsl.account.Account; import org.hyperledger.besu.tests.acceptance.dsl.transaction.account.TransferTransaction; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/extradata/StartupExtraDataPricingTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/extradata/StartupExtraDataPricingTest.java index f9719eaa..b8d53ed1 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/extradata/StartupExtraDataPricingTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/extradata/StartupExtraDataPricingTest.java @@ -18,7 +18,6 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.List; import java.util.Optional; - import linea.plugin.acc.test.LineaPluginTestBase; import linea.plugin.acc.test.TestCommandLineOptionsBuilder; import org.apache.tuweni.bytes.Bytes32; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/AbstractSendBundleTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/AbstractSendBundleTest.java index 47fe21ba..e62ef178 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/AbstractSendBundleTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/AbstractSendBundleTest.java @@ -19,7 +19,6 @@ import static org.web3j.crypto.Hash.sha3; import java.io.IOException; import java.math.BigInteger; import java.util.Arrays; - import linea.plugin.acc.test.LineaPluginTestBase; import linea.plugin.acc.test.tests.web3j.generated.AcceptanceTestToken; import linea.plugin.acc.test.tests.web3j.generated.MulmodExecutor; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasCompatibilityModeTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasCompatibilityModeTest.java index 9fcf28fe..a0b86399 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasCompatibilityModeTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasCompatibilityModeTest.java @@ -19,7 +19,6 @@ import static org.assertj.core.api.Assertions.assertThat; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.List; - import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.tests.acceptance.dsl.account.Account; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasModuleLimitOverflowTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasModuleLimitOverflowTest.java index 8100bd15..5d33b9f3 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasModuleLimitOverflowTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasModuleLimitOverflowTest.java @@ -18,7 +18,6 @@ import static org.assertj.core.api.Assertions.assertThat; import java.math.BigInteger; import java.util.List; - import linea.plugin.acc.test.LineaPluginTestBase; import linea.plugin.acc.test.TestCommandLineOptionsBuilder; import linea.plugin.acc.test.tests.web3j.generated.DummyAdder; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasTest.java index 9966dc86..b0c6e550 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasTest.java @@ -17,6 +17,7 @@ package linea.plugin.acc.test.rpc.linea; import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; import static org.assertj.core.api.Assertions.assertThat; +import com.fasterxml.jackson.annotation.JsonInclude; import java.io.IOException; import java.math.BigInteger; import java.net.URI; @@ -27,8 +28,6 @@ import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonInclude; import linea.plugin.acc.test.LineaPluginTestBase; import linea.plugin.acc.test.TestCommandLineOptionsBuilder; import linea.plugin.acc.test.tests.web3j.generated.SimpleStorage; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationCheckTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationCheckTest.java index b4b2c621..b2c7ab50 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationCheckTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationCheckTest.java @@ -23,7 +23,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.IntStream; - import linea.plugin.acc.test.LineaPluginTestBase; import linea.plugin.acc.test.TestCommandLineOptionsBuilder; import linea.plugin.acc.test.tests.web3j.generated.ExcludedPrecompiles; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationModExpTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationModExpTest.java index c5b7e0bc..ddd40904 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationModExpTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationModExpTest.java @@ -18,7 +18,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.web3j.crypto.Hash.sha3; import java.util.List; - import linea.plugin.acc.test.LineaPluginTestBase; import linea.plugin.acc.test.TestCommandLineOptionsBuilder; import org.apache.tuweni.bytes.Bytes; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/ForwardBundleTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/ForwardBundleTest.java index 880c39de..b26d722f 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/ForwardBundleTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/ForwardBundleTest.java @@ -30,11 +30,6 @@ import static net.consensys.linea.bundles.BundleForwarder.RETRY_COUNT_HEADER; import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; -import java.time.Duration; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.http.Fault; @@ -45,6 +40,10 @@ import com.github.tomakehurst.wiremock.junit5.WireMockTest; import com.github.tomakehurst.wiremock.matching.MatchResult; import com.github.tomakehurst.wiremock.matching.StringValuePattern; import com.github.tomakehurst.wiremock.stubbing.ServeEvent; +import java.time.Duration; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; import linea.plugin.acc.test.TestCommandLineOptionsBuilder; import org.hyperledger.besu.tests.acceptance.dsl.account.Account; import org.hyperledger.besu.tests.acceptance.dsl.transaction.account.TransferTransaction; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/ModExpLimitsTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/ModExpLimitsTest.java index 808a849e..7317d55f 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/ModExpLimitsTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/ModExpLimitsTest.java @@ -20,7 +20,6 @@ import java.math.BigInteger; import java.util.Arrays; import java.util.List; import java.util.Map; - import linea.plugin.acc.test.LineaPluginTestBase; import linea.plugin.acc.test.TestCommandLineOptionsBuilder; import linea.plugin.acc.test.tests.web3j.generated.ModExp; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SendBundleMaxBlockGasTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SendBundleMaxBlockGasTest.java index 93efc3aa..583be8f8 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SendBundleMaxBlockGasTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SendBundleMaxBlockGasTest.java @@ -19,7 +19,6 @@ import static org.assertj.core.api.Assertions.assertThat; import java.math.BigInteger; import java.util.Arrays; import java.util.List; - import linea.plugin.acc.test.TestCommandLineOptionsBuilder; import linea.plugin.acc.test.tests.web3j.generated.AcceptanceTestToken; import org.hyperledger.besu.tests.acceptance.dsl.transaction.account.TransferTransaction; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SendBundleTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SendBundleTest.java index a5958a9d..52ae0cfc 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SendBundleTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SendBundleTest.java @@ -19,7 +19,6 @@ import static org.web3j.crypto.Hash.sha3; import java.math.BigInteger; import java.util.Arrays; - import linea.plugin.acc.test.tests.web3j.generated.AcceptanceTestToken; import linea.plugin.acc.test.tests.web3j.generated.RevertExample; import org.hyperledger.besu.datatypes.Wei; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SetExtraDataTest.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SetExtraDataTest.java index 8fccf961..c46613ab 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SetExtraDataTest.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/SetExtraDataTest.java @@ -16,6 +16,7 @@ package linea.plugin.acc.test.rpc.linea; import static org.assertj.core.api.Assertions.assertThat; +import com.google.common.base.Strings; import java.io.IOException; import java.math.BigInteger; import java.net.URI; @@ -23,8 +24,6 @@ import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.util.List; - -import com.google.common.base.Strings; import linea.plugin.acc.test.LineaPluginTestBase; import linea.plugin.acc.test.TestCommandLineOptionsBuilder; import net.consensys.linea.config.LineaProfitabilityCliOptions; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBase.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBase.java index 45de6aff..4a0ace20 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBase.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBase.java @@ -25,7 +25,6 @@ import java.lang.ProcessBuilder.Redirect; import java.math.BigInteger; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; - import lombok.extern.slf4j.Slf4j; import org.hyperledger.besu.tests.acceptance.dsl.account.Accounts; import org.hyperledger.besu.tests.acceptance.dsl.blockchain.Blockchain; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/org/hyperledger/besu/tests/acceptance/dsl/EngineAPIService.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/org/hyperledger/besu/tests/acceptance/dsl/EngineAPIService.java index 14a36185..57d45c78 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/org/hyperledger/besu/tests/acceptance/dsl/EngineAPIService.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/org/hyperledger/besu/tests/acceptance/dsl/EngineAPIService.java @@ -17,13 +17,12 @@ package org.hyperledger.besu.tests.acceptance.dsl; import static org.assertj.core.api.Assertions.*; -import java.io.IOException; -import java.util.Optional; - import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; +import java.io.IOException; +import java.util.Optional; import okhttp3.Call; import okhttp3.MediaType; import okhttp3.OkHttpClient; diff --git a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/org/hyperledger/besu/tests/acceptance/dsl/WaitUtils.java b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/org/hyperledger/besu/tests/acceptance/dsl/WaitUtils.java index 0f03633e..21d17655 100644 --- a/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/org/hyperledger/besu/tests/acceptance/dsl/WaitUtils.java +++ b/besu-plugins/linea-sequencer/acceptance-tests/src/test/java/org/hyperledger/besu/tests/acceptance/dsl/WaitUtils.java @@ -16,7 +16,6 @@ package org.hyperledger.besu.tests.acceptance.dsl; import java.util.concurrent.TimeUnit; - import org.awaitility.Awaitility; import org.awaitility.core.ThrowingRunnable; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/AbstractLineaSharedPrivateOptionsPlugin.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/AbstractLineaSharedPrivateOptionsPlugin.java index 9550a7f5..fc77d018 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/AbstractLineaSharedPrivateOptionsPlugin.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/AbstractLineaSharedPrivateOptionsPlugin.java @@ -18,7 +18,6 @@ package net.consensys.linea; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; - import lombok.extern.slf4j.Slf4j; import net.consensys.linea.bundles.BundlePoolService; import net.consensys.linea.bundles.LineaLimitedBundlePool; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bl/TransactionProfitabilityCalculator.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bl/TransactionProfitabilityCalculator.java index 578c14ea..e5c6bd5f 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bl/TransactionProfitabilityCalculator.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bl/TransactionProfitabilityCalculator.java @@ -15,7 +15,6 @@ package net.consensys.linea.bl; import java.math.BigDecimal; - import lombok.extern.slf4j.Slf4j; import net.consensys.linea.config.LineaProfitabilityConfiguration; import net.consensys.linea.utils.Compressor; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/BundleForwarder.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/BundleForwarder.java index 5533ea99..2767ed7c 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/BundleForwarder.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/BundleForwarder.java @@ -16,6 +16,10 @@ package net.consensys.linea.bundles; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import java.io.IOException; import java.net.URL; import java.util.OptionalLong; @@ -23,11 +27,6 @@ import java.util.concurrent.Callable; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/BundleParameter.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/BundleParameter.java index 1004fda6..9196b0fd 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/BundleParameter.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/BundleParameter.java @@ -16,13 +16,12 @@ package net.consensys.linea.bundles; import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_ABSENT; -import java.util.List; -import java.util.Optional; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.List; +import java.util.Optional; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.parameters.UnsignedLongParameter; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/BundlePoolService.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/BundlePoolService.java index 8a21dfd0..96fce123 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/BundlePoolService.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/BundlePoolService.java @@ -16,7 +16,6 @@ package net.consensys.linea.bundles; import java.util.List; import java.util.UUID; - import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.plugin.services.BesuService; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/ForwardBundlesPlugin.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/ForwardBundlesPlugin.java index dc55921a..3586d380 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/ForwardBundlesPlugin.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/ForwardBundlesPlugin.java @@ -15,13 +15,12 @@ package net.consensys.linea.bundles; +import com.google.auto.service.AutoService; import java.net.URL; import java.time.Duration; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; - -import com.google.auto.service.AutoService; import net.consensys.linea.AbstractLineaRequiredPlugin; import net.consensys.linea.utils.PriorityThreadPoolExecutor; import okhttp3.OkHttpClient; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/LineaLimitedBundlePool.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/LineaLimitedBundlePool.java index ee988d58..55e78864 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/LineaLimitedBundlePool.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/LineaLimitedBundlePool.java @@ -17,6 +17,16 @@ package net.consensys.linea.bundles; import static java.util.Collections.emptyList; +import com.fasterxml.jackson.databind.MappingIterator; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SequenceWriter; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.github.benmanes.caffeine.cache.Cache; +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.RemovalCause; +import com.github.benmanes.caffeine.cache.Scheduler; +import com.google.auto.service.AutoService; +import com.google.common.annotations.VisibleForTesting; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; @@ -33,17 +43,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Supplier; import java.util.stream.Collectors; - -import com.fasterxml.jackson.databind.MappingIterator; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SequenceWriter; -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; -import com.github.benmanes.caffeine.cache.Cache; -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.RemovalCause; -import com.github.benmanes.caffeine.cache.Scheduler; -import com.google.auto.service.AutoService; -import com.google.common.annotations.VisibleForTesting; import lombok.extern.slf4j.Slf4j; import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.datatypes.Hash; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/TransactionBundle.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/TransactionBundle.java index eda7d35d..0253b369 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/TransactionBundle.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/bundles/TransactionBundle.java @@ -15,15 +15,14 @@ package net.consensys.linea.bundles; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.SequencedMap; import java.util.UUID; import java.util.concurrent.atomic.AtomicLong; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaBundleCliOptions.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaBundleCliOptions.java index d729ff23..565303d4 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaBundleCliOptions.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaBundleCliOptions.java @@ -15,11 +15,10 @@ package net.consensys.linea.config; +import com.google.common.base.MoreObjects; import java.net.URL; import java.util.Set; import java.util.stream.Collectors; - -import com.google.common.base.MoreObjects; import net.consensys.linea.plugins.LineaCliOptions; import picocli.CommandLine; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaBundleConfiguration.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaBundleConfiguration.java index b2e951b7..c3357002 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaBundleConfiguration.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaBundleConfiguration.java @@ -17,7 +17,6 @@ package net.consensys.linea.config; import java.net.URL; import java.util.Set; - import lombok.Builder; import lombok.Getter; import lombok.ToString; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaProfitabilityCliOptions.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaProfitabilityCliOptions.java index 36ed3637..a133bf40 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaProfitabilityCliOptions.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaProfitabilityCliOptions.java @@ -15,10 +15,9 @@ package net.consensys.linea.config; -import java.math.BigDecimal; - import com.google.common.base.MoreObjects; import jakarta.validation.constraints.Positive; +import java.math.BigDecimal; import net.consensys.linea.plugins.LineaCliOptions; import picocli.CommandLine; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRejectedTxReportingCliOptions.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRejectedTxReportingCliOptions.java index cbdce8af..3fab441f 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRejectedTxReportingCliOptions.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRejectedTxReportingCliOptions.java @@ -14,9 +14,8 @@ */ package net.consensys.linea.config; -import java.net.URL; - import com.google.common.base.MoreObjects; +import java.net.URL; import net.consensys.linea.plugins.LineaCliOptions; import picocli.CommandLine.Option; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRejectedTxReportingConfiguration.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRejectedTxReportingConfiguration.java index 607d0410..fab9ed70 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRejectedTxReportingConfiguration.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRejectedTxReportingConfiguration.java @@ -16,7 +16,6 @@ package net.consensys.linea.config; import java.net.URL; - import lombok.Builder; import net.consensys.linea.plugins.LineaOptionsConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRpcCliOptions.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRpcCliOptions.java index 97b99f15..f9389db2 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRpcCliOptions.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRpcCliOptions.java @@ -15,9 +15,8 @@ package net.consensys.linea.config; -import java.math.BigDecimal; - import com.google.common.base.MoreObjects; +import java.math.BigDecimal; import net.consensys.linea.plugins.LineaCliOptions; import picocli.CommandLine; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRpcConfiguration.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRpcConfiguration.java index 79debd95..bf6fa48f 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRpcConfiguration.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/LineaRpcConfiguration.java @@ -16,7 +16,6 @@ package net.consensys.linea.config; import java.math.BigDecimal; - import lombok.Builder; import lombok.Getter; import lombok.Setter; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/converters/WeiConverter.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/converters/WeiConverter.java index 33ea6618..76a9ed55 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/converters/WeiConverter.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/config/converters/WeiConverter.java @@ -15,7 +15,6 @@ package net.consensys.linea.config.converters; import java.math.BigInteger; - import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.datatypes.Wei; import picocli.CommandLine; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataHandler.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataHandler.java index 32f05c75..ad0de302 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataHandler.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataHandler.java @@ -17,7 +17,6 @@ package net.consensys.linea.extradata; import java.util.function.Consumer; import java.util.function.Function; - import lombok.extern.slf4j.Slf4j; import net.consensys.linea.config.LineaProfitabilityConfiguration; import org.apache.commons.lang3.mutable.MutableLong; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataPlugin.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataPlugin.java index 9dee7fd8..70ecd5e5 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataPlugin.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataPlugin.java @@ -17,9 +17,8 @@ package net.consensys.linea.extradata; import static net.consensys.linea.metrics.LineaMetricCategory.PRICING_CONF; -import java.util.concurrent.atomic.AtomicBoolean; - import com.google.auto.service.AutoService; +import java.util.concurrent.atomic.AtomicBoolean; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.AbstractLineaRequiredPlugin; import net.consensys.linea.config.LineaProfitabilityConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/jsonrpc/JsonRpcManager.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/jsonrpc/JsonRpcManager.java index 7110bcc9..8c8fa297 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/jsonrpc/JsonRpcManager.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/jsonrpc/JsonRpcManager.java @@ -15,6 +15,9 @@ package net.consensys.linea.jsonrpc; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.annotations.VisibleForTesting; import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.DirectoryStream; @@ -36,10 +39,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.annotations.VisibleForTesting; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.config.LineaNodeType; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/jsonrpc/JsonRpcRequestBuilder.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/jsonrpc/JsonRpcRequestBuilder.java index 4bd4dc69..edb43613 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/jsonrpc/JsonRpcRequestBuilder.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/jsonrpc/JsonRpcRequestBuilder.java @@ -15,13 +15,12 @@ package net.consensys.linea.jsonrpc; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; import java.time.Instant; import java.util.List; import java.util.Optional; import java.util.concurrent.atomic.AtomicLong; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import net.consensys.linea.config.LineaNodeType; import net.consensys.linea.sequencer.modulelimit.ModuleLimitsValidationResult; import org.hyperledger.besu.datatypes.Transaction; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/metrics/HistogramMetrics.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/metrics/HistogramMetrics.java index a7702d38..874df4ca 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/metrics/HistogramMetrics.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/metrics/HistogramMetrics.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.function.DoubleSupplier; - import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.hyperledger.besu.plugin.services.MetricsSystem; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/metrics/LineaMetricCategory.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/metrics/LineaMetricCategory.java index 849e7ddb..42873517 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/metrics/LineaMetricCategory.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/metrics/LineaMetricCategory.java @@ -16,7 +16,6 @@ package net.consensys.linea.metrics; import java.util.Locale; import java.util.Optional; - import org.hyperledger.besu.plugin.services.metrics.MetricCategory; public enum LineaMetricCategory implements MetricCategory { diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaCancelBundle.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaCancelBundle.java index 605845dc..0426a748 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaCancelBundle.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaCancelBundle.java @@ -16,7 +16,6 @@ package net.consensys.linea.rpc.methods; import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; - import lombok.extern.slf4j.Slf4j; import net.consensys.linea.bundles.BundlePoolService; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaEstimateGas.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaEstimateGas.java index 0f28bb72..9605cd97 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaEstimateGas.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaEstimateGas.java @@ -20,15 +20,14 @@ import static net.consensys.linea.sequencer.modulelimit.ModuleLineCountValidator import static net.consensys.linea.zktracer.Fork.LONDON; import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.Quantity.create; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.VisibleForTesting; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; import java.util.Map; import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.VisibleForTesting; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.bl.TransactionProfitabilityCalculator; import net.consensys.linea.config.LineaProfitabilityConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaSendBundle.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaSendBundle.java index e613b229..29a98bcc 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaSendBundle.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaSendBundle.java @@ -14,14 +14,13 @@ */ package net.consensys.linea.rpc.methods; +import com.github.benmanes.caffeine.cache.Cache; +import com.github.benmanes.caffeine.cache.Caffeine; import java.time.Duration; import java.time.Instant; import java.util.List; import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; - -import com.github.benmanes.caffeine.cache.Cache; -import com.github.benmanes.caffeine.cache.Caffeine; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.bundles.BundleParameter; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaSetExtraData.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaSetExtraData.java index 4a02c8a0..19f93787 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaSetExtraData.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaSetExtraData.java @@ -19,7 +19,6 @@ import static net.consensys.linea.extradata.LineaExtraDataException.ErrorType.FA import static net.consensys.linea.extradata.LineaExtraDataException.ErrorType.INVALID_ARGUMENT; import java.util.concurrent.atomic.AtomicInteger; - import lombok.extern.slf4j.Slf4j; import net.consensys.linea.extradata.LineaExtraDataException; import net.consensys.linea.extradata.LineaExtraDataHandler; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/TracerAggregator.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/TracerAggregator.java index 14d18868..a59a606f 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/TracerAggregator.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/TracerAggregator.java @@ -18,7 +18,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.Set; - import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Transaction; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/modulelimit/ModuleLineCountValidator.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/modulelimit/ModuleLineCountValidator.java index 15a59521..73c5e36b 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/modulelimit/ModuleLineCountValidator.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/modulelimit/ModuleLineCountValidator.java @@ -14,14 +14,13 @@ */ package net.consensys.linea.sequencer.modulelimit; +import com.google.common.io.Resources; import java.io.File; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; - -import com.google.common.io.Resources; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.config.LineaTracerConfiguration; import org.apache.tuweni.toml.Toml; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorFactory.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorFactory.java index 18bf1193..efde1dde 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorFactory.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorFactory.java @@ -19,7 +19,6 @@ import java.util.Arrays; import java.util.Map; import java.util.Optional; import java.util.Set; - import net.consensys.linea.config.LineaProfitabilityConfiguration; import net.consensys.linea.config.LineaTransactionPoolValidatorConfiguration; import net.consensys.linea.jsonrpc.JsonRpcManager; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorPlugin.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorPlugin.java index 2f8e0ee5..d7b8c93d 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorPlugin.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorPlugin.java @@ -18,6 +18,7 @@ package net.consensys.linea.sequencer.txpoolvalidation; import static net.consensys.linea.metrics.LineaMetricCategory.TX_POOL_PROFITABILITY; import static net.consensys.linea.sequencer.modulelimit.ModuleLineCountValidator.createLimitModules; +import com.google.auto.service.AutoService; import java.io.File; import java.nio.file.Files; import java.nio.file.Path; @@ -25,8 +26,6 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; - -import com.google.auto.service.AutoService; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.AbstractLineaRequiredPlugin; import net.consensys.linea.config.LineaRejectedTxReportingConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/metrics/TransactionPoolProfitabilityMetrics.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/metrics/TransactionPoolProfitabilityMetrics.java index fccc65fa..8367fb14 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/metrics/TransactionPoolProfitabilityMetrics.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/metrics/TransactionPoolProfitabilityMetrics.java @@ -17,7 +17,6 @@ package net.consensys.linea.sequencer.txpoolvalidation.metrics; import static net.consensys.linea.metrics.LineaMetricCategory.TX_POOL_PROFITABILITY; import java.util.stream.Collectors; - import lombok.extern.slf4j.Slf4j; import net.consensys.linea.bl.TransactionProfitabilityCalculator; import net.consensys.linea.config.LineaProfitabilityConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidator.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidator.java index a30cab93..08a16d9a 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidator.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidator.java @@ -16,7 +16,6 @@ package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; import java.util.Set; - import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.hyperledger.besu.datatypes.Address; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidator.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidator.java index 44eba275..8b595b55 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidator.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidator.java @@ -15,7 +15,6 @@ package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; - import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.config.LineaTransactionPoolValidatorConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidator.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidator.java index f86e2844..73dc97cc 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidator.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidator.java @@ -15,7 +15,6 @@ package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; - import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.config.LineaTransactionPoolValidatorConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidator.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidator.java index 74040fdb..b4f3cecb 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidator.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidator.java @@ -15,7 +15,6 @@ package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; - import lombok.extern.slf4j.Slf4j; import net.consensys.linea.bl.TransactionProfitabilityCalculator; import net.consensys.linea.config.LineaProfitabilityConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java index 848324f3..e40b21e6 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java @@ -23,7 +23,6 @@ import java.time.Instant; import java.util.List; import java.util.Map; import java.util.Optional; - import lombok.extern.slf4j.Slf4j; import net.consensys.linea.config.LineaTransactionPoolValidatorConfiguration; import net.consensys.linea.jsonrpc.JsonRpcManager; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorFactory.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorFactory.java index d10c2a07..9352c5e1 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorFactory.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorFactory.java @@ -18,7 +18,6 @@ package net.consensys.linea.sequencer.txselection; import java.util.Map; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; - import lombok.extern.slf4j.Slf4j; import net.consensys.linea.bundles.BundlePoolService; import net.consensys.linea.config.LineaProfitabilityConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorPlugin.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorPlugin.java index 77e14b6b..80a7e9b9 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorPlugin.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorPlugin.java @@ -18,9 +18,8 @@ package net.consensys.linea.sequencer.txselection; import static net.consensys.linea.metrics.LineaMetricCategory.SEQUENCER_PROFITABILITY; import static net.consensys.linea.sequencer.modulelimit.ModuleLineCountValidator.createLimitModules; -import java.util.Optional; - import com.google.auto.service.AutoService; +import java.util.Optional; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.AbstractLineaRequiredPlugin; import net.consensys.linea.config.LineaRejectedTxReportingConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/BundleConstraintTransactionSelector.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/BundleConstraintTransactionSelector.java index 564093e5..3ea15806 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/BundleConstraintTransactionSelector.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/BundleConstraintTransactionSelector.java @@ -17,7 +17,6 @@ package net.consensys.linea.sequencer.txselection.selectors; import static java.lang.Boolean.TRUE; import java.time.Instant; - import net.consensys.linea.bundles.TransactionBundle; import org.hyperledger.besu.plugin.data.TransactionProcessingResult; import org.hyperledger.besu.plugin.data.TransactionSelectionResult; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/LineaTransactionSelector.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/LineaTransactionSelector.java index 142e04f7..733818b1 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/LineaTransactionSelector.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/LineaTransactionSelector.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; - import lombok.extern.slf4j.Slf4j; import net.consensys.linea.bundles.BundlePoolService; import net.consensys.linea.bundles.TransactionBundle; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelector.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelector.java index 03cbc476..4455e79b 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelector.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelector.java @@ -19,14 +19,13 @@ import static net.consensys.linea.sequencer.txselection.LineaTransactionSelectio import static net.consensys.linea.sequencer.txselection.LineaTransactionSelectionResult.TX_UNPROFITABLE_UPFRONT; import static org.hyperledger.besu.plugin.data.TransactionSelectionResult.SELECTED; +import com.google.common.annotations.VisibleForTesting; import java.util.EnumMap; import java.util.LinkedHashSet; import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.Set; - -import com.google.common.annotations.VisibleForTesting; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.bl.TransactionProfitabilityCalculator; import net.consensys.linea.config.LineaProfitabilityConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/TraceLineLimitTransactionSelector.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/TraceLineLimitTransactionSelector.java index 6263ecef..da340b7a 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/TraceLineLimitTransactionSelector.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/TraceLineLimitTransactionSelector.java @@ -21,14 +21,13 @@ import static net.consensys.linea.sequencer.txselection.LineaTransactionSelectio import static net.consensys.linea.zktracer.Fork.LONDON; import static org.hyperledger.besu.plugin.data.TransactionSelectionResult.SELECTED; +import com.google.common.annotations.VisibleForTesting; import java.math.BigInteger; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; - -import com.google.common.annotations.VisibleForTesting; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.config.LineaTracerConfiguration; import net.consensys.linea.config.LineaTransactionSelectorConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/utils/PriorityThreadPoolExecutor.java b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/utils/PriorityThreadPoolExecutor.java index 3d5a9442..f33ed48e 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/utils/PriorityThreadPoolExecutor.java +++ b/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/utils/PriorityThreadPoolExecutor.java @@ -21,7 +21,6 @@ import java.util.concurrent.RunnableFuture; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; - import lombok.EqualsAndHashCode; import lombok.Getter; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/AbstractBundleTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/AbstractBundleTest.java index 2f56a92c..fbbc1ef9 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/AbstractBundleTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/AbstractBundleTest.java @@ -15,12 +15,11 @@ package net.consensys.linea.bundles; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import java.math.BigInteger; import java.util.List; import java.util.Optional; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import org.hyperledger.besu.crypto.KeyPair; import org.hyperledger.besu.crypto.SECPPrivateKey; import org.hyperledger.besu.crypto.SECPPublicKey; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/BundleForwarderTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/BundleForwarderTest.java index e4d94531..4d06ff4e 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/BundleForwarderTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/BundleForwarderTest.java @@ -36,6 +36,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Answers.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.lenient; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.junit5.WireMockTest; +import com.github.tomakehurst.wiremock.matching.StringValuePattern; import java.io.IOException; import java.io.InterruptedIOException; import java.net.MalformedURLException; @@ -50,11 +54,6 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; -import com.github.tomakehurst.wiremock.junit5.WireMockTest; -import com.github.tomakehurst.wiremock.matching.StringValuePattern; import net.consensys.linea.bundles.BundleForwarder.SendBundleResponse; import net.consensys.linea.config.LineaBundleConfiguration; import net.consensys.linea.utils.PriorityThreadPoolExecutor; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/LineaLimitedBundlePoolTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/LineaLimitedBundlePoolTest.java index d2e7a28a..73ec7e7d 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/LineaLimitedBundlePoolTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/LineaLimitedBundlePoolTest.java @@ -38,7 +38,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.UUID; - import lombok.Getter; import net.consensys.linea.bundles.BundlePoolService.TransactionBundleAddedListener; import net.consensys.linea.bundles.BundlePoolService.TransactionBundleRemovedListener; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/TransactionBundleTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/TransactionBundleTest.java index 585d6102..5ada8b41 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/TransactionBundleTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/bundles/TransactionBundleTest.java @@ -18,11 +18,10 @@ package net.consensys.linea.bundles; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import java.util.List; - import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.exc.ValueInstantiationException; +import java.util.List; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.eth.transactions.PendingTransaction; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/config/LineaRejectedTxReportingCliOptionsTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/config/LineaRejectedTxReportingCliOptionsTest.java index 12124f17..dade4a7b 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/config/LineaRejectedTxReportingCliOptionsTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/config/LineaRejectedTxReportingCliOptionsTest.java @@ -20,7 +20,6 @@ import static org.assertj.core.api.Assertions.assertThatNoException; import java.net.MalformedURLException; import java.net.URI; - import org.hyperledger.besu.services.PicoCLIOptionsImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/jsonrpc/JsonRpcManagerStartTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/jsonrpc/JsonRpcManagerStartTest.java index 5601d35b..b9b6a940 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/jsonrpc/JsonRpcManagerStartTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/jsonrpc/JsonRpcManagerStartTest.java @@ -25,6 +25,8 @@ import static java.util.concurrent.TimeUnit.SECONDS; import static org.awaitility.Awaitility.await; import static org.mockito.Mockito.when; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.junit5.WireMockTest; import java.io.IOException; import java.net.URI; import java.nio.file.Files; @@ -32,9 +34,6 @@ import java.nio.file.Path; import java.time.Instant; import java.util.List; import java.util.Optional; - -import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; -import com.github.tomakehurst.wiremock.junit5.WireMockTest; import net.consensys.linea.config.LineaNodeType; import net.consensys.linea.config.LineaRejectedTxReportingConfiguration; import org.apache.tuweni.bytes.Bytes; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/jsonrpc/JsonRpcManagerTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/jsonrpc/JsonRpcManagerTest.java index b73845aa..5cdd75e4 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/jsonrpc/JsonRpcManagerTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/jsonrpc/JsonRpcManagerTest.java @@ -28,6 +28,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; import static org.mockito.Mockito.when; +import com.github.tomakehurst.wiremock.http.Fault; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.junit5.WireMockTest; +import com.github.tomakehurst.wiremock.stubbing.Scenario; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; @@ -37,11 +41,6 @@ import java.time.Instant; import java.util.List; import java.util.Optional; import java.util.stream.Stream; - -import com.github.tomakehurst.wiremock.http.Fault; -import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; -import com.github.tomakehurst.wiremock.junit5.WireMockTest; -import com.github.tomakehurst.wiremock.stubbing.Scenario; import net.consensys.linea.config.LineaNodeType; import net.consensys.linea.config.LineaRejectedTxReportingConfiguration; import org.apache.tuweni.bytes.Bytes; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/rpc/methods/LineaCancelBundleTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/rpc/methods/LineaCancelBundleTest.java index ef7f77b4..e799fda8 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/rpc/methods/LineaCancelBundleTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/rpc/methods/LineaCancelBundleTest.java @@ -22,7 +22,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.UUID; - import net.consensys.linea.bundles.LineaLimitedBundlePool; import org.hyperledger.besu.plugin.services.exception.PluginRpcEndpointException; import org.hyperledger.besu.plugin.services.rpc.PluginRpcRequest; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/rpc/methods/LineaSendBundleTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/rpc/methods/LineaSendBundleTest.java index d05429cf..92bcfc95 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/rpc/methods/LineaSendBundleTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/rpc/methods/LineaSendBundleTest.java @@ -31,7 +31,6 @@ import java.nio.file.Path; import java.util.List; import java.util.Optional; import java.util.UUID; - import net.consensys.linea.bundles.BundleParameter; import net.consensys.linea.bundles.LineaLimitedBundlePool; import net.consensys.linea.bundles.TransactionBundle; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/modulelimit/ModuleLineCountValidatorTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/modulelimit/ModuleLineCountValidatorTest.java index 7387bcba..b99a78c3 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/modulelimit/ModuleLineCountValidatorTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/modulelimit/ModuleLineCountValidatorTest.java @@ -17,7 +17,6 @@ package net.consensys.linea.sequencer.modulelimit; import static org.assertj.core.api.Assertions.assertThat; import java.util.Map; - import org.junit.jupiter.api.Test; class ModuleLineCountValidatorTest { diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidatorTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidatorTest.java index c2f25f68..242c4f0f 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidatorTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidatorTest.java @@ -17,7 +17,6 @@ package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; import java.util.Set; - import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.tuweni.bytes.Bytes; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidatorTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidatorTest.java index fc775580..b42cabc2 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidatorTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidatorTest.java @@ -16,7 +16,6 @@ package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; - import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.config.LineaTransactionPoolValidatorCliOptions; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidatorTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidatorTest.java index 219e62f4..6c5c73d3 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidatorTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidatorTest.java @@ -16,7 +16,6 @@ package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; - import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.config.LineaTransactionPoolValidatorCliOptions; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidatorTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidatorTest.java index 3178a5ec..4e190442 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidatorTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidatorTest.java @@ -20,7 +20,6 @@ import static org.mockito.Mockito.when; import java.math.BigInteger; import java.util.Optional; - import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.config.LineaProfitabilityCliOptions; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidatorTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidatorTest.java index d1af7304..a7c5be4d 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidatorTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidatorTest.java @@ -30,6 +30,8 @@ import static org.awaitility.Awaitility.await; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.junit5.WireMockTest; import java.io.IOException; import java.math.BigInteger; import java.net.MalformedURLException; @@ -39,9 +41,6 @@ import java.nio.file.Path; import java.util.HashMap; import java.util.Map; import java.util.Optional; - -import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; -import com.github.tomakehurst.wiremock.junit5.WireMockTest; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.config.LineaNodeType; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorFactoryTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorFactoryTest.java index ab88deb1..0d3d2846 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorFactoryTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorFactoryTest.java @@ -31,7 +31,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Stream; - import net.consensys.linea.bundles.BundlePoolService; import net.consensys.linea.bundles.LineaLimitedBundlePool; import net.consensys.linea.bundles.TransactionBundle; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/BundleConstraintTransactionSelectorTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/BundleConstraintTransactionSelectorTest.java index 838cff0b..e11f1517 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/BundleConstraintTransactionSelectorTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/BundleConstraintTransactionSelectorTest.java @@ -22,7 +22,6 @@ import static org.mockito.Mockito.when; import java.time.Instant; import java.util.List; import java.util.Optional; - import net.consensys.linea.bundles.TransactionBundle; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.Wei; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/MaxBundleBlockGasTransactionSelectorTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/MaxBundleBlockGasTransactionSelectorTest.java index b7b4dbbd..e48a4c94 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/MaxBundleBlockGasTransactionSelectorTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/MaxBundleBlockGasTransactionSelectorTest.java @@ -27,7 +27,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Optional; - import net.consensys.linea.bundles.TransactionBundle; import net.consensys.linea.sequencer.txselection.selectors.MaxBundleGasPerBlockTransactionSelector.BundleGasTracker; import org.apache.tuweni.bytes.Bytes32; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelectorTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelectorTest.java index ff3b08b9..539839d5 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelectorTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelectorTest.java @@ -23,7 +23,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.util.Optional; - import net.consensys.linea.config.LineaProfitabilityCliOptions; import net.consensys.linea.config.LineaProfitabilityConfiguration; import net.consensys.linea.config.LineaTransactionSelectorCliOptions; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/TraceLineLimitTransactionSelectorTest.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/TraceLineLimitTransactionSelectorTest.java index 6258aed6..0fc852fc 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/TraceLineLimitTransactionSelectorTest.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/sequencer/txselection/selectors/TraceLineLimitTransactionSelectorTest.java @@ -27,7 +27,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; - import net.consensys.linea.config.LineaTracerConfiguration; import net.consensys.linea.config.LineaTransactionSelectorConfiguration; import net.consensys.linea.plugins.config.LineaL1L2BridgeSharedConfiguration; diff --git a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/utils/TestablePriorityThreadPoolExecutor.java b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/utils/TestablePriorityThreadPoolExecutor.java index 6f9fc10e..14553637 100644 --- a/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/utils/TestablePriorityThreadPoolExecutor.java +++ b/besu-plugins/linea-sequencer/sequencer/src/test/java/net/consensys/linea/utils/TestablePriorityThreadPoolExecutor.java @@ -21,7 +21,6 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Semaphore; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; - import lombok.RequiredArgsConstructor; import org.hyperledger.besu.util.Subscribers; diff --git a/build.gradle b/build.gradle index 71bb670c..383aab1a 100644 --- a/build.gradle +++ b/build.gradle @@ -125,6 +125,7 @@ allprojects { removeUnusedImports() trimTrailingWhitespace() endWithNewline() + googleJavaFormat(libs.versions.googleJavaFormat.get()) } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5b18ed43..8dfff11d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -51,4 +51,5 @@ vertx = "4.5.14" web3j = "4.12.2" # Other +googleJavaFormat = "1.27.0" dependencyLicenseReport = "2.9" \ No newline at end of file diff --git a/jvm-libs/linea/blob-compressor/src/test/java/linea/blob/CompressorJavaAccessTest.java b/jvm-libs/linea/blob-compressor/src/test/java/linea/blob/CompressorJavaAccessTest.java index 5b2326d2..7d2af66a 100644 --- a/jvm-libs/linea/blob-compressor/src/test/java/linea/blob/CompressorJavaAccessTest.java +++ b/jvm-libs/linea/blob-compressor/src/test/java/linea/blob/CompressorJavaAccessTest.java @@ -1,16 +1,14 @@ package linea.blob; -import org.junit.jupiter.api.Test; - import static org.assertj.core.api.AssertionsForClassTypes.assertThat; +import org.junit.jupiter.api.Test; + public class CompressorJavaAccessTest { @Test public void shouldBeJavaCallerFriendly() { - var compressor = GoBackedBlobCompressor.getInstance( - BlobCompressorVersion.V1_2, - 102400); + var compressor = GoBackedBlobCompressor.getInstance(BlobCompressorVersion.V1_2, 102400); var compressedSize = compressor.compressedSize(new byte[1000]); assertThat(compressedSize).isBetween(0, 1000); diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/ManualLoadTest.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/ManualLoadTest.java index 4237d8b5..caf0279c 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/ManualLoadTest.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/ManualLoadTest.java @@ -6,8 +6,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ManualLoadTest { - private final static Logger logger = LoggerFactory.getLogger(ManualLoadTest.class); - + private static final Logger logger = LoggerFactory.getLogger(ManualLoadTest.class); /** * Call main method by passing arguments like '-ft 2 -nbTx 2' @@ -20,25 +19,25 @@ public class ManualLoadTest { var options = getOptions(); var parser = new DefaultParser(); - try { - // parse the command line arguments - CommandLine cmd = parser.parse(options, args); + try { + // parse the command line arguments + CommandLine cmd = parser.parse(options, args); - if (cmd.hasOption("help")) { - String header = "Tools to generate load on an ethereum network."; - HelpFormatter formatter = new HelpFormatter(); - formatter.printHelp("LoadTesting", header, options, "", true); - return; - } - - if (cmd.hasOption("request")) { - TestExecutor testExecutor = new TestExecutor(cmd.getOptionValue("request"), cmd.getOptionValue("pk")); - testExecutor.test(); - } - } catch (ParseException e) { - logger.info("Failed to parse command line properties." + e); + if (cmd.hasOption("help")) { + String header = "Tools to generate load on an ethereum network."; + HelpFormatter formatter = new HelpFormatter(); + formatter.printHelp("LoadTesting", header, options, "", true); + return; } + if (cmd.hasOption("request")) { + TestExecutor testExecutor = + new TestExecutor(cmd.getOptionValue("request"), cmd.getOptionValue("pk")); + testExecutor.test(); + } + } catch (ParseException e) { + logger.info("Failed to parse command line properties." + e); + } } private static Options getOptions() { @@ -50,5 +49,4 @@ public class ManualLoadTest { return options; } - } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/model/JSON.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/model/JSON.java index e925efc4..801ed6c5 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/model/JSON.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/model/JSON.java @@ -10,23 +10,18 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.model; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapter; import com.google.gson.internal.bind.util.ISO8601Utils; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.google.gson.JsonElement; import io.gsonfire.GsonFireBuilder; import io.gsonfire.TypeSelector; - -import net.consensys.zkevm.load.swagger.*; -import okio.ByteString; - import java.io.IOException; import java.io.StringReader; import java.lang.reflect.Type; @@ -37,8 +32,10 @@ import java.time.LocalDate; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.util.Date; -import java.util.Map; import java.util.HashMap; +import java.util.Map; +import net.consensys.zkevm.load.swagger.*; +import okio.ByteString; /* * A JSON utility class @@ -47,547 +44,616 @@ import java.util.HashMap; * backward-compatibility */ public class JSON { - private static Gson gson; - private static boolean isLenientOnJson = false; - private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); - private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); - private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); - private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); - private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = + new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); - @SuppressWarnings("unchecked") - public static GsonBuilder createGson() { - GsonFireBuilder fireBuilder = new GsonFireBuilder() - .registerTypeSelector(ArrayParameter.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("ArrayParameter", ArrayParameter.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "type")); - } - }) - .registerTypeSelector(BatchMint.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("BatchMint", BatchMint.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "type")); - } - }) - .registerTypeSelector(CallContractReference.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("CallContractReference", CallContractReference.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "contractCallType")); - } - }) - .registerTypeSelector(CallExistingContract.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("CallExistingContract", CallExistingContract.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "contractCallType")); - } - }) - .registerTypeSelector(Contract.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("CallContractReference", CallContractReference.class); - classByDiscriminatorValue.put("CallExistingContract", CallExistingContract.class); - classByDiscriminatorValue.put("CreateContract", CreateContract.class); - classByDiscriminatorValue.put("Contract", Contract.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "contractCallType")); - } - }) - .registerTypeSelector(ContractCall.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("ContractCall", ContractCall.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "scenarioType")); - } - }) - .registerTypeSelector(CreateContract.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("CreateContract", CreateContract.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "contractCallType")); - } - }) - .registerTypeSelector(GenericCall.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("GenericCall", GenericCall.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "type")); - } - }) - .registerTypeSelector(MethodAndParameter.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("BatchMint", BatchMint.class); - classByDiscriminatorValue.put("Mint", Mint.class); - classByDiscriminatorValue.put("TransferOwnership", TransferOwnership.class); - classByDiscriminatorValue.put("GenericCall", GenericCall.class); - classByDiscriminatorValue.put("MethodAndParameter", MethodAndParameter.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "type")); - } - }) - .registerTypeSelector(Mint.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("Mint", Mint.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "type")); - } - }) - .registerTypeSelector(Parameter.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("ArrayParameter", ArrayParameter.class); - classByDiscriminatorValue.put("SimpleParameter", SimpleParameter.class); - classByDiscriminatorValue.put("Parameter", Parameter.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "type")); - } - }) - .registerTypeSelector(RoundRobinMoneyTransfer.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("RoundRobinMoneyTransfer", RoundRobinMoneyTransfer.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "scenarioType")); - } - }) - .registerTypeSelector(Scenario.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("ContractCall", ContractCall.class); - classByDiscriminatorValue.put("RoundRobinMoneyTransfer", RoundRobinMoneyTransfer.class); - classByDiscriminatorValue.put("SelfTransactionWithPayload", SelfTransactionWithPayload.class); - classByDiscriminatorValue.put("SelfTransactionWithRandomPayload", SelfTransactionWithRandomPayload.class); - classByDiscriminatorValue.put("UnderPricedTransaction", UnderPricedTransaction.class); - classByDiscriminatorValue.put("Scenario", Scenario.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "scenarioType")); - } - }) - .registerTypeSelector(SelfTransactionWithPayload.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("SelfTransactionWithPayload", SelfTransactionWithPayload.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "scenarioType")); - } - }) - .registerTypeSelector(SelfTransactionWithRandomPayload.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("SelfTransactionWithRandomPayload", SelfTransactionWithRandomPayload.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "scenarioType")); - } - }) - .registerTypeSelector(SimpleParameter.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("SimpleParameter", SimpleParameter.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "type")); - } - }) - .registerTypeSelector(TransferOwnership.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("TransferOwnership", TransferOwnership.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "type")); - } - }) - .registerTypeSelector(UnderPricedTransaction.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap<>(); - classByDiscriminatorValue.put("UnderPricedTransaction", UnderPricedTransaction.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "scenarioType")); - } - }) - ; - GsonBuilder builder = fireBuilder.createGsonBuilder(); - return builder; + @SuppressWarnings("unchecked") + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = + new GsonFireBuilder() + .registerTypeSelector( + ArrayParameter.class, + new TypeSelector() { + @Override + public Class getClassForElement( + JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put("ArrayParameter", ArrayParameter.class); + return getClassByDiscriminator( + classByDiscriminatorValue, getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector( + BatchMint.class, + new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put("BatchMint", BatchMint.class); + return getClassByDiscriminator( + classByDiscriminatorValue, getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector( + CallContractReference.class, + new TypeSelector() { + @Override + public Class getClassForElement( + JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put( + "CallContractReference", CallContractReference.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "contractCallType")); + } + }) + .registerTypeSelector( + CallExistingContract.class, + new TypeSelector() { + @Override + public Class getClassForElement( + JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put( + "CallExistingContract", CallExistingContract.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "contractCallType")); + } + }) + .registerTypeSelector( + Contract.class, + new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put( + "CallContractReference", CallContractReference.class); + classByDiscriminatorValue.put( + "CallExistingContract", CallExistingContract.class); + classByDiscriminatorValue.put("CreateContract", CreateContract.class); + classByDiscriminatorValue.put("Contract", Contract.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "contractCallType")); + } + }) + .registerTypeSelector( + ContractCall.class, + new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put("ContractCall", ContractCall.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "scenarioType")); + } + }) + .registerTypeSelector( + CreateContract.class, + new TypeSelector() { + @Override + public Class getClassForElement( + JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put("CreateContract", CreateContract.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "contractCallType")); + } + }) + .registerTypeSelector( + GenericCall.class, + new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put("GenericCall", GenericCall.class); + return getClassByDiscriminator( + classByDiscriminatorValue, getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector( + MethodAndParameter.class, + new TypeSelector() { + @Override + public Class getClassForElement( + JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put("BatchMint", BatchMint.class); + classByDiscriminatorValue.put("Mint", Mint.class); + classByDiscriminatorValue.put("TransferOwnership", TransferOwnership.class); + classByDiscriminatorValue.put("GenericCall", GenericCall.class); + classByDiscriminatorValue.put("MethodAndParameter", MethodAndParameter.class); + return getClassByDiscriminator( + classByDiscriminatorValue, getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector( + Mint.class, + new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put("Mint", Mint.class); + return getClassByDiscriminator( + classByDiscriminatorValue, getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector( + Parameter.class, + new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put("ArrayParameter", ArrayParameter.class); + classByDiscriminatorValue.put("SimpleParameter", SimpleParameter.class); + classByDiscriminatorValue.put("Parameter", Parameter.class); + return getClassByDiscriminator( + classByDiscriminatorValue, getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector( + RoundRobinMoneyTransfer.class, + new TypeSelector() { + @Override + public Class getClassForElement( + JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put( + "RoundRobinMoneyTransfer", RoundRobinMoneyTransfer.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "scenarioType")); + } + }) + .registerTypeSelector( + Scenario.class, + new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put("ContractCall", ContractCall.class); + classByDiscriminatorValue.put( + "RoundRobinMoneyTransfer", RoundRobinMoneyTransfer.class); + classByDiscriminatorValue.put( + "SelfTransactionWithPayload", SelfTransactionWithPayload.class); + classByDiscriminatorValue.put( + "SelfTransactionWithRandomPayload", SelfTransactionWithRandomPayload.class); + classByDiscriminatorValue.put( + "UnderPricedTransaction", UnderPricedTransaction.class); + classByDiscriminatorValue.put("Scenario", Scenario.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "scenarioType")); + } + }) + .registerTypeSelector( + SelfTransactionWithPayload.class, + new TypeSelector() { + @Override + public Class getClassForElement( + JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put( + "SelfTransactionWithPayload", SelfTransactionWithPayload.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "scenarioType")); + } + }) + .registerTypeSelector( + SelfTransactionWithRandomPayload.class, + new TypeSelector() { + @Override + public Class getClassForElement( + JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put( + "SelfTransactionWithRandomPayload", SelfTransactionWithRandomPayload.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "scenarioType")); + } + }) + .registerTypeSelector( + SimpleParameter.class, + new TypeSelector() { + @Override + public Class getClassForElement( + JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put("SimpleParameter", SimpleParameter.class); + return getClassByDiscriminator( + classByDiscriminatorValue, getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector( + TransferOwnership.class, + new TypeSelector() { + @Override + public Class getClassForElement( + JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put("TransferOwnership", TransferOwnership.class); + return getClassByDiscriminator( + classByDiscriminatorValue, getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector( + UnderPricedTransaction.class, + new TypeSelector() { + @Override + public Class getClassForElement( + JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap<>(); + classByDiscriminatorValue.put( + "UnderPricedTransaction", UnderPricedTransaction.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "scenarioType")); + } + }); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException( + "missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + /** + * Returns the Java class that implements the OpenAPI schema for the specified discriminator + * value. + * + * @param classByDiscriminatorValue The map of discriminator values to Java classes. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @return The Java class that implements the OpenAPI schema + */ + private static Class getClassByDiscriminator( + Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException( + "cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + { + GsonBuilder gsonBuilder = createGson(); + gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); + gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gsonBuilder.registerTypeAdapterFactory(new ArrayParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new BatchMint.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new CallContractReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new CallExistingContract.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new Context.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ContractCall.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new CreateContract.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new GenericCall.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new Mint.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new Request.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new RoundRobinMoneyTransfer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ScenarioDefinition.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new SelfTransactionWithPayload.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new SelfTransactionWithRandomPayload.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new SimpleParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new TransferOwnership.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new UnderPricedTransaction.CustomTypeAdapterFactory()); + gson = gsonBuilder.create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public static Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + */ + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public static String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see + // https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** Gson TypeAdapter for Byte Array type */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } } - private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { - JsonElement element = readElement.getAsJsonObject().get(discriminatorField); - if (null == element) { - throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** Gson TypeAdapter for JSR310 OffsetDateTime type */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length() - 5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** Gson TypeAdapter for JSR310 LocalDate type */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + /** + * Gson TypeAdapter for java.sql.Date type If the dateFormat is null, a simple "yyyy-MM-dd" format + * will be used (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); } - return element.getAsString(); + out.value(value); + } } - /** - * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. - * - * @param classByDiscriminatorValue The map of discriminator values to Java classes. - * @param discriminatorValue The value of the OpenAPI discriminator in the input data. - * @return The Java class that implements the OpenAPI schema - */ - private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { - Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); - if (null == clazz) { - throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); - } - return clazz; - } - - { - GsonBuilder gsonBuilder = createGson(); - gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); - gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); - gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); - gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); - gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); - gsonBuilder.registerTypeAdapterFactory(new ArrayParameter.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new BatchMint.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new CallContractReference.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new CallExistingContract.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new Context.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ContractCall.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new CreateContract.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new GenericCall.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new Mint.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new Request.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new RoundRobinMoneyTransfer.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ScenarioDefinition.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new SelfTransactionWithPayload.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new SelfTransactionWithRandomPayload.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new SimpleParameter.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new TransferOwnership.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new UnderPricedTransaction.CustomTypeAdapterFactory()); - gson = gsonBuilder.create(); - } - - /** - * Get Gson. - * - * @return Gson - */ - public static Gson getGson() { - return gson; - } - - /** - * Set Gson. - * - * @param gson Gson - */ - public static void setGson(Gson gson) { - JSON.gson = gson; - } - - public static void setLenientOnJson(boolean lenientOnJson) { - isLenientOnJson = lenientOnJson; - } - - /** - * Serialize the given Java object into JSON string. - * - * @param obj Object - * @return String representation of the JSON - */ - public static String serialize(Object obj) { - return gson.toJson(obj); - } - - /** - * Deserialize the given JSON string to Java object. - * - * @param Type - * @param body The JSON string - * @param returnType The type to deserialize into - * @return The deserialized Java object - */ - @SuppressWarnings("unchecked") - public static T deserialize(String body, Type returnType) { - try { - if (isLenientOnJson) { - JsonReader jsonReader = new JsonReader(new StringReader(body)); - // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - jsonReader.setLenient(true); - return gson.fromJson(jsonReader, returnType); - } else { - return gson.fromJson(body, returnType); + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); } - } catch (JsonParseException e) { - // Fallback processing when failed to parse JSON form response body: - // return the response body string directly for the String return type; - if (returnType.equals(String.class)) { - return (T) body; - } else { - throw (e); - } - } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; } - /** - * Gson TypeAdapter for Byte Array type - */ - public static class ByteArrayAdapter extends TypeAdapter { - - @Override - public void write(JsonWriter out, byte[] value) throws IOException { - if (value == null) { - out.nullValue(); - } else { - out.value(ByteString.of(value).base64()); - } - } - - @Override - public byte[] read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String bytesAsBase64 = in.nextString(); - ByteString byteString = ByteString.decodeBase64(bytesAsBase64); - return byteString.toByteArray(); - } - } + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; } - /** - * Gson TypeAdapter for JSR310 OffsetDateTime type - */ - public static class OffsetDateTimeTypeAdapter extends TypeAdapter { - - private DateTimeFormatter formatter; - - public OffsetDateTimeTypeAdapter() { - this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); - } - - public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { - this.formatter = formatter; - } - - public void setFormat(DateTimeFormatter dateFormat) { - this.formatter = dateFormat; - } - - @Override - public void write(JsonWriter out, OffsetDateTime date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } - } - - @Override - public OffsetDateTime read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - if (date.endsWith("+0000")) { - date = date.substring(0, date.length()-5) + "Z"; - } - return OffsetDateTime.parse(date, formatter); - } + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); } + out.value(value); + } } - /** - * Gson TypeAdapter for JSR310 LocalDate type - */ - public static class LocalDateTypeAdapter extends TypeAdapter { - - private DateTimeFormatter formatter; - - public LocalDateTypeAdapter() { - this(DateTimeFormatter.ISO_LOCAL_DATE); - } - - public LocalDateTypeAdapter(DateTimeFormatter formatter) { - this.formatter = formatter; - } - - public void setFormat(DateTimeFormatter dateFormat) { - this.formatter = dateFormat; - } - - @Override - public void write(JsonWriter out, LocalDate date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } - } - - @Override - public LocalDate read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return LocalDate.parse(date, formatter); - } - } - } - - public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - offsetDateTimeTypeAdapter.setFormat(dateFormat); - } - - public static void setLocalDateFormat(DateTimeFormatter dateFormat) { - localDateTypeAdapter.setFormat(dateFormat); - } - - /** - * Gson TypeAdapter for java.sql.Date type - * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used - * (more efficient than SimpleDateFormat). - */ - public static class SqlDateTypeAdapter extends TypeAdapter { - - private DateFormat dateFormat; - - public SqlDateTypeAdapter() {} - - public SqlDateTypeAdapter(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - public void setFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - @Override - public void write(JsonWriter out, java.sql.Date date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - String value; - if (dateFormat != null) { - value = dateFormat.format(date); - } else { - value = date.toString(); - } - out.value(value); - } - } - - @Override - public java.sql.Date read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - try { - if (dateFormat != null) { - return new java.sql.Date(dateFormat.parse(date).getTime()); - } - return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); - } catch (ParseException e) { - throw new JsonParseException(e); - } - } - } - } - - /** - * Gson TypeAdapter for java.util.Date type - * If the dateFormat is null, ISO8601Utils will be used. - */ - public static class DateTypeAdapter extends TypeAdapter { - - private DateFormat dateFormat; - - public DateTypeAdapter() {} - - public DateTypeAdapter(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - public void setFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - @Override - public void write(JsonWriter out, Date date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - String value; - if (dateFormat != null) { - value = dateFormat.format(date); - } else { - value = ISO8601Utils.format(date, true); - } - out.value(value); - } - } - - @Override - public Date read(JsonReader in) throws IOException { + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); try { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - try { - if (dateFormat != null) { - return dateFormat.parse(date); - } - return ISO8601Utils.parse(date, new ParsePosition(0)); - } catch (ParseException e) { - throw new JsonParseException(e); - } - } - } catch (IllegalArgumentException e) { - throw new JsonParseException(e); + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); } } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } } + } - public static void setDateFormat(DateFormat dateFormat) { - dateTypeAdapter.setFormat(dateFormat); - } + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } - public static void setSqlDateFormat(DateFormat dateFormat) { - sqlDateTypeAdapter.setFormat(dateFormat); - } + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/ArrayParameter.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/ArrayParameter.java index f336ae58..a01b41ea 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/ArrayParameter.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/ArrayParameter.java @@ -10,36 +10,30 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * ArrayParameter - */ - +/** ArrayParameter */ public class ArrayParameter extends Parameter { public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) private List values; @@ -60,10 +54,11 @@ public class ArrayParameter extends Parameter { return this; } - /** + /** * Get values + * * @return values - **/ + */ @javax.annotation.Nullable public List getValues() { return values; @@ -73,8 +68,6 @@ public class ArrayParameter extends Parameter { this.values = values; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -84,8 +77,7 @@ public class ArrayParameter extends Parameter { return false; } ArrayParameter arrayParameter = (ArrayParameter) o; - return Objects.equals(this.values, arrayParameter.values) && - super.equals(o); + return Objects.equals(this.values, arrayParameter.values) && super.equals(o); } @Override @@ -104,8 +96,7 @@ public class ArrayParameter extends Parameter { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -114,7 +105,6 @@ public class ArrayParameter extends Parameter { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -128,80 +118,90 @@ public class ArrayParameter extends Parameter { openapiRequiredFields.add("type"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ArrayParameter - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayParameter + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ArrayParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayParameter is not found in the empty JSON string", ArrayParameter.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!ArrayParameter.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ArrayParameter is not found in the empty JSON string", + ArrayParameter.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ArrayParameter.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ArrayParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ArrayParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `ArrayParameter` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : ArrayParameter.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ArrayParameter.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!ArrayParameter.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ArrayParameter' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(ArrayParameter.class)); + if (!ArrayParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ArrayParameter.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, ArrayParameter value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public ArrayParameter read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public ArrayParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of ArrayParameter given an JSON string - * - * @param jsonString JSON string - * @return An instance of ArrayParameter - * @throws IOException if the JSON string is invalid with respect to ArrayParameter - */ + /** + * Create an instance of ArrayParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayParameter + * @throws IOException if the JSON string is invalid with respect to ArrayParameter + */ public static ArrayParameter fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ArrayParameter.class); } - /** - * Convert an instance of ArrayParameter to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of ArrayParameter to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/BatchMint.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/BatchMint.java index d1389a06..721d6f9a 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/BatchMint.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/BatchMint.java @@ -10,40 +10,35 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * BatchMint - */ - +/** BatchMint */ public class BatchMint extends MethodAndParameter { public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) private List address; public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) private Integer amount; @@ -64,10 +59,11 @@ public class BatchMint extends MethodAndParameter { return this; } - /** + /** * Get address + * * @return address - **/ + */ @javax.annotation.Nullable public List getAddress() { return address; @@ -77,16 +73,16 @@ public class BatchMint extends MethodAndParameter { this.address = address; } - public BatchMint amount(Integer amount) { this.amount = amount; return this; } - /** + /** * Get amount + * * @return amount - **/ + */ @javax.annotation.Nullable public Integer getAmount() { return amount; @@ -96,8 +92,6 @@ public class BatchMint extends MethodAndParameter { this.amount = amount; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -107,9 +101,9 @@ public class BatchMint extends MethodAndParameter { return false; } BatchMint batchMint = (BatchMint) o; - return Objects.equals(this.address, batchMint.address) && - Objects.equals(this.amount, batchMint.amount) && - super.equals(o); + return Objects.equals(this.address, batchMint.address) + && Objects.equals(this.amount, batchMint.amount) + && super.equals(o); } @Override @@ -129,8 +123,7 @@ public class BatchMint extends MethodAndParameter { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -139,7 +132,6 @@ public class BatchMint extends MethodAndParameter { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -155,80 +147,90 @@ public class BatchMint extends MethodAndParameter { openapiRequiredFields.add("numberOfTimes"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to BatchMint - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BatchMint + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!BatchMint.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in BatchMint is not found in the empty JSON string", BatchMint.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!BatchMint.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BatchMint is not found in the empty JSON string", + BatchMint.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!BatchMint.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BatchMint` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BatchMint.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `BatchMint` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : BatchMint.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BatchMint.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!BatchMint.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BatchMint' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BatchMint.class)); + if (!BatchMint.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BatchMint' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BatchMint.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, BatchMint value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BatchMint value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public BatchMint read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public BatchMint read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of BatchMint given an JSON string - * - * @param jsonString JSON string - * @return An instance of BatchMint - * @throws IOException if the JSON string is invalid with respect to BatchMint - */ + /** + * Create an instance of BatchMint given an JSON string + * + * @param jsonString JSON string + * @return An instance of BatchMint + * @throws IOException if the JSON string is invalid with respect to BatchMint + */ public static BatchMint fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, BatchMint.class); } - /** - * Convert an instance of BatchMint to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of BatchMint to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/CallContractReference.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/CallContractReference.java index ae2793cd..127ca191 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/CallContractReference.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/CallContractReference.java @@ -10,38 +10,33 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * CallContractReference - */ - +/** CallContractReference */ public class CallContractReference extends Contract { public static final String SERIALIZED_NAME_CONTRACT_NAME = "contractName"; + @SerializedName(SERIALIZED_NAME_CONTRACT_NAME) private String contractName; public static final String SERIALIZED_NAME_METHOD_AND_PARAMETERS = "methodAndParameters"; + @SerializedName(SERIALIZED_NAME_METHOD_AND_PARAMETERS) private MethodAndParameter methodAndParameters; @@ -54,10 +49,11 @@ public class CallContractReference extends Contract { return this; } - /** + /** * Get contractName + * * @return contractName - **/ + */ @javax.annotation.Nullable public String getContractName() { return contractName; @@ -67,16 +63,16 @@ public class CallContractReference extends Contract { this.contractName = contractName; } - public CallContractReference methodAndParameters(MethodAndParameter methodAndParameters) { this.methodAndParameters = methodAndParameters; return this; } - /** + /** * Get methodAndParameters + * * @return methodAndParameters - **/ + */ @javax.annotation.Nullable public MethodAndParameter getMethodAndParameters() { return methodAndParameters; @@ -86,8 +82,6 @@ public class CallContractReference extends Contract { this.methodAndParameters = methodAndParameters; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -97,9 +91,9 @@ public class CallContractReference extends Contract { return false; } CallContractReference callContractReference = (CallContractReference) o; - return Objects.equals(this.contractName, callContractReference.contractName) && - Objects.equals(this.methodAndParameters, callContractReference.methodAndParameters) && - super.equals(o); + return Objects.equals(this.contractName, callContractReference.contractName) + && Objects.equals(this.methodAndParameters, callContractReference.methodAndParameters) + && super.equals(o); } @Override @@ -113,14 +107,15 @@ public class CallContractReference extends Contract { sb.append("class CallContractReference {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" contractName: ").append(toIndentedString(contractName)).append("\n"); - sb.append(" methodAndParameters: ").append(toIndentedString(methodAndParameters)).append("\n"); + sb.append(" methodAndParameters: ") + .append(toIndentedString(methodAndParameters)) + .append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -129,7 +124,6 @@ public class CallContractReference extends Contract { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -143,80 +137,90 @@ public class CallContractReference extends Contract { openapiRequiredFields.add("contractCallType"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CallContractReference - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CallContractReference + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CallContractReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CallContractReference is not found in the empty JSON string", CallContractReference.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!CallContractReference.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CallContractReference is not found in the empty JSON string", + CallContractReference.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CallContractReference.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CallContractReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CallContractReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `CallContractReference` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CallContractReference.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CallContractReference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!CallContractReference.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CallContractReference' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CallContractReference.class)); + if (!CallContractReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CallContractReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CallContractReference.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CallContractReference value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CallContractReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public CallContractReference read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public CallContractReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of CallContractReference given an JSON string - * - * @param jsonString JSON string - * @return An instance of CallContractReference - * @throws IOException if the JSON string is invalid with respect to CallContractReference - */ + /** + * Create an instance of CallContractReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of CallContractReference + * @throws IOException if the JSON string is invalid with respect to CallContractReference + */ public static CallContractReference fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CallContractReference.class); } - /** - * Convert an instance of CallContractReference to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CallContractReference to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/CallExistingContract.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/CallExistingContract.java index 03477ad0..b37abadf 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/CallExistingContract.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/CallExistingContract.java @@ -10,38 +10,33 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * CallExistingContract - */ - +/** CallExistingContract */ public class CallExistingContract extends Contract { public static final String SERIALIZED_NAME_CONTRACT_ADDRESS = "contractAddress"; + @SerializedName(SERIALIZED_NAME_CONTRACT_ADDRESS) private String contractAddress; public static final String SERIALIZED_NAME_METHOD_AND_PARAMETERS = "methodAndParameters"; + @SerializedName(SERIALIZED_NAME_METHOD_AND_PARAMETERS) private MethodAndParameter methodAndParameters; @@ -54,10 +49,11 @@ public class CallExistingContract extends Contract { return this; } - /** + /** * Get contractAddress + * * @return contractAddress - **/ + */ @javax.annotation.Nullable public String getContractAddress() { return contractAddress; @@ -67,16 +63,16 @@ public class CallExistingContract extends Contract { this.contractAddress = contractAddress; } - public CallExistingContract methodAndParameters(MethodAndParameter methodAndParameters) { this.methodAndParameters = methodAndParameters; return this; } - /** + /** * Get methodAndParameters + * * @return methodAndParameters - **/ + */ @javax.annotation.Nullable public MethodAndParameter getMethodAndParameters() { return methodAndParameters; @@ -86,8 +82,6 @@ public class CallExistingContract extends Contract { this.methodAndParameters = methodAndParameters; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -97,9 +91,9 @@ public class CallExistingContract extends Contract { return false; } CallExistingContract callExistingContract = (CallExistingContract) o; - return Objects.equals(this.contractAddress, callExistingContract.contractAddress) && - Objects.equals(this.methodAndParameters, callExistingContract.methodAndParameters) && - super.equals(o); + return Objects.equals(this.contractAddress, callExistingContract.contractAddress) + && Objects.equals(this.methodAndParameters, callExistingContract.methodAndParameters) + && super.equals(o); } @Override @@ -113,14 +107,15 @@ public class CallExistingContract extends Contract { sb.append("class CallExistingContract {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" contractAddress: ").append(toIndentedString(contractAddress)).append("\n"); - sb.append(" methodAndParameters: ").append(toIndentedString(methodAndParameters)).append("\n"); + sb.append(" methodAndParameters: ") + .append(toIndentedString(methodAndParameters)) + .append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -129,7 +124,6 @@ public class CallExistingContract extends Contract { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -143,80 +137,90 @@ public class CallExistingContract extends Contract { openapiRequiredFields.add("contractCallType"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CallExistingContract - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CallExistingContract + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CallExistingContract.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CallExistingContract is not found in the empty JSON string", CallExistingContract.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!CallExistingContract.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CallExistingContract is not found in the empty JSON string", + CallExistingContract.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CallExistingContract.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CallExistingContract` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CallExistingContract.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `CallExistingContract` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CallExistingContract.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CallExistingContract.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!CallExistingContract.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CallExistingContract' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CallExistingContract.class)); + if (!CallExistingContract.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CallExistingContract' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CallExistingContract.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CallExistingContract value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CallExistingContract value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public CallExistingContract read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public CallExistingContract read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of CallExistingContract given an JSON string - * - * @param jsonString JSON string - * @return An instance of CallExistingContract - * @throws IOException if the JSON string is invalid with respect to CallExistingContract - */ + /** + * Create an instance of CallExistingContract given an JSON string + * + * @param jsonString JSON string + * @return An instance of CallExistingContract + * @throws IOException if the JSON string is invalid with respect to CallExistingContract + */ public static CallExistingContract fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CallExistingContract.class); } - /** - * Convert an instance of CallExistingContract to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CallExistingContract to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Context.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Context.java index 14d7be1c..d9128a6d 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Context.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Context.java @@ -10,64 +10,64 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * Context - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-03-20T14:40:46.004960500+01:00[Europe/Berlin]") +/** Context */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2024-03-20T14:40:46.004960500+01:00[Europe/Berlin]") public class Context { public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) private String url = "http://localhost:8545"; public static final String SERIALIZED_NAME_NB_OF_EXECUTIONS = "nbOfExecutions"; + @SerializedName(SERIALIZED_NAME_NB_OF_EXECUTIONS) private Integer nbOfExecutions = 1; public static final String SERIALIZED_NAME_CHAIN_ID = "chainId"; + @SerializedName(SERIALIZED_NAME_CHAIN_ID) private Integer chainId; public static final String SERIALIZED_NAME_CONTRACTS = "contracts"; + @SerializedName(SERIALIZED_NAME_CONTRACTS) private List contracts; - public Context() { - } + public Context() {} public Context url(String url) { this.url = url; return this; } - /** + /** * Get url + * * @return url - **/ + */ @javax.annotation.Nullable public String getUrl() { return url; @@ -77,16 +77,16 @@ public class Context { this.url = url; } - public Context nbOfExecutions(Integer nbOfExecutions) { this.nbOfExecutions = nbOfExecutions; return this; } - /** + /** * Get nbOfExecutions + * * @return nbOfExecutions - **/ + */ @javax.annotation.Nullable public Integer getNbOfExecutions() { return nbOfExecutions; @@ -96,16 +96,16 @@ public class Context { this.nbOfExecutions = nbOfExecutions; } - public Context chainId(Integer chainId) { this.chainId = chainId; return this; } - /** + /** * Get chainId + * * @return chainId - **/ + */ @javax.annotation.Nonnull public Integer getChainId() { return chainId; @@ -115,7 +115,6 @@ public class Context { this.chainId = chainId; } - public Context contracts(List contracts) { this.contracts = contracts; return this; @@ -129,10 +128,11 @@ public class Context { return this; } - /** + /** * Get contracts + * * @return contracts - **/ + */ @javax.annotation.Nullable public List getContracts() { return contracts; @@ -142,8 +142,6 @@ public class Context { this.contracts = contracts; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -153,10 +151,10 @@ public class Context { return false; } Context context = (Context) o; - return Objects.equals(this.url, context.url) && - Objects.equals(this.nbOfExecutions, context.nbOfExecutions) && - Objects.equals(this.chainId, context.chainId) && - Objects.equals(this.contracts, context.contracts); + return Objects.equals(this.url, context.url) + && Objects.equals(this.nbOfExecutions, context.nbOfExecutions) + && Objects.equals(this.chainId, context.chainId) + && Objects.equals(this.contracts, context.contracts); } @Override @@ -177,8 +175,7 @@ public class Context { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -187,7 +184,6 @@ public class Context { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -204,98 +200,116 @@ public class Context { openapiRequiredFields.add("chainId"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Context - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Context + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Context.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Context is not found in the empty JSON string", Context.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!Context.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Context is not found in the empty JSON string", + Context.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Context.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Context` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Context.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `Context` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Context.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Context.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) + && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `url` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("url").toString())); + } + if (jsonObj.get("contracts") != null && !jsonObj.get("contracts").isJsonNull()) { + JsonArray jsonArraycontracts = jsonObj.getAsJsonArray("contracts"); + if (jsonArraycontracts != null) { + // ensure the json data is an array + if (!jsonObj.get("contracts").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `contracts` to be an array in the JSON string but got `%s`", + jsonObj.get("contracts").toString())); } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); - } - if (jsonObj.get("contracts") != null && !jsonObj.get("contracts").isJsonNull()) { - JsonArray jsonArraycontracts = jsonObj.getAsJsonArray("contracts"); - if (jsonArraycontracts != null) { - // ensure the json data is an array - if (!jsonObj.get("contracts").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `contracts` to be an array in the JSON string but got `%s`", jsonObj.get("contracts").toString())); - } - // validate the optional field `contracts` (array) - for (int i = 0; i < jsonArraycontracts.size(); i++) { - CreateContract.validateJsonElement(jsonArraycontracts.get(i)); - }; + // validate the optional field `contracts` (array) + for (int i = 0; i < jsonArraycontracts.size(); i++) { + CreateContract.validateJsonElement(jsonArraycontracts.get(i)); } + ; } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!Context.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Context' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Context.class)); + if (!Context.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Context' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Context.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Context value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Context value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public Context read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public Context read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of Context given an JSON string - * - * @param jsonString JSON string - * @return An instance of Context - * @throws IOException if the JSON string is invalid with respect to Context - */ + /** + * Create an instance of Context given an JSON string + * + * @param jsonString JSON string + * @return An instance of Context + * @throws IOException if the JSON string is invalid with respect to Context + */ public static Context fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Context.class); } - /** - * Convert an instance of Context to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of Context to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Contract.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Contract.java index 27fc2eec..6739ca48 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Contract.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Contract.java @@ -10,27 +10,19 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; - -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; - import com.google.gson.JsonElement; - +import com.google.gson.annotations.SerializedName; +import java.io.IOException; import java.util.HashSet; - +import java.util.Objects; import net.consensys.zkevm.load.model.JSON; -/** - * Contract - */ - +/** Contract */ public class Contract { public static final String SERIALIZED_NAME_CONTRACT_CALL_TYPE = "contractCallType"; + @SerializedName(SERIALIZED_NAME_CONTRACT_CALL_TYPE) protected String contractCallType; @@ -43,10 +35,11 @@ public class Contract { return this; } - /** + /** * Get contractCallType + * * @return contractCallType - **/ + */ @javax.annotation.Nonnull public String getContractCallType() { return contractCallType; @@ -56,8 +49,6 @@ public class Contract { this.contractCallType = contractCallType; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -85,8 +76,7 @@ public class Contract { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -95,7 +85,6 @@ public class Contract { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -109,52 +98,58 @@ public class Contract { openapiRequiredFields.add("contractCallType"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Contract - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Contract + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Contract.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Contract is not found in the empty JSON string", Contract.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!Contract.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Contract is not found in the empty JSON string", + Contract.openapiRequiredFields.toString())); } + } - String discriminatorValue = jsonElement.getAsJsonObject().get("contractCallType").getAsString(); - switch (discriminatorValue) { - case "CallContractReference": - CallContractReference.validateJsonElement(jsonElement); - break; - case "CallExistingContract": - CallExistingContract.validateJsonElement(jsonElement); - break; - case "CreateContract": - CreateContract.validateJsonElement(jsonElement); - break; - default: - throw new IllegalArgumentException(String.format("The value of the `contractCallType` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); - } + String discriminatorValue = jsonElement.getAsJsonObject().get("contractCallType").getAsString(); + switch (discriminatorValue) { + case "CallContractReference": + CallContractReference.validateJsonElement(jsonElement); + break; + case "CallExistingContract": + CallExistingContract.validateJsonElement(jsonElement); + break; + case "CreateContract": + CreateContract.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException( + String.format( + "The value of the `contractCallType` field `%s` does not match any key defined in the discriminator's mapping.", + discriminatorValue)); + } } - - /** - * Create an instance of Contract given an JSON string - * - * @param jsonString JSON string - * @return An instance of Contract - * @throws IOException if the JSON string is invalid with respect to Contract - */ + /** + * Create an instance of Contract given an JSON string + * + * @param jsonString JSON string + * @return An instance of Contract + * @throws IOException if the JSON string is invalid with respect to Contract + */ public static Contract fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Contract.class); } - /** - * Convert an instance of Contract to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of Contract to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/ContractCall.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/ContractCall.java index d787f232..c5013343 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/ContractCall.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/ContractCall.java @@ -10,38 +10,33 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * ContractCall - */ - +/** ContractCall */ public class ContractCall extends Scenario { public static final String SERIALIZED_NAME_WALLET = "wallet"; + @SerializedName(SERIALIZED_NAME_WALLET) private String wallet = "source"; public static final String SERIALIZED_NAME_CONTRACT = "contract"; + @SerializedName(SERIALIZED_NAME_CONTRACT) private Contract contract; @@ -54,10 +49,12 @@ public class ContractCall extends Scenario { return this; } - /** - * new means a new wallet is going to be created by the test framework to make the calls, source means the test will use the sourceWallet passed in the context. + /** + * new means a new wallet is going to be created by the test framework to make the calls, source + * means the test will use the sourceWallet passed in the context. + * * @return wallet - **/ + */ @javax.annotation.Nullable public String getWallet() { return wallet; @@ -67,16 +64,16 @@ public class ContractCall extends Scenario { this.wallet = wallet; } - public ContractCall contract(Contract contract) { this.contract = contract; return this; } - /** + /** * Get contract + * * @return contract - **/ + */ @javax.annotation.Nullable public Contract getContract() { return contract; @@ -86,8 +83,6 @@ public class ContractCall extends Scenario { this.contract = contract; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -97,9 +92,9 @@ public class ContractCall extends Scenario { return false; } ContractCall contractCall = (ContractCall) o; - return Objects.equals(this.wallet, contractCall.wallet) && - Objects.equals(this.contract, contractCall.contract) && - super.equals(o); + return Objects.equals(this.wallet, contractCall.wallet) + && Objects.equals(this.contract, contractCall.contract) + && super.equals(o); } @Override @@ -119,8 +114,7 @@ public class ContractCall extends Scenario { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -129,7 +123,6 @@ public class ContractCall extends Scenario { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -143,80 +136,90 @@ public class ContractCall extends Scenario { openapiRequiredFields.add("scenarioType"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ContractCall - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ContractCall + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ContractCall.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in ContractCall is not found in the empty JSON string", ContractCall.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!ContractCall.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ContractCall is not found in the empty JSON string", + ContractCall.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ContractCall.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ContractCall` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ContractCall.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `ContractCall` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : ContractCall.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ContractCall.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!ContractCall.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ContractCall' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(ContractCall.class)); + if (!ContractCall.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ContractCall' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ContractCall.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, ContractCall value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ContractCall value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public ContractCall read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public ContractCall read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of ContractCall given an JSON string - * - * @param jsonString JSON string - * @return An instance of ContractCall - * @throws IOException if the JSON string is invalid with respect to ContractCall - */ + /** + * Create an instance of ContractCall given an JSON string + * + * @param jsonString JSON string + * @return An instance of ContractCall + * @throws IOException if the JSON string is invalid with respect to ContractCall + */ public static ContractCall fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ContractCall.class); } - /** - * Convert an instance of ContractCall to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of ContractCall to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/CreateContract.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/CreateContract.java index 9245696c..dbdc1e2c 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/CreateContract.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/CreateContract.java @@ -10,43 +10,39 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.math.BigInteger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigInteger; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * CreateContract - */ - +/** CreateContract */ public class CreateContract extends Contract { public static final String SERIALIZED_NAME_BYTE_CODE = "byteCode"; + @SerializedName(SERIALIZED_NAME_BYTE_CODE) private String byteCode; public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name; public static final String SERIALIZED_NAME_GAS_LIMIT = "gasLimit"; + @SerializedName(SERIALIZED_NAME_GAS_LIMIT) private BigInteger gasLimit; @@ -60,10 +56,11 @@ public class CreateContract extends Contract { return this; } - /** + /** * Get byteCode + * * @return byteCode - **/ + */ public String getByteCode() { return byteCode; } @@ -72,10 +69,11 @@ public class CreateContract extends Contract { this.byteCode = byteCode; } - /** + /** * Get gasLimit + * * @return gasLimit - **/ + */ public BigInteger getGasLimit() { return gasLimit; } @@ -84,16 +82,16 @@ public class CreateContract extends Contract { this.gasLimit = gasLimit; } - public CreateContract name(String name) { this.name = name; return this; } - /** + /** * Get name + * * @return name - **/ + */ @javax.annotation.Nullable public String getName() { return name; @@ -103,8 +101,6 @@ public class CreateContract extends Contract { this.name = name; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -114,9 +110,9 @@ public class CreateContract extends Contract { return false; } CreateContract createContract = (CreateContract) o; - return Objects.equals(this.byteCode, createContract.byteCode) && - Objects.equals(this.name, createContract.name) && - super.equals(o); + return Objects.equals(this.byteCode, createContract.byteCode) + && Objects.equals(this.name, createContract.name) + && super.equals(o); } @Override @@ -136,8 +132,7 @@ public class CreateContract extends Contract { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -146,7 +141,6 @@ public class CreateContract extends Contract { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -160,80 +154,90 @@ public class CreateContract extends Contract { openapiRequiredFields.add("contractCallType"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CreateContract - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateContract + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CreateContract.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateContract is not found in the empty JSON string", CreateContract.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!CreateContract.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateContract is not found in the empty JSON string", + CreateContract.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateContract.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateContract` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateContract.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `CreateContract` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateContract.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateContract.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateContract.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateContract' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateContract.class)); + if (!CreateContract.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateContract' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateContract.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateContract value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateContract value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public CreateContract read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public CreateContract read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of CreateContract given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateContract - * @throws IOException if the JSON string is invalid with respect to CreateContract - */ + /** + * Create an instance of CreateContract given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateContract + * @throws IOException if the JSON string is invalid with respect to CreateContract + */ public static CreateContract fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreateContract.class); } - /** - * Convert an instance of CreateContract to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CreateContract to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/GenericCall.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/GenericCall.java index fbac0e61..6c572598 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/GenericCall.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/GenericCall.java @@ -10,44 +10,40 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * GenericCall - */ - +/** GenericCall */ public class GenericCall extends MethodAndParameter { public static final String SERIALIZED_NAME_METHOD_NAME = "methodName"; + @SerializedName(SERIALIZED_NAME_METHOD_NAME) private String methodName; public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) private Long price; public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) private List parameters; @@ -60,10 +56,11 @@ public class GenericCall extends MethodAndParameter { return this; } - /** + /** * Get methodName + * * @return methodName - **/ + */ @javax.annotation.Nullable public String getMethodName() { return methodName; @@ -73,16 +70,16 @@ public class GenericCall extends MethodAndParameter { this.methodName = methodName; } - public GenericCall price(Long price) { this.price = price; return this; } - /** + /** * Get price + * * @return price - **/ + */ @javax.annotation.Nullable public Long getPrice() { return price; @@ -92,7 +89,6 @@ public class GenericCall extends MethodAndParameter { this.price = price; } - public GenericCall parameters(List parameters) { this.parameters = parameters; return this; @@ -106,10 +102,11 @@ public class GenericCall extends MethodAndParameter { return this; } - /** + /** * Get parameters + * * @return parameters - **/ + */ @javax.annotation.Nullable public List getParameters() { return parameters; @@ -119,8 +116,6 @@ public class GenericCall extends MethodAndParameter { this.parameters = parameters; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -130,10 +125,10 @@ public class GenericCall extends MethodAndParameter { return false; } GenericCall genericCall = (GenericCall) o; - return Objects.equals(this.methodName, genericCall.methodName) && - Objects.equals(this.price, genericCall.price) && - Objects.equals(this.parameters, genericCall.parameters) && - super.equals(o); + return Objects.equals(this.methodName, genericCall.methodName) + && Objects.equals(this.price, genericCall.price) + && Objects.equals(this.parameters, genericCall.parameters) + && super.equals(o); } @Override @@ -154,8 +149,7 @@ public class GenericCall extends MethodAndParameter { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -164,7 +158,6 @@ public class GenericCall extends MethodAndParameter { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -180,80 +173,90 @@ public class GenericCall extends MethodAndParameter { openapiRequiredFields.add("numberOfTimes"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to GenericCall - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GenericCall + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!GenericCall.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GenericCall is not found in the empty JSON string", GenericCall.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!GenericCall.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GenericCall is not found in the empty JSON string", + GenericCall.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!GenericCall.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GenericCall` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GenericCall.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `GenericCall` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GenericCall.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GenericCall.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!GenericCall.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GenericCall' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GenericCall.class)); + if (!GenericCall.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GenericCall' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GenericCall.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GenericCall value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GenericCall value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public GenericCall read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public GenericCall read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of GenericCall given an JSON string - * - * @param jsonString JSON string - * @return An instance of GenericCall - * @throws IOException if the JSON string is invalid with respect to GenericCall - */ + /** + * Create an instance of GenericCall given an JSON string + * + * @param jsonString JSON string + * @return An instance of GenericCall + * @throws IOException if the JSON string is invalid with respect to GenericCall + */ public static GenericCall fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, GenericCall.class); } - /** - * Convert an instance of GenericCall to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of GenericCall to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/MethodAndParameter.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/MethodAndParameter.java index c0d4fe51..100c3814 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/MethodAndParameter.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/MethodAndParameter.java @@ -10,31 +10,24 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; - -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; - import com.google.gson.JsonElement; - +import com.google.gson.annotations.SerializedName; +import java.io.IOException; import java.util.HashSet; - +import java.util.Objects; import net.consensys.zkevm.load.model.JSON; -/** - * MethodAndParameter - */ - +/** MethodAndParameter */ public class MethodAndParameter { public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) protected String type; public static final String SERIALIZED_NAME_NUMBER_OF_TIMES = "numberOfTimes"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_TIMES) private Integer numberOfTimes = 1; @@ -47,10 +40,11 @@ public class MethodAndParameter { return this; } - /** + /** * Get type + * * @return type - **/ + */ @javax.annotation.Nonnull public String getType() { return type; @@ -60,16 +54,16 @@ public class MethodAndParameter { this.type = type; } - public MethodAndParameter numberOfTimes(Integer numberOfTimes) { this.numberOfTimes = numberOfTimes; return this; } - /** + /** * Get numberOfTimes + * * @return numberOfTimes - **/ + */ @javax.annotation.Nonnull public Integer getNumberOfTimes() { return numberOfTimes; @@ -79,8 +73,6 @@ public class MethodAndParameter { this.numberOfTimes = numberOfTimes; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -90,8 +82,8 @@ public class MethodAndParameter { return false; } MethodAndParameter methodAndParameter = (MethodAndParameter) o; - return Objects.equals(this.type, methodAndParameter.type) && - Objects.equals(this.numberOfTimes, methodAndParameter.numberOfTimes); + return Objects.equals(this.type, methodAndParameter.type) + && Objects.equals(this.numberOfTimes, methodAndParameter.numberOfTimes); } @Override @@ -110,8 +102,7 @@ public class MethodAndParameter { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -120,7 +111,6 @@ public class MethodAndParameter { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -136,55 +126,61 @@ public class MethodAndParameter { openapiRequiredFields.add("numberOfTimes"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to MethodAndParameter - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MethodAndParameter + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!MethodAndParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in MethodAndParameter is not found in the empty JSON string", MethodAndParameter.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!MethodAndParameter.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in MethodAndParameter is not found in the empty JSON string", + MethodAndParameter.openapiRequiredFields.toString())); } + } - String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); - switch (discriminatorValue) { - case "BatchMint": - BatchMint.validateJsonElement(jsonElement); - break; - case "Mint": - Mint.validateJsonElement(jsonElement); - break; - case "TransferOwnership": - TransferOwnership.validateJsonElement(jsonElement); - break; - case "GenericCall": - GenericCall.validateJsonElement(jsonElement); - break; - default: - throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); - } + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "BatchMint": + BatchMint.validateJsonElement(jsonElement); + break; + case "Mint": + Mint.validateJsonElement(jsonElement); + break; + case "TransferOwnership": + TransferOwnership.validateJsonElement(jsonElement); + break; + case "GenericCall": + GenericCall.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException( + String.format( + "The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", + discriminatorValue)); + } } - - /** - * Create an instance of MethodAndParameter given an JSON string - * - * @param jsonString JSON string - * @return An instance of MethodAndParameter - * @throws IOException if the JSON string is invalid with respect to MethodAndParameter - */ + /** + * Create an instance of MethodAndParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of MethodAndParameter + * @throws IOException if the JSON string is invalid with respect to MethodAndParameter + */ public static MethodAndParameter fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MethodAndParameter.class); } - /** - * Convert an instance of MethodAndParameter to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MethodAndParameter to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Mint.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Mint.java index f2c3bdfa..b73b7c70 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Mint.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Mint.java @@ -10,38 +10,33 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * Mint - */ - +/** Mint */ public class Mint extends MethodAndParameter { public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) private String address; public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) private Integer amount; @@ -54,10 +49,11 @@ public class Mint extends MethodAndParameter { return this; } - /** + /** * Get address + * * @return address - **/ + */ @javax.annotation.Nullable public String getAddress() { return address; @@ -67,16 +63,16 @@ public class Mint extends MethodAndParameter { this.address = address; } - public Mint amount(Integer amount) { this.amount = amount; return this; } - /** + /** * Get amount + * * @return amount - **/ + */ @javax.annotation.Nullable public Integer getAmount() { return amount; @@ -86,8 +82,6 @@ public class Mint extends MethodAndParameter { this.amount = amount; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -97,9 +91,9 @@ public class Mint extends MethodAndParameter { return false; } Mint mint = (Mint) o; - return Objects.equals(this.address, mint.address) && - Objects.equals(this.amount, mint.amount) && - super.equals(o); + return Objects.equals(this.address, mint.address) + && Objects.equals(this.amount, mint.amount) + && super.equals(o); } @Override @@ -119,8 +113,7 @@ public class Mint extends MethodAndParameter { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -129,7 +122,6 @@ public class Mint extends MethodAndParameter { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -145,80 +137,89 @@ public class Mint extends MethodAndParameter { openapiRequiredFields.add("numberOfTimes"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Mint - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Mint + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Mint.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Mint is not found in the empty JSON string", Mint.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!Mint.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Mint is not found in the empty JSON string", + Mint.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Mint.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Mint` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Mint.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `Mint` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Mint.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Mint.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!Mint.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Mint' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Mint.class)); + if (!Mint.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Mint' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Mint.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Mint value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Mint value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public Mint read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public Mint read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of Mint given an JSON string - * - * @param jsonString JSON string - * @return An instance of Mint - * @throws IOException if the JSON string is invalid with respect to Mint - */ + /** + * Create an instance of Mint given an JSON string + * + * @param jsonString JSON string + * @return An instance of Mint + * @throws IOException if the JSON string is invalid with respect to Mint + */ public static Mint fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Mint.class); } - /** - * Convert an instance of Mint to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of Mint to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Parameter.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Parameter.java index 72597613..68a4471b 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Parameter.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Parameter.java @@ -10,27 +10,19 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; - -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; - import com.google.gson.JsonElement; - +import com.google.gson.annotations.SerializedName; +import java.io.IOException; import java.util.HashSet; - +import java.util.Objects; import net.consensys.zkevm.load.model.JSON; -/** - * Parameter - */ - +/** Parameter */ public class Parameter { public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) protected String type; @@ -43,10 +35,11 @@ public class Parameter { return this; } - /** + /** * Get type + * * @return type - **/ + */ @javax.annotation.Nonnull public String getType() { return type; @@ -56,8 +49,6 @@ public class Parameter { this.type = type; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -85,8 +76,7 @@ public class Parameter { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -95,7 +85,6 @@ public class Parameter { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -109,49 +98,55 @@ public class Parameter { openapiRequiredFields.add("type"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Parameter - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Parameter + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Parameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Parameter is not found in the empty JSON string", Parameter.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!Parameter.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Parameter is not found in the empty JSON string", + Parameter.openapiRequiredFields.toString())); } + } - String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); - switch (discriminatorValue) { - case "ArrayParameter": - ArrayParameter.validateJsonElement(jsonElement); - break; - case "SimpleParameter": - SimpleParameter.validateJsonElement(jsonElement); - break; - default: - throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); - } + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "ArrayParameter": + ArrayParameter.validateJsonElement(jsonElement); + break; + case "SimpleParameter": + SimpleParameter.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException( + String.format( + "The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", + discriminatorValue)); + } } - - /** - * Create an instance of Parameter given an JSON string - * - * @param jsonString JSON string - * @return An instance of Parameter - * @throws IOException if the JSON string is invalid with respect to Parameter - */ + /** + * Create an instance of Parameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of Parameter + * @throws IOException if the JSON string is invalid with respect to Parameter + */ public static Parameter fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Parameter.class); } - /** - * Convert an instance of Parameter to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of Parameter to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Request.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Request.java index 415e24a7..4e40c7a0 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Request.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Request.java @@ -10,64 +10,61 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * Request - */ - +/** Request */ public class Request { public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) private Integer id; public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name; public static final String SERIALIZED_NAME_CONTEXT = "context"; + @SerializedName(SERIALIZED_NAME_CONTEXT) private Context context; public static final String SERIALIZED_NAME_CALLS = "calls"; + @SerializedName(SERIALIZED_NAME_CALLS) private List calls; - public Request() { - } + public Request() {} public Request id(Integer id) { this.id = id; return this; } - /** + /** * Get id + * * @return id - **/ + */ @javax.annotation.Nullable public Integer getId() { return id; @@ -77,16 +74,16 @@ public class Request { this.id = id; } - public Request name(String name) { this.name = name; return this; } - /** + /** * Get name + * * @return name - **/ + */ @javax.annotation.Nullable public String getName() { return name; @@ -96,16 +93,16 @@ public class Request { this.name = name; } - public Request context(Context context) { this.context = context; return this; } - /** + /** * Get context + * * @return context - **/ + */ @javax.annotation.Nonnull public Context getContext() { return context; @@ -115,7 +112,6 @@ public class Request { this.context = context; } - public Request calls(List calls) { this.calls = calls; return this; @@ -129,10 +125,11 @@ public class Request { return this; } - /** + /** * Get calls + * * @return calls - **/ + */ @javax.annotation.Nullable public List getCalls() { return calls; @@ -142,8 +139,6 @@ public class Request { this.calls = calls; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -153,10 +148,10 @@ public class Request { return false; } Request request = (Request) o; - return Objects.equals(this.id, request.id) && - Objects.equals(this.name, request.name) && - Objects.equals(this.context, request.context) && - Objects.equals(this.calls, request.calls); + return Objects.equals(this.id, request.id) + && Objects.equals(this.name, request.name) + && Objects.equals(this.context, request.context) + && Objects.equals(this.calls, request.calls); } @Override @@ -177,8 +172,7 @@ public class Request { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -187,7 +181,6 @@ public class Request { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -204,100 +197,118 @@ public class Request { openapiRequiredFields.add("context"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Request - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Request + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Request.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Request is not found in the empty JSON string", Request.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!Request.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Request is not found in the empty JSON string", + Request.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Request.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Request` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Request.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `Request` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Request.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Request.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + // validate the required field `context` + Context.validateJsonElement(jsonObj.get("context")); + if (jsonObj.get("calls") != null && !jsonObj.get("calls").isJsonNull()) { + JsonArray jsonArraycalls = jsonObj.getAsJsonArray("calls"); + if (jsonArraycalls != null) { + // ensure the json data is an array + if (!jsonObj.get("calls").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `calls` to be an array in the JSON string but got `%s`", + jsonObj.get("calls").toString())); } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); - } - // validate the required field `context` - Context.validateJsonElement(jsonObj.get("context")); - if (jsonObj.get("calls") != null && !jsonObj.get("calls").isJsonNull()) { - JsonArray jsonArraycalls = jsonObj.getAsJsonArray("calls"); - if (jsonArraycalls != null) { - // ensure the json data is an array - if (!jsonObj.get("calls").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `calls` to be an array in the JSON string but got `%s`", jsonObj.get("calls").toString())); - } - // validate the optional field `calls` (array) - for (int i = 0; i < jsonArraycalls.size(); i++) { - ScenarioDefinition.validateJsonElement(jsonArraycalls.get(i)); - }; + // validate the optional field `calls` (array) + for (int i = 0; i < jsonArraycalls.size(); i++) { + ScenarioDefinition.validateJsonElement(jsonArraycalls.get(i)); } + ; } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!Request.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Request' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Request.class)); + if (!Request.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Request' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Request.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Request value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Request value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public Request read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public Request read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of Request given an JSON string - * - * @param jsonString JSON string - * @return An instance of Request - * @throws IOException if the JSON string is invalid with respect to Request - */ + /** + * Create an instance of Request given an JSON string + * + * @param jsonString JSON string + * @return An instance of Request + * @throws IOException if the JSON string is invalid with respect to Request + */ public static Request fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Request.class); } - /** - * Convert an instance of Request to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of Request to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/RoundRobinMoneyTransfer.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/RoundRobinMoneyTransfer.java index 75067f8a..6414615f 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/RoundRobinMoneyTransfer.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/RoundRobinMoneyTransfer.java @@ -10,38 +10,36 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; /** - * The test will create nbWallets new wallets and make each of them send nbTransfers requests to each other in a round robin fashion. + * The test will create nbWallets new wallets and make each of them send nbTransfers requests to + * each other in a round robin fashion. */ - public class RoundRobinMoneyTransfer extends Scenario { public static final String SERIALIZED_NAME_NB_TRANSFERS = "nbTransfers"; + @SerializedName(SERIALIZED_NAME_NB_TRANSFERS) private Integer nbTransfers = 1; public static final String SERIALIZED_NAME_NB_WALLETS = "nbWallets"; + @SerializedName(SERIALIZED_NAME_NB_WALLETS) private Integer nbWallets = 1; @@ -54,10 +52,11 @@ public class RoundRobinMoneyTransfer extends Scenario { return this; } - /** + /** * Get nbTransfers + * * @return nbTransfers - **/ + */ @javax.annotation.Nullable public Integer getNbTransfers() { return nbTransfers; @@ -67,16 +66,16 @@ public class RoundRobinMoneyTransfer extends Scenario { this.nbTransfers = nbTransfers; } - public RoundRobinMoneyTransfer nbWallets(Integer nbWallets) { this.nbWallets = nbWallets; return this; } - /** + /** * Get nbWallets + * * @return nbWallets - **/ + */ @javax.annotation.Nullable public Integer getNbWallets() { return nbWallets; @@ -86,8 +85,6 @@ public class RoundRobinMoneyTransfer extends Scenario { this.nbWallets = nbWallets; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -97,9 +94,9 @@ public class RoundRobinMoneyTransfer extends Scenario { return false; } RoundRobinMoneyTransfer roundRobinMoneyTransfer = (RoundRobinMoneyTransfer) o; - return Objects.equals(this.nbTransfers, roundRobinMoneyTransfer.nbTransfers) && - Objects.equals(this.nbWallets, roundRobinMoneyTransfer.nbWallets) && - super.equals(o); + return Objects.equals(this.nbTransfers, roundRobinMoneyTransfer.nbTransfers) + && Objects.equals(this.nbWallets, roundRobinMoneyTransfer.nbWallets) + && super.equals(o); } @Override @@ -119,8 +116,7 @@ public class RoundRobinMoneyTransfer extends Scenario { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -129,7 +125,6 @@ public class RoundRobinMoneyTransfer extends Scenario { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -143,80 +138,90 @@ public class RoundRobinMoneyTransfer extends Scenario { openapiRequiredFields.add("scenarioType"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to RoundRobinMoneyTransfer - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RoundRobinMoneyTransfer + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!RoundRobinMoneyTransfer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in RoundRobinMoneyTransfer is not found in the empty JSON string", RoundRobinMoneyTransfer.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!RoundRobinMoneyTransfer.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in RoundRobinMoneyTransfer is not found in the empty JSON string", + RoundRobinMoneyTransfer.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!RoundRobinMoneyTransfer.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RoundRobinMoneyTransfer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RoundRobinMoneyTransfer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `RoundRobinMoneyTransfer` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : RoundRobinMoneyTransfer.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RoundRobinMoneyTransfer.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!RoundRobinMoneyTransfer.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'RoundRobinMoneyTransfer' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(RoundRobinMoneyTransfer.class)); + if (!RoundRobinMoneyTransfer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RoundRobinMoneyTransfer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RoundRobinMoneyTransfer.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, RoundRobinMoneyTransfer value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RoundRobinMoneyTransfer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public RoundRobinMoneyTransfer read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public RoundRobinMoneyTransfer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of RoundRobinMoneyTransfer given an JSON string - * - * @param jsonString JSON string - * @return An instance of RoundRobinMoneyTransfer - * @throws IOException if the JSON string is invalid with respect to RoundRobinMoneyTransfer - */ + /** + * Create an instance of RoundRobinMoneyTransfer given an JSON string + * + * @param jsonString JSON string + * @return An instance of RoundRobinMoneyTransfer + * @throws IOException if the JSON string is invalid with respect to RoundRobinMoneyTransfer + */ public static RoundRobinMoneyTransfer fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, RoundRobinMoneyTransfer.class); } - /** - * Convert an instance of RoundRobinMoneyTransfer to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of RoundRobinMoneyTransfer to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Scenario.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Scenario.java index fbca4328..9e6200ce 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Scenario.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/Scenario.java @@ -10,27 +10,19 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; - -import com.google.gson.annotations.SerializedName; - -import java.io.IOException; - import com.google.gson.JsonElement; - +import com.google.gson.annotations.SerializedName; +import java.io.IOException; import java.util.HashSet; - +import java.util.Objects; import net.consensys.zkevm.load.model.JSON; -/** - * Scenario - */ - +/** Scenario */ public class Scenario { public static final String SERIALIZED_NAME_TRANSACTION_TYPE = "scenarioType"; + @SerializedName(SERIALIZED_NAME_TRANSACTION_TYPE) protected String scenarioType; @@ -43,10 +35,11 @@ public class Scenario { return this; } - /** + /** * Get scenarioType + * * @return scenarioType - **/ + */ @javax.annotation.Nonnull public String getScenarioType() { return scenarioType; @@ -56,8 +49,6 @@ public class Scenario { this.scenarioType = scenarioType; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -85,8 +76,7 @@ public class Scenario { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -95,7 +85,6 @@ public class Scenario { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -109,58 +98,64 @@ public class Scenario { openapiRequiredFields.add("scenarioType"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Scenario - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Scenario + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Scenario.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Scenario is not found in the empty JSON string", Scenario.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!Scenario.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Scenario is not found in the empty JSON string", + Scenario.openapiRequiredFields.toString())); } + } - String discriminatorValue = jsonElement.getAsJsonObject().get("scenarioType").getAsString(); - switch (discriminatorValue) { - case "ContractCall": - ContractCall.validateJsonElement(jsonElement); - break; - case "RoundRobinMoneyTransfer": - RoundRobinMoneyTransfer.validateJsonElement(jsonElement); - break; - case "SelfTransactionWithPayload": - SelfTransactionWithPayload.validateJsonElement(jsonElement); - break; - case "SelfTransactionWithRandomPayload": - SelfTransactionWithRandomPayload.validateJsonElement(jsonElement); - break; - case "UnderPricedTransaction": - UnderPricedTransaction.validateJsonElement(jsonElement); - break; - default: - throw new IllegalArgumentException(String.format("The value of the `scenarioType` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); - } + String discriminatorValue = jsonElement.getAsJsonObject().get("scenarioType").getAsString(); + switch (discriminatorValue) { + case "ContractCall": + ContractCall.validateJsonElement(jsonElement); + break; + case "RoundRobinMoneyTransfer": + RoundRobinMoneyTransfer.validateJsonElement(jsonElement); + break; + case "SelfTransactionWithPayload": + SelfTransactionWithPayload.validateJsonElement(jsonElement); + break; + case "SelfTransactionWithRandomPayload": + SelfTransactionWithRandomPayload.validateJsonElement(jsonElement); + break; + case "UnderPricedTransaction": + UnderPricedTransaction.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException( + String.format( + "The value of the `scenarioType` field `%s` does not match any key defined in the discriminator's mapping.", + discriminatorValue)); + } } - - /** - * Create an instance of Scenario given an JSON string - * - * @param jsonString JSON string - * @return An instance of Scenario - * @throws IOException if the JSON string is invalid with respect to Scenario - */ + /** + * Create an instance of Scenario given an JSON string + * + * @param jsonString JSON string + * @return An instance of Scenario + * @throws IOException if the JSON string is invalid with respect to Scenario + */ public static Scenario fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Scenario.class); } - /** - * Convert an instance of Scenario to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of Scenario to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/ScenarioDefinition.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/ScenarioDefinition.java index 39bbaa68..09050b38 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/ScenarioDefinition.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/ScenarioDefinition.java @@ -10,53 +10,49 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * ScenarioDefinition - */ - +/** ScenarioDefinition */ public class ScenarioDefinition { public static final String SERIALIZED_NAME_NB_OF_EXECUTION = "nbOfExecution"; + @SerializedName(SERIALIZED_NAME_NB_OF_EXECUTION) private Integer nbOfExecution = 1; public static final String SERIALIZED_NAME_SCENARIO = "scenario"; + @SerializedName(SERIALIZED_NAME_SCENARIO) private Scenario scenario; - public ScenarioDefinition() { - } + public ScenarioDefinition() {} public ScenarioDefinition nbOfExecution(Integer nbOfExecution) { this.nbOfExecution = nbOfExecution; return this; } - /** - * Number of time the set of call described in this ScenarioDefinition object will be executed. Set to 0 to disable this ScenarioDefinition. + /** + * Number of time the set of call described in this ScenarioDefinition object will be executed. + * Set to 0 to disable this ScenarioDefinition. + * * @return nbOfExecution - **/ + */ @javax.annotation.Nullable public Integer getNbOfExecution() { return nbOfExecution; @@ -66,16 +62,16 @@ public class ScenarioDefinition { this.nbOfExecution = nbOfExecution; } - public ScenarioDefinition scenario(Scenario scenario) { this.scenario = scenario; return this; } - /** + /** * Get scenario + * * @return scenario - **/ + */ @javax.annotation.Nullable public Scenario getScenario() { return scenario; @@ -85,8 +81,6 @@ public class ScenarioDefinition { this.scenario = scenario; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -96,8 +90,8 @@ public class ScenarioDefinition { return false; } ScenarioDefinition scenarioDefinition = (ScenarioDefinition) o; - return Objects.equals(this.nbOfExecution, scenarioDefinition.nbOfExecution) && - Objects.equals(this.scenario, scenarioDefinition.scenario); + return Objects.equals(this.nbOfExecution, scenarioDefinition.nbOfExecution) + && Objects.equals(this.scenario, scenarioDefinition.scenario); } @Override @@ -116,8 +110,7 @@ public class ScenarioDefinition { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -126,7 +119,6 @@ public class ScenarioDefinition { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -140,78 +132,85 @@ public class ScenarioDefinition { openapiRequiredFields = new HashSet(); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ScenarioDefinition - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ScenarioDefinition + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ScenarioDefinition.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in ScenarioDefinition is not found in the empty JSON string", ScenarioDefinition.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!ScenarioDefinition.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ScenarioDefinition is not found in the empty JSON string", + ScenarioDefinition.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ScenarioDefinition.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ScenarioDefinition` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `scenario` - if (jsonObj.get("scenario") != null && !jsonObj.get("scenario").isJsonNull()) { - Scenario.validateJsonElement(jsonObj.get("scenario")); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ScenarioDefinition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `ScenarioDefinition` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `scenario` + if (jsonObj.get("scenario") != null && !jsonObj.get("scenario").isJsonNull()) { + Scenario.validateJsonElement(jsonObj.get("scenario")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!ScenarioDefinition.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ScenarioDefinition' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(ScenarioDefinition.class)); + if (!ScenarioDefinition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ScenarioDefinition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ScenarioDefinition.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, ScenarioDefinition value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ScenarioDefinition value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public ScenarioDefinition read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public ScenarioDefinition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of ScenarioDefinition given an JSON string - * - * @param jsonString JSON string - * @return An instance of ScenarioDefinition - * @throws IOException if the JSON string is invalid with respect to ScenarioDefinition - */ + /** + * Create an instance of ScenarioDefinition given an JSON string + * + * @param jsonString JSON string + * @return An instance of ScenarioDefinition + * @throws IOException if the JSON string is invalid with respect to ScenarioDefinition + */ public static ScenarioDefinition fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ScenarioDefinition.class); } - /** - * Convert an instance of ScenarioDefinition to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of ScenarioDefinition to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/SelfTransactionWithPayload.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/SelfTransactionWithPayload.java index b1abf4d7..6bce911f 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/SelfTransactionWithPayload.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/SelfTransactionWithPayload.java @@ -10,49 +10,52 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; /** - * The test will create nbTransfers new wallets and make each of them send one request to itself. A new wallet is created for each transaction as it's likely the tx will remain in pending state. + * The test will create nbTransfers new wallets and make each of them send one request to itself. A + * new wallet is created for each transaction as it's likely the tx will remain in pending + * state. */ public class SelfTransactionWithPayload extends Scenario { public static final String SERIALIZED_NAME_WALLET = "wallet"; + @SerializedName(SERIALIZED_NAME_WALLET) private String wallet = "new"; public static final String SERIALIZED_NAME_NB_TRANSFERS = "nbTransfers"; + @SerializedName(SERIALIZED_NAME_NB_TRANSFERS) private Integer nbTransfers = 1; public static final String SERIALIZED_NAME_NB_WALLETS = "nbWallets"; + @SerializedName(SERIALIZED_NAME_NB_WALLETS) private Integer nbWallets = 1; public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + @SerializedName(SERIALIZED_NAME_PAYLOAD) private String payload; public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) private Integer price = 27000; @@ -65,10 +68,12 @@ public class SelfTransactionWithPayload extends Scenario { return this; } - /** - * new means a new wallet is going to be created by the test framework to make the calls, source means the test will use the sourceWallet whose pk is passed as parameter. + /** + * new means a new wallet is going to be created by the test framework to make the calls, source + * means the test will use the sourceWallet whose pk is passed as parameter. + * * @return wallet - **/ + */ @javax.annotation.Nullable public String getWallet() { return wallet; @@ -78,16 +83,16 @@ public class SelfTransactionWithPayload extends Scenario { this.wallet = wallet; } - public SelfTransactionWithPayload nbTransfers(Integer nbTransfers) { this.nbTransfers = nbTransfers; return this; } - /** + /** * Get nbTransfers + * * @return nbTransfers - **/ + */ @javax.annotation.Nullable public Integer getNbTransfers() { return nbTransfers; @@ -97,16 +102,16 @@ public class SelfTransactionWithPayload extends Scenario { this.nbTransfers = nbTransfers; } - public SelfTransactionWithPayload nbWallets(Integer nbWallets) { this.nbWallets = nbWallets; return this; } - /** + /** * Get nbWallets + * * @return nbWallets - **/ + */ @javax.annotation.Nullable public Integer getNbWallets() { return nbWallets; @@ -116,16 +121,16 @@ public class SelfTransactionWithPayload extends Scenario { this.nbWallets = nbWallets; } - public SelfTransactionWithPayload payload(String payload) { this.payload = payload; return this; } - /** + /** * Get payload + * * @return payload - **/ + */ @javax.annotation.Nullable public String getPayload() { return payload; @@ -135,16 +140,16 @@ public class SelfTransactionWithPayload extends Scenario { this.payload = payload; } - public SelfTransactionWithPayload price(Integer price) { this.price = price; return this; } - /** + /** * Get price + * * @return price - **/ + */ @javax.annotation.Nullable public Integer getPrice() { return price; @@ -154,8 +159,6 @@ public class SelfTransactionWithPayload extends Scenario { this.price = price; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -165,12 +168,12 @@ public class SelfTransactionWithPayload extends Scenario { return false; } SelfTransactionWithPayload selfTransactionWithPayload = (SelfTransactionWithPayload) o; - return Objects.equals(this.wallet, selfTransactionWithPayload.wallet) && - Objects.equals(this.nbTransfers, selfTransactionWithPayload.nbTransfers) && - Objects.equals(this.nbWallets, selfTransactionWithPayload.nbWallets) && - Objects.equals(this.payload, selfTransactionWithPayload.payload) && - Objects.equals(this.price, selfTransactionWithPayload.price) && - super.equals(o); + return Objects.equals(this.wallet, selfTransactionWithPayload.wallet) + && Objects.equals(this.nbTransfers, selfTransactionWithPayload.nbTransfers) + && Objects.equals(this.nbWallets, selfTransactionWithPayload.nbWallets) + && Objects.equals(this.payload, selfTransactionWithPayload.payload) + && Objects.equals(this.price, selfTransactionWithPayload.price) + && super.equals(o); } @Override @@ -193,8 +196,7 @@ public class SelfTransactionWithPayload extends Scenario { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -203,7 +205,6 @@ public class SelfTransactionWithPayload extends Scenario { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -217,80 +218,90 @@ public class SelfTransactionWithPayload extends Scenario { openapiRequiredFields.add("scenarioType"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to SelfTransactionWithPayload - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SelfTransactionWithPayload + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SelfTransactionWithPayload.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SelfTransactionWithPayload is not found in the empty JSON string", SelfTransactionWithPayload.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!SelfTransactionWithPayload.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SelfTransactionWithPayload is not found in the empty JSON string", + SelfTransactionWithPayload.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SelfTransactionWithPayload.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SelfTransactionWithPayload` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SelfTransactionWithPayload.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `SelfTransactionWithPayload` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SelfTransactionWithPayload.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SelfTransactionWithPayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!SelfTransactionWithPayload.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SelfTransactionWithPayload' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SelfTransactionWithPayload.class)); + if (!SelfTransactionWithPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SelfTransactionWithPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SelfTransactionWithPayload.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SelfTransactionWithPayload value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SelfTransactionWithPayload value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public SelfTransactionWithPayload read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public SelfTransactionWithPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of SelfTransactionWithPayload given an JSON string - * - * @param jsonString JSON string - * @return An instance of SelfTransactionWithPayload - * @throws IOException if the JSON string is invalid with respect to SelfTransactionWithPayload - */ + /** + * Create an instance of SelfTransactionWithPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of SelfTransactionWithPayload + * @throws IOException if the JSON string is invalid with respect to SelfTransactionWithPayload + */ public static SelfTransactionWithPayload fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, SelfTransactionWithPayload.class); } - /** - * Convert an instance of SelfTransactionWithPayload to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of SelfTransactionWithPayload to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/SelfTransactionWithRandomPayload.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/SelfTransactionWithRandomPayload.java index 269ffc1f..b781d641 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/SelfTransactionWithRandomPayload.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/SelfTransactionWithRandomPayload.java @@ -10,49 +10,52 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; /** - * The test will create nbTransfers new wallets and make each of them send one request to itself. A new wallet is created for each transaction as it's likely the tx will remain in pending state. + * The test will create nbTransfers new wallets and make each of them send one request to itself. A + * new wallet is created for each transaction as it's likely the tx will remain in pending + * state. */ public class SelfTransactionWithRandomPayload extends Scenario { public static final String SERIALIZED_NAME_WALLET = "wallet"; + @SerializedName(SERIALIZED_NAME_WALLET) private String wallet = "new"; public static final String SERIALIZED_NAME_NB_WALLETS = "nbWallets"; + @SerializedName(SERIALIZED_NAME_NB_WALLETS) private Integer nbWallets = 1; public static final String SERIALIZED_NAME_NB_TRANSFERS = "nbTransfers"; + @SerializedName(SERIALIZED_NAME_NB_TRANSFERS) private Integer nbTransfers = 1; public static final String SERIALIZED_NAME_PAYLOAD_SIZE = "payloadSize"; + @SerializedName(SERIALIZED_NAME_PAYLOAD_SIZE) private Integer payloadSize = 50000; public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) private Integer price = 27000; @@ -65,10 +68,12 @@ public class SelfTransactionWithRandomPayload extends Scenario { return this; } - /** - * new means a new wallet is going to be created by the test framework to make the calls, source means the test will use the sourceWallet whose pk is passed as parameter. + /** + * new means a new wallet is going to be created by the test framework to make the calls, source + * means the test will use the sourceWallet whose pk is passed as parameter. + * * @return wallet - **/ + */ @javax.annotation.Nullable public String getWallet() { return wallet; @@ -78,16 +83,16 @@ public class SelfTransactionWithRandomPayload extends Scenario { this.wallet = wallet; } - public SelfTransactionWithRandomPayload nbWallets(Integer nbWallets) { this.nbWallets = nbWallets; return this; } - /** + /** * Get nbWallets + * * @return nbWallets - **/ + */ @javax.annotation.Nullable public Integer getNbWallets() { return nbWallets; @@ -97,16 +102,16 @@ public class SelfTransactionWithRandomPayload extends Scenario { this.nbWallets = nbWallets; } - public SelfTransactionWithRandomPayload nbTransfers(Integer nbTransfers) { this.nbTransfers = nbTransfers; return this; } - /** + /** * Get nbTransfers + * * @return nbTransfers - **/ + */ @javax.annotation.Nullable public Integer getNbTransfers() { return nbTransfers; @@ -116,16 +121,16 @@ public class SelfTransactionWithRandomPayload extends Scenario { this.nbTransfers = nbTransfers; } - public SelfTransactionWithRandomPayload payloadSize(Integer payloadSize) { this.payloadSize = payloadSize; return this; } - /** + /** * Get payloadSize + * * @return payloadSize - **/ + */ @javax.annotation.Nullable public Integer getPayloadSize() { return payloadSize; @@ -135,16 +140,16 @@ public class SelfTransactionWithRandomPayload extends Scenario { this.payloadSize = payloadSize; } - public SelfTransactionWithRandomPayload price(Integer price) { this.price = price; return this; } - /** + /** * Get price + * * @return price - **/ + */ @javax.annotation.Nullable public Integer getPrice() { return price; @@ -154,8 +159,6 @@ public class SelfTransactionWithRandomPayload extends Scenario { this.price = price; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -164,13 +167,14 @@ public class SelfTransactionWithRandomPayload extends Scenario { if (o == null || getClass() != o.getClass()) { return false; } - SelfTransactionWithRandomPayload selfTransactionWithRandomPayload = (SelfTransactionWithRandomPayload) o; - return Objects.equals(this.wallet, selfTransactionWithRandomPayload.wallet) && - Objects.equals(this.nbWallets, selfTransactionWithRandomPayload.nbWallets) && - Objects.equals(this.nbTransfers, selfTransactionWithRandomPayload.nbTransfers) && - Objects.equals(this.payloadSize, selfTransactionWithRandomPayload.payloadSize) && - Objects.equals(this.price, selfTransactionWithRandomPayload.price) && - super.equals(o); + SelfTransactionWithRandomPayload selfTransactionWithRandomPayload = + (SelfTransactionWithRandomPayload) o; + return Objects.equals(this.wallet, selfTransactionWithRandomPayload.wallet) + && Objects.equals(this.nbWallets, selfTransactionWithRandomPayload.nbWallets) + && Objects.equals(this.nbTransfers, selfTransactionWithRandomPayload.nbTransfers) + && Objects.equals(this.payloadSize, selfTransactionWithRandomPayload.payloadSize) + && Objects.equals(this.price, selfTransactionWithRandomPayload.price) + && super.equals(o); } @Override @@ -193,8 +197,7 @@ public class SelfTransactionWithRandomPayload extends Scenario { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -203,7 +206,6 @@ public class SelfTransactionWithRandomPayload extends Scenario { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -217,80 +219,94 @@ public class SelfTransactionWithRandomPayload extends Scenario { openapiRequiredFields.add("scenarioType"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to SelfTransactionWithRandomPayload - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * SelfTransactionWithRandomPayload + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SelfTransactionWithRandomPayload.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SelfTransactionWithRandomPayload is not found in the empty JSON string", SelfTransactionWithRandomPayload.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!SelfTransactionWithRandomPayload.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SelfTransactionWithRandomPayload is not found in the empty JSON string", + SelfTransactionWithRandomPayload.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SelfTransactionWithRandomPayload.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SelfTransactionWithRandomPayload` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SelfTransactionWithRandomPayload.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `SelfTransactionWithRandomPayload` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SelfTransactionWithRandomPayload.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SelfTransactionWithRandomPayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!SelfTransactionWithRandomPayload.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SelfTransactionWithRandomPayload' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SelfTransactionWithRandomPayload.class)); + if (!SelfTransactionWithRandomPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SelfTransactionWithRandomPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SelfTransactionWithRandomPayload.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SelfTransactionWithRandomPayload value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SelfTransactionWithRandomPayload value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public SelfTransactionWithRandomPayload read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public SelfTransactionWithRandomPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of SelfTransactionWithRandomPayload given an JSON string - * - * @param jsonString JSON string - * @return An instance of SelfTransactionWithRandomPayload - * @throws IOException if the JSON string is invalid with respect to SelfTransactionWithRandomPayload - */ + /** + * Create an instance of SelfTransactionWithRandomPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of SelfTransactionWithRandomPayload + * @throws IOException if the JSON string is invalid with respect to + * SelfTransactionWithRandomPayload + */ public static SelfTransactionWithRandomPayload fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, SelfTransactionWithRandomPayload.class); } - /** - * Convert an instance of SelfTransactionWithRandomPayload to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of SelfTransactionWithRandomPayload to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/SimpleParameter.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/SimpleParameter.java index ac238662..d72e8142 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/SimpleParameter.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/SimpleParameter.java @@ -10,38 +10,33 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * SimpleParameter - */ - +/** SimpleParameter */ public class SimpleParameter extends Parameter { public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) private String value; public static final String SERIALIZED_NAME_SOLIDITY_TYPE = "solidityType"; + @SerializedName(SERIALIZED_NAME_SOLIDITY_TYPE) private String solidityType; @@ -54,10 +49,11 @@ public class SimpleParameter extends Parameter { return this; } - /** + /** * Get value + * * @return value - **/ + */ @javax.annotation.Nullable public String getValue() { return value; @@ -67,16 +63,16 @@ public class SimpleParameter extends Parameter { this.value = value; } - public SimpleParameter solidityType(String solidityType) { this.solidityType = solidityType; return this; } - /** + /** * Get solidityType + * * @return solidityType - **/ + */ @javax.annotation.Nullable public String getSolidityType() { return solidityType; @@ -86,8 +82,6 @@ public class SimpleParameter extends Parameter { this.solidityType = solidityType; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -97,9 +91,9 @@ public class SimpleParameter extends Parameter { return false; } SimpleParameter simpleParameter = (SimpleParameter) o; - return Objects.equals(this.value, simpleParameter.value) && - Objects.equals(this.solidityType, simpleParameter.solidityType) && - super.equals(o); + return Objects.equals(this.value, simpleParameter.value) + && Objects.equals(this.solidityType, simpleParameter.solidityType) + && super.equals(o); } @Override @@ -119,8 +113,7 @@ public class SimpleParameter extends Parameter { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -129,7 +122,6 @@ public class SimpleParameter extends Parameter { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -143,80 +135,90 @@ public class SimpleParameter extends Parameter { openapiRequiredFields.add("type"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to SimpleParameter - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SimpleParameter + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SimpleParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SimpleParameter is not found in the empty JSON string", SimpleParameter.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!SimpleParameter.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SimpleParameter is not found in the empty JSON string", + SimpleParameter.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SimpleParameter.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SimpleParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SimpleParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `SimpleParameter` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SimpleParameter.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SimpleParameter.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!SimpleParameter.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SimpleParameter' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SimpleParameter.class)); + if (!SimpleParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SimpleParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SimpleParameter.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SimpleParameter value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SimpleParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public SimpleParameter read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public SimpleParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of SimpleParameter given an JSON string - * - * @param jsonString JSON string - * @return An instance of SimpleParameter - * @throws IOException if the JSON string is invalid with respect to SimpleParameter - */ + /** + * Create an instance of SimpleParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of SimpleParameter + * @throws IOException if the JSON string is invalid with respect to SimpleParameter + */ public static SimpleParameter fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, SimpleParameter.class); } - /** - * Convert an instance of SimpleParameter to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of SimpleParameter to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/TransferOwnership.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/TransferOwnership.java index ac2d4f30..a9c2db35 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/TransferOwnership.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/TransferOwnership.java @@ -10,34 +10,28 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; -/** - * TransferOwnership - */ - +/** TransferOwnership */ public class TransferOwnership extends MethodAndParameter { public static final String SERIALIZED_NAME_DESTINATION_ADDRESS = "destinationAddress"; + @SerializedName(SERIALIZED_NAME_DESTINATION_ADDRESS) private String destinationAddress; @@ -50,10 +44,11 @@ public class TransferOwnership extends MethodAndParameter { return this; } - /** + /** * Get destinationAddress + * * @return destinationAddress - **/ + */ @javax.annotation.Nullable public String getDestinationAddress() { return destinationAddress; @@ -63,8 +58,6 @@ public class TransferOwnership extends MethodAndParameter { this.destinationAddress = destinationAddress; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -74,8 +67,8 @@ public class TransferOwnership extends MethodAndParameter { return false; } TransferOwnership transferOwnership = (TransferOwnership) o; - return Objects.equals(this.destinationAddress, transferOwnership.destinationAddress) && - super.equals(o); + return Objects.equals(this.destinationAddress, transferOwnership.destinationAddress) + && super.equals(o); } @Override @@ -94,8 +87,7 @@ public class TransferOwnership extends MethodAndParameter { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -104,7 +96,6 @@ public class TransferOwnership extends MethodAndParameter { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -120,80 +111,90 @@ public class TransferOwnership extends MethodAndParameter { openapiRequiredFields.add("numberOfTimes"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to TransferOwnership - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TransferOwnership + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!TransferOwnership.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in TransferOwnership is not found in the empty JSON string", TransferOwnership.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!TransferOwnership.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TransferOwnership is not found in the empty JSON string", + TransferOwnership.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TransferOwnership.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TransferOwnership` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TransferOwnership.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `TransferOwnership` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : TransferOwnership.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TransferOwnership.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!TransferOwnership.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'TransferOwnership' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(TransferOwnership.class)); + if (!TransferOwnership.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TransferOwnership' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TransferOwnership.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, TransferOwnership value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TransferOwnership value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public TransferOwnership read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public TransferOwnership read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of TransferOwnership given an JSON string - * - * @param jsonString JSON string - * @return An instance of TransferOwnership - * @throws IOException if the JSON string is invalid with respect to TransferOwnership - */ + /** + * Create an instance of TransferOwnership given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransferOwnership + * @throws IOException if the JSON string is invalid with respect to TransferOwnership + */ public static TransferOwnership fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, TransferOwnership.class); } - /** - * Convert an instance of TransferOwnership to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of TransferOwnership to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/UnderPricedTransaction.java b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/UnderPricedTransaction.java index d156a35e..a362038f 100644 --- a/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/UnderPricedTransaction.java +++ b/testing-tools/app/src/main/java/net/consensys/zkevm/load/swagger/UnderPricedTransaction.java @@ -10,34 +10,31 @@ * Do not edit the class manually. */ - package net.consensys.zkevm.load.swagger; -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import java.util.Set; - import net.consensys.zkevm.load.model.JSON; /** - * The test will create nbTransfers new wallets and make each of them send one request to itself. A new wallet is created for each transaction as the tx will remain in pending state. + * The test will create nbTransfers new wallets and make each of them send one request to itself. A + * new wallet is created for each transaction as the tx will remain in pending state. */ - public class UnderPricedTransaction extends Scenario { public static final String SERIALIZED_NAME_NB_TRANSFERS = "nbTransfers"; + @SerializedName(SERIALIZED_NAME_NB_TRANSFERS) private Integer nbTransfers = 1; @@ -50,10 +47,11 @@ public class UnderPricedTransaction extends Scenario { return this; } - /** + /** * Get nbTransfers + * * @return nbTransfers - **/ + */ @javax.annotation.Nullable public Integer getNbTransfers() { return nbTransfers; @@ -63,8 +61,6 @@ public class UnderPricedTransaction extends Scenario { this.nbTransfers = nbTransfers; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -74,8 +70,7 @@ public class UnderPricedTransaction extends Scenario { return false; } UnderPricedTransaction underPricedTransaction = (UnderPricedTransaction) o; - return Objects.equals(this.nbTransfers, underPricedTransaction.nbTransfers) && - super.equals(o); + return Objects.equals(this.nbTransfers, underPricedTransaction.nbTransfers) && super.equals(o); } @Override @@ -94,8 +89,7 @@ public class UnderPricedTransaction extends Scenario { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -104,7 +98,6 @@ public class UnderPricedTransaction extends Scenario { return o.toString().replace("\n", "\n "); } - public static HashSet openapiFields; public static HashSet openapiRequiredFields; @@ -118,80 +111,90 @@ public class UnderPricedTransaction extends Scenario { openapiRequiredFields.add("scenarioType"); } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UnderPricedTransaction - */ + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnderPricedTransaction + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UnderPricedTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UnderPricedTransaction is not found in the empty JSON string", UnderPricedTransaction.openapiRequiredFields.toString())); - } + if (jsonElement == null) { + if (!UnderPricedTransaction.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UnderPricedTransaction is not found in the empty JSON string", + UnderPricedTransaction.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UnderPricedTransaction.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnderPricedTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnderPricedTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `UnderPricedTransaction` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UnderPricedTransaction.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UnderPricedTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!UnderPricedTransaction.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UnderPricedTransaction' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UnderPricedTransaction.class)); + if (!UnderPricedTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnderPricedTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UnderPricedTransaction.class)); - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UnderPricedTransaction value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UnderPricedTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public UnderPricedTransaction read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); + @Override + public UnderPricedTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } } - /** - * Create an instance of UnderPricedTransaction given an JSON string - * - * @param jsonString JSON string - * @return An instance of UnderPricedTransaction - * @throws IOException if the JSON string is invalid with respect to UnderPricedTransaction - */ + /** + * Create an instance of UnderPricedTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnderPricedTransaction + * @throws IOException if the JSON string is invalid with respect to UnderPricedTransaction + */ public static UnderPricedTransaction fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, UnderPricedTransaction.class); } - /** - * Convert an instance of UnderPricedTransaction to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of UnderPricedTransaction to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); } diff --git a/testing-tools/app/src/test/kotlin/swagger/TestModel.java b/testing-tools/app/src/test/kotlin/swagger/TestModel.java index 5bf706c6..73802f11 100644 --- a/testing-tools/app/src/test/kotlin/swagger/TestModel.java +++ b/testing-tools/app/src/test/kotlin/swagger/TestModel.java @@ -1,4 +1,5 @@ package swagger; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import net.consensys.zkevm.load.model.JSON; @@ -36,7 +37,6 @@ public class TestModel { String json = om.writeValueAsString(request); System.out.println(json); - var builder = JSON.createGson(); var source = builder.create().fromJson(json, Request.class); Assertions.assertEquals(json, om.writeValueAsString(source)); @@ -47,5 +47,4 @@ public class TestModel { Assertions.assertTrue(true); } - }