-
Notifications
You must be signed in to change notification settings - Fork 1
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
disable auto case indexation #39
Conversation
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
decb125
to
4fb0ead
Compare
fde5d71
to
dff6051
Compare
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
00c954d
to
571a851
Compare
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
LOGGER.debug("importCase request received with file = {}", file.getName()); | ||
UUID caseUuid = caseService.importCase(file, withExpiration); | ||
UUID caseUuid = caseService.importCase(file, withExpiration, indexed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename by withIndexation
But in database leave indexed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -17,4 +18,8 @@ | |||
@Repository | |||
public interface CaseMetadataRepository extends JpaRepository<CaseMetadataEntity, UUID> { | |||
|
|||
@Override | |||
List<CaseMetadataEntity> findAllById(Iterable<UUID> uuids); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
return nbIndexesToDelete; | ||
} | ||
|
||
public long getIndexedCaseElementsCount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove elements
-> getIndexedCasesCount
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -165,9 +166,10 @@ public ResponseEntity<UUID> importCase(@RequestParam("file") MultipartFile file, | |||
@ApiResponse(responseCode = "500", description = "An error occurred during the case file duplication")}) | |||
public ResponseEntity<UUID> duplicateCase( | |||
@RequestParam("duplicateFrom") UUID caseId, | |||
@RequestParam(value = "withExpiration", required = false, defaultValue = "false") boolean withExpiration) { | |||
@RequestParam(value = "withExpiration", required = false, defaultValue = "false") boolean withExpiration, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove paramter
Do indexation if the origin case is indexed only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -273,6 +284,12 @@ public void disableCaseExpiration(UUID caseUuid) { | |||
caseMetadataEntity.setExpirationDate(null); | |||
} | |||
|
|||
@Transactional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@RunWith(SpringRunner.class) | ||
@AutoConfigureMockMvc | ||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, properties = {"case-store-directory=/cases"}) | ||
@ContextConfigurationWithTestChannel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RunWith(SpringRunner.class) | |
@AutoConfigureMockMvc | |
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, properties = {"case-store-directory=/cases"}) | |
@ContextConfigurationWithTestChannel | |
@RunWith(SpringRunner.class) | |
@AutoConfigureMockMvc | |
@SpringBootTest | |
@ContextConfiguration(classes = {CaseApplication.class}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done partially , the tests does not pass without properties = {"case-store-directory=/cases"}
private FileSystem fileSystem; | ||
|
||
@Test | ||
public void testGetElementInfosCount() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ranma element by case anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
@Test | ||
public void testDeleteElementInfos() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename by testReindexAll
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Assert.assertEquals(2, supervisionService.getIndexedCaseElementsCount()); | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a test for index name ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
fileSystem = Jimfs.newFileSystem(Configuration.unix()); | ||
caseService.setFileSystem(fileSystem); | ||
caseService.setComputationManager(Mockito.mock(ComputationManager.class)); | ||
cleanDB(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move cleanDB in the tearDown
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
@@ -238,7 +236,10 @@ UUID duplicateCase(UUID sourceCaseUuid, boolean withExpiration) { | |||
CaseInfos existingCaseInfos = caseInfosService.getCaseInfosByUuid(sourceCaseUuid.toString()).orElseThrow(); | |||
CaseInfos caseInfos = createInfos(existingCaseInfos.getName(), newCaseUuid, existingCaseInfos.getFormat()); | |||
caseInfosService.addCaseInfos(caseInfos); | |||
createCaseMetadataEntity(newCaseUuid, withExpiration); | |||
|
|||
Optional<CaseMetadataEntity> existingCase = caseMetadataRepository.findById(sourceCaseUuid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throws NO_FOUND
exception like disableCaseExpiration
Remove any reference of the word |
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Quality Gate passedIssues Measures |
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
this PR disable auto indexation of the cases, and intreduce a new param "indexed" to indicate wich cases should be indexed by
/v1/supervision/case/reindex
This also PR create a supervision service to delete elk documents and reindex cases.
What is the current behavior?
when a case is created or duplication , this service index it automatically
What is the new behavior (if this is a feature change)?
cases are indexed on demand
Does this PR introduce a breaking change or deprecate an API?
If yes, please check if the following requirements are fulfilled
What changes might users need to make in their application due to this PR? (migration steps)
The endpoint for reindexing all cases has been renamed from
/v1/cases/index-all
to/v1/supervision/cases/reindex
.Any client applications or scripts that previously called the
/v1/cases/index-all
endpoint will need to be updated to use the new/v1/supervision/cases/reindex
endpoint.The database schema has also been changed to add a new column "indexed" , the values of this collumn will be set to false by default.
Other information:
To test this PR :
/v1/supervision/cases/reindex
to recreate the index ( you should have no cases indexed , all of them are marked indexed=false by default)PUT /cases/{caseUuid}/indexation