예제 #1
0
 public void testDescendSmaller() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(STHashtableT.class);
   Query qElements = q.descend("col");
   qElements.constrain(new Integer(3)).smaller();
   st.expect(q, new Object[] {r[2], r[3]});
 }
예제 #2
0
 public void testNotGreaterGreater() {
   Query q = st.query();
   q.constrain(new STOrU());
   Query sub = q.descend("orInt");
   (sub.constrain(new Integer(30000)).greater().or(sub.constrain(new Integer(5)).greater())).not();
   Object[] r = store();
   st.expect(q, new Object[] {r[0], r[1]});
 }
예제 #3
0
 public void testDescendNotSmaller() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(STArrIntegerON.class);
   Query qElements = q.descend("intArr");
   qElements.constrain(new Integer(3)).smaller();
   st.expect(q, new Object[] {r[2], r[3]});
 }
  public void testDescendNotSmaller() {
    Query q = newQuery();

    q.constrain(STArrIntegerWTONTestCase.class);
    Query qElements = q.descend("intArr");
    qElements.constrain(new Integer(3)).smaller();
    expect(q, new int[] {2, 3});
  }
예제 #5
0
 public void _test() throws Exception {
   Query query = newQuery();
   query.constrain(new TestEvaluation());
   query.constrain(Item.class);
   query.descend("name").orderDescending();
   ObjectSet set = query.execute();
   Assert.areEqual(3, set.size());
 }
  public void testDescendSmaller() {
    Query q = newQuery();

    q.constrain(STHashSetUTestCase.class);
    Query qElements = q.descend("col");
    qElements.constrain(new Integer(3)).smaller();
    expect(q, new int[] {2, 3});
  }
예제 #7
0
 public void testGreaterEquals() {
   Query q = st.query();
   q.constrain(new STOrU());
   Query sub = q.descend("orInt");
   sub.constrain(new Integer(1000)).greater().or(sub.constrain(new Integer(0)));
   Object[] r = store();
   st.expect(q, new Object[] {r[0], r[3], r[4]});
 }
예제 #8
0
 public void testDescendTwo() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(STHashtableT.class);
   Query qElements = q.descend("col");
   qElements.constrain(new Integer(17));
   qElements.constrain(new Integer(25));
   st.expect(q, new Object[] {r[4]});
 }
예제 #9
0
  public void testGreaterAndNot() {
    Query q = newQuery();
    q.constrain(new STDoubleTestCase());
    Query val = q.descend("i_double");
    val.constrain(new Double(0)).greater();
    val.constrain(new Double(99.99)).not();

    expect(q, new int[] {2, 4});
  }
  public void testDescendTwo() {
    Query q = newQuery();

    q.constrain(STHashSetUTestCase.class);
    Query qElements = q.descend("col");
    qElements.constrain(new Integer(17));
    qElements.constrain(new Integer(25));
    expect(q, new int[] {4});
  }
예제 #11
0
 public void testLike() {
   Query q = st.query();
   q.constrain(new STInteger(90));
   q.descend("i_int").constraints().like();
   st.expectOne(q, new STInteger(909));
   q = st.query();
   q.constrain(new STInteger(10));
   q.descend("i_int").constraints().like();
   st.expectNone(q);
 }
예제 #12
0
 public void testIdentity() {
   Query q = st.query();
   q.constrain(new STInteger(1));
   ObjectSet set = q.execute();
   STInteger identityConstraint = (STInteger) set.next();
   identityConstraint.i_int = 9999;
   q = st.query();
   q.constrain(identityConstraint).identity();
   identityConstraint.i_int = 1;
   st.expectOne(q, store()[1]);
 }
  public void conc(ExtObjectContainer oc) {
    Query q = oc.query();
    q.constrain(QueryForUnknownFieldTestCase.class);
    q.descend("_name").constrain("name");
    Assert.areEqual(1, q.execute().size());

    q = oc.query();
    q.constrain(QueryForUnknownFieldTestCase.class);
    q.descend("name").constrain("name");
    Assert.areEqual(0, q.execute().size());
  }
예제 #14
0
 public void testSequentialAddition() {
   Query q = st.query();
   store();
   q.constrain(new STRUH1());
   Query cur = q.descend("h2");
   cur.constrain(new STRUH2());
   cur.descend("foo2").constrain("str2");
   cur = cur.descend("h3");
   cur.constrain(new STRUH3());
   cur.descend("foo3").constrain("str3");
   st.expectOne(q, store()[5]);
 }
예제 #15
0
 public void testNotIdentity() {
   Query q = st.query();
   q.constrain(new STInteger(1));
   ObjectSet set = q.execute();
   STInteger identityConstraint = (STInteger) set.next();
   identityConstraint.i_int = 9080;
   q = st.query();
   q.constrain(identityConstraint).identity().not();
   identityConstraint.i_int = 1;
   Object[] r = store();
   st.expect(q, new Object[] {r[0], r[2], r[3]});
 }
예제 #16
0
 public void test() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(new Helper("aaa"));
   ObjectSet os = q.execute();
   Helper helperA = (Helper) os.next();
   q = st.query();
   q.constrain(STIdentityEvaluation.class);
   q.descend("helper").constrain(helperA).identity();
   q.constrain(new IncludeAllEvaluation());
   st.expect(q, new Object[] {r[1], r[2], r[3]});
 }
예제 #17
0
 @SuppressWarnings("unchecked")
 private ObjectSet executeSODAQuery(final A a, Evaluation e) {
   Query q = db().query();
   q.constrain(e);
   ObjectSet set = q.execute();
   return set;
 }
예제 #18
0
 public void testDescendToObject() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(new STHashtableT());
   q.descend("col").descend("foo1").constrain("bar");
   st.expect(q, new Object[] {r[5], r[6]});
 }
예제 #19
0
 public void testDescendantDescendantNotNull() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(new STRUH1());
   q.descend("h2").descend("h3").constrain(null).not();
   st.expect(q, new Object[] {r[4], r[5]});
 }
예제 #20
0
 public void testDescendOne() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(STOwnCollectionW.class);
   q.descend("col").constrain(new Integer(17));
   st.expect(q, new Object[] {r[3], r[4]});
 }
 public long size(ObjectContainer container) {
   Query query = container.query();
   query.constrain(PersistentCooldownQueueItem.class);
   query.descend("parent").constrain(this).identity();
   ObjectSet<PersistentCooldownQueueItem> results = query.execute();
   return results.size();
 }
 private Item itemByName(String string) {
   Query q = db().query();
   q.constrain(Item.class);
   q.descend("_name").constrain(string);
   Object object = q.execute().next();
   return (Item) object;
 }
예제 #23
0
  public void handleRevisions(
      EClass eClass,
      CDOBranch branch,
      long timeStamp,
      boolean exactTime,
      CDORevisionHandler handler) {
    Query query = getObjectContainer().query();
    query.constrain(DB4ORevision.class);
    if (eClass != null) {
      query
          .descend(DB4ORevision.ATTRIBUTE_PACKAGE_NS_URI)
          .constrain(eClass.getEPackage().getNsURI());
      query.descend(DB4ORevision.ATTRIBUTE_CLASS_NAME).constrain(eClass.getName());
    }

    ObjectSet<?> revisions = query.execute();
    if (revisions.isEmpty()) {
      return;
    }

    for (Object revision : revisions.toArray()) {
      CDORevision cdoRevision = DB4ORevision.getCDORevision(getStore(), (DB4ORevision) revision);
      handler.handleRevision(cdoRevision);
    }
  }
예제 #24
0
 public void testNotLike() {
   Query q = st.query();
   q.constrain(new STInteger(1));
   q.descend("i_int").constraints().like().not();
   Object[] r = store();
   st.expect(q, new Object[] {r[0], r[2], r[3]});
 }
예제 #25
0
  // FIXME
  public void _testDescendOne() {
    Query q = newQuery();

    q.constrain(STVectorEU.class);
    q.descend("col").constrain(new Integer(17));
    expect(q, new int[] {0});
  }
예제 #26
0
 public void testNotContains() {
   Query q = st.query();
   q.constrain(new STInteger(0));
   q.descend("i_int").constrain(new Integer(0)).contains().not();
   Object[] r = store();
   st.expect(q, new Object[] {r[1], r[2]});
 }
  @SuppressWarnings("unchecked")
  private void garbageCollectIdentities() {
    final MessageManager messageManager = mFreetalk.getMessageManager();
    final PersistentTaskManager taskManager = mFreetalk.getTaskManager();

    synchronized (this) {
      if (mIdentityFetchInProgress
          || mOwnIdentityFetchInProgress
          || mLastIdentityFetchTime == 0
          || mLastOwnIdentityFetchTime == 0) return;

      /* Executing the thread loop once will always take longer than THREAD_PERIOD. Therefore, if we set the limit to 3*THREAD_PERIOD,
       * it will hit identities which were last received before more than 2*THREAD_LOOP, not exactly 3*THREAD_LOOP. */
      long lastAcceptTime =
          Math.min(mLastIdentityFetchTime, mLastOwnIdentityFetchTime) - GARBAGE_COLLECT_DELAY;
      lastAcceptTime =
          Math.max(
              lastAcceptTime,
              0); // This is not really needed but a time less than 0 does not make sense.;

      Query q = db.query();
      q.constrain(WoTIdentity.class);
      q.descend("mLastReceivedFromWoT").constrain(lastAcceptTime).smaller();
      ObjectSet<WoTIdentity> result = q.execute();

      for (WoTIdentity identity : result) {
        identity.initializeTransient(mFreetalk);
        Logger.debug(this, "Garbage collecting identity " + identity);
        deleteIdentity(identity, messageManager, taskManager);
      }

      if (mShortestUniqueNicknameCacheNeedsUpdate) updateShortestUniqueNicknameCache();
    }
  }
예제 #28
0
 public void testNotEquals() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(r[0]);
   q.descend("i_int").constrain(new Integer(0)).not();
   st.expect(q, new Object[] {r[1], r[2], r[3]});
 }
예제 #29
0
 public void testDescendOne() {
   Query q = st.query();
   Object[] r = store();
   q.constrain(STVectorEU.class);
   q.descend("col").constrain(new Integer(17));
   st.expect(q, new Object[] {r[0]});
 }
예제 #30
0
 public void testGreater() {
   Query q = st.query();
   q.constrain(new STInteger(9));
   q.descend("i_int").constraints().greater();
   Object[] r = store();
   st.expect(q, new Object[] {r[2], r[3]});
 }