Skip to content

Merge release into master branch #3331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 60 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
7c7c97d
prepare for next development iteration
github-actions[bot] Aug 13, 2024
02fefef
Gh 3152 mystery test coverage changes for two files (#3268)
j69772 Aug 19, 2024
75c0d07
Gh-3272 Make Swagger Server URL dynamic (#3273)
p29876 Aug 23, 2024
4e15ae1
Gh-3270: Make DeleteAllData a core operation (#3271)
cn337131 Aug 29, 2024
cd93f5e
Gh 2839 track creation date of sub graphs (#3269)
wb36499 Sep 2, 2024
a8b0739
Gh-3274: Simplified federation proof of concept (#3275)
tb06904 Sep 4, 2024
789a898
Gh-3279: AddGraph Operation for Federated POC (#3280)
tb06904 Sep 5, 2024
278acd3
Gh-3283: Remove Graph operation for Federated POC (#3285)
tb06904 Sep 11, 2024
8173237
Add the simple federated store to spring-rest (#3287)
p29876 Sep 12, 2024
ce06bdf
Gh-3281: add examples for /operations/execute (#3282)
p29876 Sep 12, 2024
58ad080
Gh-3277: Add custom GafferPop Vertex Step (#3278)
p29876 Sep 12, 2024
0289d6f
allow setting the timeout bean
tb06904 Sep 12, 2024
2dc7976
set timeout for execution
tb06904 Sep 12, 2024
1becb6f
test updates
tb06904 Sep 12, 2024
16fd6a3
Gh 3288: Store Graphs in cache in federated POC (#3289)
tb06904 Sep 13, 2024
a5f59dc
Gh-3276: Add ability to seed with Vertex only in Gremlin (#3286)
cn337131 Sep 13, 2024
024ea82
add execute endpoints that return graphson
tb06904 Sep 13, 2024
d2c43b8
Merge remote-tracking branch 'origin/develop' into gh-3292-restapi-gr…
tb06904 Sep 13, 2024
6b54fc4
tweaks and duplication removal
tb06904 Sep 13, 2024
602bfd3
add getAllInfo to simple fed POC
cn337131 Sep 13, 2024
1b7a952
move to set and stream processing
tb06904 Sep 13, 2024
87791cc
remove log
tb06904 Sep 13, 2024
968734d
Merge branch 'develop' into gh-3292-restapi-gremlin-timeout
tb06904 Sep 13, 2024
1099bef
Gh-3290: Configure with properties in federated POC (#3293)
tb06904 Sep 16, 2024
917d2eb
Merge branch 'develop' into gh-3292-restapi-gremlin-timeout
wb36499 Sep 16, 2024
79b1f9e
checkstyle, add test
cn337131 Sep 16, 2024
1e29cd3
Merge branch 'develop' into gh-3291-add-getallgraphinfo-poc-fed-store
cn337131 Sep 16, 2024
fd0027b
fix
cn337131 Sep 16, 2024
d6ad45c
update to better handle stream response
tb06904 Sep 16, 2024
ea928f8
make sure not modifying original element
tb06904 Sep 16, 2024
2c5297a
change schema aggregation methods
tb06904 Sep 16, 2024
a42c200
Merge branch 'develop' into gh-3295-accumulo-iterators-issue-federate…
tb06904 Sep 16, 2024
5f19d90
make keys constants
cn337131 Sep 17, 2024
99acc0d
oops
cn337131 Sep 17, 2024
0fbb929
better handle default graphs
tb06904 Sep 17, 2024
549b5d3
update tests
tb06904 Sep 18, 2024
9e7f5d5
checkstyle
tb06904 Sep 18, 2024
4ce1ec5
Gh-3291: Add GetAllGraphInfo operation to POC federated store (#3298)
j69772 Sep 19, 2024
f99cb11
Merge branch 'develop' into gh-3292-restapi-gremlin-timeout
j69772 Sep 19, 2024
d770cff
Merge branch 'develop' into gh-3295-accumulo-iterators-issue-federate…
j69772 Sep 19, 2024
4007ee3
Gh-3295: Fix issue with Accumulo iterators when smart merging Federat…
j69772 Sep 19, 2024
2577ba9
Merge branch 'develop' into gh-3292-restapi-gremlin-timeout
j69772 Sep 19, 2024
6471de9
Gh-3292: REST API Gremlin Timeout and Execute Endpoints (#3294)
j69772 Sep 19, 2024
5960ac1
Gh-3299: Add ChangeGraphId operation to POC simple federated store (#…
cn337131 Sep 30, 2024
d3d494e
Gh-3303: No error reported when Gremlin endpoint fails (#3304)
tb06904 Sep 30, 2024
9d4563d
Gh-3305: Fix to apply OpOptions at OpChain level (#3306)
cn337131 Sep 30, 2024
2250c5b
Bump commons-io:commons-io from 2.11.0 to 2.14.0
dependabot[bot] Oct 3, 2024
e0db908
Bump commons-io:commons-io from 2.11.0 to 2.14.0 (#3312)
j69772 Oct 9, 2024
279e60a
Gh-3308: Specify merge classes federated POC (#3311)
tb06904 Oct 10, 2024
b9e4593
Gh-3309: Add new fed store to GafferPop testing (#3310)
cn337131 Oct 10, 2024
ac9c4a7
Gh-3121: MapStore only supports string visibility (#3313)
rj77259 Oct 14, 2024
2b89f94
Gh-3300: Graph access controls for federated POC (#3307)
tb06904 Oct 14, 2024
9bf6f1b
Change OTEL user attribute (#3321)
p29876 Oct 18, 2024
a5a67ac
Gh-3319: Fixes ability to get orphan vertices from edges (#3320)
cn337131 Oct 21, 2024
c8f0732
Gh-3324: Add OperationChainValidator to FedStore POC (#3325)
cn337131 Oct 22, 2024
5e2b804
Gh-3322: Cache updates for federated POC (#3323)
tb06904 Oct 23, 2024
73b7544
Gh-2840: MapStore MatchedVertex inconsistent (#3297)
j69772 Oct 23, 2024
3aae44d
Gh-3315: Add AbstractStoreITs to the new fed store POC (#3316)
cn337131 Oct 30, 2024
5655f6c
Gh-3326: Update Schema merge federated POC (#3328)
tb06904 Oct 31, 2024
d265a92
prepare release gaffer2-2.3.1
github-actions[bot] Nov 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration-legacy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Accumulo
values: :accumulo-store,:accumulo-rest
- name: Federated-And-Map
values: :integration-test,:federated-store,:map-store,:map-rest
values: :integration-test,:federated-store,:map-store,:map-rest,:simple-federated-store
- name: REST
values: :rest-api,:common-rest,:spring-rest,:core-rest,:store-implementation,:proxy-store
- name: Examples
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
- name: Accumulo
values: :accumulo-store,:accumulo-rest
- name: Federated-And-Map
values: :integration-test,:federated-store,:map-store,:map-rest
values: :integration-test,:federated-store,:map-store,:map-rest,:simple-federated-store
- name: REST
values: :rest-api,:common-rest,:spring-rest,:core-rest,:store-implementation,:proxy-store
- name: Examples
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Crown Copyright
* Copyright 2017-2024 Crown Copyright
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -117,14 +117,10 @@ public void removeAnyItem() {
}

public int size() {
if (null == collection) {
if (null != singleItem) {
return 1;
}
return 0;
if (collection != null) {
return collection.size();
}

return collection.size();
return (singleItem != null) ? 1 : 0;
}

public boolean isEmpty() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Crown Copyright
* Copyright 2017-2024 Crown Copyright
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,6 +39,11 @@ public class ElementVisibility {
EMPTY_NODE = new ElementVisibility.Node(ElementVisibility.NodeType.EMPTY, 0);
}

public ElementVisibility(final Object expression) {
this.node = null;
this.validate(convert(expression));
}

public ElementVisibility(final String expression) {
this(expression.getBytes(UTF_8));
}
Expand All @@ -48,6 +53,10 @@ public ElementVisibility(final byte[] expression) {
this.validate(expression);
}

private byte[] convert(final Object expression) {
return expression.toString().getBytes(UTF_8);
}

public byte[] getExpression() {
return this.expression;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Crown Copyright
* Copyright 2017-2024 Crown Copyright
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -86,20 +86,28 @@ public boolean add(final E e) {
boolean result = false;

final OneOrMore<E> values = backingMap.get(e);
// Skip the item if we are deduplicating and the item already exists
// Skip the item if we are deduplicating and the item already exists.
boolean skipItem = (deduplicate && nonNull(values) && values.contains(e));
if (!skipItem) {
if (nonNull(limit) && size >= limit) {
// Check the item against the last item.
final Map.Entry<E, OneOrMore<E>> last = backingMap.lastEntry();
// Checks if the last items key is greater than e
if (0 < comparator.compare(last.getKey(), e)) {
// Checks if the items value contains a collection or a single item
if (1 < last.getValue().size()) {
// Items value contains a collection.
// Remove item from collection.
last.getValue().removeAnyItem();
} else {
// Items value contains a single item.
// Remove item from backingMap.
backingMap.remove(last.getKey());
}
size--;
// e is bigger than the lastEntry.
} else {
// Skip adding the item.
skipItem = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@

public final class OtelUtil {

public static final String USER_ATTRIBUTE = "enduser.id";
public static final String JOB_ID_ATTRIBUTE = "gaffer.jobId";
public static final String GRAPH_ID_ATTRIBUTE = "gaffer.graphId";
public static final String VIEW_ATTRIBUTE = "gaffer.view";
public static final String GREMLIN_QUERY_ATTRIBUTE = "gaffer.gremlin.query";

private static boolean openTelemetryActive = false;

private OtelUtil() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Crown Copyright
* Copyright 2017-2024 Crown Copyright
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,6 @@
import java.util.stream.IntStream;

import static org.assertj.core.api.Assertions.assertThat;

public class OneOrMoreTest {

@Test
Expand Down Expand Up @@ -72,6 +71,32 @@ public void shouldRemoveLastItemInList() {
.containsExactly(1, 2);
}

@Test
void testSizeWithNonNullCollection() {
final boolean deduplicate = true;
final OneOrMore<Integer> collection = new OneOrMore<>(deduplicate, 1);
collection.add(2);
collection.add(3);

assertThat(collection).hasSize(3);
}

@Test
void testSizeWithSingleItem() {
final boolean deduplicate = true;
final OneOrMore<Integer> collection = new OneOrMore<>(deduplicate, 1);

assertThat(collection).hasSize(1);
}

@Test
void testSizeWithNullCollectionAndSingleItem() {
final boolean deduplicate = true;
final OneOrMore<Integer> collection = new OneOrMore<>(deduplicate, null);

assertThat(collection).isEmpty();
}

@Test
public void shouldAddItemsWithoutDeduplicate() {
// Given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@

class ElementVisibilityTest {

@Test
void testIntegerTypeIsAccepted() {
final ElementVisibility ev = new ElementVisibility(1);
assertThat(ev).hasToString("[1]");
}

@Test
void testCustomObjectIsAccepted() {
RandomObject randomObject = new RandomObject("Hello", 1);
final ElementVisibility ev = new ElementVisibility(randomObject);
assertThat(ev).hasToString("[hello]");
}

@Test
void testEmptyStringIsValid() {
final ElementVisibility a = new ElementVisibility(new byte[0]);
Expand Down Expand Up @@ -188,4 +201,19 @@ private void assertNode(final ElementVisibility.Node node, final ElementVisibili
}
);
}

class RandomObject {
private String randomString;
private Integer randomInteger;

RandomObject(String randomString, Integer randomInteger) {
this.randomString = randomString;
this.randomInteger = randomInteger;
}

@Override
public String toString() {
return "hello";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ void shouldLimitAndNotDeduplicateEntries() {
assertThat(list).containsExactly(1, 1, 2, 2);
}

@Test
void shouldInsertNewItemAndRemoveOldItemWhenlimitIsReachedAndNewItemIsLessThanLastEntry() {
final LimitedInMemorySortedIterable<Integer> list = new LimitedInMemorySortedIterable<Integer>(Comparator.naturalOrder(), 3, false);

list.add(3);
list.add(2);
list.add(3);
list.add(2);

assertThat(list).hasSize(3).containsExactly(2, 2, 3);
}

@Test
void shouldAddAll() {
final LimitedInMemorySortedIterable<Integer> itr = new LimitedInMemorySortedIterable<Integer>(Comparator.naturalOrder(), 100);
Expand Down
10 changes: 7 additions & 3 deletions core/graph/src/main/java/uk/gov/gchq/gaffer/graph/Graph.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ private <O> GraphResult<O> _execute(final StoreExecuter<O> storeExecuter, final
Span span = OtelUtil.startSpan(
this.getClass().getName(),
"Graph Request: " + clonedOpChain.toOverviewString());
span.setAttribute("gaffer.graphId", getGraphId());
span.setAttribute("gaffer.jobId", clonedContext.getJobId());
span.setAttribute("gaffer.user", clonedContext.getUser().getUserId());
span.setAttribute(OtelUtil.GRAPH_ID_ATTRIBUTE, getGraphId());
span.setAttribute(OtelUtil.JOB_ID_ATTRIBUTE, clonedContext.getJobId());
span.setAttribute(OtelUtil.USER_ATTRIBUTE, clonedContext.getUser().getUserId());

O result = null;
// Sets the span to current so parent child spans are auto linked
Expand Down Expand Up @@ -520,6 +520,10 @@ public GraphLibrary getGraphLibrary() {
return store.getCaches();
}

public String getCreatedTime() {
return store.getCreatedTime();
}

@FunctionalInterface
private interface StoreExecuter<O> {
O execute(final OperationChain<O> operation, final Context context) throws OperationException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ private Collection<Operation> resolveNamedOperations(final Operation operation,
.getOperationChain(namedOperation.getParameters());
// Update the operation inputs and add operation chain to the updated list
OperationHandlerUtil.updateOperationInput(namedOperationChain, namedOperation.getInput());
namedOperationChain.setOptions(namedOperation.getOptions());

// Run again to resolve any nested operations in the chain before adding
namedOperationChain.updateOperations(resolveNamedOperations(namedOperationChain, user, depth + 1));
Expand Down
34 changes: 34 additions & 0 deletions core/graph/src/test/java/uk/gov/gchq/gaffer/graph/GraphTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
import uk.gov.gchq.gaffer.store.TestTypes;
import uk.gov.gchq.gaffer.store.library.GraphLibrary;
import uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary;
import uk.gov.gchq.gaffer.store.operation.DeleteAllData;
import uk.gov.gchq.gaffer.store.operation.GetTraits;
import uk.gov.gchq.gaffer.store.operation.handler.GetTraitsHandler;
import uk.gov.gchq.gaffer.store.operation.handler.OperationHandler;
Expand All @@ -104,6 +105,8 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -117,6 +120,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.within;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand Down Expand Up @@ -2687,6 +2691,31 @@ public void shouldNotExpandGlobalEdgesWhereNotPresentInSchema(@Mock final Store
assertNotNull(mergedView.getGlobalEdges().get(0).getPostAggregationFilter());

}
@Test
void shouldGetGraphCreatedTime() {
// Given
final Store store = new TestStoreImpl();
final Schema schema = new Schema.Builder().build();
Graph graph = new Graph.Builder()
.config(new GraphConfig.Builder()
.graphId(GRAPH_ID)
.build())
.storeProperties(StreamUtil.storeProps(getClass()))
.store(store)
.addSchema(schema)
.build();

// When
String graphCreatedTime = graph.getCreatedTime();

// Then
assertThat(graphCreatedTime)
.isNotNull()
.isInstanceOf(String.class);
assertThat(LocalDateTime.parse(graphCreatedTime))
.isInstanceOf(LocalDateTime.class)
.isCloseTo(LocalDateTime.now(), within(20, ChronoUnit.SECONDS));
}

public static class TestStoreImpl extends Store {
@Override
Expand Down Expand Up @@ -2719,6 +2748,11 @@ protected OperationHandler<? extends DeleteElements> getDeleteElementsHandler()
return null;
}

@Override
protected OperationHandler<DeleteAllData> getDeleteAllDataHandler() {
return null;
}

@Override
protected OutputOperationHandler<GetTraits, Set<StoreTrait>> getGetTraitsHandler() {
return new GetTraitsHandler(new HashSet<>(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import uk.gov.gchq.gaffer.store.Context;
import uk.gov.gchq.gaffer.store.Store;
import uk.gov.gchq.gaffer.store.StoreTrait;
import uk.gov.gchq.gaffer.store.operation.DeleteAllData;
import uk.gov.gchq.gaffer.store.operation.GetTraits;
import uk.gov.gchq.gaffer.store.operation.handler.GetTraitsHandler;
import uk.gov.gchq.gaffer.store.operation.handler.OperationHandler;
Expand Down Expand Up @@ -89,6 +90,11 @@ protected OperationHandler<? extends DeleteElements> getDeleteElementsHandler()
return null;
}

@Override
protected OperationHandler<DeleteAllData> getDeleteAllDataHandler() {
return null;
}

@Override
protected OutputOperationHandler<GetTraits, Set<StoreTrait>> getGetTraitsHandler() {
return mock(GetTraitsHandler.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 Crown Copyright
* Copyright 2016-2024 Crown Copyright
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading
Loading