Search in sources :

Example 1 with EntityTypeRegistry

use of org.molgenis.data.postgresql.identifier.EntityTypeRegistry in project molgenis by molgenis.

the class PostgreSqlExceptionTranslatorTest method setUpBeforeMethod.

@BeforeMethod
public void setUpBeforeMethod() {
    DataSource dataSource = mock(DataSource.class);
    EntityTypeRegistry entityTypeRegistry = mock(EntityTypeRegistry.class);
    EntityTypeDescription entityTypeDescription = EntityTypeDescription.create("myEntity", ImmutableMap.<String, AttributeDescription>builder().put("myColumn", AttributeDescription.create("myAttr")).build());
    EntityTypeDescription refEntityTypeDescription = EntityTypeDescription.create("myRefEntity", ImmutableMap.<String, AttributeDescription>builder().put("myColumn", AttributeDescription.create("myAttr")).build());
    EntityTypeDescription otherRefEntityTypeDescription = EntityTypeDescription.create("myOtherRefEntity", ImmutableMap.<String, AttributeDescription>builder().put("myColumn", AttributeDescription.create("myAttr")).build());
    when(entityTypeRegistry.getEntityTypeDescription("myTable")).thenReturn(entityTypeDescription);
    when(entityTypeRegistry.getEntityTypeDescription("myDependentTable")).thenReturn(refEntityTypeDescription);
    when(entityTypeRegistry.getEntityTypeDescription("myOtherDependentTable")).thenReturn(otherRefEntityTypeDescription);
    postgreSqlExceptionTranslator = new PostgreSqlExceptionTranslator(dataSource, entityTypeRegistry);
}
Also used : EntityTypeRegistry(org.molgenis.data.postgresql.identifier.EntityTypeRegistry) EntityTypeDescription(org.molgenis.data.postgresql.identifier.EntityTypeDescription) DataSource(javax.sql.DataSource) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with EntityTypeRegistry

use of org.molgenis.data.postgresql.identifier.EntityTypeRegistry in project molgenis by molgenis.

the class PostgreSqlRepositoryCollectionDecoratorTest method setUpBeforeMethod.

@BeforeMethod
public void setUpBeforeMethod() {
    String entityTypeId = "entityTypeId";
    entityType = mock(EntityType.class);
    when(entityType.getEntityType()).thenReturn(mock(EntityType.class));
    when(entityType.getId()).thenReturn(entityTypeId);
    updatedEntityType = mock(EntityType.class);
    repoCollection = mock(RepositoryCollection.class);
    entityTypeRegistry = mock(EntityTypeRegistry.class);
    EntityTypeCopier entityTypeCopier = mock(EntityTypeCopier.class);
    when(entityTypeCopier.copy(entityType)).thenReturn(updatedEntityType);
    attributeCopier = mock(AttributeCopier.class);
    repoCollectionDecorator = new PostgreSqlRepositoryCollectionDecorator(repoCollection, entityTypeRegistry, entityTypeCopier, attributeCopier);
}
Also used : EntityType(org.molgenis.data.meta.model.EntityType) RepositoryCollection(org.molgenis.data.RepositoryCollection) EntityTypeCopier(org.molgenis.data.meta.util.EntityTypeCopier) EntityTypeRegistry(org.molgenis.data.postgresql.identifier.EntityTypeRegistry) AttributeCopier(org.molgenis.data.meta.util.AttributeCopier) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

EntityTypeRegistry (org.molgenis.data.postgresql.identifier.EntityTypeRegistry)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 DataSource (javax.sql.DataSource)1 RepositoryCollection (org.molgenis.data.RepositoryCollection)1 EntityType (org.molgenis.data.meta.model.EntityType)1 AttributeCopier (org.molgenis.data.meta.util.AttributeCopier)1 EntityTypeCopier (org.molgenis.data.meta.util.EntityTypeCopier)1 EntityTypeDescription (org.molgenis.data.postgresql.identifier.EntityTypeDescription)1