Added GraphQL Service Information in responese result NetServices (#7580)

Signed-off-by: ITStarMan100 <danhopeman@outlook.com>
Co-authored-by: Justin Florentine <justin+github@florentine.us>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/7627/head
ITStarMan100 1 month ago committed by GitHub
parent 87bad72b52
commit 12caf7d83c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
  2. 4
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcTestMethodsFactory.java
  3. 11
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/NetServices.java
  4. 5
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/JsonRpcMethodsFactory.java
  5. 12
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/NetJsonRpcMethods.java
  6. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java
  7. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java
  8. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java
  9. 3
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java
  10. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java
  11. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java
  12. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java
  13. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java
  14. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java

@ -863,6 +863,7 @@ public class RunnerBuilder {
jsonRpcConfiguration,
webSocketConfiguration,
metricsConfiguration,
graphQLConfiguration,
natService,
besuPluginContext.getNamedPlugins(),
dataDir,
@ -907,6 +908,7 @@ public class RunnerBuilder {
engineJsonRpcConfiguration.get(),
webSocketConfiguration,
metricsConfiguration,
graphQLConfiguration,
natService,
besuPluginContext.getNamedPlugins(),
dataDir,
@ -1001,6 +1003,7 @@ public class RunnerBuilder {
jsonRpcConfiguration,
webSocketConfiguration,
metricsConfiguration,
graphQLConfiguration,
natService,
besuPluginContext.getNamedPlugins(),
dataDir,
@ -1081,6 +1084,7 @@ public class RunnerBuilder {
jsonRpcConfiguration,
webSocketConfiguration,
metricsConfiguration,
graphQLConfiguration,
natService,
besuPluginContext.getNamedPlugins(),
dataDir,
@ -1119,6 +1123,7 @@ public class RunnerBuilder {
jsonRpcConfiguration,
webSocketConfiguration,
metricsConfiguration,
graphQLConfiguration,
natService,
besuPluginContext.getNamedPlugins(),
dataDir,
@ -1280,6 +1285,7 @@ public class RunnerBuilder {
final JsonRpcConfiguration jsonRpcConfiguration,
final WebSocketConfiguration webSocketConfiguration,
final MetricsConfiguration metricsConfiguration,
final GraphQLConfiguration graphQLConfiguration,
final NatService natService,
final Map<String, BesuPlugin> namedPlugins,
final Path dataDir,
@ -1313,6 +1319,7 @@ public class RunnerBuilder {
jsonRpcConfiguration,
webSocketConfiguration,
metricsConfiguration,
graphQLConfiguration,
natService,
namedPlugins,
dataDir,

@ -21,6 +21,7 @@ import static org.mockito.Mockito.mock;
import org.hyperledger.besu.config.StubGenesisConfigOptions;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManagerBuilder;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
@ -164,6 +165,8 @@ public class JsonRpcTestMethodsFactory {
final JsonRpcConfiguration jsonRpcConfiguration = mock(JsonRpcConfiguration.class);
final WebSocketConfiguration webSocketConfiguration = mock(WebSocketConfiguration.class);
final MetricsConfiguration metricsConfiguration = mock(MetricsConfiguration.class);
final GraphQLConfiguration graphQLConfiguration = mock(GraphQLConfiguration.class);
final NatService natService = new NatService(Optional.empty());
final List<String> apis = new ArrayList<>();
@ -200,6 +203,7 @@ public class JsonRpcTestMethodsFactory {
jsonRpcConfiguration,
webSocketConfiguration,
metricsConfiguration,
graphQLConfiguration,
natService,
new HashMap<>(),
dataDir,

@ -14,6 +14,7 @@
*/
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext;
@ -32,16 +33,19 @@ public class NetServices implements JsonRpcMethod {
private final WebSocketConfiguration webSocketConfiguration;
private final P2PNetwork p2pNetwork;
private final MetricsConfiguration metricsConfiguration;
private final GraphQLConfiguration graphQLConfiguration;
public NetServices(
final JsonRpcConfiguration jsonRpcConfiguration,
final WebSocketConfiguration webSocketConfiguration,
final P2PNetwork p2pNetwork,
final MetricsConfiguration metricsConfiguration) {
final MetricsConfiguration metricsConfiguration,
final GraphQLConfiguration graphQLConfiguration) {
this.jsonRpcConfiguration = jsonRpcConfiguration;
this.webSocketConfiguration = webSocketConfiguration;
this.p2pNetwork = p2pNetwork;
this.metricsConfiguration = metricsConfiguration;
this.graphQLConfiguration = graphQLConfiguration;
}
@Override
@ -82,6 +86,11 @@ public class NetServices implements JsonRpcMethod {
createServiceDetailsMap(
metricsConfiguration.getHost(), metricsConfiguration.getActualPort()));
}
if (graphQLConfiguration.isEnabled()) {
servicesMapBuilder.put(
"graphQL",
createServiceDetailsMap(graphQLConfiguration.getHost(), graphQLConfiguration.getPort()));
}
return new JsonRpcSuccessResponse(
requestContext.getRequest().getId(), servicesMapBuilder.build());

@ -17,6 +17,7 @@ package org.hyperledger.besu.ethereum.api.jsonrpc.methods;
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
@ -77,6 +78,7 @@ public class JsonRpcMethodsFactory {
final JsonRpcConfiguration jsonRpcConfiguration,
final WebSocketConfiguration webSocketConfiguration,
final MetricsConfiguration metricsConfiguration,
final GraphQLConfiguration graphQLConfiguration,
final NatService natService,
final Map<String, BesuPlugin> namedPlugins,
final Path dataDir,
@ -135,7 +137,8 @@ public class JsonRpcMethodsFactory {
networkId,
jsonRpcConfiguration,
webSocketConfiguration,
metricsConfiguration),
metricsConfiguration,
graphQLConfiguration),
new MinerJsonRpcMethods(miningParameters, miningCoordinator),
new PermJsonRpcMethods(accountsAllowlistController, nodeAllowlistController),
new PrivJsonRpcMethods(

@ -14,6 +14,7 @@
*/
package org.hyperledger.besu.ethereum.api.jsonrpc.methods;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
@ -37,18 +38,21 @@ public class NetJsonRpcMethods extends ApiGroupJsonRpcMethods {
private final JsonRpcConfiguration jsonRpcConfiguration;
private final WebSocketConfiguration webSocketConfiguration;
private final MetricsConfiguration metricsConfiguration;
private final GraphQLConfiguration graphQLConfiguration;
public NetJsonRpcMethods(
final P2PNetwork p2pNetwork,
final BigInteger networkId,
final JsonRpcConfiguration jsonRpcConfiguration,
final WebSocketConfiguration webSocketConfiguration,
final MetricsConfiguration metricsConfiguration) {
final MetricsConfiguration metricsConfiguration,
final GraphQLConfiguration graphQLConfiguration) {
this.p2pNetwork = p2pNetwork;
this.networkId = networkId;
this.jsonRpcConfiguration = jsonRpcConfiguration;
this.webSocketConfiguration = webSocketConfiguration;
this.metricsConfiguration = metricsConfiguration;
this.graphQLConfiguration = graphQLConfiguration;
}
@Override
@ -64,6 +68,10 @@ public class NetJsonRpcMethods extends ApiGroupJsonRpcMethods {
new NetPeerCount(p2pNetwork),
new NetEnode(p2pNetwork),
new NetServices(
jsonRpcConfiguration, webSocketConfiguration, p2pNetwork, metricsConfiguration));
jsonRpcConfiguration,
webSocketConfiguration,
p2pNetwork,
metricsConfiguration,
graphQLConfiguration));
}
}

@ -23,6 +23,7 @@ import static org.mockito.Mockito.when;
import org.hyperledger.besu.config.StubGenesisConfigOptions;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterIdGenerator;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager;
@ -193,6 +194,7 @@ public abstract class AbstractJsonRpcHttpServiceTest {
config,
mock(WebSocketConfiguration.class),
mock(MetricsConfiguration.class),
mock(GraphQLConfiguration.class),
natService,
new HashMap<>(),
folder,

@ -21,6 +21,7 @@ import static org.mockito.Mockito.mock;
import org.hyperledger.besu.config.StubGenesisConfigOptions;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
@ -130,6 +131,7 @@ public class JsonRpcHttpServiceHostAllowlistTest {
mock(JsonRpcConfiguration.class),
mock(WebSocketConfiguration.class),
mock(MetricsConfiguration.class),
mock(GraphQLConfiguration.class),
natService,
new HashMap<>(),
folder,

@ -23,6 +23,7 @@ import static org.mockito.Mockito.mock;
import org.hyperledger.besu.config.StubGenesisConfigOptions;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.EthAccounts;
@ -161,6 +162,7 @@ public class JsonRpcHttpServiceLoginTest {
mock(JsonRpcConfiguration.class),
mock(WebSocketConfiguration.class),
mock(MetricsConfiguration.class),
mock(GraphQLConfiguration.class),
natService,
new HashMap<>(),
folder,

@ -24,6 +24,7 @@ import org.hyperledger.besu.cryptoservices.NodeKeyUtils;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
@ -227,6 +228,7 @@ public class JsonRpcHttpServiceRpcApisTest {
mock(JsonRpcConfiguration.class),
mock(WebSocketConfiguration.class),
mock(MetricsConfiguration.class),
mock(GraphQLConfiguration.class),
natService,
new HashMap<>(),
folder,
@ -337,6 +339,7 @@ public class JsonRpcHttpServiceRpcApisTest {
jsonRpcConfiguration,
webSocketConfiguration,
metricsConfiguration,
mock(GraphQLConfiguration.class),
natService,
new HashMap<>(),
folder,

@ -19,6 +19,7 @@ import static org.mockito.Mockito.mock;
import org.hyperledger.besu.config.StubGenesisConfigOptions;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
@ -139,6 +140,7 @@ public class JsonRpcHttpServiceTestBase {
mock(JsonRpcConfiguration.class),
mock(WebSocketConfiguration.class),
mock(MetricsConfiguration.class),
mock(GraphQLConfiguration.class),
natService,
new HashMap<>(),
folder,

@ -25,6 +25,7 @@ import static org.mockito.Mockito.mock;
import org.hyperledger.besu.config.StubGenesisConfigOptions;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
@ -144,6 +145,7 @@ public class JsonRpcHttpServiceTlsClientAuthTest {
mock(JsonRpcConfiguration.class),
mock(WebSocketConfiguration.class),
mock(MetricsConfiguration.class),
mock(GraphQLConfiguration.class),
natService,
Collections.emptyMap(),
folder,

@ -24,6 +24,7 @@ import static org.mockito.Mockito.mock;
import org.hyperledger.besu.config.StubGenesisConfigOptions;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
@ -132,6 +133,7 @@ class JsonRpcHttpServiceTlsMisconfigurationTest {
mock(JsonRpcConfiguration.class),
mock(WebSocketConfiguration.class),
mock(MetricsConfiguration.class),
mock(GraphQLConfiguration.class),
natService,
Collections.emptyMap(),
tempDir.getRoot(),

@ -24,6 +24,7 @@ import static org.mockito.Mockito.mock;
import org.hyperledger.besu.config.StubGenesisConfigOptions;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManager;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
@ -133,6 +134,7 @@ public class JsonRpcHttpServiceTlsTest {
mock(JsonRpcConfiguration.class),
mock(WebSocketConfiguration.class),
mock(MetricsConfiguration.class),
mock(GraphQLConfiguration.class),
natService,
Collections.emptyMap(),
folder,

@ -26,6 +26,7 @@ import static org.mockito.Mockito.spy;
import org.hyperledger.besu.config.StubGenesisConfigOptions;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.handlers.TimeoutOptions;
import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcHttpService;
@ -197,6 +198,7 @@ public class WebSocketServiceLoginTest {
mock(JsonRpcConfiguration.class),
mock(WebSocketConfiguration.class),
mock(MetricsConfiguration.class),
mock(GraphQLConfiguration.class),
natService,
new HashMap<>(),
folder,

Loading…
Cancel
Save