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(); }
public void verify() { if (getObjectFromDistributedCache(manager) == null) { throw new TestErrorException( "New employee was not added to distributed cache with " + " SEND_NEW_OBJECTS_WITH_CHANGES descriptor CacheSynchronizationTypeSetting."); } Employee distributedEmployee = (Employee) getObjectFromDistributedCache(employee); Employee distributedManager = (Employee) getObjectFromDistributedCache(manager); if (!(distributedEmployee.getSalary() == employee.getSalary())) { throw new TestErrorException( "Changes for existing employee were not sent to the " + "distributed cache."); } if (!((AbstractSession) getSession()) .compareObjects(distributedEmployee.getManager(), manager)) { throw new TestErrorException( "Relationship between employee and manager was not " + "properly maintained in distributed cache."); } }
protected void changeObject() { Employee employee = (Employee) this.workingCopy; // Direct to field employee.setFirstName(new String(employee.getFirstName().getBytes())); // Object type employee.setGender(new String(employee.getGender().getBytes())); // Transformation employee.setNormalHours(employee.getNormalHours().clone()); // Aggregate employee.setPeriod( new EmploymentPeriod( employee.getPeriod().getStartDate(), employee.getPeriod().getEndDate())); // One to many private/public employee.setPhoneNumbers((Vector) employee.getPhoneNumbers().clone()); employee.setProjects((Vector) employee.getProjects().clone()); employee.setManagedEmployees((Vector) employee.getManagedEmployees().clone()); // Direct collection employee.setResponsibilitiesList((Vector) employee.getResponsibilitiesList().clone()); // One to one private/public employee.getAddress(); employee.getManager(); }