use of com.orientechnologies.orient.core.db.record.OMultiValueChangeEvent in project orientdb by orientechnologies.
the class OPropertyRidBagAbstractIndexDefinitionTest method testProcessChangeEventAddTwoTimes.
public void testProcessChangeEventAddTwoTimes() {
final Map<Object, Integer> keysToAdd = new HashMap<Object, Integer>();
final Map<Object, Integer> keysToRemove = new HashMap<Object, Integer>();
final OMultiValueChangeEvent<OIdentifiable, OIdentifiable> multiValueChangeEventOne = new OMultiValueChangeEvent<OIdentifiable, OIdentifiable>(OMultiValueChangeEvent.OChangeType.ADD, new ORecordId("#1:12"), new ORecordId("#1:12"));
final OMultiValueChangeEvent<OIdentifiable, OIdentifiable> multiValueChangeEventTwo = new OMultiValueChangeEvent<OIdentifiable, OIdentifiable>(OMultiValueChangeEvent.OChangeType.ADD, new ORecordId("#1:12"), new ORecordId("#1:12"));
propertyIndex.processChangeEvent(multiValueChangeEventOne, keysToAdd, keysToRemove);
propertyIndex.processChangeEvent(multiValueChangeEventTwo, keysToAdd, keysToRemove);
final Map<Object, Integer> addedKeys = new HashMap<Object, Integer>();
addedKeys.put(new ORecordId("#1:12"), 2);
final Map<Object, Integer> removedKeys = new HashMap<Object, Integer>();
Assert.assertEquals(keysToAdd, addedKeys);
Assert.assertEquals(keysToRemove, removedKeys);
}
use of com.orientechnologies.orient.core.db.record.OMultiValueChangeEvent in project orientdb by orientechnologies.
the class OPropertyRidBagAbstractIndexDefinitionTest method testProcessChangeEventAddRemoveInvValue.
public void testProcessChangeEventAddRemoveInvValue() {
final Map<Object, Integer> keysToAdd = new HashMap<Object, Integer>();
final Map<Object, Integer> keysToRemove = new HashMap<Object, Integer>();
final OMultiValueChangeEvent<OIdentifiable, OIdentifiable> multiValueChangeEventOne = new OMultiValueChangeEvent<OIdentifiable, OIdentifiable>(OMultiValueChangeEvent.OChangeType.ADD, new ORecordId("#1:12"), new ORecordId("#1:12"));
final OMultiValueChangeEvent<OIdentifiable, OIdentifiable> multiValueChangeEventTwo = new OMultiValueChangeEvent<OIdentifiable, OIdentifiable>(OMultiValueChangeEvent.OChangeType.REMOVE, new ORecordId("#1:13"), null, new ORecordId("#1:13"));
propertyIndex.processChangeEvent(multiValueChangeEventOne, keysToAdd, keysToRemove);
propertyIndex.processChangeEvent(multiValueChangeEventTwo, keysToAdd, keysToRemove);
final Map<Object, Integer> addedKeys = new HashMap<Object, Integer>();
addedKeys.put(new ORecordId("#1:12"), 1);
final Map<Object, Integer> removedKeys = new HashMap<Object, Integer>();
removedKeys.put(new ORecordId("#1:13"), 1);
Assert.assertEquals(keysToAdd, addedKeys);
Assert.assertEquals(keysToRemove, removedKeys);
}
use of com.orientechnologies.orient.core.db.record.OMultiValueChangeEvent in project orientdb by orientechnologies.
the class OPropertyRidBagAbstractIndexDefinitionTest method testProcessChangeEventAddTwiceRemoveOnce.
public void testProcessChangeEventAddTwiceRemoveOnce() {
final Map<Object, Integer> keysToAdd = new HashMap<Object, Integer>();
final Map<Object, Integer> keysToRemove = new HashMap<Object, Integer>();
final OMultiValueChangeEvent<OIdentifiable, OIdentifiable> multiValueChangeEventOne = new OMultiValueChangeEvent<OIdentifiable, OIdentifiable>(OMultiValueChangeEvent.OChangeType.ADD, new ORecordId("#1:12"), new ORecordId("#1:12"));
final OMultiValueChangeEvent<OIdentifiable, OIdentifiable> multiValueChangeEventTwo = new OMultiValueChangeEvent<OIdentifiable, OIdentifiable>(OMultiValueChangeEvent.OChangeType.ADD, new ORecordId("#1:12"), new ORecordId("#1:12"));
final OMultiValueChangeEvent<OIdentifiable, OIdentifiable> multiValueChangeEventThree = new OMultiValueChangeEvent<OIdentifiable, OIdentifiable>(OMultiValueChangeEvent.OChangeType.REMOVE, new ORecordId("#1:12"), null, new ORecordId("#1:12"));
propertyIndex.processChangeEvent(multiValueChangeEventOne, keysToAdd, keysToRemove);
propertyIndex.processChangeEvent(multiValueChangeEventTwo, keysToAdd, keysToRemove);
propertyIndex.processChangeEvent(multiValueChangeEventThree, keysToAdd, keysToRemove);
final Map<Object, Integer> addedKeys = new HashMap<Object, Integer>();
addedKeys.put(new ORecordId("#1:12"), 1);
final Map<Object, Integer> removedKeys = new HashMap<Object, Integer>();
Assert.assertEquals(keysToAdd, addedKeys);
Assert.assertEquals(keysToRemove, removedKeys);
}
use of com.orientechnologies.orient.core.db.record.OMultiValueChangeEvent in project orientdb by orientechnologies.
the class OPropertyRidBagAbstractIndexDefinitionTest method testProcessChangeEventAddRemove.
public void testProcessChangeEventAddRemove() {
final Map<Object, Integer> keysToAdd = new HashMap<Object, Integer>();
final Map<Object, Integer> keysToRemove = new HashMap<Object, Integer>();
final OMultiValueChangeEvent<OIdentifiable, OIdentifiable> multiValueChangeEventOne = new OMultiValueChangeEvent<OIdentifiable, OIdentifiable>(OMultiValueChangeEvent.OChangeType.ADD, new ORecordId("#1:12"), new ORecordId("#1:12"));
final OMultiValueChangeEvent<OIdentifiable, OIdentifiable> multiValueChangeEventTwo = new OMultiValueChangeEvent<OIdentifiable, OIdentifiable>(OMultiValueChangeEvent.OChangeType.REMOVE, new ORecordId("#1:12"), null, new ORecordId("#1:12"));
propertyIndex.processChangeEvent(multiValueChangeEventOne, keysToAdd, keysToRemove);
propertyIndex.processChangeEvent(multiValueChangeEventTwo, keysToAdd, keysToRemove);
final Map<Object, Integer> addedKeys = new HashMap<Object, Integer>();
final Map<Object, Integer> removedKeys = new HashMap<Object, Integer>();
Assert.assertEquals(keysToAdd, addedKeys);
Assert.assertEquals(keysToRemove, removedKeys);
}
use of com.orientechnologies.orient.core.db.record.OMultiValueChangeEvent in project orientdb by orientechnologies.
the class OPropertyRidBagAbstractIndexDefinitionTest method testProcessChangeEventRemoveTwoTimesAddOnce.
public void testProcessChangeEventRemoveTwoTimesAddOnce() {
final Map<Object, Integer> keysToAdd = new HashMap<Object, Integer>();
final Map<Object, Integer> keysToRemove = new HashMap<Object, Integer>();
final OMultiValueChangeEvent<OIdentifiable, OIdentifiable> multiValueChangeEventOne = new OMultiValueChangeEvent<OIdentifiable, OIdentifiable>(OMultiValueChangeEvent.OChangeType.REMOVE, new ORecordId("#1:12"), null, new ORecordId("#1:12"));
final OMultiValueChangeEvent<OIdentifiable, OIdentifiable> multiValueChangeEventTwo = new OMultiValueChangeEvent<OIdentifiable, OIdentifiable>(OMultiValueChangeEvent.OChangeType.REMOVE, new ORecordId("#1:12"), null, new ORecordId("#1:12"));
final OMultiValueChangeEvent<OIdentifiable, OIdentifiable> multiValueChangeEventThree = new OMultiValueChangeEvent<OIdentifiable, OIdentifiable>(OMultiValueChangeEvent.OChangeType.ADD, new ORecordId("#1:12"), new ORecordId("#1:12"));
propertyIndex.processChangeEvent(multiValueChangeEventOne, keysToAdd, keysToRemove);
propertyIndex.processChangeEvent(multiValueChangeEventTwo, keysToAdd, keysToRemove);
propertyIndex.processChangeEvent(multiValueChangeEventThree, keysToAdd, keysToRemove);
final Map<Object, Integer> addedKeys = new HashMap<Object, Integer>();
final Map<Object, Integer> removedKeys = new HashMap<Object, Integer>();
removedKeys.put(new ORecordId("#1:12"), 1);
Assert.assertEquals(keysToAdd, addedKeys);
Assert.assertEquals(keysToRemove, removedKeys);
}
Aggregations