Package com.orientechnologies.orient.core.index

Examples of com.orientechnologies.orient.core.index.OCompositeKey


    doc.save();

    final OIndex<?> index = database.getMetadata().getIndexManager().getIndex("classIndexManagerTestIndexValueAndCollection");
    Assert.assertEquals(index.getSize(), 2);

    Assert.assertEquals(index.get(new OCompositeKey("test1", 1)), doc.getIdentity());
    Assert.assertEquals(index.get(new OCompositeKey("test1", 2)), doc.getIdentity());

    doc.delete();

    Assert.assertEquals(index.getSize(), 0);
  }
View Full Code Here


    doc.field("prop1", "test2");

    doc.save();

    Assert.assertEquals(index.get(new OCompositeKey("test2", 1)), doc.getIdentity());
    Assert.assertEquals(index.get(new OCompositeKey("test2", 2)), doc.getIdentity());

    Assert.assertEquals(index.getSize(), 2);

    doc.delete();
View Full Code Here

    doc.field("prop2", Arrays.asList(1, 3));

    doc.save();

    Assert.assertEquals(index.get(new OCompositeKey("test1", 1)), doc.getIdentity());
    Assert.assertEquals(index.get(new OCompositeKey("test1", 3)), doc.getIdentity());

    Assert.assertEquals(index.getSize(), 2);

    doc.delete();
View Full Code Here

    docList.remove(0);

    doc.save();

    Assert.assertEquals(index.get(new OCompositeKey("test1", 2)), doc.getIdentity());
    Assert.assertEquals(index.get(new OCompositeKey("test1", 3)), doc.getIdentity());
    Assert.assertEquals(index.get(new OCompositeKey("test1", 4)), doc.getIdentity());
    Assert.assertEquals(index.get(new OCompositeKey("test1", 5)), doc.getIdentity());

    Assert.assertEquals(index.getSize(), 4);

    doc.delete();
View Full Code Here

  @BeforeMethod
  public void beforeMethod() {
    for (double i = 1; i < 4; i++) {
      for (double j = 1; j < 10; j++) {
        final OCompositeKey compositeKey = new OCompositeKey();
        compositeKey.addKey(i);
        compositeKey.addKey(j);
        localSBTree.put(compositeKey, new ORecordId((int) i, new OClusterPositionLong((long) (j))));
      }
    }
  }
View Full Code Here

        assertTrue(orids.contains(new ORecordId(i, new OClusterPositionLong((j)))));
      }
  }

  private OCompositeKey compositeKey(Comparable<?>... params) {
    return new OCompositeKey(Arrays.asList(params));
  }
View Full Code Here

  }

  public void testEmbeddedObjectSerialization() {
    final ODocument originalDoc = new ODocument();

    final OCompositeKey compositeKey = new OCompositeKey(123, "56", new Date(), new ORecordId("#0:12"));
    originalDoc.field("compositeKey", compositeKey);
    originalDoc.field("int", 12);
    originalDoc.field("val""test");
    originalDoc.save();

    final ODocument loadedDoc = database.load(originalDoc.getIdentity(), "*:-1", true);
    Assert.assertNotSame(loadedDoc, originalDoc);

    final OCompositeKey loadedCompositeKey = loadedDoc.field("compositeKey");
    Assert.assertEquals(loadedCompositeKey, compositeKey);

    originalDoc.delete();
  }
View Full Code Here

  }

  public void testEmbeddedObjectSerializationInsideOfOtherEmbeddedObjects() {
    final ODocument originalDoc = new ODocument();

    final OCompositeKey compositeKeyOne = new OCompositeKey(123, "56", new Date(), new ORecordId("#0:12"));
    final OCompositeKey compositeKeyTwo = new OCompositeKey(245, "63", new Date(System.currentTimeMillis() +   100), new ORecordId("#0:2"));
    final OCompositeKey compositeKeyThree = new OCompositeKey(36, "563", new Date(System.currentTimeMillis() +   1000), new ORecordId("#0:23"));

    final ODocument embeddedDocOne = new ODocument();
    embeddedDocOne.field("compositeKey", compositeKeyOne);
    embeddedDocOne.field("val", "test");
    embeddedDocOne.field("int", 10);
View Full Code Here

    doc2.field("byteArrayKey", key2);
    doc2.field("intKey", 2);
    doc2.save();

    OIndex<?> index = database.getMetadata().getIndexManager().getIndex("compositeByteArrayKey");
    Assert.assertEquals(index.get(new OCompositeKey(key1, 1)), doc1);
    Assert.assertEquals(index.get(new OCompositeKey(key2, 2)), doc2);
  }
View Full Code Here

    doc2.field("intKey", 2);
    doc2.save();
    database.commit();

    OIndex<?> index = database.getMetadata().getIndexManager().getIndex("compositeByteArrayKey");
    Assert.assertEquals(index.get(new OCompositeKey(key1, 1)), doc1);
    Assert.assertEquals(index.get(new OCompositeKey(key2, 2)), doc2);
  }
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.index.OCompositeKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.