Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit 48747a8

Browse files
authored
Merge release into master branch (#3371)
2 parents 31abc0e + d7b1b59 commit 48747a8

File tree

71 files changed

+1809
-798
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1809
-798
lines changed

NOTICES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ and their licenses, below. For information on the dependencies of these dependen
2121
projects below.
2222

2323

24-
Koryphe (uk.gov.gchq.koryphe:koryphe:2.5.2):
24+
Koryphe (uk.gov.gchq.koryphe:koryphe:2.6.0):
2525

2626
- Apache License, Version 2.0
2727

core/access/src/main/java/uk/gov/gchq/gaffer/access/predicate/user/NoAccessUserPredicate.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 Crown Copyright
2+
* Copyright 2020-2025 Crown Copyright
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,9 +21,11 @@
2121
import uk.gov.gchq.koryphe.Summary;
2222
import uk.gov.gchq.koryphe.predicate.KoryphePredicate;
2323

24+
import java.io.Serializable;
25+
2426
@Since("1.13.1")
2527
@Summary("Predicate which never allows user access")
26-
public class NoAccessUserPredicate extends KoryphePredicate<User> {
28+
public class NoAccessUserPredicate extends KoryphePredicate<User> implements Serializable {
2729
@Override
2830
public boolean test(final User user) {
2931
return false;

core/access/src/main/java/uk/gov/gchq/gaffer/access/predicate/user/UnrestrictedAccessUserPredicate.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 Crown Copyright
2+
* Copyright 2020-2025 Crown Copyright
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,16 +13,19 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package uk.gov.gchq.gaffer.access.predicate.user;
1718

1819
import uk.gov.gchq.gaffer.user.User;
1920
import uk.gov.gchq.koryphe.Since;
2021
import uk.gov.gchq.koryphe.Summary;
2122
import uk.gov.gchq.koryphe.predicate.KoryphePredicate;
2223

24+
import java.io.Serializable;
25+
2326
@Since("1.13.1")
2427
@Summary("A predicate which always allows a user access")
25-
public class UnrestrictedAccessUserPredicate extends KoryphePredicate<User> {
28+
public class UnrestrictedAccessUserPredicate extends KoryphePredicate<User> implements Serializable {
2629
@Override
2730
public boolean test(final User user) {
2831
return true;

core/common-util/src/main/java/uk/gov/gchq/gaffer/commonutil/otel/OtelUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Crown Copyright
2+
* Copyright 2024-2025 Crown Copyright
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ public final class OtelUtil {
2525
public static final String JOB_ID_ATTRIBUTE = "gaffer.jobId";
2626
public static final String GRAPH_ID_ATTRIBUTE = "gaffer.graphId";
2727
public static final String VIEW_ATTRIBUTE = "gaffer.view";
28+
public static final String OP_OPTIONS_ATTRIBUTE = "gaffer.operation.options";
2829
public static final String GREMLIN_QUERY_ATTRIBUTE = "gaffer.gremlin.query";
2930

3031
private static boolean openTelemetryActive = false;

core/graph/src/main/java/uk/gov/gchq/gaffer/graph/Graph.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2024 Crown Copyright
2+
* Copyright 2017-2025 Crown Copyright
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -320,10 +320,11 @@ private <O> GraphResult<O> _execute(final StoreExecuter<O> storeExecuter, final
320320
// OpenTelemetry hooks
321321
Span span = OtelUtil.startSpan(
322322
this.getClass().getName(),
323-
"Graph Request: " + clonedOpChain.toOverviewString());
323+
"Graph Request: " + clonedContext.getJobId());
324324
span.setAttribute(OtelUtil.GRAPH_ID_ATTRIBUTE, getGraphId());
325325
span.setAttribute(OtelUtil.JOB_ID_ATTRIBUTE, clonedContext.getJobId());
326326
span.setAttribute(OtelUtil.USER_ATTRIBUTE, clonedContext.getUser().getUserId());
327+
span.setAttribute(OtelUtil.OP_OPTIONS_ATTRIBUTE, clonedOpChain.getOptions().toString());
327328

328329
O result = null;
329330
// Sets the span to current so parent child spans are auto linked

core/graph/src/test/java/uk/gov/gchq/gaffer/graph/GraphTest.java

Lines changed: 33 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 Crown Copyright
2+
* Copyright 2016-2025 Crown Copyright
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -342,7 +342,7 @@ public void shouldCreateNewContextInstanceWhenExecuteOperation(@Mock final Store
342342

343343
@Test
344344
public void shouldCreateNewContextInstanceWhenExecuteOutputOperation(@Mock final Store store)
345-
throws OperationException, IOException {
345+
throws OperationException {
346346
// Given
347347
final Schema schema = new Schema();
348348
given(store.getProperties()).willReturn(new StoreProperties());
@@ -365,7 +365,7 @@ public void shouldCreateNewContextInstanceWhenExecuteOutputOperation(@Mock final
365365

366366
@Test
367367
public void shouldCreateNewContextInstanceWhenExecuteJob(@Mock final Store store)
368-
throws OperationException, IOException {
368+
throws OperationException {
369369
// Given
370370
final Schema schema = new Schema();
371371
given(store.getProperties()).willReturn(new StoreProperties());
@@ -1065,7 +1065,7 @@ public void shouldNotSetGraphViewOnOperationWhenOperationIsNotAGet(@Mock final S
10651065
}
10661066

10671067
@Test
1068-
public void shouldThrowExceptionIfStoreClassPropertyIsNotSet() throws OperationException {
1068+
public void shouldThrowExceptionIfStoreClassPropertyIsNotSet() {
10691069
try {
10701070
new Graph.Builder()
10711071
.config(new GraphConfig.Builder()
@@ -1097,15 +1097,10 @@ public void shouldThrowExceptionIfGraphIdIsMissing() {
10971097
}
10981098

10991099
@Test
1100-
public void shouldThrowExceptionIfSchemaIsInvalid() throws OperationException {
1100+
public void shouldThrowExceptionIfSchemaIsInvalid() {
11011101
final StoreProperties storeProperties = new StoreProperties();
11021102
storeProperties.setStoreClass(TestStoreImpl.class.getName());
1103-
try {
1104-
new Graph.Builder()
1105-
.config(new GraphConfig.Builder()
1106-
.graphId(GRAPH_ID)
1107-
.build())
1108-
.addSchema(new Schema.Builder()
1103+
final Schema invalidSchema = new Schema.Builder()
11091104
.type("int", new TypeDefinition.Builder()
11101105
.clazz(Integer.class)
11111106
.aggregateFunction(new Sum())
@@ -1126,13 +1121,17 @@ public void shouldThrowExceptionIfSchemaIsInvalid() throws OperationException {
11261121
.vertex("string")
11271122
.property("p2", "int")
11281123
.build())
1129-
.build())
1124+
.build();
1125+
final GraphConfig config = new GraphConfig.Builder()
1126+
.graphId(GRAPH_ID)
1127+
.build();
1128+
assertThatExceptionOfType(SchemaException.class)
1129+
.isThrownBy(() -> new Graph.Builder()
1130+
.config(config)
1131+
.addSchema(invalidSchema)
11301132
.storeProperties(storeProperties)
1131-
.build();
1132-
fail("exception expected");
1133-
} catch (final SchemaException e) {
1134-
assertNotNull(e.getMessage());
1135-
}
1133+
.build())
1134+
.withMessageContaining("Schema is not valid");
11361135
}
11371136

11381137
@Test
@@ -1254,7 +1253,7 @@ private void writeToFile(final String schemaFile, final File dir) throws IOExcep
12541253
}
12551254

12561255
@Test
1257-
public void shouldThrowExceptionIfGraphIdIsInvalid(@Mock final StoreProperties properties) throws Exception {
1256+
void shouldThrowExceptionIfGraphIdIsInvalid(@Mock final StoreProperties properties) {
12581257
try {
12591258
new Graph.Builder()
12601259
.config(new GraphConfig.Builder()
@@ -1355,8 +1354,7 @@ public void shouldBuildGraphUsingGraphIdAndLookupSchema() throws Exception {
13551354

13561355
@Test
13571356
public void shouldAddHooksVarArgsAndGetGraphHooks(@Mock final GraphHook graphHook1,
1358-
@Mock final Log4jLogger graphHook2)
1359-
throws Exception {
1357+
@Mock final Log4jLogger graphHook2) {
13601358
// Given
13611359
final StoreProperties storeProperties = new StoreProperties();
13621360
storeProperties.setStoreClass(TestStoreImpl.class.getName());
@@ -1382,8 +1380,7 @@ public void shouldAddHooksVarArgsAndGetGraphHooks(@Mock final GraphHook graphHoo
13821380

13831381
@Test
13841382
public void shouldAddHookAndGetGraphHooks(@Mock final GraphHook graphHook1,
1385-
@Mock final Log4jLogger graphHook3)
1386-
throws Exception {
1383+
@Mock final Log4jLogger graphHook3) {
13871384
// Given
13881385
final StoreProperties storeProperties = new StoreProperties();
13891386
storeProperties.setStoreClass(TestStore.class.getName());
@@ -1417,8 +1414,7 @@ public void shouldAddHookAndGetGraphHooks(@Mock final GraphHook graphHook1,
14171414

14181415
@Test
14191416
public void shouldAddNamedViewResolverHookAfterNamedOperationResolver(@Mock final GraphHook graphHook1,
1420-
@Mock final Log4jLogger graphHook2)
1421-
throws Exception {
1417+
@Mock final Log4jLogger graphHook2) {
14221418
// Given
14231419
final StoreProperties storeProperties = new StoreProperties();
14241420
storeProperties.setStoreClass(TestStore.class.getName());
@@ -1511,7 +1507,7 @@ public void shouldAddHookFromPathAndGetGraphHooks() throws Exception {
15111507
}
15121508

15131509
@Test
1514-
public void shouldBuildGraphFromConfigFile() throws Exception {
1510+
void shouldBuildGraphFromConfigFile() {
15151511
// Given
15161512
final StoreProperties storeProperties = new StoreProperties();
15171513
storeProperties.setStoreClass(TestStoreImpl.class.getName());
@@ -1541,8 +1537,7 @@ public void shouldBuildGraphFromConfigFile() throws Exception {
15411537

15421538
@Test
15431539
public void shouldBuildGraphFromConfigAndMergeConfigWithExistingConfig(@Mock final GraphLibrary library1, @Mock final GraphLibrary library2,
1544-
@Mock final GraphHook hook1, @Mock final GraphHook hook2, @Mock final GraphHook hook3)
1545-
throws Exception {
1540+
@Mock final GraphHook hook1, @Mock final GraphHook hook2, @Mock final GraphHook hook3) {
15461541
// Given
15471542
final StoreProperties storeProperties = new StoreProperties();
15481543
storeProperties.setStoreClass(TestStoreImpl.class.getName());
@@ -1591,8 +1586,7 @@ public void shouldBuildGraphFromConfigAndMergeConfigWithExistingConfig(@Mock fin
15911586

15921587
@Test
15931588
public void shouldBuildGraphFromConfigAndOverrideFields(@Mock final GraphLibrary library1, @Mock final GraphLibrary library2,
1594-
@Mock final GraphHook hook1, @Mock final GraphHook hook2, @Mock final GraphHook hook3)
1595-
throws Exception {
1589+
@Mock final GraphHook hook1, @Mock final GraphHook hook2, @Mock final GraphHook hook3) {
15961590
// Given
15971591
final StoreProperties storeProperties = new StoreProperties();
15981592
storeProperties.setStoreClass(TestStoreImpl.class.getName());
@@ -1642,7 +1636,7 @@ public void shouldBuildGraphFromConfigAndOverrideFields(@Mock final GraphLibrary
16421636
}
16431637

16441638
@Test
1645-
public void shouldReturnClonedViewFromConfig() throws Exception {
1639+
void shouldReturnClonedViewFromConfig() {
16461640
// Given
16471641
final StoreProperties storeProperties = new StoreProperties();
16481642
storeProperties.setStoreClass(TestStoreImpl.class.getName());
@@ -1840,8 +1834,7 @@ public void shouldCorrectlySetViewForNestedOperationChain() throws OperationExce
18401834
}
18411835

18421836
@Test
1843-
public void shouldThrowExceptionOnExecuteWithANullContext(@Mock final OperationChain opChain)
1844-
throws OperationException {
1837+
void shouldThrowExceptionOnExecuteWithANullContext(@Mock final OperationChain opChain) {
18451838
// Given
18461839
final Context context = null;
18471840

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

18621855
@Test
1863-
public void shouldThrowExceptionOnExecuteJobWithANullContext(@Mock final OperationChain opChain)
1864-
throws OperationException {
1856+
void shouldThrowExceptionOnExecuteJobWithANullContext(@Mock final OperationChain opChain) {
18651857
// Given
18661858
final Context context = null;
18671859

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

18821874
@Test
1883-
public void shouldThrowExceptionOnExecuteWithANullUser(@Mock final OperationChain opChain)
1884-
throws OperationException {
1875+
void shouldThrowExceptionOnExecuteWithANullUser(@Mock final OperationChain opChain) {
18851876
// Given
18861877
final User user = null;
18871878

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

19021893
@Test
1903-
public void shouldThrowExceptionOnExecuteJobWithANullUser(@Mock final OperationChain opChain)
1904-
throws OperationException {
1894+
void shouldThrowExceptionOnExecuteJobWithANullUser(@Mock final OperationChain opChain) {
19051895
// Given
19061896
final User user = null;
19071897

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

19221912
@Test
1923-
public void shouldThrowExceptionOnExecuteJobUsingJobWithANullContext(@Mock final OperationChain opChain)
1924-
throws OperationException {
1913+
void shouldThrowExceptionOnExecuteJobUsingJobWithANullContext(@Mock final OperationChain opChain) {
19251914
// Given
19261915
final Context context = null;
19271916

@@ -1942,7 +1931,7 @@ public void shouldThrowExceptionOnExecuteJobUsingJobWithANullContext(@Mock final
19421931
}
19431932

19441933
@Test
1945-
public void shouldThrowExceptionOnExecuteJobUsingJobWithANullOperation() throws OperationException {
1934+
void shouldThrowExceptionOnExecuteJobUsingJobWithANullOperation() {
19461935
// Given
19471936
final Context context = new Context();
19481937

@@ -1963,7 +1952,7 @@ public void shouldThrowExceptionOnExecuteJobUsingJobWithANullOperation() throws
19631952
}
19641953

19651954
@Test
1966-
public void shouldThrowExceptionOnExecuteJobUsingJobWithANullJob() throws OperationException {
1955+
void shouldThrowExceptionOnExecuteJobUsingJobWithANullJob() {
19671956
// Given
19681957
final Context context = new Context();
19691958

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

19861975
@Test
1987-
public void shouldThrowExceptionOnExecuteJobUsingJobWithANullUser(@Mock final OperationChain opChain)
1988-
throws OperationException {
1976+
void shouldThrowExceptionOnExecuteJobUsingJobWithANullUser(@Mock final OperationChain opChain) {
19891977
// Given
19901978
final User user = null;
19911979

@@ -2744,7 +2732,7 @@ protected OperationHandler<? extends AddElements> getAddElementsHandler() {
27442732
}
27452733

27462734
@Override
2747-
protected OperationHandler<? extends DeleteElements> getDeleteElementsHandler() {
2735+
protected OutputOperationHandler<DeleteElements, Long> getDeleteElementsHandler() {
27482736
return null;
27492737
}
27502738

core/graph/src/test/java/uk/gov/gchq/gaffer/integration/store/TestStore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 Crown Copyright
2+
* Copyright 2016-2025 Crown Copyright
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -86,7 +86,7 @@ protected OperationHandler<? extends AddElements> getAddElementsHandler() {
8686
}
8787

8888
@Override
89-
protected OperationHandler<? extends DeleteElements> getDeleteElementsHandler() {
89+
protected OutputOperationHandler<DeleteElements, Long> getDeleteElementsHandler() {
9090
return null;
9191
}
9292

core/operation/src/main/java/uk/gov/gchq/gaffer/operation/impl/GetWalks.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 Crown Copyright
2+
* Copyright 2017-2025 Crown Copyright
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,6 +41,7 @@
4141
import uk.gov.gchq.koryphe.ValidationResult;
4242

4343
import java.util.ArrayList;
44+
import java.util.Arrays;
4445
import java.util.List;
4546
import java.util.Map;
4647
import java.util.function.Predicate;
@@ -153,6 +154,11 @@ public ValidationResult validate() {
153154
return result;
154155
}
155156

157+
@Override
158+
public List<Operation> flatten() {
159+
return Arrays.asList(this);
160+
}
161+
156162
@JsonIgnore
157163
public int getNumberOfGetEdgeOperations() {
158164
return getNumberOfGetEdgeOperations(operations);
@@ -166,7 +172,7 @@ private int getNumberOfGetEdgeOperations(final Operation op) {
166172
hops += getNumberOfGetEdgeOperations(((Operations<?>) op).getOperations());
167173
} else if (op instanceof GetElements) {
168174
final GetElements getElements = (GetElements) op;
169-
if (null != getElements.getView() && getElements.getView().hasEdges()) {
175+
if (null != getElements.getView() && (getElements.getView().hasEdges() || getElements.getView().isAllEdges())) {
170176
hops += 1;
171177
}
172178
}
@@ -187,7 +193,7 @@ private int getNumberOfGetEdgeOperationsWithoutRepeats(final Operation op) {
187193
hops += getNumberOfGetEdgeOperationsWithoutRepeats(((Operations<?>) op).getOperations());
188194
} else if (op instanceof GetElements) {
189195
final GetElements getElements = (GetElements) op;
190-
if (null != getElements.getView() && getElements.getView().hasEdges()) {
196+
if (null != getElements.getView() && (getElements.getView().hasEdges() || getElements.getView().isAllEdges())) {
191197
hops += 1;
192198
}
193199
}

0 commit comments

Comments
 (0)