From f9ad532fd4d298b06096f0a658caf2c947a61ff4 Mon Sep 17 00:00:00 2001 From: Santanu Sinha Date: Thu, 19 Dec 2024 09:40:26 +0530 Subject: [PATCH] Changes for better readability --- ...covery.bundle.id.IdGeneratorPerfTest.testGenerate.json | 2 +- ....bundle.id.IdGeneratorPerfTest.testGenerateBase36.json | 2 +- .../ranger/http/servicefinder/HttpApiCommunicator.java | 4 ++-- .../http/servicefinderhub/HttpServiceDataSourceTest.java | 4 ++-- .../ranger/server/bundle/resources/RangerResource.java | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ranger-discovery-bundle/perf/results/io.appform.ranger.discovery.bundle.id.IdGeneratorPerfTest.testGenerate.json b/ranger-discovery-bundle/perf/results/io.appform.ranger.discovery.bundle.id.IdGeneratorPerfTest.testGenerate.json index f0855806..1f56e6d3 100644 --- a/ranger-discovery-bundle/perf/results/io.appform.ranger.discovery.bundle.id.IdGeneratorPerfTest.testGenerate.json +++ b/ranger-discovery-bundle/perf/results/io.appform.ranger.discovery.bundle.id.IdGeneratorPerfTest.testGenerate.json @@ -4,5 +4,5 @@ "iterations" : 4, "threads" : 1, "forks" : 3, - "mean_ops" : 812476.3197574528 + "mean_ops" : 764043.6230133567 } \ No newline at end of file diff --git a/ranger-discovery-bundle/perf/results/io.appform.ranger.discovery.bundle.id.IdGeneratorPerfTest.testGenerateBase36.json b/ranger-discovery-bundle/perf/results/io.appform.ranger.discovery.bundle.id.IdGeneratorPerfTest.testGenerateBase36.json index 179cec48..705c67b6 100644 --- a/ranger-discovery-bundle/perf/results/io.appform.ranger.discovery.bundle.id.IdGeneratorPerfTest.testGenerateBase36.json +++ b/ranger-discovery-bundle/perf/results/io.appform.ranger.discovery.bundle.id.IdGeneratorPerfTest.testGenerateBase36.json @@ -4,5 +4,5 @@ "iterations" : 4, "threads" : 1, "forks" : 3, - "mean_ops" : 592802.8071907263 + "mean_ops" : 584064.863102317 } \ No newline at end of file diff --git a/ranger-http/src/main/java/io/appform/ranger/http/servicefinder/HttpApiCommunicator.java b/ranger-http/src/main/java/io/appform/ranger/http/servicefinder/HttpApiCommunicator.java index 2f0eff55..b5ee80f9 100644 --- a/ranger-http/src/main/java/io/appform/ranger/http/servicefinder/HttpApiCommunicator.java +++ b/ranger-http/src/main/java/io/appform/ranger/http/servicefinder/HttpApiCommunicator.java @@ -73,7 +73,7 @@ public Set services() { .host(config.getHost()) .port(config.getPort() == 0 ? defaultPort() : config.getPort()) .encodedPath("/ranger/services/v1") - .addQueryParameter("skipReplicationSources", Objects.toString(config.isReplicationSource())) + .addQueryParameter("skipDataFromReplicationSources", Objects.toString(config.isReplicationSource())) .build(); val request = new Request.Builder() .url(httpUrl) @@ -110,7 +110,7 @@ public List> listNodes( .host(config.getHost()) .port(config.getPort() == 0 ? defaultPort() : config.getPort()) .encodedPath(url) - .addQueryParameter("skipReplicationSources", Objects.toString(config.isReplicationSource())) + .addQueryParameter("skipDataFromReplicationSources", Objects.toString(config.isReplicationSource())) .build(); val request = new Request.Builder() .url(httpUrl) diff --git a/ranger-http/src/test/java/io/appform/ranger/http/servicefinderhub/HttpServiceDataSourceTest.java b/ranger-http/src/test/java/io/appform/ranger/http/servicefinderhub/HttpServiceDataSourceTest.java index 397ee62f..ef0cf33d 100644 --- a/ranger-http/src/test/java/io/appform/ranger/http/servicefinderhub/HttpServiceDataSourceTest.java +++ b/ranger-http/src/test/java/io/appform/ranger/http/servicefinderhub/HttpServiceDataSourceTest.java @@ -45,7 +45,7 @@ void testServiceDataSource(WireMockRuntimeInfo wireMockRuntimeInfo) throws IOExc RangerTestUtils.getService("test-n", "test-s2") )) .build(); - stubFor(get(urlEqualTo("/ranger/services/v1?skipReplicationSources=false")) + stubFor(get(urlEqualTo("/ranger/services/v1?skipDataFromReplicationSources=false")) .willReturn(aResponse() .withBody(MAPPER.writeValueAsBytes(responseObjReplicated)) .withStatus(200))); @@ -54,7 +54,7 @@ void testServiceDataSource(WireMockRuntimeInfo wireMockRuntimeInfo) throws IOExc RangerTestUtils.getService("test-n", "test-s"), RangerTestUtils.getService("test-n", "test-s1"))) .build(); - stubFor(get(urlEqualTo("/ranger/services/v1?skipReplicationSources=true")) + stubFor(get(urlEqualTo("/ranger/services/v1?skipDataFromReplicationSources=true")) .willReturn(aResponse() .withBody(MAPPER.writeValueAsBytes(responseObjReplicationSkipped)) .withStatus(200))); diff --git a/ranger-server-bundle/src/main/java/io/appform/ranger/server/bundle/resources/RangerResource.java b/ranger-server-bundle/src/main/java/io/appform/ranger/server/bundle/resources/RangerResource.java index bb38e6e3..d30e72da 100644 --- a/ranger-server-bundle/src/main/java/io/appform/ranger/server/bundle/resources/RangerResource.java +++ b/ranger-server-bundle/src/main/java/io/appform/ranger/server/bundle/resources/RangerResource.java @@ -52,10 +52,10 @@ public RangerResource(List> rangerHubs) { @Path("/services/v1") @Timed public GenericResponse> getServices( - @QueryParam("skipReplicationSources") @DefaultValue("false") boolean skipReplicationSources) { + @QueryParam("skipDataFromReplicationSources") @DefaultValue("false") boolean skipDataFromReplicationSources) { return GenericResponse.>builder() .data(rangerHubs.stream() - .filter(hub -> !skipReplicationSources || !hub.isReplicationSource()) + .filter(hub -> !skipDataFromReplicationSources || !hub.isReplicationSource()) .map(RangerHubClient::getRegisteredServices) .flatMap(Collection::stream) .collect(Collectors.toSet())) @@ -68,11 +68,11 @@ public GenericResponse> getServices( public GenericResponse>> getNodes( @NotNull @NotEmpty @PathParam("namespace") final String namespace, @NotNull @NotEmpty @PathParam("serviceName") final String serviceName, - @QueryParam("skipReplicationSources") @DefaultValue("false") boolean skipReplicationSources) { + @QueryParam("skipDataFromReplicationSources") @DefaultValue("false") boolean skipDataFromReplicationSources) { val service = Service.builder().namespace(namespace).serviceName(serviceName).build(); return GenericResponse.>>builder() .data(rangerHubs.stream() - .filter(hub -> !skipReplicationSources || !hub.isReplicationSource()) + .filter(hub -> !(skipDataFromReplicationSources && hub.isReplicationSource())) .map(hub -> hub.getAllNodes(service)) .flatMap(List::stream) .collect(Collectors.toMap(node -> node.getHost() + ":" + node.getPort(),