Skip to content

Commit

Permalink
gh-3059 rename
Browse files Browse the repository at this point in the history
  • Loading branch information
GCHQDev404 committed Nov 7, 2023
1 parent 20e7548 commit ec966c3
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.FederatedElementFunction;
import uk.gov.gchq.gaffer.federatedstore.util.MergeElementFunction;
import uk.gov.gchq.gaffer.federatedstore.util.MergeSchema;
import uk.gov.gchq.gaffer.graph.GraphSerialisable;
import uk.gov.gchq.gaffer.operation.Operation;
Expand Down Expand Up @@ -156,8 +156,8 @@ public FederatedStore(@JsonProperty("customPropertiesAuths") final Set<String> 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 FederatedElementFunction());
this.storeConfiguredMergeFunctions.putIfAbsent(GetElements.class.getCanonicalName(), new FederatedElementFunction());
this.storeConfiguredMergeFunctions.putIfAbsent(GetAllElements.class.getCanonicalName(), new MergeElementFunction());
this.storeConfiguredMergeFunctions.putIfAbsent(GetElements.class.getCanonicalName(), new MergeElementFunction());
this.storeConfiguredMergeFunctions.putIfAbsent(GetSchema.class.getCanonicalName(), new MergeSchema());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@

import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
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;
import static uk.gov.gchq.gaffer.federatedstore.util.MergeElementFunction.SCHEMA;
import static uk.gov.gchq.gaffer.federatedstore.util.MergeElementFunction.USER;
import static uk.gov.gchq.gaffer.federatedstore.util.MergeElementFunction.VIEW;

public final class FederatedStoreUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(FederatedStoreUtil.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
* By default, a local in memory MapStore is used for local aggregation,
* but a Graph or {@link GraphSerialisable} of any kind could be supplied via the {@link #context} with the key {@link #TEMP_RESULTS_GRAPH}.
*/
public class FederatedElementFunction implements ContextSpecificMergeFunction<Object, Iterable<Object>, Iterable<Object>> {
private static final Logger LOGGER = LoggerFactory.getLogger(FederatedElementFunction.class);
public class MergeElementFunction implements ContextSpecificMergeFunction<Object, Iterable<Object>, Iterable<Object>> {
private static final Logger LOGGER = LoggerFactory.getLogger(MergeElementFunction.class);
public static final String VIEW = "view";
public static final String SCHEMA = "schema";
public static final String USER = "user";
Expand All @@ -70,16 +70,16 @@ public class FederatedElementFunction implements ContextSpecificMergeFunction<Ob
@JsonProperty("context")
private Map<String, Object> context;

public FederatedElementFunction() {
public MergeElementFunction() {
}

public FederatedElementFunction(final Map<String, Object> context) throws GafferCheckedException {
public MergeElementFunction(final Map<String, Object> 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, FederatedElementFunction.class.getSimpleName(), RANDOM.nextInt(Integer.MAX_VALUE))))
.config(new GraphConfig(String.format("%s%s%d", TEMP_RESULTS_GRAPH, MergeElementFunction.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())
Expand Down Expand Up @@ -120,8 +120,8 @@ private static void updateViewWithValidationFromSchema(final Map<String, Object>
}

@Override
public FederatedElementFunction createFunctionWithContext(final HashMap<String, Object> context) throws GafferCheckedException {
return new FederatedElementFunction(context);
public MergeElementFunction createFunctionWithContext(final HashMap<String, Object> context) throws GafferCheckedException {
return new MergeElementFunction(context);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import static uk.gov.gchq.gaffer.federatedstore.FederatedStoreTestUtil.loadSchemaFromJson;
import static uk.gov.gchq.gaffer.federatedstore.FederatedStoreTestUtil.resetForFederatedTests;

public class FederatedElementFunctionAggregationSchemaValidationTest {
public class MergeElementFunctionAggregationSchemaValidationTest {

private FederatedStore federatedStore;
private Entity entity1, entity99, entityOther;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import static uk.gov.gchq.gaffer.federatedstore.FederatedStoreTestUtil.loadSchemaFromJson;
import static uk.gov.gchq.gaffer.federatedstore.FederatedStoreTestUtil.resetForFederatedTests;

public class FederatedElementFunctionAggregationViewFilterTest {
public class MergeElementFunctionAggregationViewFilterTest {

private FederatedStore federatedStore;
private Entity entity1, entity99, entityOther;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
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.ConcatenateMergeFunction;
import uk.gov.gchq.gaffer.federatedstore.util.FederatedElementFunction;
import uk.gov.gchq.gaffer.federatedstore.util.MergeElementFunction;
import uk.gov.gchq.gaffer.graph.Graph;
import uk.gov.gchq.gaffer.graph.GraphConfig;
import uk.gov.gchq.gaffer.graph.GraphSerialisable;
Expand Down Expand Up @@ -180,7 +180,7 @@ public final void shouldGetDefaultedMergeForOperation() throws Exception {
assertThat(getElementsMerge)
.isNotSameAs(traitsMerge)
.isNotSameAs(graphsIdsMerge)
.isInstanceOf(FederatedElementFunction.class);
.isInstanceOf(MergeElementFunction.class);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import static uk.gov.gchq.gaffer.user.StoreUser.blankUser;
import static uk.gov.gchq.gaffer.user.StoreUser.testUser;

class FederatedElementFunctionTest {
class MergeElementFunctionTest {

public static final Schema SCHEMA = loadSchemaFromJson(SCHEMA_EDGE_BASIC_JSON);
public static final AccumuloProperties ACCUMULO_PROPERTIES = loadAccumuloStoreProperties(ACCUMULO_STORE_SINGLE_USE_PROPERTIES);
Expand Down Expand Up @@ -89,7 +89,7 @@ public void shouldAggregateEdgesFromMultipleRetrievers() throws Exception {
final AccumuloStore accumuloStore = getTestStore("shouldAggregateEdgesFromMultipleRetrievers");
addEdgeBasic(accumuloStore);
AccumuloAllElementsRetriever[] retrievers = getRetrievers(accumuloStore);
final FederatedElementFunction function = new FederatedElementFunction().createFunctionWithContext(
final MergeElementFunction function = new MergeElementFunction().createFunctionWithContext(
makeContext(
new View.Builder().edge(GROUP_BASIC_EDGE).build(),
SCHEMA.clone()));
Expand Down Expand Up @@ -122,7 +122,7 @@ public void shouldApplyViewToAggregatedEdgesFromMultipleRetrievers() throws Exce
final AccumuloStore accumuloStore = getTestStore("shouldApplyViewToAggregatedEdgesFromMultipleRetrievers");
addEdgeBasic(accumuloStore);
AccumuloAllElementsRetriever[] retrievers = getRetrievers(accumuloStore);
final FederatedElementFunction function = new FederatedElementFunction().createFunctionWithContext(
final MergeElementFunction function = new MergeElementFunction().createFunctionWithContext(
makeContext(
//Update View to filter OUT greater than 2.
new View.Builder().edge(GROUP_BASIC_EDGE,
Expand Down Expand Up @@ -168,9 +168,9 @@ private static AccumuloStore getTestStore(final String instanceName) throws Stor

private static HashMap<String, Object> makeContext(final View view, final Schema schema) {
final HashMap<String, Object> map = new HashMap<>();
map.put(FederatedElementFunction.VIEW, view);
map.put(FederatedElementFunction.SCHEMA, schema);
map.put(FederatedElementFunction.USER, testUser());
map.put(MergeElementFunction.VIEW, view);
map.put(MergeElementFunction.SCHEMA, schema);
map.put(MergeElementFunction.USER, testUser());
return map;
}
}

0 comments on commit ec966c3

Please sign in to comment.