Skip to content
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

Update Koryphe version to 2.6.0 #3367

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
960c599
prepare for next development iteration
github-actions[bot] Nov 1, 2024
3b93f97
Gh-3334: Fix Gremlin Reusing Accumulo Iterators (#3335)
tb06904 Nov 21, 2024
7726ff3
Gh-3340: Misleading vertices in Gremlin (#3341)
tb06904 Dec 2, 2024
1a91fcf
Gh-3342: Handle different groups in View federated poc (#3343)
tb06904 Dec 5, 2024
a900916
Gh-3344: Change graph permissions operation in federated POC (#3345)
tb06904 Dec 11, 2024
d41a74b
Gh-2478: JobTracker tracks all operations, not just jobs (#3347)
cn337131 Jan 9, 2025
4eee4de
Gh-3351: Better GetWalks support on federated POC (#3352)
tb06904 Jan 13, 2025
ac5f6ac
dont reset user on graphstep
tb06904 Jan 15, 2025
656c0b0
misc otel updates
tb06904 Jan 15, 2025
a8c955d
multi instances when on rest api
tb06904 Jan 15, 2025
1f0d16e
tweaks so vars are still reset
tb06904 Jan 16, 2025
89d808f
test tweaks
tb06904 Jan 16, 2025
d039e97
minor tweaks
tb06904 Jan 17, 2025
46b32d3
checkstyle
tb06904 Jan 17, 2025
d796499
add count and logging to DeleteElements
cn337131 Jan 21, 2025
43b0d99
sonarcloud
cn337131 Jan 21, 2025
1c0e6fa
more sonarcloud
cn337131 Jan 21, 2025
bdc8bc0
checkstyle
cn337131 Jan 21, 2025
2b911f2
tweak set usage
tb06904 Jan 21, 2025
b536dc6
sonarcloud
cn337131 Jan 21, 2025
c78b623
copyright
cn337131 Jan 21, 2025
c561778
address comment
cn337131 Jan 21, 2025
8bac723
refactor
cn337131 Jan 21, 2025
b263383
fix
cn337131 Jan 21, 2025
07694ea
Gh-3353: Ensure user info passed in GafferPop (#3354)
j69772 Jan 21, 2025
4531628
Merge branch 'develop' into gh-3355-delete-elements-to-return-count
j69772 Jan 21, 2025
9a0de1b
DeleteElements to return count (#3356)
j69772 Jan 22, 2025
3ec4c9b
Gh-3350: Simple fed store fixes (#3358)
p29876 Jan 29, 2025
72aeb9b
Gh-3359: Reduce number of vertex lookups for edges (#3360)
p29876 Jan 30, 2025
dc0070d
Updated Koryphe version to 2.6.0
github-actions[bot] Jan 31, 2025
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 NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ and their licenses, below. For information on the dependencies of these dependen
projects below.


Koryphe (uk.gov.gchq.koryphe:koryphe:2.5.2):
Koryphe (uk.gov.gchq.koryphe:koryphe:2.6.0):

- Apache License, Version 2.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 Crown Copyright
* Copyright 2020-2025 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 @@ -21,9 +21,11 @@
import uk.gov.gchq.koryphe.Summary;
import uk.gov.gchq.koryphe.predicate.KoryphePredicate;

import java.io.Serializable;

@Since("1.13.1")
@Summary("Predicate which never allows user access")
public class NoAccessUserPredicate extends KoryphePredicate<User> {
public class NoAccessUserPredicate extends KoryphePredicate<User> implements Serializable {
@Override
public boolean test(final User user) {
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 Crown Copyright
* Copyright 2020-2025 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 @@ -13,16 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package uk.gov.gchq.gaffer.access.predicate.user;

import uk.gov.gchq.gaffer.user.User;
import uk.gov.gchq.koryphe.Since;
import uk.gov.gchq.koryphe.Summary;
import uk.gov.gchq.koryphe.predicate.KoryphePredicate;

import java.io.Serializable;

@Since("1.13.1")
@Summary("A predicate which always allows a user access")
public class UnrestrictedAccessUserPredicate extends KoryphePredicate<User> {
public class UnrestrictedAccessUserPredicate extends KoryphePredicate<User> implements Serializable {
@Override
public boolean test(final User user) {
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Crown Copyright
* Copyright 2024-2025 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 @@ -25,6 +25,7 @@ public final class OtelUtil {
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 OP_OPTIONS_ATTRIBUTE = "gaffer.operation.options";
public static final String GREMLIN_QUERY_ATTRIBUTE = "gaffer.gremlin.query";

private static boolean openTelemetryActive = false;
Expand Down
5 changes: 3 additions & 2 deletions core/graph/src/main/java/uk/gov/gchq/gaffer/graph/Graph.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2024 Crown Copyright
* Copyright 2017-2025 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 @@ -320,10 +320,11 @@ private <O> GraphResult<O> _execute(final StoreExecuter<O> storeExecuter, final
// OpenTelemetry hooks
Span span = OtelUtil.startSpan(
this.getClass().getName(),
"Graph Request: " + clonedOpChain.toOverviewString());
"Graph Request: " + clonedContext.getJobId());
span.setAttribute(OtelUtil.GRAPH_ID_ATTRIBUTE, getGraphId());
span.setAttribute(OtelUtil.JOB_ID_ATTRIBUTE, clonedContext.getJobId());
span.setAttribute(OtelUtil.USER_ATTRIBUTE, clonedContext.getUser().getUserId());
span.setAttribute(OtelUtil.OP_OPTIONS_ATTRIBUTE, clonedOpChain.getOptions().toString());

O result = null;
// Sets the span to current so parent child spans are auto linked
Expand Down
78 changes: 33 additions & 45 deletions core/graph/src/test/java/uk/gov/gchq/gaffer/graph/GraphTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2024 Crown Copyright
* Copyright 2016-2025 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 @@ -342,7 +342,7 @@ public void shouldCreateNewContextInstanceWhenExecuteOperation(@Mock final Store

@Test
public void shouldCreateNewContextInstanceWhenExecuteOutputOperation(@Mock final Store store)
throws OperationException, IOException {
throws OperationException {
// Given
final Schema schema = new Schema();
given(store.getProperties()).willReturn(new StoreProperties());
Expand All @@ -365,7 +365,7 @@ public void shouldCreateNewContextInstanceWhenExecuteOutputOperation(@Mock final

@Test
public void shouldCreateNewContextInstanceWhenExecuteJob(@Mock final Store store)
throws OperationException, IOException {
throws OperationException {
// Given
final Schema schema = new Schema();
given(store.getProperties()).willReturn(new StoreProperties());
Expand Down Expand Up @@ -1065,7 +1065,7 @@ public void shouldNotSetGraphViewOnOperationWhenOperationIsNotAGet(@Mock final S
}

@Test
public void shouldThrowExceptionIfStoreClassPropertyIsNotSet() throws OperationException {
public void shouldThrowExceptionIfStoreClassPropertyIsNotSet() {
try {
new Graph.Builder()
.config(new GraphConfig.Builder()
Expand Down Expand Up @@ -1097,15 +1097,10 @@ public void shouldThrowExceptionIfGraphIdIsMissing() {
}

@Test
public void shouldThrowExceptionIfSchemaIsInvalid() throws OperationException {
public void shouldThrowExceptionIfSchemaIsInvalid() {
final StoreProperties storeProperties = new StoreProperties();
storeProperties.setStoreClass(TestStoreImpl.class.getName());
try {
new Graph.Builder()
.config(new GraphConfig.Builder()
.graphId(GRAPH_ID)
.build())
.addSchema(new Schema.Builder()
final Schema invalidSchema = new Schema.Builder()
.type("int", new TypeDefinition.Builder()
.clazz(Integer.class)
.aggregateFunction(new Sum())
Expand All @@ -1126,13 +1121,17 @@ public void shouldThrowExceptionIfSchemaIsInvalid() throws OperationException {
.vertex("string")
.property("p2", "int")
.build())
.build())
.build();
final GraphConfig config = new GraphConfig.Builder()
.graphId(GRAPH_ID)
.build();
assertThatExceptionOfType(SchemaException.class)
.isThrownBy(() -> new Graph.Builder()
.config(config)
.addSchema(invalidSchema)
.storeProperties(storeProperties)
.build();
fail("exception expected");
} catch (final SchemaException e) {
assertNotNull(e.getMessage());
}
.build())
.withMessageContaining("Schema is not valid");
}

@Test
Expand Down Expand Up @@ -1254,7 +1253,7 @@ private void writeToFile(final String schemaFile, final File dir) throws IOExcep
}

@Test
public void shouldThrowExceptionIfGraphIdIsInvalid(@Mock final StoreProperties properties) throws Exception {
void shouldThrowExceptionIfGraphIdIsInvalid(@Mock final StoreProperties properties) {
try {
new Graph.Builder()
.config(new GraphConfig.Builder()
Expand Down Expand Up @@ -1355,8 +1354,7 @@ public void shouldBuildGraphUsingGraphIdAndLookupSchema() throws Exception {

@Test
public void shouldAddHooksVarArgsAndGetGraphHooks(@Mock final GraphHook graphHook1,
@Mock final Log4jLogger graphHook2)
throws Exception {
@Mock final Log4jLogger graphHook2) {
// Given
final StoreProperties storeProperties = new StoreProperties();
storeProperties.setStoreClass(TestStoreImpl.class.getName());
Expand All @@ -1382,8 +1380,7 @@ public void shouldAddHooksVarArgsAndGetGraphHooks(@Mock final GraphHook graphHoo

@Test
public void shouldAddHookAndGetGraphHooks(@Mock final GraphHook graphHook1,
@Mock final Log4jLogger graphHook3)
throws Exception {
@Mock final Log4jLogger graphHook3) {
// Given
final StoreProperties storeProperties = new StoreProperties();
storeProperties.setStoreClass(TestStore.class.getName());
Expand Down Expand Up @@ -1417,8 +1414,7 @@ public void shouldAddHookAndGetGraphHooks(@Mock final GraphHook graphHook1,

@Test
public void shouldAddNamedViewResolverHookAfterNamedOperationResolver(@Mock final GraphHook graphHook1,
@Mock final Log4jLogger graphHook2)
throws Exception {
@Mock final Log4jLogger graphHook2) {
// Given
final StoreProperties storeProperties = new StoreProperties();
storeProperties.setStoreClass(TestStore.class.getName());
Expand Down Expand Up @@ -1511,7 +1507,7 @@ public void shouldAddHookFromPathAndGetGraphHooks() throws Exception {
}

@Test
public void shouldBuildGraphFromConfigFile() throws Exception {
void shouldBuildGraphFromConfigFile() {
// Given
final StoreProperties storeProperties = new StoreProperties();
storeProperties.setStoreClass(TestStoreImpl.class.getName());
Expand Down Expand Up @@ -1541,8 +1537,7 @@ public void shouldBuildGraphFromConfigFile() throws Exception {

@Test
public void shouldBuildGraphFromConfigAndMergeConfigWithExistingConfig(@Mock final GraphLibrary library1, @Mock final GraphLibrary library2,
@Mock final GraphHook hook1, @Mock final GraphHook hook2, @Mock final GraphHook hook3)
throws Exception {
@Mock final GraphHook hook1, @Mock final GraphHook hook2, @Mock final GraphHook hook3) {
// Given
final StoreProperties storeProperties = new StoreProperties();
storeProperties.setStoreClass(TestStoreImpl.class.getName());
Expand Down Expand Up @@ -1591,8 +1586,7 @@ public void shouldBuildGraphFromConfigAndMergeConfigWithExistingConfig(@Mock fin

@Test
public void shouldBuildGraphFromConfigAndOverrideFields(@Mock final GraphLibrary library1, @Mock final GraphLibrary library2,
@Mock final GraphHook hook1, @Mock final GraphHook hook2, @Mock final GraphHook hook3)
throws Exception {
@Mock final GraphHook hook1, @Mock final GraphHook hook2, @Mock final GraphHook hook3) {
// Given
final StoreProperties storeProperties = new StoreProperties();
storeProperties.setStoreClass(TestStoreImpl.class.getName());
Expand Down Expand Up @@ -1642,7 +1636,7 @@ public void shouldBuildGraphFromConfigAndOverrideFields(@Mock final GraphLibrary
}

@Test
public void shouldReturnClonedViewFromConfig() throws Exception {
void shouldReturnClonedViewFromConfig() {
// Given
final StoreProperties storeProperties = new StoreProperties();
storeProperties.setStoreClass(TestStoreImpl.class.getName());
Expand Down Expand Up @@ -1840,8 +1834,7 @@ public void shouldCorrectlySetViewForNestedOperationChain() throws OperationExce
}

@Test
public void shouldThrowExceptionOnExecuteWithANullContext(@Mock final OperationChain opChain)
throws OperationException {
void shouldThrowExceptionOnExecuteWithANullContext(@Mock final OperationChain opChain) {
// Given
final Context context = null;

Expand All @@ -1860,8 +1853,7 @@ public void shouldThrowExceptionOnExecuteWithANullContext(@Mock final OperationC
}

@Test
public void shouldThrowExceptionOnExecuteJobWithANullContext(@Mock final OperationChain opChain)
throws OperationException {
void shouldThrowExceptionOnExecuteJobWithANullContext(@Mock final OperationChain opChain) {
// Given
final Context context = null;

Expand All @@ -1880,8 +1872,7 @@ public void shouldThrowExceptionOnExecuteJobWithANullContext(@Mock final Operati
}

@Test
public void shouldThrowExceptionOnExecuteWithANullUser(@Mock final OperationChain opChain)
throws OperationException {
void shouldThrowExceptionOnExecuteWithANullUser(@Mock final OperationChain opChain) {
// Given
final User user = null;

Expand All @@ -1900,8 +1891,7 @@ public void shouldThrowExceptionOnExecuteWithANullUser(@Mock final OperationChai
}

@Test
public void shouldThrowExceptionOnExecuteJobWithANullUser(@Mock final OperationChain opChain)
throws OperationException {
void shouldThrowExceptionOnExecuteJobWithANullUser(@Mock final OperationChain opChain) {
// Given
final User user = null;

Expand All @@ -1920,8 +1910,7 @@ public void shouldThrowExceptionOnExecuteJobWithANullUser(@Mock final OperationC
}

@Test
public void shouldThrowExceptionOnExecuteJobUsingJobWithANullContext(@Mock final OperationChain opChain)
throws OperationException {
void shouldThrowExceptionOnExecuteJobUsingJobWithANullContext(@Mock final OperationChain opChain) {
// Given
final Context context = null;

Expand All @@ -1942,7 +1931,7 @@ public void shouldThrowExceptionOnExecuteJobUsingJobWithANullContext(@Mock final
}

@Test
public void shouldThrowExceptionOnExecuteJobUsingJobWithANullOperation() throws OperationException {
void shouldThrowExceptionOnExecuteJobUsingJobWithANullOperation() {
// Given
final Context context = new Context();

Expand All @@ -1963,7 +1952,7 @@ public void shouldThrowExceptionOnExecuteJobUsingJobWithANullOperation() throws
}

@Test
public void shouldThrowExceptionOnExecuteJobUsingJobWithANullJob() throws OperationException {
void shouldThrowExceptionOnExecuteJobUsingJobWithANullJob() {
// Given
final Context context = new Context();

Expand All @@ -1984,8 +1973,7 @@ public void shouldThrowExceptionOnExecuteJobUsingJobWithANullJob() throws Operat
}

@Test
public void shouldThrowExceptionOnExecuteJobUsingJobWithANullUser(@Mock final OperationChain opChain)
throws OperationException {
void shouldThrowExceptionOnExecuteJobUsingJobWithANullUser(@Mock final OperationChain opChain) {
// Given
final User user = null;

Expand Down Expand Up @@ -2744,7 +2732,7 @@ protected OperationHandler<? extends AddElements> getAddElementsHandler() {
}

@Override
protected OperationHandler<? extends DeleteElements> getDeleteElementsHandler() {
protected OutputOperationHandler<DeleteElements, Long> getDeleteElementsHandler() {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2024 Crown Copyright
* Copyright 2016-2025 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,7 +86,7 @@ protected OperationHandler<? extends AddElements> getAddElementsHandler() {
}

@Override
protected OperationHandler<? extends DeleteElements> getDeleteElementsHandler() {
protected OutputOperationHandler<DeleteElements, Long> getDeleteElementsHandler() {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Crown Copyright
* Copyright 2017-2025 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 @@ -41,6 +41,7 @@
import uk.gov.gchq.koryphe.ValidationResult;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
Expand Down Expand Up @@ -153,6 +154,11 @@ public ValidationResult validate() {
return result;
}

@Override
public List<Operation> flatten() {
return Arrays.asList(this);
}

@JsonIgnore
public int getNumberOfGetEdgeOperations() {
return getNumberOfGetEdgeOperations(operations);
Expand All @@ -166,7 +172,7 @@ private int getNumberOfGetEdgeOperations(final Operation op) {
hops += getNumberOfGetEdgeOperations(((Operations<?>) op).getOperations());
} else if (op instanceof GetElements) {
final GetElements getElements = (GetElements) op;
if (null != getElements.getView() && getElements.getView().hasEdges()) {
if (null != getElements.getView() && (getElements.getView().hasEdges() || getElements.getView().isAllEdges())) {
hops += 1;
}
}
Expand All @@ -187,7 +193,7 @@ private int getNumberOfGetEdgeOperationsWithoutRepeats(final Operation op) {
hops += getNumberOfGetEdgeOperationsWithoutRepeats(((Operations<?>) op).getOperations());
} else if (op instanceof GetElements) {
final GetElements getElements = (GetElements) op;
if (null != getElements.getView() && getElements.getView().hasEdges()) {
if (null != getElements.getView() && (getElements.getView().hasEdges() || getElements.getView().isAllEdges())) {
hops += 1;
}
}
Expand Down
Loading
Loading