Search in sources :

Example 1 with IntHashMap

use of jetbrains.exodus.core.dataStructures.hash.IntHashMap in project xodus by JetBrains.

the class HumanReadablePresentationTests method test1.

@SuppressWarnings({ "HardcodedLineSeparator", "OverlyCoupledMethod" })
public void test1() {
    assertEquals(EntityIterableType.values().length, EntityIterableBase.children.length);
    assertEquals(EntityIterableType.values().length, EntityIterableBase.fields.length);
    final PersistentStoreTransaction txn = getStoreTransaction();
    assertNotNull(txn);
    checkIterable(new AddNullDecoratorIterable(txn, new PropertyRangeIterable(txn, 0, 1, "minValue", "maxValue"), EntityIterableBase.EMPTY), "Left operand appended with null if it's present in the right, but not left one\n" + "|   Entities with a property value in range 0 1 minvalue maxvalue\n" + "|   Empty iterable");
    checkIterable(new UnionIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY), "Union\n" + "|   Empty iterable\n" + "|   Empty iterable");
    checkIterable(new MinusIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY), "Minus\n" + "|   Empty iterable\n" + "|   Empty iterable");
    checkIterable(new IntersectionIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY), "Intersection\n" + "|   Empty iterable\n" + "|   Empty iterable");
    checkIterable(new ConcatenationIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY), "Concatenation\n" + "|   Empty iterable\n" + "|   Empty iterable");
    checkIterable(new PropertiesIterable(txn, 0, 1), "Entities with property sorted by its value 0 1");
    checkIterable(new PropertyValueIterable(txn, 0, 1, "value"), "Entities with specified property value 0 1 value");
    checkIterable(new PropertyContainsValueEntityIterable(txn, 0, 1, "sub", true), "Entities with string property containing a value 0 1 sub true");
    checkIterable(new EntitiesOfTypeIterable(txn, 0), "All entities of specific type 0");
    checkIterable(new EntitiesOfTypeRangeIterable(txn, 0, 3, 8), "Entities of specific type within id range 0 3 8");
    checkIterable(new EntitiesWithLinkIterable(txn, 0, 1), "Entities with link 0 1");
    checkIterable(new EntitiesWithLinkSortedIterable(txn, 0, 1, 2, 3), "Entities with link 0 1");
    checkIterable(new SingleEntityIterable(txn, new PersistentEntityId(0, 1)), "Single entity 0 1");
    checkIterable(new MergeSortedIterableWithValueGetter(txn, new ArrayList<>(), entity -> null, (o1, o2) -> 0), "Merge sorted iterables 0");
    checkIterable(new EntitiesWithPropertyIterable(txn, 0, 1), "Entities with property 0 1");
    checkIterable(new EntitiesWithBlobIterable(txn, 0, 1), "Entities with blob 0 1");
    checkIterable(new TakeEntityIterable(txn, EntityIterableBase.EMPTY, 0), "Take iterable 0\n" + "|   Empty iterable");
    checkIterable(new EntityReverseIterable(txn, EntityIterableBase.EMPTY), "Reversed iterable\n" + "|   Empty iterable");
    checkIterable(new SortIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY, 0, 2, false), "Sorting iterable 0 2 1\n" + "|   Empty iterable");
    checkIterable(new DistinctIterable(txn, EntityIterableBase.EMPTY), "Distinct iterable\n" + "|   Empty iterable");
    checkIterable(new SelectManyIterable(txn, EntityIterableBase.EMPTY, 0, true), "SelectMany distinct iterable 0\n" + "|   Empty iterable");
    checkIterable(new SortResultIterable(txn, EntityIterableBase.EMPTY), "Empty iterable");
    checkIterable(new SelectDistinctIterable(txn, EntityIterableBase.EMPTY, 0), "Select distinct iterable 0\n" + "|   Empty iterable");
    checkIterable(new SkipEntityIterable(txn, EntityIterableBase.EMPTY, 0), "Skip iterable 0\n" + "|   Empty iterable");
    checkIterable(new ExcludeNullIterableDecorator(txn, EntityIterableBase.EMPTY), "Exclude null\n" + "|   Empty iterable");
    IntHashMap<String> map = new IntHashMap<>();
    map.put(3, "value3");
    map.put(4, "value2");
    checkIterable(new EntityFromLinkSetIterable(txn, new PersistentEntityId(0, 1), map), "Outgoing links of a set from an entity 0 1  2 links: 3 4");
    checkIterable(new EntityFromLinksIterable(txn, new PersistentEntityId(0, 1), 2), "Outgoing links from an entity 0 1 2");
    checkIterable(new EntityToLinksIterable(txn, new PersistentEntityId(0, 1), 2, 3), "Incoming links to an entity 0 1 2 3");
    checkIterable(new FilterEntityTypeIterable(txn, 0, EntityIterableBase.EMPTY), "Filter source iterable by entity type 0\n" + "|   Empty iterable");
    checkIterable(new FilterLinksIterable(txn, 0, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY), "Filter source iterable by links set 0\n" + "|   Empty iterable\n" + "|   Empty iterable");
    // XD-441
    checkIterable(new IntersectionIterable(txn, new IntersectionIterable(txn, new IntersectionIterable(txn, new UnionIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY), new MinusIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY)), new IntersectionIterable(txn, new UnionIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY), new MinusIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY))), new IntersectionIterable(txn, new IntersectionIterable(txn, new UnionIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY), new MinusIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY)), new IntersectionIterable(txn, new UnionIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY), new MinusIterable(txn, EntityIterableBase.EMPTY, EntityIterableBase.EMPTY)))), "Intersection\n" + "|   Intersection\n" + "|   |   Intersection\n" + "|   |   |   Union\n" + "|   |   |   |   Empty iterable\n" + "|   |   |   |   Empty iterable\n" + "|   |   |   Minus\n" + "|   |   |   |   Empty iterable\n" + "|   |   |   |   Empty iterable\n" + "|   |   Intersection\n" + "|   |   |   Union\n" + "|   |   |   |   Empty iterable\n" + "|   |   |   |   Empty iterable\n" + "|   |   |   Minus\n" + "|   |   |   |   Empty iterable\n" + "|   |   |   |   Empty iterable\n" + "|   Intersection\n" + "|   |   Intersection\n" + "|   |   |   Union\n" + "|   |   |   |   Empty iterable\n" + "|   |   |   |   Empty iterable\n" + "|   |   |   Minus\n" + "|   |   |   |   Empty iterable\n" + "|   |   |   |   Empty iterable\n" + "|   |   Intersection\n" + "|   |   |   Union\n" + "|   |   |   |   Empty iterable\n" + "|   |   |   |   Empty iterable\n" + "|   |   |   Minus\n" + "|   |   |   |   Empty iterable\n" + "|   |   |   |   Empty iterable");
}
Also used : PersistentEntityId(jetbrains.exodus.entitystore.PersistentEntityId) EntityIterableType(jetbrains.exodus.entitystore.EntityIterableType) jetbrains.exodus.entitystore.iterate.binop(jetbrains.exodus.entitystore.iterate.binop) IntHashMap(jetbrains.exodus.core.dataStructures.hash.IntHashMap) EntityStoreTestBase(jetbrains.exodus.entitystore.EntityStoreTestBase) PersistentStoreTransaction(jetbrains.exodus.entitystore.PersistentStoreTransaction) ArrayList(java.util.ArrayList) PersistentStoreTransaction(jetbrains.exodus.entitystore.PersistentStoreTransaction) ArrayList(java.util.ArrayList) IntHashMap(jetbrains.exodus.core.dataStructures.hash.IntHashMap) PersistentEntityId(jetbrains.exodus.entitystore.PersistentEntityId)

Aggregations

ArrayList (java.util.ArrayList)1 IntHashMap (jetbrains.exodus.core.dataStructures.hash.IntHashMap)1 EntityIterableType (jetbrains.exodus.entitystore.EntityIterableType)1 EntityStoreTestBase (jetbrains.exodus.entitystore.EntityStoreTestBase)1 PersistentEntityId (jetbrains.exodus.entitystore.PersistentEntityId)1 PersistentStoreTransaction (jetbrains.exodus.entitystore.PersistentStoreTransaction)1 jetbrains.exodus.entitystore.iterate.binop (jetbrains.exodus.entitystore.iterate.binop)1