Search in sources :

Example 1 with CompositePKTableCreator

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

the class AdvancedCompositePKJunitTest method testSetup.

/**
 * The setup is done as a test, both to record its failure, and to allow execution in the server.
 */
public void testSetup() {
    new CompositePKTableCreator().replaceTables(JUnitTestCase.getServerSession());
    new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession());
    clearCache();
}
Also used : CompositePKTableCreator(org.eclipse.persistence.testing.models.jpa.advanced.compositepk.CompositePKTableCreator) AdvancedTableCreator(org.eclipse.persistence.testing.models.jpa.advanced.AdvancedTableCreator)

Example 2 with CompositePKTableCreator

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

the class AdvancedCompositePKJunitTest method testSetup.

/**
 * The setup is done as a test, both to record its failure, and to allow execution in the server.
 */
public void testSetup() {
    new CompositePKTableCreator().replaceTables(JUnitTestCase.getServerSession());
    new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession());
    clearCache();
}
Also used : CompositePKTableCreator(org.eclipse.persistence.testing.models.jpa.advanced.compositepk.CompositePKTableCreator) AdvancedTableCreator(org.eclipse.persistence.testing.models.jpa.advanced.AdvancedTableCreator)

Example 3 with CompositePKTableCreator

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

the class JUnitJPQLComplexTestSuite method testSetup.

/**
 * The setup is done as a test, both to record its failure, and to allow execution in the server.
 */
public void testSetup() {
    clearCache();
    // get session to start setup
    DatabaseSession session = JUnitTestCase.getServerSession();
    // create a new EmployeePopulator
    EmployeePopulator employeePopulator = new EmployeePopulator();
    // create a new PartnerLinkPopulator
    PartnerLinkPopulator partnerLinkPopulator = new PartnerLinkPopulator();
    new AdvancedTableCreator().replaceTables(session);
    // initialize the global comparer object
    comparer = new JUnitDomainObjectComparer();
    // set the session for the comparer to use
    comparer.setSession((AbstractSession) session.getActiveSession());
    // Populate the tables
    employeePopulator.buildExamples();
    // Persist the examples in the database
    employeePopulator.persistExample(session);
    // Populate the tables
    partnerLinkPopulator.buildExamples();
    // Persist the examples in the database
    partnerLinkPopulator.persistExample(session);
    new InheritedTableManager().replaceTables(session);
    new DataTypesTableCreator().replaceTables(session);
    // create stored function when database supports it
    if (supportsStoredFunctions()) {
        SchemaManager schema = new SchemaManager(session);
        schema.replaceObject(buildStoredFunction());
    }
    new CompositePKTableCreator().replaceTables(JUnitTestCase.getServerSession());
}
Also used : InheritedTableManager(org.eclipse.persistence.testing.models.jpa.inherited.InheritedTableManager) CompositePKTableCreator(org.eclipse.persistence.testing.models.jpa.advanced.compositepk.CompositePKTableCreator) AdvancedTableCreator(org.eclipse.persistence.testing.models.jpa.advanced.AdvancedTableCreator) EmployeePopulator(org.eclipse.persistence.testing.models.jpa.advanced.EmployeePopulator) DatabaseSession(org.eclipse.persistence.sessions.DatabaseSession) DataTypesTableCreator(org.eclipse.persistence.testing.models.jpa.datatypes.DataTypesTableCreator) SchemaManager(org.eclipse.persistence.tools.schemaframework.SchemaManager) PartnerLinkPopulator(org.eclipse.persistence.testing.models.jpa.advanced.PartnerLinkPopulator)

Example 4 with CompositePKTableCreator

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

the class JUnitJPQLComplexAggregateTestSuite method testSetup.

/**
 * The setup is done as a test, both to record its failure, and to allow execution in the server.
 */
public void testSetup() {
    clearCache();
    // get session to start setup
    DatabaseSession session = JUnitTestCase.getServerSession();
    // create a new EmployeePopulator
    EmployeePopulator employeePopulator = new EmployeePopulator();
    new AdvancedTableCreator().replaceTables(session);
    new CompositePKTableCreator().replaceTables(session);
    RelationshipsExamples relationshipExamples = new RelationshipsExamples();
    new RelationshipsTableManager().replaceTables(session);
    // initialize the global comparer object
    comparer = new JUnitDomainObjectComparer();
    // set the session for the comparer to use
    comparer.setSession((AbstractSession) session.getActiveSession());
    // Populate the tables
    employeePopulator.buildExamples();
    // Persist the examples in the database
    employeePopulator.persistExample(session);
    // populate the relationships model and persist as well
    relationshipExamples.buildExamples(session);
}
Also used : CompositePKTableCreator(org.eclipse.persistence.testing.models.jpa.advanced.compositepk.CompositePKTableCreator) RelationshipsTableManager(org.eclipse.persistence.testing.models.jpa.relationships.RelationshipsTableManager) AdvancedTableCreator(org.eclipse.persistence.testing.models.jpa.advanced.AdvancedTableCreator) RelationshipsExamples(org.eclipse.persistence.testing.models.jpa.relationships.RelationshipsExamples) EmployeePopulator(org.eclipse.persistence.testing.models.jpa.advanced.EmployeePopulator) DatabaseSession(org.eclipse.persistence.sessions.DatabaseSession)

Example 5 with CompositePKTableCreator

use of org.eclipse.persistence.testing.models.jpa.advanced.compositepk.CompositePKTableCreator 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

AdvancedTableCreator (org.eclipse.persistence.testing.models.jpa.advanced.AdvancedTableCreator)5 CompositePKTableCreator (org.eclipse.persistence.testing.models.jpa.advanced.compositepk.CompositePKTableCreator)5 EmployeePopulator (org.eclipse.persistence.testing.models.jpa.advanced.EmployeePopulator)3 DatabaseSession (org.eclipse.persistence.sessions.DatabaseSession)2 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)1 ServerSession (org.eclipse.persistence.sessions.server.ServerSession)1 PartnerLinkPopulator (org.eclipse.persistence.testing.models.jpa.advanced.PartnerLinkPopulator)1 CompositePKPopulator (org.eclipse.persistence.testing.models.jpa.advanced.compositepk.CompositePKPopulator)1 DataTypesTableCreator (org.eclipse.persistence.testing.models.jpa.datatypes.DataTypesTableCreator)1 InheritedTableManager (org.eclipse.persistence.testing.models.jpa.inherited.InheritedTableManager)1 RelationshipsExamples (org.eclipse.persistence.testing.models.jpa.relationships.RelationshipsExamples)1 RelationshipsTableManager (org.eclipse.persistence.testing.models.jpa.relationships.RelationshipsTableManager)1 SchemaManager (org.eclipse.persistence.tools.schemaframework.SchemaManager)1 Test (org.junit.Test)1