use of org.eclipse.persistence.sessions.broker.SessionBroker in project eclipselink by eclipse-ee4j.
the class ExternalTransactionControllerInitializationTest method test.
@Override
public void test() {
broker = new SessionBroker();
CustomServerPlatform platform = new CustomServerPlatform(broker);
platform.setExternalTransactionControllerClass(JTATransactionController.class);
broker.setServerPlatform(platform);
broker.setSessionLog(getSession().getSessionLog());
broker.login();
}
use of org.eclipse.persistence.sessions.broker.SessionBroker in project eclipselink by eclipse-ee4j.
the class MultipleClientBrokersTestModel method createTables.
/**
* This method was created in VisualAge.
*/
public void createTables() {
SessionBroker broker = new SessionBroker();
DatabaseSession session1 = new DatabaseSessionImpl(Server.getLogin1());
DatabaseSession session2 = new DatabaseSessionImpl(Server.getLogin2());
session1.addDescriptors(new EmployeeProject1());
session2.addDescriptors(new EmployeeProject2());
broker.registerSession("broker1", session1);
broker.registerSession("broker2", session2);
broker.setLogLevel(getSession().getLogLevel());
broker.setLog(getSession().getLog());
broker.login();
// Set session for join table.
((ManyToManyMapping) session1.getDescriptor(Employee.class).getObjectBuilder().getMappingForAttributeName("projects")).setSessionName("broker2");
// Disable delete verify.
((OneToOneMapping) session1.getDescriptor(Employee.class).getObjectBuilder().getMappingForAttributeName("address")).setShouldVerifyDelete(false);
org.eclipse.persistence.testing.models.employee.relational.EmployeeTableCreator tables = new org.eclipse.persistence.testing.models.employee.relational.EmployeeTableCreator();
tables.replaceTables(session1);
tables.replaceTables(session2);
tables.dropConstraints(session1);
tables.dropConstraints(session2);
new org.eclipse.persistence.tools.schemaframework.SchemaManager(session1).createSequences();
new org.eclipse.persistence.tools.schemaframework.SchemaManager(session2).createSequences();
new EmployeeSystem().populate(broker);
broker.logout();
}
use of org.eclipse.persistence.sessions.broker.SessionBroker 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();
}
use of org.eclipse.persistence.sessions.broker.SessionBroker in project eclipselink by eclipse-ee4j.
the class ServerBrokerTestModel method buildBroker.
/**
* Build the session broker, this assume two data-sources Broker1 and Broker2 (JConnect).
*/
public SessionBroker buildBroker() {
createTables();
SessionBroker broker = new SessionBroker();
addQuery1(broker);
addQuery2(broker);
ServerSession ssession1 = new ServerSession(getLogin1());
ServerSession ssession2 = new ServerSession(getLogin2());
ssession1.addDescriptors(new EmployeeProject1());
ssession2.addDescriptors(new EmployeeProject2());
broker.registerSession("broker1", ssession1);
broker.registerSession("broker2", ssession2);
broker.setLog(oldSession.getLog());
broker.setLogLevel(oldSession.getLogLevel());
broker.login();
// Set session for join table.
((ManyToManyMapping) ssession1.getDescriptor(Employee.class).getObjectBuilder().getMappingForAttributeName("projects")).setSessionName("broker2");
// Disable delete verify.
((OneToOneMapping) ssession1.getDescriptor(Employee.class).getObjectBuilder().getMappingForAttributeName("address")).setShouldVerifyDelete(false);
SessionBroker clientBroker = broker.acquireClientSessionBroker();
new org.eclipse.persistence.testing.models.employee.relational.EmployeeSystem().populate(clientBroker);
return clientBroker;
}
use of org.eclipse.persistence.sessions.broker.SessionBroker in project eclipselink by eclipse-ee4j.
the class ServerBrokerTestModel method createTables.
/**
* Create the tables on both databases.
*/
public void createTables() {
SessionBroker broker = new SessionBroker();
DatabaseSession session1 = new DatabaseSessionImpl(getLogin1());
DatabaseSession session2 = new DatabaseSessionImpl(getLogin2());
session1.addDescriptors(new EmployeeProject1());
session2.addDescriptors(new EmployeeProject2());
broker.registerSession("broker1", session1);
broker.registerSession("broker2", session2);
broker.setLog(oldSession.getLog());
broker.setLogLevel(oldSession.getLogLevel());
broker.login();
org.eclipse.persistence.testing.models.employee.relational.EmployeeTableCreator tables = new org.eclipse.persistence.testing.models.employee.relational.EmployeeTableCreator();
tables.replaceTables(session1);
tables.replaceTables(session2);
tables.dropConstraints(session1);
tables.dropConstraints(session2);
new SchemaManager(session1).createSequences();
new SchemaManager(session2).createSequences();
broker.logout();
}
Aggregations