Search in sources :

Example 16 with Project

use of org.eclipse.persistence.sessions.Project in project eclipselink by eclipse-ee4j.

the class SimpleMapProject method setUp.

@BeforeClass
public static void setUp() {
    DynamicClassLoader dcl = new DynamicClassLoader(SimpleMapProject.class.getClassLoader());
    Project project = null;
    try {
        project = DynamicTypeBuilder.loadDynamicProject(PROJECT_XML, createLogin(), dcl);
    } catch (IOException e) {
        // e.printStackTrace();
        fail("cannot find simple-map-project.xml");
    }
    session = project.createDatabaseSession();
    if (SessionLog.OFF == logLevel) {
        session.dontLogMessages();
    } else {
        session.setLogLevel(logLevel);
    }
    dynamicHelper = new DynamicHelper(session);
    session.login();
    new DynamicSchemaManager(session).createTables();
}
Also used : DynamicClassLoader(org.eclipse.persistence.dynamic.DynamicClassLoader) Project(org.eclipse.persistence.sessions.Project) DynamicHelper(org.eclipse.persistence.dynamic.DynamicHelper) DynamicSchemaManager(org.eclipse.persistence.tools.schemaframework.DynamicSchemaManager) IOException(java.io.IOException) BeforeClass(org.junit.BeforeClass)

Example 17 with Project

use of org.eclipse.persistence.sessions.Project in project eclipselink by eclipse-ee4j.

the class SimpleMapProjectNoLogin method setUp.

@BeforeClass
public static void setUp() {
    DynamicClassLoader dcl = new DynamicClassLoader(SimpleMapProjectNoLogin.class.getClassLoader());
    Project project = null;
    try {
        project = DynamicTypeBuilder.loadDynamicProject(PROJECT_XML, createLogin(), dcl);
    } catch (IOException e) {
        // e.printStackTrace();
        fail("cannot find simple-map-project-no-login.xml");
    }
    session = project.createDatabaseSession();
    if (SessionLog.OFF == logLevel) {
        session.dontLogMessages();
    } else {
        session.setLogLevel(logLevel);
    }
    dynamicHelper = new DynamicHelper(session);
    session.login();
    new DynamicSchemaManager(session).createTables();
}
Also used : DynamicClassLoader(org.eclipse.persistence.dynamic.DynamicClassLoader) Project(org.eclipse.persistence.sessions.Project) DynamicHelper(org.eclipse.persistence.dynamic.DynamicHelper) DynamicSchemaManager(org.eclipse.persistence.tools.schemaframework.DynamicSchemaManager) IOException(java.io.IOException) BeforeClass(org.junit.BeforeClass)

Example 18 with Project

use of org.eclipse.persistence.sessions.Project in project eclipselink by eclipse-ee4j.

the class DynamicTestingHelper method createSession.

public static DatabaseSession createSession() {
    if (username == null) {
        fail("error retrieving database username");
    }
    if (password == null) {
        fail("error retrieving database password");
    }
    if (url == null) {
        fail("error retrieving database url");
    }
    Project project = new Project(createLogin());
    DatabaseSession session = project.createDatabaseSession();
    if (SessionLog.OFF == logLevel) {
        session.dontLogMessages();
    } else {
        session.setLogLevel(logLevel);
    }
    return session;
}
Also used : Project(org.eclipse.persistence.sessions.Project) DatabaseSession(org.eclipse.persistence.sessions.DatabaseSession)

Example 19 with Project

use of org.eclipse.persistence.sessions.Project in project eclipselink by eclipse-ee4j.

the class ClientSessionBrokerTestAdapter method setupTestSession.

@Override
public Session setupTestSession(Session oldSession) {
    DatabaseLogin login = (DatabaseLogin) oldSession.getLogin().clone();
    Project project = oldSession.getProject().clone();
    project.setLogin(login);
    this.server = new org.eclipse.persistence.testing.tests.clientserver.Server(project);
    this.server.serverSession.setLogLevel(oldSession.getLogLevel());
    this.server.serverSession.setLog(oldSession.getLog());
    this.server.login();
    this.server.copyDescriptors(oldSession);
    SessionBroker broker = new SessionBroker();
    broker.registerSession("serverSession", this.server.serverSession);
    // didn't login the broker.  Not needed and worried about why copyDescriptors above was for.
    return broker.acquireClientSessionBroker();
}
Also used : DatabaseLogin(org.eclipse.persistence.sessions.DatabaseLogin) Project(org.eclipse.persistence.sessions.Project) SessionBroker(org.eclipse.persistence.sessions.broker.SessionBroker)

Example 20 with Project

use of org.eclipse.persistence.sessions.Project in project eclipselink by eclipse-ee4j.

the class ReadOnlyClassesInSessionBrokerTest method setup.

@Override
public void setup() {
    ServerSession serverSession;
    Project project = new org.eclipse.persistence.testing.models.readonly.ReadOnlyProject();
    DatabaseLogin login = project.getLogin();
    login.usePlatform(new OraclePlatform());
    login.setDriverClassName("oracle.jdbc.OracleDriver");
    login.setConnectionString("jdbc:oracle:thin:@ottvm028.ca.oracle.com:1521:toplink");
    login.setUserName("QA6");
    login.setPassword("password");
    serverSession = (ServerSession) project.createServerSession();
    this.sessionBroker = new SessionBroker();
    this.sessionBroker.registerSession("broker1", serverSession);
    this.sessionBroker.login();
}
Also used : Project(org.eclipse.persistence.sessions.Project) DatabaseLogin(org.eclipse.persistence.sessions.DatabaseLogin) ServerSession(org.eclipse.persistence.sessions.server.ServerSession) SessionBroker(org.eclipse.persistence.sessions.broker.SessionBroker) OraclePlatform(org.eclipse.persistence.platform.database.OraclePlatform)

Aggregations

Project (org.eclipse.persistence.sessions.Project)216 StringReader (java.io.StringReader)92 ObjectPersistenceWorkbenchXMLProject (org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject)83 Test (org.junit.Test)83 XMLContext (org.eclipse.persistence.oxm.XMLContext)80 NonJDBCTestHelper.buildTestProject (org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildTestProject)60 NonJDBCTestHelper.buildWorkbenchXMLProject (org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildWorkbenchXMLProject)60 Document (org.w3c.dom.Document)53 XMLMarshaller (org.eclipse.persistence.oxm.XMLMarshaller)49 PLSQLStoredProcedureCall (org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall)37 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)30 DatabaseLogin (org.eclipse.persistence.sessions.DatabaseLogin)28 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)27 XMLLogin (org.eclipse.persistence.oxm.XMLLogin)25 SchemaModelProject (org.eclipse.persistence.internal.oxm.schema.SchemaModelProject)24 DatabaseSession (org.eclipse.persistence.sessions.DatabaseSession)23 DataModifyQuery (org.eclipse.persistence.queries.DataModifyQuery)22 Schema (org.eclipse.persistence.internal.oxm.schema.model.Schema)17 Descriptor (org.eclipse.persistence.internal.oxm.mappings.Descriptor)16 XMLUnmarshaller (org.eclipse.persistence.oxm.XMLUnmarshaller)16