VarInt.writeVInt(schemasStream, header.getSchemas().size()); for(HollowSchema schema : header.getSchemas()) schema.writeTo(schemasStream); byte[] schemasData = schemasStream.toByteArray();
schema.writeTo(dos);
@Test public void testTransient() throws IOException { HollowObjectMapper mapper = new HollowObjectMapper(writeStateEngine); mapper.initializeTypeState(TestTransientClass.class); mapper.add(new TestTransientClass(1, 2, 3)); roundTripSnapshot(); HollowSchema schema = readStateEngine.getSchema("TestTransientClass"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); schema.writeTo(baos); String schemeText = baos.toString(); Assert.assertTrue(schemeText.contains("notTransient")); Assert.assertFalse(schemeText.contains("transientKeyword")); Assert.assertFalse(schemeText.contains("annotatedTransient")); }
@Test public void testMappingClassWithTransientArray() throws IOException { HollowObjectMapper mapper = new HollowObjectMapper(writeStateEngine); mapper.initializeTypeState(TestClassContainingTransientArray.class); mapper.add(new TestClassContainingTransientArray(new int[]{1, 2})); roundTripSnapshot(); HollowSchema schema = readStateEngine.getSchema("TestClassContainingTransientArray"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); schema.writeTo(baos); String schemeText = baos.toString(); Assert.assertTrue(schemeText.contains("TestClassContainingTransientArray")); Assert.assertFalse(schemeText.contains("int[]")); Assert.assertFalse(schemeText.contains("intArray")); }
@Test public void testMappingClassWithHollowTransientArray() throws IOException { HollowObjectMapper mapper = new HollowObjectMapper(writeStateEngine); mapper.initializeTypeState(TestClassContainingHollowTransientArray.class); mapper.add(new TestClassContainingTransientArray(new int[]{1, 2})); roundTripSnapshot(); HollowSchema schema = readStateEngine.getSchema("TestClassContainingHollowTransientArray"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); schema.writeTo(baos); String schemeText = baos.toString(); Assert.assertTrue(schemeText.contains("TestClassContainingHollowTransientArray")); Assert.assertFalse(schemeText.contains("int[]")); Assert.assertFalse(schemeText.contains("intArray")); }
if(typeState.hasChangedSinceLastCycle()) { HollowSchema schema = typeState.getSchema(); schema.writeTo(dos);
if(typeState.hasChangedSinceLastCycle()) { HollowSchema schema = typeState.getSchema(); schema.writeTo(dos);
} else { for(int j=0;j<streamsWithType.length;j++) { schema.writeTo(streamsWithType[j].getStream()); VarInt.writeVInt(streamsWithType[j].getStream(), 1 + VarInt.sizeOfVInt(numShards)); VarInt.writeVInt(streamsWithType[j].getStream(), 0); /// forwards compatibility