Search in sources :

Example 1 with CompositePKPopulator

use of org.eclipse.persistence.testing.models.jpa.advanced.compositepk.CompositePKPopulator in project eclipselink by eclipse-ee4j.

the class BaseFetchGroupTests method testSetup.

@Test
public void testSetup() {
    ServerSession session = getServerSession();
    new AdvancedTableCreator().replaceTables(session);
    // requires another package
    new CompositePKTableCreator().replaceTables(session);
    // Force uppercase for Postgres.
    if (session.getPlatform().isPostgreSQL()) {
        session.getLogin().setShouldForceFieldNamesToUpperCase(true);
    }
    // The EquipmentCode class 'should' be set to read only. We want
    // to be able to create a couple in the Employee populator, so
    // force the read only to false. If EquipmentCode is not
    // actually read only, don't worry, we set the original read
    // only value back on the descriptor and the error will be
    // caught in a later test in this suite.
    ClassDescriptor descriptor = session.getDescriptor(EquipmentCode.class);
    boolean shouldBeReadOnly = descriptor.shouldBeReadOnly();
    descriptor.setShouldBeReadOnly(false);
    // Populate the database with our examples.
    EmployeePopulator employeePopulator = new EmployeePopulator();
    employeePopulator.buildExamples();
    employeePopulator.persistExample(session);
    CompositePKPopulator compositePKPopulator = new CompositePKPopulator();
    compositePKPopulator.buildExamples();
    compositePKPopulator.persistExample(session);
    descriptor.setShouldBeReadOnly(shouldBeReadOnly);
    clearCache();
}
Also used : CompositePKTableCreator(org.eclipse.persistence.testing.models.jpa.advanced.compositepk.CompositePKTableCreator) ServerSession(org.eclipse.persistence.sessions.server.ServerSession) AdvancedTableCreator(org.eclipse.persistence.testing.models.jpa.advanced.AdvancedTableCreator) ClassDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor) EmployeePopulator(org.eclipse.persistence.testing.models.jpa.advanced.EmployeePopulator) CompositePKPopulator(org.eclipse.persistence.testing.models.jpa.advanced.compositepk.CompositePKPopulator) Test(org.junit.Test)

Aggregations

ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)1 ServerSession (org.eclipse.persistence.sessions.server.ServerSession)1 AdvancedTableCreator (org.eclipse.persistence.testing.models.jpa.advanced.AdvancedTableCreator)1 EmployeePopulator (org.eclipse.persistence.testing.models.jpa.advanced.EmployeePopulator)1 CompositePKPopulator (org.eclipse.persistence.testing.models.jpa.advanced.compositepk.CompositePKPopulator)1 CompositePKTableCreator (org.eclipse.persistence.testing.models.jpa.advanced.compositepk.CompositePKTableCreator)1 Test (org.junit.Test)1