SchemalessPipe { public static int contentRemaining(Pipe<MessageSchemaDynamic> p) { return Pipe.contentRemaining(p); }  static void writeFloat(Pipe<MessageSchemaDynamic> p, float value); static float readFloat(Pipe<MessageSchemaDynamic> p); static void writeInt(Pipe<MessageSchemaDynamic> p, int value); static int readInt(Pipe<MessageSchemaDynamic> p); static void writeDouble(Pipe<MessageSchemaDynamic> p, double value); static double readDouble(Pipe<MessageSchemaDynamic> p); static void writeLong(Pipe<MessageSchemaDynamic> p, long value); static long readLong(Pipe<MessageSchemaDynamic> p); static void publishWrites(Pipe<MessageSchemaDynamic> p); static void releaseReads(Pipe<MessageSchemaDynamic> p); static int contentRemaining(Pipe<MessageSchemaDynamic> p); static int roomRemaining(Pipe<MessageSchemaDynamic> p);  }
@Test public void schemalessIntTest() { Pipe<MessageSchemaDynamic> p = new Pipe<MessageSchemaDynamic>(config); p.setPublishBatchSize(p, 0); p.setReleaseBatchSize(p, 0); p.initBuffers(); Random rSource = new Random(123); Random rConfirm = new Random(123); int i = 33; while (--i>=0) { Pipe.addIntValue(rSource.nextInt(), p); Pipe.publishWritesBatched(p); assertTrue(Pipe.contentRemaining(p)==1); int readValue = Pipe.takeInt(p); Pipe.releaseReadsBatched(p); assertEquals(rConfirm.nextInt(), readValue); assertTrue(Pipe.contentRemaining(p)==0); while (Pipe.contentRemaining(p)<p.sizeOfSlabRing) { Pipe.addIntValue(rSource.nextInt(), p); Pipe.publishWritesBatched(p); } while (Pipe.contentRemaining(p)>0) { int readValueX = Pipe.takeInt(p); assertEquals(rConfirm.nextInt(), readValueX); Pipe.releaseReadsBatched(p); } } }
@Test public void schemalessLongTest() { Pipe<MessageSchemaDynamic> p = new Pipe<MessageSchemaDynamic>(config); p.setPublishBatchSize(p, 0); p.setReleaseBatchSize(p, 0); p.initBuffers(); Random rSource = new Random(123); Random rConfirm = new Random(123); int i = 33; while (--i>=0) { Pipe.addLongValue(rSource.nextLong(), p); Pipe.publishWritesBatched(p); assertTrue(Pipe.contentRemaining(p)==2); long readValue = Pipe.takeLong(p); Pipe.releaseReadsBatched(p); assertEquals(rConfirm.nextLong(), readValue); assertTrue(Pipe.contentRemaining(p)==0); while (Pipe.contentRemaining(p)<p.sizeOfSlabRing) { Pipe.addLongValue(rSource.nextLong(), p); Pipe.publishWritesBatched(p); } while (Pipe.contentRemaining(p)>0) { long readValueX = Pipe.takeLong(p); assertEquals(rConfirm.nextLong(), readValueX); Pipe.releaseReadsBatched(p); } } }