Skip to content

Commit

Permalink
fix test and copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
cn337131 committed Jan 7, 2025
1 parent 779e53f commit 3249ebb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
15 changes: 4 additions & 11 deletions core/store/src/test/java/uk/gov/gchq/gaffer/store/StoreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static uk.gov.gchq.gaffer.jobtracker.JobTracker.JOB_TRACKER_CACHE_SERVICE_NAME;
import static uk.gov.gchq.gaffer.store.StoreTrait.INGEST_AGGREGATION;
import static uk.gov.gchq.gaffer.store.StoreTrait.ORDERED;
Expand Down Expand Up @@ -257,29 +258,21 @@ public void after() {
}

@Test
public void shouldExecuteOperationWhenJobTrackerCacheIsBroken(@Mock final StoreProperties storeProperties) throws Exception {
public void shouldNotCreateJobWhenExecutingOperation(@Mock final StoreProperties storeProperties) throws Exception {
// Given
ICache<Object, Object> mockICache = Mockito.mock(ICache.class);
doThrow(new CacheOperationException("Stubbed class")).when(mockICache).put(any(), any());
ICacheService mockICacheService = Mockito.spy(ICacheService.class);
given(mockICacheService.getCache(any())).willReturn(mockICache);

Field field = CacheServiceLoader.class.getDeclaredField("SERVICES");
field.setAccessible(true);
java.util.Map<String, ICacheService> mockCacheServices = (java.util.Map<String, ICacheService>) field.get(new HashMap<>());
mockCacheServices.put(JOB_TRACKER_CACHE_SERVICE_NAME, mockICacheService);

final AddElements addElements = new AddElements();
final StoreImpl3 store = new StoreImpl3();
store.initialise("graphId", createSchemaMock(), storeProperties);

// When
store.executeJob(addElements, context);
store.execute(addElements, context);

// Then
verify(addElementsHandler).doOperation(addElements, context, store);
verify(mockICacheService, Mockito.atLeast(1)).getCache(any());
verify(mockICache, Mockito.atLeast(1)).put(any(), any());
verifyNoInteractions(mockICacheService, mockICache);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
public class OperationServiceV2IT extends OperationServiceIT {

@Test
void shouldReturnNotJobIdHeader() throws IOException {
void shouldNotReturnJobIdHeader() throws IOException {
// When
final Response response = client.executeOperation(new GetAllElements());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2024 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 Down

0 comments on commit 3249ebb

Please sign in to comment.