use of org.eclipse.persistence.testing.models.employee.relational.EmployeeProject in project eclipselink by eclipse-ee4j.
the class PreBeginTransactionFailureTest method setup.
@Override
public void setup() {
Project project = new EmployeeProject();
project.setLogin((DatabaseLogin) getSession().getLogin().clone());
serverSession = project.createServerSession(1, 1);
serverSession.setSessionLog(getSession().getSessionLog());
serverSession.login();
PreBeginTransactionFailureTest.SessionListener listener = new PreBeginTransactionFailureTest.SessionListener();
Session clientSession = serverSession.acquireClientSession();
clientSession.getEventManager().addListener(listener);
uow = clientSession.acquireUnitOfWork();
}
use of org.eclipse.persistence.testing.models.employee.relational.EmployeeProject in project eclipselink by eclipse-ee4j.
the class ProjectXMLDatabaseTableNameTest method test.
@Override
public void test() {
Project project1 = new EmployeeProject();
m_tableNameBeforeWrite = project1.getDescriptor(Address.class).getTableName();
DatabaseTable dbTable = project1.getDescriptor(Address.class).getTable(m_tableNameBeforeWrite);
dbTable.setName(m_tableNameBeforeWrite);
dbTable.setTableQualifier(TABLE_NAME_QUALIFIER);
// Write out the project with changes and read back in again.
XMLProjectWriter.write(TEMP_FILE, project1);
Project project2 = XMLProjectReader.read(TEMP_FILE, getClass().getClassLoader());
m_tableNameAfterWrite = project2.getDescriptor(Address.class).getTable(m_tableNameBeforeWrite).getQualifiedName();
}
use of org.eclipse.persistence.testing.models.employee.relational.EmployeeProject in project eclipselink by eclipse-ee4j.
the class QueryShouldMaintainCacheTest method setup.
@Override
public void setup() {
project = new EmployeeProject();
ClassDescriptor descriptor = project.getDescriptors().get(org.eclipse.persistence.testing.models.employee.domain.Employee.class);
descriptor.disableCacheHits();
// ReadObjectQuery query = new ReadObjectQuery(Employee.class);
// descriptor.getQueryManager().addQuery("UndefinedQuery", query);
ReadObjectQuery query = new ReadObjectQuery(Employee.class);
query.maintainCache();
descriptor.getQueryManager().addQuery("TrueQuery", query);
query = new ReadObjectQuery(Employee.class);
query.dontMaintainCache();
descriptor.getQueryManager().addQuery("FalseQuery", query);
}
use of org.eclipse.persistence.testing.models.employee.relational.EmployeeProject in project eclipselink by eclipse-ee4j.
the class RuntimeCustomSQLQueriesTest method setup.
@Override
protected void setup() {
// Modify the employee project to use custom SQL queries
EmployeeProject project = new EmployeeProject();
ClassDescriptor addressDescriptor = project.getDescriptors().get(Address.class);
addressDescriptor.getQueryManager().setInsertSQLString(INSERT_SQL);
addressDescriptor.getQueryManager().setReadObjectSQLString(READ_OBJECT_SQL);
addressDescriptor.getQueryManager().setReadAllSQLString(READ_ALL_SQL);
addressDescriptor.getQueryManager().setUpdateSQLString(UPDATE_SQL);
addressDescriptor.getQueryManager().setDeleteSQLString(DELETE_SQL);
// write project to an XMLl project file
XMLProjectWriter.write(PROJECT_FILE, project);
}
use of org.eclipse.persistence.testing.models.employee.relational.EmployeeProject in project eclipselink by eclipse-ee4j.
the class AddDescriptorsTest method reset.
@Override
public void reset() {
if (newProjectDescriptor == oldProjectDescriptor) {
// The test has failed - at least one "old" descriptor is referenced by a new descriptor.
// To ensure consistency, remove EmployeeSystem interface descriptors first,
// then add all EmployeeSystem descriptors again
Iterator<Class<?>> iterator = getSession().getDescriptors().keySet().iterator();
while (iterator.hasNext()) {
Class<?> cls = iterator.next();
String packageName = Helper.getPackageName(cls);
if (packageName.equals("org.eclipse.persistence.testing.models.employee.interfaces")) {
getSession().getDescriptors().remove(cls);
}
}
getDatabaseSession().addDescriptors(new EmployeeProject());
}
}
Aggregations