Search in sources :

Example 1 with AdvancedTableCreator

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

the class BaseFetchGroupTests method testSetup.

@Test
public void testSetup() {
    ServerSession session = getServerSession("fieldaccess");
    new AdvancedTableCreator().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);
    descriptor.setShouldBeReadOnly(shouldBeReadOnly);
    clearCache("fieldaccess");
}
Also used : ServerSession(org.eclipse.persistence.sessions.server.ServerSession) AdvancedTableCreator(org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.AdvancedTableCreator) ClassDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor) EmployeePopulator(org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.EmployeePopulator) Test(org.junit.Test)

Example 2 with AdvancedTableCreator

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

the class ExtendedPersistenceContextJUnitTestSuite 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 AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
    // create a new EmployeePopulator
    EmployeePopulator employeePopulator = new EmployeePopulator();
    // Populate the tables
    employeePopulator.buildExamples();
    // Persist the examples in the database
    employeePopulator.persistExample(JUnitTestCase.getServerSession("fieldaccess"));
    clearCache("fieldaccess");
}
Also used : AdvancedTableCreator(org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.AdvancedTableCreator) EmployeePopulator(org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.EmployeePopulator)

Example 3 with AdvancedTableCreator

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

the class NamedNativeQueryJUnitTest 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 AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
    clearCache("fieldaccess");
}
Also used : AdvancedTableCreator(org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.AdvancedTableCreator)

Example 4 with AdvancedTableCreator

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

the class SessionBeanTests method testSetup.

/**
 * The setup is done as a test, both to record its failure, and to allow
 * execution in the server.
 */
public void testSetup() throws Exception {
    new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("sessionbean"));
    Employee bob = new Employee();
    bob.setFirstName("Bob");
    bob.setLastName("Jones");
    bob.setAddress(new Address());
    bob.setDepartment(new Department());
    getEmployeeService().insert(bob);
    Employee joe = new Employee();
    joe.setFirstName("Joe");
    joe.setLastName("Smith");
    joe.setAddress(new Address());
    joe.setDepartment(new Department());
    getEmployeeService().insert(joe);
}
Also used : Department(org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Department) AdvancedTableCreator(org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.AdvancedTableCreator) Employee(org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Employee) Address(org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Address)

Example 5 with AdvancedTableCreator

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

the class AdvancedJunitTest 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 AdvancedTableCreator().replaceTables(getDatabaseSession());
    clearCache();
}
Also used : AdvancedTableCreator(org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.AdvancedTableCreator)

Aggregations

AdvancedTableCreator (org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.AdvancedTableCreator)10 EmployeePopulator (org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.EmployeePopulator)5 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)2 ServerSession (org.eclipse.persistence.sessions.server.ServerSession)2 Employee (org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Employee)2 EntityManager (jakarta.persistence.EntityManager)1 Address (org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Address)1 Department (org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Department)1 Test (org.junit.Test)1