コード例 #1
0
 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();
 }
コード例 #2
0
 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() {
         public void preMergeUnitOfWorkChangeSet(SessionEvent event) {
           sentChanges = true;
         }
       };
   server.getDistributedSession().getEventManager().addListener(this.listener);
   this.sentChanges = false;
 }
コード例 #3
0
  public void addTests() {
    super.addTests();
    PopulationManager manager = PopulationManager.getDefaultManager();
    Employee employee = (Employee) manager.getObject(Employee.class, "0001");

    Hashtable configurationHashtable = new Hashtable();
    configurationHashtable.put(
        Employee.class, new Integer(ClassDescriptor.INVALIDATE_CHANGED_OBJECTS));
    ConfigurableUpdateChangeObjectTest test =
        new ConfigurableUpdateChangeObjectTest(employee, configurationHashtable);
    test.setName("Update Change Employee - Invalidate Employee");
    test.setDescription("Test the invalidation setting on cache synchronization for Employee");
    addTest(test);

    configurationHashtable = new Hashtable();
    configurationHashtable.put(
        PhoneNumber.class, new Integer(ClassDescriptor.INVALIDATE_CHANGED_OBJECTS));
    configurationHashtable.put(
        Employee.class, new Integer(ClassDescriptor.INVALIDATE_CHANGED_OBJECTS));
    test = new ConfigurableUpdateChangeObjectTest(employee, configurationHashtable);
    test.setName("Update Change Employee - Invalidate Employee, Phone Number");
    test.setDescription("Test the invalidation setting on cache synchronization for Phone Number");
    addTest(test);

    addTest(new SendNewObjectCacheSyncTest(true));
    addTest(new SendNewObjectCacheSyncTest(false));
    addTest(new RelatedNewObjectCacheSyncTest());
    addTest(new MultipleCacheSyncTypeTest());
    addTest(new RelatedNewObjectNotSentTest());
    addTest(new DeleteObjectNotSentTest());
    addTest(new ChangeObjectNotSentTest());
    // Add the 2 tests below to verify bug 4194320
    // addTest(new InvalidCacheSyncTypeTest(-1));
    // addTest(new InvalidCacheSyncTypeTest(5));
    addTest(new IsolatedObjectNotSentTest());

    configurationHashtable = new Hashtable();
    configurationHashtable.put(
        IsolatedEmployee.class, new Integer(ClassDescriptor.SEND_OBJECT_CHANGES));
    IsolatedObjectNotSentTest atest = new IsolatedObjectNotSentTest(configurationHashtable);
    atest.setName("IsolatedObjectNotSentTest - SEND_OBJECT_CHANGES");
    addTest(atest);

    configurationHashtable = new Hashtable();
    configurationHashtable.put(
        IsolatedEmployee.class, new Integer(ClassDescriptor.INVALIDATE_CHANGED_OBJECTS));
    atest = new IsolatedObjectNotSentTest(configurationHashtable);
    atest.setName("IsolatedObjectNotSentTest - INVALIDATE_CHANGED_OBJECTS");
    addTest(atest);

    configurationHashtable = new Hashtable();
    configurationHashtable.put(
        IsolatedEmployee.class, new Integer(ClassDescriptor.SEND_NEW_OBJECTS_WITH_CHANGES));
    atest = new IsolatedObjectNotSentTest(configurationHashtable);
    atest.setName("IsolatedObjectNotSentTest - SEND_NEW_OBJECTS_WITH_CHANGES");
    addTest(atest);

    configurationHashtable = new Hashtable();
    configurationHashtable.put(
        IsolatedEmployee.class, new Integer(ClassDescriptor.DO_NOT_SEND_CHANGES));
    atest = new IsolatedObjectNotSentTest(configurationHashtable);
    atest.setName("IsolatedObjectNotSentTest - DO_NOT_SEND_CHANGES");
    addTest(atest);

    addTest(new InvalidateObjectWithMissingReferenceTest());
    addTest(new UpdateObjectInvalidationTest());
    addTest(new NativeUpdateObjectInvalidationTest());
    addTest(new NewObjectWithOptimisticLockingTest());
    addTest(new OrderedListNewObjectTest());
  }
コード例 #4
0
 public void addRequiredSystems() {
   super.addRequiredSystems();
   addRequiredSystem(new IsolatedSessionSystem());
   addRequiredSystem(new OptimisticLockingSystem());
 }
コード例 #5
0
 public void reset() {
   super.reset();
   DistributedServer server =
       (DistributedServer) DistributedServersModel.getDistributedServers().get(0);
   server.getDistributedSession().getEventManager().removeListener(this.listener);
 }