use of org.eclipse.persistence.testing.models.employee.domain.Employee in project eclipselink by eclipse-ee4j.
the class PreBeginTransactionFailureTest method test.
@Override
public void test() {
Employee emp = new Employee();
Employee empCopy = (Employee) uow.registerObject(emp);
empCopy.setFirstName("A");
try {
uow.commit();
} catch (Exception ex) {
exception = ex;
}
}
use of org.eclipse.persistence.testing.models.employee.domain.Employee in project eclipselink by eclipse-ee4j.
the class RollbackObjectsTest method test.
@Override
public void test() {
org.eclipse.persistence.sessions.Session hs = getSession().acquireHistoricalSession(pastTime);
pastObjects = hs.readAllObjects(domainClass);
// getSession().getProject().checkDatabaseForDoesExist();
Vector currentProjects = getSession().readAllObjects(Project.class);
for (Enumeration enumtr = currentProjects.elements(); enumtr.hasMoreElements(); ) {
((Project) enumtr.nextElement()).getTeamLeader();
}
UnitOfWork uow = getSession().acquireUnitOfWork();
for (Enumeration enumtr = pastObjects.elements(); enumtr.hasMoreElements(); ) {
Employee emp = (Employee) enumtr.nextElement();
emp.getProjects();
for (Enumeration proj = emp.getProjects().elements(); proj.hasMoreElements(); ) {
((Project) proj.nextElement()).getTeamLeader();
}
emp.getAddress();
}
for (Enumeration enumtr = pastObjects.elements(); enumtr.hasMoreElements(); ) {
Employee emp = (Employee) enumtr.nextElement();
uow.registerObject(emp);
}
Vector pastProjects = hs.readAllObjects(Project.class);
for (Enumeration enumtr = pastProjects.elements(); enumtr.hasMoreElements(); ) {
Project project = (Project) enumtr.nextElement();
uow.registerObject(project);
uow.deepMergeClone(project);
}
// uow.registerAllObjects(pastProjects);
// clone = uow.deepClone(obj);
// } else {
// clone = uow.deepMergeClone(obj);
// }
uow.commit();
}
use of org.eclipse.persistence.testing.models.employee.domain.Employee in project eclipselink by eclipse-ee4j.
the class GetAllFromIdentityMapTest method test.
/**
* Test case.
* Verify that {@code ConcurrentModificationException} is not thrown from {@code IdentityMapManager}
* during 2nd query execution when objects are already in the cache.
*/
@Override
public void test() throws Throwable {
Vector<Employee> employees = (Vector<Employee>) uow.executeQuery(query);
assertFalse(employees.isEmpty());
for (Employee employee : employees) {
assertEquals("Bob", employee.getManager().getFirstName());
}
}
use of org.eclipse.persistence.testing.models.employee.domain.Employee in project eclipselink by eclipse-ee4j.
the class InsertWeakIdentityMapTest method test.
@Override
public void test() {
for (int index = 0; index < (identityMapSize * 2); index++) {
Employee obj = new Employee();
InsertObjectQuery query = new InsertObjectQuery(obj);
getAbstractSession().beginTransaction();
getSession().executeQuery(query);
getAbstractSession().rollbackTransaction();
System.gc();
}
System.gc();
}
use of org.eclipse.persistence.testing.models.employee.domain.Employee in project eclipselink by eclipse-ee4j.
the class InsertOverflowTest method test.
@Override
public void test() {
for (int index = 0; index < (originalMaxSize * 10); index++) {
Employee employee = new Employee();
java.math.BigDecimal id = new java.math.BigDecimal((double) index * 101);
java.util.Vector primaryKeys = new java.util.Vector();
employee.setId(id);
employee.setFirstName("Mr. " + id);
primaryKeys.addElement(id);
cache.put(primaryKeys, employee, null, 0);
}
}
Aggregations