private void assertList(Collection<GenericHollowObject> listOfObj, List<Integer> listOfIds) { int i = 0; for (GenericHollowObject obj : listOfObj) { int id = listOfIds.get(i++); Assert.assertEquals(id, obj.getInt("f1")); } }
private void assertObject(HollowReadStateEngine output, int aKey, int expectAOrigin, int expectBKey, int expectBOrigin, int expectCKey, int expectCOrigin) { HollowPrimaryKeyIndex idx = new HollowPrimaryKeyIndex(output, new PrimaryKey("TypeA", "key")); GenericHollowObject typeA = (GenericHollowObject)GenericHollowRecordHelper.instantiate(output, "TypeA", idx.getMatchingOrdinal(aKey)); Assert.assertEquals(aKey, typeA.getInt("key")); Assert.assertEquals(expectAOrigin, typeA.getInt("origin")); GenericHollowObject typeB = (GenericHollowObject)typeA.getReferencedGenericRecord("b"); Assert.assertEquals(expectBKey, typeB.getInt("key")); Assert.assertEquals(expectBOrigin, typeB.getInt("origin")); GenericHollowObject typeC = (GenericHollowObject)typeB.getReferencedGenericRecord("c"); Assert.assertEquals(expectCKey, typeC.getInt("key")); Assert.assertEquals(expectCOrigin, typeC.getInt("origin")); }
private void assertObject(int ordinal, int int1, int int2) { HollowObjectTypeReadState typeState = (HollowObjectTypeReadState) readStateEngine.getTypeState("TestObject"); GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(typeState), ordinal); Assert.assertEquals(int1, obj.getInt("f1")); Assert.assertEquals(int2, obj.getInt("f2")); }
@Override protected Integer getData(HollowObjectTypeReadState readState, int ordinal) { GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(readState), ordinal); return obj.getInt("value"); }
@Test public void testWithSelectRootTypeGenericHollowObject() { HashIndexSelect<DataModel.Consumer.TypeA, GenericHollowObject, Integer> hi = HashIndex .from(consumer, DataModel.Consumer.TypeA.class) .selectField("", GenericHollowObject.class) .usingPath("i", int.class); boolean r = hi.findMatches(1) .sorted(Comparator.comparingInt(HollowObject::getOrdinal)) .mapToInt(gho -> gho.getInt("i")) .allMatch(i -> i == 1); Assert.assertTrue(r); }
private void assertUpdatedList(Collection<UpdatedRecord<GenericHollowObject>> listOfObj, List<String> beforeValues, List<String> afterValues) { int i = 0; for (UpdatedRecord<GenericHollowObject> obj : listOfObj) { int beforeId = obj.getBefore().getInt("f1"); int afterId = obj.getAfter().getInt("f1"); Assert.assertEquals(beforeId, afterId); String beforeVal = beforeValues.get(i); String afterVal = afterValues.get(i++); Assert.assertNotEquals(beforeVal, afterVal); Assert.assertEquals(beforeVal, obj.getBefore().getString("f2")); Assert.assertEquals(afterVal, obj.getAfter().getString("f2")); } }
private void assertTypeB(int ordinal, int b1) { HollowObjectTypeReadState typeState = (HollowObjectTypeReadState) readStateEngine.getTypeState("TypeB"); GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(typeState), ordinal); Assert.assertEquals(b1, obj.getInt("b1")); }
private void assertTypeB(int ordinal, int b1) { HollowObjectTypeReadState typeState = (HollowObjectTypeReadState) readStateEngine.getTypeState("TypeB"); GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(typeState), ordinal); Assert.assertEquals(b1, obj.getInt("b1")); }
private void assertA(HollowReadStateEngine stateEngine, int id, String val, boolean verifyEchoes) { HollowPrimaryKeyIndex idx = new HollowPrimaryKeyIndex(stateEngine, "TypeA", "id"); int ordinal = idx.getMatchingOrdinal(id); GenericHollowObject a = (GenericHollowObject) GenericHollowRecordHelper.instantiate(stateEngine, "TypeA", ordinal); GenericHollowList bList = (GenericHollowList)a.getReferencedGenericRecord("b"); GenericHollowObject b = (GenericHollowObject)bList.get(0); GenericHollowObject str = (GenericHollowObject)b.getReferencedGenericRecord("val"); Assert.assertEquals(val, str.getString("value")); if(verifyEchoes) { Assert.assertEquals(id, a.getInt("idEcho")); Assert.assertEquals(id, b.getInt("idEcho")); } }
private void assertObject(HollowObjectTypeReadState readState, int ordinal, int intVal, String strVal) { GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(readState), ordinal); Assert.assertEquals(intVal, obj.getInt("f1")); Assert.assertEquals(strVal, obj.getString("f2")); }
private void assertObject(HollowObjectTypeReadState readState, int ordinal, int intVal, String strVal) { GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(readState), ordinal); Assert.assertEquals(intVal, obj.getInt("f1")); Assert.assertEquals(strVal, obj.getString("f2")); }
private void assertObject(HollowObjectTypeReadState readState, int ordinal, int intVal, String strVal) { GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(readState), ordinal); Assert.assertEquals(intVal, obj.getInt("f1")); Assert.assertEquals(strVal, obj.getString("f2")); }
private void assertObject(HollowObjectTypeReadState readState, int ordinal, int intVal, String strVal) { GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(readState), ordinal); Assert.assertEquals(intVal, obj.getInt("f1")); Assert.assertEquals(strVal, obj.getString("f2")); }
private void assertObject(HollowObjectTypeReadState readState, int ordinal, int intVal, String strVal) { GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(readState), ordinal); Assert.assertEquals(intVal, obj.getInt("f1")); Assert.assertEquals(strVal, obj.getString("f2")); }
private void assertObject(HollowObjectTypeReadState readState, int ordinal, int intVal, String strVal) { GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(readState), ordinal); Assert.assertEquals(intVal, obj.getInt("f1")); Assert.assertEquals(strVal, obj.getString("f2")); }
private void assertTypeA(int ordinal, int a1, int bOrdinal) { HollowObjectTypeReadState typeState = (HollowObjectTypeReadState) readStateEngine.getTypeState("TypeA"); GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(typeState), ordinal); Assert.assertEquals(a1, obj.getInt("a1")); Assert.assertEquals(bOrdinal, obj.getOrdinal("a2")); }
private void assertTypeA(int ordinal, int a1, int bOrdinal) { HollowObjectTypeReadState typeState = (HollowObjectTypeReadState) readStateEngine.getTypeState("TypeA"); GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(typeState), ordinal); Assert.assertEquals(a1, obj.getInt("a1")); Assert.assertEquals(bOrdinal, obj.getOrdinal("a2")); }
private void assertTypeB(int ordinal, int b1, boolean b2) { HollowObjectTypeReadState typeState = (HollowObjectTypeReadState) readStateEngine.getTypeState("TypeB"); GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(typeState), ordinal); Assert.assertEquals(b1, obj.getInt("b1")); Assert.assertEquals(b2, obj.getBoolean("b2")); }
@Test public void test() throws IOException { HollowWriteStateEngine writeEngine = new HollowWriteStateEngine(); HollowObjectMapper mapper = new HollowObjectMapper(writeEngine); for(int i=0;i<10;i++) { mapper.add(new TypeWithFloat(-200f, i)); } HollowReadStateEngine readEngine = StateEngineRoundTripper.roundTripSnapshot(writeEngine); for(int i=0;i<10;i++) { GenericHollowObject obj = new GenericHollowObject(readEngine, "TypeWithFloat", i); Assert.assertEquals(i, obj.getInt("i")); } }
private void assertObject(int ordinal, long l, int i, double d) { HollowObjectTypeReadState typeState = (HollowObjectTypeReadState) readStateEngine.getTypeState("TestObject"); GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(typeState), ordinal); Assert.assertEquals(l, obj.getLong("longField")); Assert.assertEquals(i, obj.getInt("intField")); Assert.assertTrue(d == obj.getDouble("doubleField")); }