From 81044191e497ff8d4d4cdb1550ff5c4a1df9eff8 Mon Sep 17 00:00:00 2001 From: Emil Lai <39825288+EmilLa1@users.noreply.github.com> Date: Mon, 18 Sep 2023 13:06:09 +0200 Subject: [PATCH] Fix a bug where providers headers was not correctly set for `ClientV2`. (#264) * Fix a bug where additional headers were not set for clientv2. * Changelog. * Fix examples project dep version. --- CHANGELOG.md | 1 + concordium-sdk-examples/pom.xml | 2 +- .../main/java/com/concordium/sdk/ClientV2.java | 17 ++++++++++++++--- .../ClientV2CryptographicParametersTest.java | 4 +++- .../sdk/ClientV2GetAccountInfoTest.java | 2 +- .../sdk/ClientV2GetAccountListTest.java | 4 +++- ...2GetAccountNonFinalizedTransactionsTest.java | 4 +++- .../sdk/ClientV2GetAncestorsTest.java | 4 +++- .../sdk/ClientV2GetAnonymityRevokersTest.java | 5 ++++- .../sdk/ClientV2GetBakerListTest.java | 4 +++- .../sdk/ClientV2GetBannedPeersTest.java | 3 ++- ...ClientV2GetBlockFinalizationSummaryTest.java | 3 ++- .../sdk/ClientV2GetBlockInfoTest.java | 4 +++- .../sdk/ClientV2GetBlockItemStatusTest.java | 4 +++- .../sdk/ClientV2GetBlockPendingUpdatesTest.java | 3 ++- .../sdk/ClientV2GetBlockSpecialEventsTest.java | 3 ++- .../concordium/sdk/ClientV2GetBlocksTest.java | 4 +++- .../concordium/sdk/ClientV2GetBranchesTest.java | 4 +++- .../sdk/ClientV2GetConsensusStatusTest.java | 4 +++- .../sdk/ClientV2GetElectionInfoTest.java | 4 +++- .../sdk/ClientV2GetIdentityProvidersTest.java | 4 +++- .../sdk/ClientV2GetInstanceInfoTest.java | 4 +++- .../sdk/ClientV2GetInstanceListTest.java | 4 +++- .../sdk/ClientV2GetInstanceStateTest.java | 4 +++- .../concordium/sdk/ClientV2GetItemsTest.java | 4 +++- .../sdk/ClientV2GetModuleListTest.java | 4 +++- .../sdk/ClientV2GetModuleSourceTest.java | 4 +++- ...lientV2GetNextAccountSequenceNumberTest.java | 4 +++- ...lientV2GetNextUpdateSequenceNumbersTest.java | 4 +++- .../concordium/sdk/ClientV2GetNodeInfoTest.java | 4 +++- ...tV2GetPassiveDelegatorsRewardPeriodTest.java | 4 +++- .../sdk/ClientV2GetPassiveDelegatorsTest.java | 2 +- .../sdk/ClientV2GetPeersInfoTest.java | 3 ++- ...ientV2GetPoolDelegatorsRewardPeriodTest.java | 4 +++- .../sdk/ClientV2GetPoolDelegatorsTest.java | 2 +- .../concordium/sdk/ClientV2GetPoolInfoTest.java | 4 +++- .../sdk/ClientV2GetRewardsOverviewTest.java | 4 +++- .../sdk/ClientV2SendAccountTransactionTest.java | 4 +++- .../concordium/sdk/ClientV2ShutdownTest.java | 4 +++- 39 files changed, 114 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 707fd4c3f..40b86e247 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Unreleased changes +- Fix a bug that caused custom http headers to be set for `ClientV2`. ## 5.0.0 diff --git a/concordium-sdk-examples/pom.xml b/concordium-sdk-examples/pom.xml index 52794f446..e47f0af4b 100644 --- a/concordium-sdk-examples/pom.xml +++ b/concordium-sdk-examples/pom.xml @@ -24,7 +24,7 @@ com.concordium.sdk concordium-sdk - 4.2.1-SNAPSHOT + 5.0.1-SNAPSHOT compile diff --git a/concordium-sdk/src/main/java/com/concordium/sdk/ClientV2.java b/concordium-sdk/src/main/java/com/concordium/sdk/ClientV2.java index b4cc0c47f..009fc41d1 100644 --- a/concordium-sdk/src/main/java/com/concordium/sdk/ClientV2.java +++ b/concordium-sdk/src/main/java/com/concordium/sdk/ClientV2.java @@ -39,6 +39,7 @@ import com.google.common.collect.ImmutableList; import com.google.protobuf.ByteString; import io.grpc.ManagedChannel; +import jdk.nashorn.internal.runtime.options.Option; import lombok.val; import java.io.File; @@ -76,16 +77,26 @@ public final class ClientV2 { public static ClientV2 from(final Connection connection) throws ClientInitializationException { try { - return new ClientV2(connection.getTimeout(), connection.newChannel()); + return new ClientV2(connection.getTimeout(), connection.newChannel(), Optional.ofNullable(connection.getCredentials())); } catch (IOException e) { throw ClientInitializationException.from(e); } } - ClientV2(final int timeout, final ManagedChannel channel) { + /** + * Construct a new client + * @param timeout The timeout in milliseconds. + * @param channel the underlying grpc channel. + * @param credentials Optionally extra headers. + */ + ClientV2(final int timeout, final ManagedChannel channel, final Optional credentials) { this.timeout = timeout; this.channel = channel; - this.blockingStub = QueriesGrpc.newBlockingStub(channel); + if (credentials.isPresent()) { + this.blockingStub = QueriesGrpc.newBlockingStub(channel).withCallCredentials(credentials.get().getCallCredentials()); + } else { + this.blockingStub = QueriesGrpc.newBlockingStub(channel); + } } /** diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2CryptographicParametersTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2CryptographicParametersTest.java index d35ba9054..6faf3178c 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2CryptographicParametersTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2CryptographicParametersTest.java @@ -22,6 +22,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -78,7 +80,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountInfoTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountInfoTest.java index aa477e5b5..7a9f80099 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountInfoTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountInfoTest.java @@ -319,7 +319,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountListTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountListTest.java index 2e5e9df01..334aac133 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountListTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountListTest.java @@ -20,6 +20,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -68,7 +70,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountNonFinalizedTransactionsTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountNonFinalizedTransactionsTest.java index 873e16d84..3905dbaf1 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountNonFinalizedTransactionsTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAccountNonFinalizedTransactionsTest.java @@ -18,6 +18,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -59,7 +61,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAncestorsTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAncestorsTest.java index 50218becb..1fa9c23a8 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAncestorsTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAncestorsTest.java @@ -21,6 +21,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -68,7 +70,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAnonymityRevokersTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAnonymityRevokersTest.java index dba3ea19c..887a0f5af 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAnonymityRevokersTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetAnonymityRevokersTest.java @@ -7,6 +7,7 @@ import com.concordium.sdk.transactions.Hash; import com.google.common.collect.ImmutableList; import com.google.protobuf.ByteString; +import io.grpc.CallCredentials; import io.grpc.ManagedChannel; import io.grpc.inprocess.InProcessChannelBuilder; import io.grpc.inprocess.InProcessServerBuilder; @@ -19,6 +20,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -86,7 +89,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBakerListTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBakerListTest.java index b092ff189..cddb03910 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBakerListTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBakerListTest.java @@ -18,6 +18,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -58,7 +60,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBannedPeersTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBannedPeersTest.java index 32f82138e..2a1801aa2 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBannedPeersTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBannedPeersTest.java @@ -15,6 +15,7 @@ import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; +import java.util.Optional; import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; @@ -97,7 +98,7 @@ public void setUp() throws IOException { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockFinalizationSummaryTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockFinalizationSummaryTest.java index 1ad897ad0..5a740d76b 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockFinalizationSummaryTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockFinalizationSummaryTest.java @@ -20,6 +20,7 @@ import java.math.BigInteger; import java.util.List; +import java.util.Optional; import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; @@ -126,7 +127,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockInfoTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockInfoTest.java index 8ee602384..0b82c5522 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockInfoTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockInfoTest.java @@ -19,6 +19,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -160,7 +162,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockItemStatusTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockItemStatusTest.java index 5c691baa4..28fdc4c2b 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockItemStatusTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockItemStatusTest.java @@ -22,6 +22,8 @@ import org.junit.Rule; import org.junit.Test; +import java.util.Optional; + import static com.concordium.sdk.ClientV2MapperExtensions.to; import static com.concordium.sdk.ClientV2MapperExtensions.toTransactionHash; import static org.junit.Assert.assertEquals; @@ -134,7 +136,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockPendingUpdatesTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockPendingUpdatesTest.java index 5239328f0..623781d79 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockPendingUpdatesTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockPendingUpdatesTest.java @@ -39,6 +39,7 @@ import org.mockito.junit.MockitoJUnitRunner; import java.util.List; +import java.util.Optional; import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; @@ -635,7 +636,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockSpecialEventsTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockSpecialEventsTest.java index b1d1cf6d3..9ef47eb78 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockSpecialEventsTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlockSpecialEventsTest.java @@ -20,6 +20,7 @@ import java.util.Iterator; import java.util.List; +import java.util.Optional; import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; @@ -243,7 +244,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlocksTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlocksTest.java index b4dab7996..0918eb637 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlocksTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBlocksTest.java @@ -17,6 +17,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -74,7 +76,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBranchesTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBranchesTest.java index bf2de8c1d..4cb9a7caf 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBranchesTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetBranchesTest.java @@ -20,6 +20,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -63,7 +65,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetConsensusStatusTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetConsensusStatusTest.java index 59a5c9f7c..d7de70b84 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetConsensusStatusTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetConsensusStatusTest.java @@ -15,6 +15,8 @@ import org.junit.Rule; import org.junit.Test; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.ArgumentMatchers.any; @@ -188,7 +190,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetElectionInfoTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetElectionInfoTest.java index 454cbd77b..637130603 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetElectionInfoTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetElectionInfoTest.java @@ -20,6 +20,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -92,7 +94,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetIdentityProvidersTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetIdentityProvidersTest.java index 241547373..e06327d29 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetIdentityProvidersTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetIdentityProvidersTest.java @@ -21,6 +21,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -96,7 +98,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetInstanceInfoTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetInstanceInfoTest.java index 08da56972..9329fb705 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetInstanceInfoTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetInstanceInfoTest.java @@ -19,6 +19,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -88,7 +90,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetInstanceListTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetInstanceListTest.java index 2fc092721..245623af8 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetInstanceListTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetInstanceListTest.java @@ -18,6 +18,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -56,7 +58,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetInstanceStateTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetInstanceStateTest.java index ad671ddc2..ae8b6c176 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetInstanceStateTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetInstanceStateTest.java @@ -17,6 +17,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; @@ -68,7 +70,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetItemsTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetItemsTest.java index c4a1790c6..6a78ba71b 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetItemsTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetItemsTest.java @@ -34,6 +34,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static com.concordium.sdk.ClientV2MapperExtensions.to; import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; @@ -169,7 +171,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetModuleListTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetModuleListTest.java index 2c4c01026..5a0dd9cca 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetModuleListTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetModuleListTest.java @@ -18,6 +18,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -61,7 +63,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetModuleSourceTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetModuleSourceTest.java index fb2044900..8470850cd 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetModuleSourceTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetModuleSourceTest.java @@ -21,6 +21,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -61,7 +63,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetNextAccountSequenceNumberTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetNextAccountSequenceNumberTest.java index 3efd43b83..5ad0adac1 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetNextAccountSequenceNumberTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetNextAccountSequenceNumberTest.java @@ -15,6 +15,8 @@ import org.junit.Rule; import org.junit.Test; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.ArgumentMatchers.any; @@ -61,7 +63,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetNextUpdateSequenceNumbersTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetNextUpdateSequenceNumbersTest.java index fad4352b6..55d9462ac 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetNextUpdateSequenceNumbersTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetNextUpdateSequenceNumbersTest.java @@ -18,6 +18,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -103,7 +105,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetNodeInfoTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetNodeInfoTest.java index 9107f0456..0a0c2e5b4 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetNodeInfoTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetNodeInfoTest.java @@ -17,6 +17,8 @@ import org.junit.Rule; import org.junit.Test; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.ArgumentMatchers.any; @@ -217,7 +219,7 @@ public void getNodeInfo(Empty request, StreamObserver responseObserver .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); return serviceImpl; } diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPassiveDelegatorsRewardPeriodTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPassiveDelegatorsRewardPeriodTest.java index 932100fcf..49dfd4326 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPassiveDelegatorsRewardPeriodTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPassiveDelegatorsRewardPeriodTest.java @@ -17,6 +17,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -83,7 +85,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPassiveDelegatorsTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPassiveDelegatorsTest.java index 24b66684d..bd342d36a 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPassiveDelegatorsTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPassiveDelegatorsTest.java @@ -133,7 +133,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } /** diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPeersInfoTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPeersInfoTest.java index 0bf3efba2..59dde6ef7 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPeersInfoTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPeersInfoTest.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; +import java.util.Optional; import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; @@ -175,7 +176,7 @@ public void setupClient() throws IOException { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPoolDelegatorsRewardPeriodTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPoolDelegatorsRewardPeriodTest.java index 3fc3f5181..31d482487 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPoolDelegatorsRewardPeriodTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPoolDelegatorsRewardPeriodTest.java @@ -17,6 +17,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -86,7 +88,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPoolDelegatorsTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPoolDelegatorsTest.java index 9015f899e..7511f4525 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPoolDelegatorsTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPoolDelegatorsTest.java @@ -134,7 +134,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel,Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPoolInfoTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPoolInfoTest.java index 55245fe02..b3c7c5c9e 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPoolInfoTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetPoolInfoTest.java @@ -23,6 +23,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -153,7 +155,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetRewardsOverviewTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetRewardsOverviewTest.java index d2a4e1043..c61db6c24 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetRewardsOverviewTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2GetRewardsOverviewTest.java @@ -15,6 +15,8 @@ import org.junit.Rule; import org.junit.Test; +import java.util.Optional; + import static org.junit.Assert.assertEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.ArgumentMatchers.any; @@ -87,7 +89,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2SendAccountTransactionTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2SendAccountTransactionTest.java index 639713219..b54ce7de0 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2SendAccountTransactionTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2SendAccountTransactionTest.java @@ -22,6 +22,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.junit.Assert.assertArrayEquals; import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.ArgumentMatchers.any; @@ -82,7 +84,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test diff --git a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2ShutdownTest.java b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2ShutdownTest.java index c89837ba3..6f585bbae 100644 --- a/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2ShutdownTest.java +++ b/concordium-sdk/src/test/java/com/concordium/sdk/ClientV2ShutdownTest.java @@ -13,6 +13,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import java.util.Optional; + import static org.mockito.AdditionalAnswers.delegatesTo; import static org.mockito.Mockito.*; @@ -43,7 +45,7 @@ public void setUp() throws Exception { .forName(serverName).directExecutor().addService(serviceImpl).build().start()); ManagedChannel channel = grpcCleanup.register( InProcessChannelBuilder.forName(serverName).directExecutor().build()); - client = new ClientV2(10000, channel); + client = new ClientV2(10000, channel, Optional.empty()); } @Test