use of org.molgenis.api.metadata.v3.job.MetadataDeleteJobExecution in project molgenis by molgenis.
the class MetadataApiControllerTest method testDeleteEntityTypes.
@Test
void testDeleteEntityTypes() {
Query query = Query.create("id", IN, asList("MyEntityTypeId0", "MyEntityTypeId1"));
DeleteEntityTypesRequest deleteEntityTypesRequest = new DeleteEntityTypesRequest();
deleteEntityTypesRequest.setQ(query);
MetadataDeleteJobExecution jobExecution = mockDeleteJobExecution();
when(metadataApiService.deleteEntityTypesAsync(query)).thenReturn(jobExecution);
metadataApiController.deleteEntityTypes(deleteEntityTypesRequest);
verify(metadataApiService).deleteEntityTypesAsync(query);
}
use of org.molgenis.api.metadata.v3.job.MetadataDeleteJobExecution in project molgenis by molgenis.
the class MetadataApiControllerTest method mockDeleteJobExecution.
private static MetadataDeleteJobExecution mockDeleteJobExecution() {
EntityType entityType = mock(EntityType.class);
MetadataDeleteJobExecution jobExecution = mock(MetadataDeleteJobExecution.class);
when(jobExecution.getEntityType()).thenReturn(entityType);
return jobExecution;
}
use of org.molgenis.api.metadata.v3.job.MetadataDeleteJobExecution in project molgenis by molgenis.
the class MetadataApiJobServiceImplTest method testScheduleDelete.
@Test
void testScheduleDelete() {
EntityType entityType = mock(EntityType.class);
when(entityType.getId()).thenReturn("entity1");
MetadataDeleteJobExecution jobExecution = mock(MetadataDeleteJobExecution.class);
when(metadataDeleteJobExecutionFactory.create()).thenReturn(jobExecution);
MetadataDeleteJobExecution actualJobExecution = metadataApiJobService.scheduleDelete(entityType);
assertAll(() -> assertEquals(jobExecution, actualJobExecution), () -> verify(jobExecution).setIds(singletonList("entity1")), () -> verify(jobExecutor).submit(jobExecution));
}
use of org.molgenis.api.metadata.v3.job.MetadataDeleteJobExecution in project molgenis by molgenis.
the class MetadataApiControllerTest method testDeleteEntityType.
@Test
void testDeleteEntityType() {
String entityTypeId = "MyEntityTypeId";
MetadataDeleteJobExecution jobExecution = mockDeleteJobExecution();
when(metadataApiService.deleteEntityTypeAsync(entityTypeId)).thenReturn(jobExecution);
metadataApiController.deleteEntityType(entityTypeId);
verify(metadataApiService).deleteEntityTypeAsync(entityTypeId);
}
use of org.molgenis.api.metadata.v3.job.MetadataDeleteJobExecution in project molgenis by molgenis.
the class MetadataApiJobServiceImplTest method testScheduleDeleteCollection.
@Test
void testScheduleDeleteCollection() {
EntityType entityType1 = mock(EntityType.class);
when(entityType1.getId()).thenReturn("entity1");
EntityType entityType2 = mock(EntityType.class);
when(entityType2.getId()).thenReturn("entity2");
MetadataDeleteJobExecution jobExecution = mock(MetadataDeleteJobExecution.class);
when(metadataDeleteJobExecutionFactory.create()).thenReturn(jobExecution);
MetadataDeleteJobExecution actualJobExecution = metadataApiJobService.scheduleDelete(asList(entityType1, entityType2));
assertAll(() -> assertEquals(jobExecution, actualJobExecution), () -> verify(jobExecution).setIds(asList("entity1", "entity2")), () -> verify(jobExecutor).submit(jobExecution));
}
Aggregations