From abd495087e2987ddb05d75e78de4c44adde241c7 Mon Sep 17 00:00:00 2001 From: GCHQDev404 <45399082+GCHQDev404@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:10:31 +0000 Subject: [PATCH] gh-3059 rename. --- .../gchq/gaffer/federatedstore/FederatedStore.java | 6 +++--- ...Function.java => FederatedElementFunction.java} | 14 +++++++------- .../federatedstore/util/FederatedStoreUtil.java | 6 +++--- .../federatedstore/FederatedStoreSchemaTest.java | 12 ++++++------ .../handler/FederatedOperationHandlerTest.java | 4 ++-- ...Test.java => FederatedElementFunctionTest.java} | 12 ++++++------ .../src/test/resources/withConfigMergeMapping.json | 2 +- 7 files changed, 28 insertions(+), 28 deletions(-) rename store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/util/{ApplyViewToElementsFunction.java => FederatedElementFunction.java} (93%) rename store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/util/{ApplyViewToElementsFunctionTest.java => FederatedElementFunctionTest.java} (94%) diff --git a/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/FederatedStore.java b/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/FederatedStore.java index 76a38bdde97..1851130eca9 100644 --- a/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/FederatedStore.java +++ b/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/FederatedStore.java @@ -54,7 +54,7 @@ import uk.gov.gchq.gaffer.federatedstore.operation.handler.impl.FederatedRemoveGraphAndDeleteAllDataHandler; import uk.gov.gchq.gaffer.federatedstore.operation.handler.impl.FederatedRemoveGraphHandler; import uk.gov.gchq.gaffer.federatedstore.schema.FederatedViewValidator; -import uk.gov.gchq.gaffer.federatedstore.util.ApplyViewToElementsFunction; +import uk.gov.gchq.gaffer.federatedstore.util.FederatedElementFunction; import uk.gov.gchq.gaffer.federatedstore.util.MergeSchema; import uk.gov.gchq.gaffer.graph.GraphSerialisable; import uk.gov.gchq.gaffer.operation.Operation; @@ -156,8 +156,8 @@ public FederatedStore(@JsonProperty("customPropertiesAuths") final Set c this.storeConfiguredMergeFunctions = (null == storeConfiguredMergeFunctions) ? new HashMap<>() : new HashMap<>(storeConfiguredMergeFunctions); this.storeConfiguredMergeFunctions.putIfAbsent(GetTraits.class.getCanonicalName(), new CollectionIntersect<>()); - this.storeConfiguredMergeFunctions.putIfAbsent(GetAllElements.class.getCanonicalName(), new ApplyViewToElementsFunction()); - this.storeConfiguredMergeFunctions.putIfAbsent(GetElements.class.getCanonicalName(), new ApplyViewToElementsFunction()); + this.storeConfiguredMergeFunctions.putIfAbsent(GetAllElements.class.getCanonicalName(), new FederatedElementFunction()); + this.storeConfiguredMergeFunctions.putIfAbsent(GetElements.class.getCanonicalName(), new FederatedElementFunction()); this.storeConfiguredMergeFunctions.putIfAbsent(GetSchema.class.getCanonicalName(), new MergeSchema()); } diff --git a/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/util/ApplyViewToElementsFunction.java b/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/util/FederatedElementFunction.java similarity index 93% rename from store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/util/ApplyViewToElementsFunction.java rename to store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/util/FederatedElementFunction.java index 4022e744892..e6eac541093 100644 --- a/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/util/ApplyViewToElementsFunction.java +++ b/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/util/FederatedElementFunction.java @@ -52,8 +52,8 @@ import java.util.Set; import java.util.stream.Stream; -public class ApplyViewToElementsFunction implements ContextSpecificMergeFunction, Iterable> { - private static final Logger LOGGER = LoggerFactory.getLogger(ApplyViewToElementsFunction.class); +public class FederatedElementFunction implements ContextSpecificMergeFunction, Iterable> { + private static final Logger LOGGER = LoggerFactory.getLogger(FederatedElementFunction.class); public static final String VIEW = "view"; public static final String SCHEMA = "schema"; public static final String USER = "user"; @@ -63,16 +63,16 @@ public class ApplyViewToElementsFunction implements ContextSpecificMergeFunction @JsonProperty("context") private Map context; - public ApplyViewToElementsFunction() { + public FederatedElementFunction() { } - public ApplyViewToElementsFunction(final Map context) throws GafferCheckedException { + public FederatedElementFunction(final Map context) throws GafferCheckedException { this(); try { // Check if results graph, hasn't already be supplied, otherwise make a default results graph. if (!context.containsKey(TEMP_RESULTS_GRAPH)) { final Graph resultsGraph = new Graph.Builder() - .config(new GraphConfig(String.format("%s%s%d", TEMP_RESULTS_GRAPH, ApplyViewToElementsFunction.class.getSimpleName(), RANDOM.nextInt(Integer.MAX_VALUE)))) + .config(new GraphConfig(String.format("%s%s%d", TEMP_RESULTS_GRAPH, FederatedElementFunction.class.getSimpleName(), RANDOM.nextInt(Integer.MAX_VALUE)))) .addSchema((Schema) context.get(SCHEMA)) //MapStore easy in memory Store. Large results size may not be suitable, a graph could be provided via Context. .addStoreProperties(new MapStoreProperties()) @@ -113,8 +113,8 @@ private static void updateViewWithValidationFromSchema(final Map } @Override - public ApplyViewToElementsFunction createFunctionWithContext(final HashMap context) throws GafferCheckedException { - return new ApplyViewToElementsFunction(context); + public FederatedElementFunction createFunctionWithContext(final HashMap context) throws GafferCheckedException { + return new FederatedElementFunction(context); } /** diff --git a/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/util/FederatedStoreUtil.java b/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/util/FederatedStoreUtil.java index 716daa0b8b1..6bb76c119f3 100644 --- a/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/util/FederatedStoreUtil.java +++ b/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/util/FederatedStoreUtil.java @@ -66,9 +66,9 @@ import static java.util.Objects.isNull; import static java.util.Objects.nonNull; -import static uk.gov.gchq.gaffer.federatedstore.util.ApplyViewToElementsFunction.SCHEMA; -import static uk.gov.gchq.gaffer.federatedstore.util.ApplyViewToElementsFunction.USER; -import static uk.gov.gchq.gaffer.federatedstore.util.ApplyViewToElementsFunction.VIEW; +import static uk.gov.gchq.gaffer.federatedstore.util.FederatedElementFunction.SCHEMA; +import static uk.gov.gchq.gaffer.federatedstore.util.FederatedElementFunction.USER; +import static uk.gov.gchq.gaffer.federatedstore.util.FederatedElementFunction.VIEW; public final class FederatedStoreUtil { private static final Logger LOGGER = LoggerFactory.getLogger(FederatedStoreUtil.class); diff --git a/store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/FederatedStoreSchemaTest.java b/store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/FederatedStoreSchemaTest.java index 38957ba4c42..231e7cce42f 100644 --- a/store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/FederatedStoreSchemaTest.java +++ b/store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/FederatedStoreSchemaTest.java @@ -221,7 +221,7 @@ public void shouldBeAbleToGetElementsWithOverlappingSchemas() throws OperationEx addEdgeBasicWith(DEST_2, 1, 2); // When - // No merge function specified - ApplyViewToElementsFunction is used + // No merge function specified - FederatedElementFunction is used final Iterable results = federatedStore.execute(new GetElements.Builder() .input(new EntitySeed(SOURCE_BASIC)) .view(new View.Builder() @@ -432,7 +432,7 @@ public void shouldValidateCorrectlyWithOverlappingSchemas() throws OperationExce // When addEdgeBasicWith(DEST_2, 1, 2); - // No merge function specified - ApplyViewToElementsFunction is used + // No merge function specified - FederatedElementFunction is used // An exception is raised because the aggregated results are missing a validated property assertThatExceptionOfType(OperationException.class) .isThrownBy(() -> { @@ -521,7 +521,7 @@ public void shouldBeAbleToIngestAggregateWithOverlappingSchemas() throws Operati .build(), testContext); // When - // No merge function specified - ApplyViewToElementsFunction is used + // No merge function specified - FederatedElementFunction is used final Iterable results = federatedStore.execute(new GetElements.Builder() .input(new EntitySeed(SOURCE_BASIC)) .view(new View.Builder() @@ -607,7 +607,7 @@ public void shouldBeAbleToIngestAggregateMissingPropertyWithOverlappingSchemas() addEdgeBasicWith(DEST_BASIC, 1); // When - // No merge function specified - ApplyViewToElementsFunction is used + // No merge function specified - FederatedElementFunction is used final Iterable elements = federatedStore.execute(new GetElements.Builder() .input(new EntitySeed(SOURCE_BASIC)) .view(new View.Builder() @@ -711,7 +711,7 @@ public void shouldBeAbleToViewPropertyWithOverlappingSchemas() throws OperationE // When - // No merge function specified - ApplyViewToElementsFunction is used + // No merge function specified - FederatedElementFunction is used final Iterable results = federatedStore.execute(new GetElements.Builder() .input(new EntitySeed(SOURCE_BASIC)) .view(new View.Builder() @@ -877,7 +877,7 @@ public void shouldBeAbleToQueryAggregatePropertyWithOverlappingSchemas() throws // When - // No merge function specified - ApplyViewToElementsFunction is used + // No merge function specified - FederatedElementFunction is used final Iterable results = federatedStore.execute(new GetElements.Builder() .input(new EntitySeed(SOURCE_BASIC)) .view(new View.Builder() diff --git a/store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/operation/handler/FederatedOperationHandlerTest.java b/store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/operation/handler/FederatedOperationHandlerTest.java index 9a02e6d9718..7e69434874b 100644 --- a/store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/operation/handler/FederatedOperationHandlerTest.java +++ b/store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/operation/handler/FederatedOperationHandlerTest.java @@ -36,7 +36,7 @@ import uk.gov.gchq.gaffer.federatedstore.operation.FederatedOperation; import uk.gov.gchq.gaffer.federatedstore.operation.GetAllGraphIds; import uk.gov.gchq.gaffer.federatedstore.operation.handler.impl.FederatedOperationHandler; -import uk.gov.gchq.gaffer.federatedstore.util.ApplyViewToElementsFunction; +import uk.gov.gchq.gaffer.federatedstore.util.FederatedElementFunction; import uk.gov.gchq.gaffer.federatedstore.util.ConcatenateMergeFunction; import uk.gov.gchq.gaffer.graph.Graph; import uk.gov.gchq.gaffer.graph.GraphConfig; @@ -180,7 +180,7 @@ public final void shouldGetDefaultedMergeForOperation() throws Exception { assertThat(getElementsMerge) .isNotSameAs(traitsMerge) .isNotSameAs(graphsIdsMerge) - .isInstanceOf(ApplyViewToElementsFunction.class); + .isInstanceOf(FederatedElementFunction.class); } @Test diff --git a/store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/util/ApplyViewToElementsFunctionTest.java b/store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/util/FederatedElementFunctionTest.java similarity index 94% rename from store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/util/ApplyViewToElementsFunctionTest.java rename to store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/util/FederatedElementFunctionTest.java index 642e84667fa..9b082a6ee32 100644 --- a/store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/util/ApplyViewToElementsFunctionTest.java +++ b/store-implementation/federated-store/src/test/java/uk/gov/gchq/gaffer/federatedstore/util/FederatedElementFunctionTest.java @@ -54,7 +54,7 @@ import static uk.gov.gchq.gaffer.user.StoreUser.blankUser; import static uk.gov.gchq.gaffer.user.StoreUser.testUser; -class ApplyViewToElementsFunctionTest { +class FederatedElementFunctionTest { public static final Schema SCHEMA = loadSchemaFromJson(SCHEMA_EDGE_BASIC_JSON); public static final AccumuloProperties ACCUMULO_PROPERTIES = loadAccumuloStoreProperties(ACCUMULO_STORE_SINGLE_USE_PROPERTIES); @@ -89,7 +89,7 @@ public void shouldAggregateEdgesFromMultipleRetrievers() throws Exception { final AccumuloStore accumuloStore = getTestStore("shouldAggregateEdgesFromMultipleRetrievers"); addEdgeBasic(accumuloStore); AccumuloAllElementsRetriever[] retrievers = getRetrievers(accumuloStore); - final ApplyViewToElementsFunction function = new ApplyViewToElementsFunction().createFunctionWithContext( + final FederatedElementFunction function = new FederatedElementFunction().createFunctionWithContext( makeContext( new View.Builder().edge(GROUP_BASIC_EDGE).build(), SCHEMA.clone())); @@ -122,7 +122,7 @@ public void shouldApplyViewToAggregatedEdgesFromMultipleRetrievers() throws Exce final AccumuloStore accumuloStore = getTestStore("shouldApplyViewToAggregatedEdgesFromMultipleRetrievers"); addEdgeBasic(accumuloStore); AccumuloAllElementsRetriever[] retrievers = getRetrievers(accumuloStore); - final ApplyViewToElementsFunction function = new ApplyViewToElementsFunction().createFunctionWithContext( + final FederatedElementFunction function = new FederatedElementFunction().createFunctionWithContext( makeContext( //Update View to filter OUT greater than 2. new View.Builder().edge(GROUP_BASIC_EDGE, @@ -168,9 +168,9 @@ private static AccumuloStore getTestStore(final String instanceName) throws Stor private static HashMap makeContext(final View view, final Schema schema) { final HashMap map = new HashMap<>(); - map.put(ApplyViewToElementsFunction.VIEW, view); - map.put(ApplyViewToElementsFunction.SCHEMA, schema); - map.put(ApplyViewToElementsFunction.USER, testUser()); + map.put(FederatedElementFunction.VIEW, view); + map.put(FederatedElementFunction.SCHEMA, schema); + map.put(FederatedElementFunction.USER, testUser()); return map; } } diff --git a/store-implementation/federated-store/src/test/resources/withConfigMergeMapping.json b/store-implementation/federated-store/src/test/resources/withConfigMergeMapping.json index 4b4f1e4e5f9..c0e3f656244 100644 --- a/store-implementation/federated-store/src/test/resources/withConfigMergeMapping.json +++ b/store-implementation/federated-store/src/test/resources/withConfigMergeMapping.json @@ -6,7 +6,7 @@ "class" : "uk.gov.gchq.gaffer.federatedstore.util.ConcatenateMergeFunction" }, "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements" : { - "class" : "uk.gov.gchq.gaffer.federatedstore.util.ApplyViewToElementsFunction" + "class" : "uk.gov.gchq.gaffer.federatedstore.util.FederatedElementFunction" } } } \ No newline at end of file