@Test public void testSerDeserPerf2() throws Exception { Kryo kryo = new Kryo(); String outputPath = FilenameUtils.concat(getTmpPath(), "file2.bin"); Output output = new Output(new FileOutputStream(outputPath)); for (int i = 0; i < 1000; i++) { kryo.writeObject(output, constructNewPE()); } output.close(); Input input = new Input(new FileInputStream(outputPath)); NewPartitionedEvent someObject = kryo.readObject(input, NewPartitionedEvent.class); input.close(); Assert.assertTrue(someObject.getData().length == 1); }
private NewPartitionedEvent constructNewPE() { NewPartitionedEvent pe = new NewPartitionedEvent(); pe.setStreamId("testStreamId"); pe.setTimestamp(1463159382000L); pe.setData(data); pe.setType(StreamPartition.Type.GROUPBY); List<String> col = new ArrayList<>(); col.add("host"); pe.setColumns(col); pe.setPartitionKey(1000); pe.setWindowMargin(30000); pe.setWindowPeriod("PT1M"); return pe; }