use of org.eclipse.persistence.testing.tests.distributedservers.DistributedServer in project eclipselink by eclipse-ee4j.
the class DeleteObjectNotSentTest method setup.
@Override
public void setup() {
super.setup();
// Create an Employee
employee = new Employee();
employee.setFirstName("Dean");
employee.setLastName("Keaton");
UnitOfWork uow = getSession().acquireUnitOfWork();
uow.registerObject(employee);
uow.commit();
// Ensure the employee exists in the Distributed Session
ExpressionBuilder employees = new ExpressionBuilder();
expression = employees.get("firstName").equal("Dean");
expression = expression.and(employees.get("lastName").equal("Keaton"));
// ensure our employee is in one of the distributed caches
DistributedServer server = (DistributedServer) DistributedServersModel.getDistributedServers().get(0);
Object result = server.getDistributedSession().readObject(Employee.class, expression);
}
use of org.eclipse.persistence.testing.tests.distributedservers.DistributedServer in project eclipselink by eclipse-ee4j.
the class IsolatedObjectNotSentTest method setup.
@Override
public void setup() {
super.setup();
ExpressionBuilder employees = new ExpressionBuilder();
this.expression = employees.get("firstName").equal("Andy");
this.expression = this.expression.and(employees.get("lastName").equal("McDurmont"));
// ensure our employee is in one of the distributed caches
DistributedServer server = (DistributedServer) DistributedServersModel.getDistributedServers().get(0);
this.distributedEmployee = (IsolatedEmployee) server.getDistributedSession().readObject(IsolatedEmployee.class, this.expression);
this.listener = new SessionEventAdapter() {
@Override
public void preMergeUnitOfWorkChangeSet(SessionEvent event) {
sentChanges = true;
}
};
server.getDistributedSession().getEventManager().addListener(this.listener);
this.sentChanges = false;
}
use of org.eclipse.persistence.testing.tests.distributedservers.DistributedServer in project eclipselink by eclipse-ee4j.
the class IsolatedObjectNotSentTest method reset.
@Override
public void reset() {
super.reset();
DistributedServer server = (DistributedServer) DistributedServersModel.getDistributedServers().get(0);
server.getDistributedSession().getEventManager().removeListener(this.listener);
}
use of org.eclipse.persistence.testing.tests.distributedservers.DistributedServer in project eclipselink by eclipse-ee4j.
the class NewObjectWithOptimisticLockingTest method test.
@Override
public void test() {
DistributedServer server = (DistributedServer) DistributedServersModel.getDistributedServers().get(0);
UnitOfWork uow = server.getDistributedSession().acquireUnitOfWork();
holder = (ListHolder) uow.readObject(ListHolder.class);
ListItem item = new ListItem();
item.setDescription("test2");
item = (ListItem) uow.registerObject(item);
holder.getItems().add(item);
uow.commit();
}
use of org.eclipse.persistence.testing.tests.distributedservers.DistributedServer in project eclipselink by eclipse-ee4j.
the class RelatedNewObjectCacheSyncTest method setup.
@Override
public void setup() {
super.setup();
ExpressionBuilder employees = new ExpressionBuilder();
expression = employees.get("firstName").equal("Charles");
expression = expression.and(employees.get("lastName").equal("Chanley"));
// ensure our employee is in one of the distributed caches
DistributedServer server = (DistributedServer) DistributedServersModel.getDistributedServers().get(0);
Object result = server.getDistributedSession().readObject(Employee.class, expression);
((Employee) result).getManagedEmployees();
((Employee) result).getPhoneNumbers();
((Employee) result).getAddress();
((Employee) result).getManager();
((Employee) result).getProjects();
((Employee) result).getResponsibilitiesList();
}
Aggregations