Search in sources :

Example 1 with TimesTenPlatform

use of org.eclipse.persistence.platform.database.TimesTenPlatform in project eclipselink by eclipse-ee4j.

the class SessionsXMLBasicTestModel method setup.

@Override
public void setup() {
    originalSession = getSession();
    if ((getSession().getPlatform() instanceof TimesTenPlatform)) {
        throw new TestProblemException("This model is not intended for TimesTen databases.");
    }
    XMLSessionConfigLoader xmlLoader = new XMLSessionConfigLoader("org/eclipse/persistence/testing/models/sessionsxml/sessions.xml");
    // Do not login here, login later on.
    newXMLSession = SessionManager.getManager().getSession(xmlLoader, "EmployeeSession", getClass().getClassLoader(), false, true);
    newXMLSession.setSessionLog(originalSession.getSessionLog());
    newXMLSession.setLogLevel(originalSession.getLogLevel());
    ((DatabaseSession) originalSession).logout();
    newXMLSession.getLogin().setPlatform(originalSession.getLogin().getPlatform());
    newXMLSession.getLogin().setDriverClassName(originalSession.getLogin().getDriverClassName());
    newXMLSession.getLogin().setConnectionString(originalSession.getLogin().getConnectionString());
    newXMLSession.getLogin().setUserName(originalSession.getLogin().getUserName());
    newXMLSession.getLogin().setEncryptedPassword(originalSession.getLogin().getPassword());
    ((DatabaseSession) newXMLSession).login();
    getExecutor().setSession(newXMLSession);
    new EmployeeSystem().createTables((DatabaseSession) newXMLSession);
    new EmployeeSystem().populate((DatabaseSession) newXMLSession);
}
Also used : DatabaseSession(org.eclipse.persistence.sessions.DatabaseSession) TimesTenPlatform(org.eclipse.persistence.platform.database.TimesTenPlatform) TestProblemException(org.eclipse.persistence.testing.framework.TestProblemException) XMLSessionConfigLoader(org.eclipse.persistence.sessions.factories.XMLSessionConfigLoader) EmployeeSystem(org.eclipse.persistence.testing.models.employee.relational.EmployeeSystem)

Aggregations

TimesTenPlatform (org.eclipse.persistence.platform.database.TimesTenPlatform)1 DatabaseSession (org.eclipse.persistence.sessions.DatabaseSession)1 XMLSessionConfigLoader (org.eclipse.persistence.sessions.factories.XMLSessionConfigLoader)1 TestProblemException (org.eclipse.persistence.testing.framework.TestProblemException)1 EmployeeSystem (org.eclipse.persistence.testing.models.employee.relational.EmployeeSystem)1