Esempio n. 1
0
 public void test() {
   ObjectContainer oc = Test.objectContainer();
   ObjectSet objectSet = oc.queryByExample(new CallbackCanDelete("p1", null));
   CallbackCanDelete ccd = (CallbackCanDelete) objectSet.next();
   oc.deactivate(ccd, Integer.MAX_VALUE);
   oc.delete(ccd);
 }
Esempio n. 2
0
 public void testOne() {
   ExtObjectContainer oc = Test.objectContainer();
   StoredClass sc = oc.storedClass(this);
   StoredField[] sf = sc.getStoredFields();
   boolean[] cases = new boolean[3];
   for (int i = 0; i < sf.length; i++) {
     StoredField f = sf[i];
     if (f.getName().equals("foo")) {
       Test.ensure(f.get(this).equals("foo"));
       Test.ensure(f.getStoredType().getName().equals(String.class.getName()));
       cases[0] = true;
     }
     if (f.getName().equals("bar")) {
       Test.ensure(f.get(this).equals(new Integer(10)));
       Test.ensure(f.getStoredType().getName().equals(int.class.getName()));
       cases[1] = true;
     }
     if (f.getName().equals("atoms")) {
       Test.ensure(f.getStoredType().getName().equals(Atom.class.getName()));
       Test.ensure(f.isArray());
       Atom[] at = (Atom[]) f.get(this);
       Test.ensure(at[0].name.equals("one"));
       Test.ensure(at[1].name.equals("two"));
       cases[2] = true;
     }
   }
   for (int i = 0; i < cases.length; i++) {
     Test.ensure(cases[i]);
   }
 }
Esempio n. 3
0
  public void test() {

    ObjectContainer con = Test.objectContainer();
    Test.deleteAllInstances(this);

    IsStored isStored = new IsStored();
    isStored.myString = "isStored";
    con.store(isStored);
    Test.ensure(con.ext().isStored(isStored));
    Test.ensure(Test.occurrences(this) == 1);
    con.delete(isStored);
    Test.ensure(!con.ext().isStored(isStored));
    Test.ensure(Test.occurrences(this) == 0);
    con.commit();
    if (con.ext().isStored(isStored)) {

      // this will fail in CS due to locally cached references
      if (!Test.clientServer) {
        Test.error();
      }
    }
    Test.ensure(Test.occurrences(this) == 0);
    con.store(isStored);
    Test.ensure(con.ext().isStored(isStored));
    Test.ensure(Test.occurrences(this) == 1);
    con.commit();
    Test.ensure(con.ext().isStored(isStored));
    Test.ensure(Test.occurrences(this) == 1);
    con.delete(isStored);
    Test.ensure(!con.ext().isStored(isStored));
    Test.ensure(Test.occurrences(this) == 0);
    con.commit();
    if (con.ext().isStored(isStored)) {

      // this will fail in CS due to locally cached references
      if (!Test.clientServer) {
        Test.error();
      }
    }
    Test.ensure(Test.occurrences(this) == 0);
  }
 public void store() {
   Test.objectContainer().store(new Bar(0));
   Test.objectContainer().store(new Bar(1));
   Test.objectContainer().store(new Baz("A"));
 }