Search in sources :

Example 11 with MetadataUpsertJobExecution

use of org.molgenis.api.metadata.v3.job.MetadataUpsertJobExecution in project molgenis by molgenis.

the class MetadataApiJobServiceImplTest method testScheduleUpdate.

@Test
void testScheduleUpdate() {
    EntityType entityType = mock(EntityType.class);
    MetadataUpsertJobExecution jobExecution = mock(MetadataUpsertJobExecution.class);
    when(metadataUpsertJobExecutionFactory.create()).thenReturn(jobExecution);
    when(entityTypeSerializer.serializeEntityType(entityType)).thenReturn("entity data");
    MetadataUpsertJobExecution actualJobExecution = metadataApiJobService.scheduleUpdate(entityType);
    assertAll(() -> assertEquals(jobExecution, actualJobExecution), () -> verify(jobExecution).setAction(Action.UPDATE), () -> verify(jobExecution).setEntityTypeData("entity data"), () -> verify(jobExecutor).submit(jobExecution));
}
Also used : EntityType(org.molgenis.data.meta.model.EntityType) MetadataUpsertJobExecution(org.molgenis.api.metadata.v3.job.MetadataUpsertJobExecution) Test(org.junit.jupiter.api.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Example 12 with MetadataUpsertJobExecution

use of org.molgenis.api.metadata.v3.job.MetadataUpsertJobExecution in project molgenis by molgenis.

the class MetadataApiServiceImplTest method testUpdateEntityTypeAsync.

@Test
void testUpdateEntityTypeAsync() {
    EntityType entityType = mock(EntityType.class);
    MetadataUpsertJobExecution metadataUpsertJobExecution = mock(MetadataUpsertJobExecution.class);
    when(metadataApiJobService.scheduleUpdate(entityType)).thenReturn(metadataUpsertJobExecution);
    assertEquals(metadataUpsertJobExecution, metadataApiService.updateEntityTypeAsync(entityType));
}
Also used : EntityType(org.molgenis.data.meta.model.EntityType) MetadataUpsertJobExecution(org.molgenis.api.metadata.v3.job.MetadataUpsertJobExecution) Test(org.junit.jupiter.api.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Aggregations

MetadataUpsertJobExecution (org.molgenis.api.metadata.v3.job.MetadataUpsertJobExecution)11 Test (org.junit.jupiter.api.Test)9 EntityType (org.molgenis.data.meta.model.EntityType)9 AbstractMockitoTest (org.molgenis.test.AbstractMockitoTest)9 URI (java.net.URI)4 Attribute (org.molgenis.data.meta.model.Attribute)3 CreateAttributeRequest (org.molgenis.api.metadata.v3.model.CreateAttributeRequest)2 Objects.requireNonNull (java.util.Objects.requireNonNull)1 Action (org.molgenis.api.metadata.v3.job.MetadataUpsertJobExecutionMetadata.Action)1 CreateEntityTypeRequest (org.molgenis.api.metadata.v3.model.CreateEntityTypeRequest)1 DeleteAttributesRequest (org.molgenis.api.metadata.v3.model.DeleteAttributesRequest)1 Query (org.molgenis.api.model.Query)1 MetaDataService (org.molgenis.data.meta.MetaDataService)1 Job (org.molgenis.jobs.Job)1 JobFactory (org.molgenis.jobs.JobFactory)1 UnexpectedEnumException (org.molgenis.util.UnexpectedEnumException)1 Bean (org.springframework.context.annotation.Bean)1 Configuration (org.springframework.context.annotation.Configuration)1