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 6, 2023
1 parent 8e07f18 commit abd4950
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 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.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;
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 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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
import java.util.Set;
import java.util.stream.Stream;

public class ApplyViewToElementsFunction implements ContextSpecificMergeFunction<Object, Iterable<Object>, Iterable<Object>> {
private static final Logger LOGGER = LoggerFactory.getLogger(ApplyViewToElementsFunction.class);
public class FederatedElementFunction implements ContextSpecificMergeFunction<Object, Iterable<Object>, Iterable<Object>> {
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";
Expand All @@ -63,16 +63,16 @@ public class ApplyViewToElementsFunction implements ContextSpecificMergeFunction
@JsonProperty("context")
private Map<String, Object> context;

public ApplyViewToElementsFunction() {
public FederatedElementFunction() {
}

public ApplyViewToElementsFunction(final Map<String, Object> context) throws GafferCheckedException {
public FederatedElementFunction(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, 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())
Expand Down Expand Up @@ -113,8 +113,8 @@ private static void updateViewWithValidationFromSchema(final Map<String, Object>
}

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

/**
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.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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<? extends Element> results = federatedStore.execute(new GetElements.Builder()
.input(new EntitySeed(SOURCE_BASIC))
.view(new View.Builder()
Expand Down Expand Up @@ -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(() -> {
Expand Down Expand Up @@ -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<? extends Element> results = federatedStore.execute(new GetElements.Builder()
.input(new EntitySeed(SOURCE_BASIC))
.view(new View.Builder()
Expand Down Expand Up @@ -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<? extends Element> elements = federatedStore.execute(new GetElements.Builder()
.input(new EntitySeed(SOURCE_BASIC))
.view(new View.Builder()
Expand Down Expand Up @@ -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<? extends Element> results = federatedStore.execute(new GetElements.Builder()
.input(new EntitySeed(SOURCE_BASIC))
.view(new View.Builder()
Expand Down Expand Up @@ -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<? extends Element> results = federatedStore.execute(new GetElements.Builder()
.input(new EntitySeed(SOURCE_BASIC))
.view(new View.Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -180,7 +180,7 @@ public final void shouldGetDefaultedMergeForOperation() throws Exception {
assertThat(getElementsMerge)
.isNotSameAs(traitsMerge)
.isNotSameAs(graphsIdsMerge)
.isInstanceOf(ApplyViewToElementsFunction.class);
.isInstanceOf(FederatedElementFunction.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 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);
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 ApplyViewToElementsFunction function = new ApplyViewToElementsFunction().createFunctionWithContext(
final FederatedElementFunction function = new FederatedElementFunction().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 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,
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(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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}

0 comments on commit abd4950

Please sign in to comment.