PartitionedEvent implements Serializable { public PartitionedEvent() { this.event = null; this.partition = null; this.partitionKey = 0L; } PartitionedEvent();  PartitionedEvent(StreamEvent event, StreamPartition partition, int partitionKey); @Override boolean equals(Object obj); @Override int hashCode(); StreamEvent getEvent(); void setEvent(StreamEvent event); StreamPartition getPartition(); void setPartition(StreamPartition partition); void setPartitionKey(long partitionKey); long getPartitionKey(); String toString(); long getTimestamp(); String getStreamId(); Object[] getData(); boolean isSortRequired(); boolean isPartitionRequired(); PartitionedEvent copy(); Tuple getAnchor(); void setAnchor(Tuple anchor); PartitionedEvent withAnchor(Tuple tuple);  }
@Test public void testPartitionedEvent() { PartitionedEvent partitionedEvent = new PartitionedEvent(); Assert.assertEquals("PartitionedEvent[partition=null,event=null,key=0", partitionedEvent.toString()); Object[] data = new Object[]{"namevalue", "hostvalue", "1", 10, 0.1, -0.2, "{\"name\":\"heap.COMMITTED\", \"Value\":\"175636480\"}", 1}; StreamEvent streamEvent = new StreamEvent("streamId", 1478667686971l, data); StreamSortSpec streamSortSpec = new StreamSortSpec(); streamSortSpec.setWindowPeriod("PT10S"); StreamPartition streamPartition = new StreamPartition(); List<String> columns = new ArrayList<>(); columns.add("jobId"); streamPartition.setColumns(columns); streamPartition.setSortSpec(streamSortSpec); streamPartition.setStreamId("test"); streamPartition.setType(StreamPartition.Type.GROUPBY); partitionedEvent = new PartitionedEvent(streamEvent, streamPartition, 1); Assert.assertEquals("PartitionedEvent[partition=StreamPartition[streamId=test,type=GROUPBY,columns=[jobId],sortSpec=[StreamSortSpec[windowPeriod=PT10S,windowMargin=30000]]],event=StreamEvent[stream=STREAMID,timestamp=2016-11-09 05:01:26,971,data=[namevalue,hostvalue,1,10,0.1,-0.2,{\"name\":\"heap.COMMITTED\", \"Value\":\"175636480\"},1],metaVersion=null],key=1", partitionedEvent.toString()); PartitionedEvent partitionedEventCopy = partitionedEvent.copy(); Assert.assertFalse(partitionedEventCopy == partitionedEvent); Assert.assertTrue(partitionedEventCopy.equals(partitionedEvent)); Assert.assertTrue(partitionedEventCopy.hashCode() == partitionedEvent.hashCode()); }