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);
}
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);
}
Aggregations