use of com.yahoo.bullet.query.Projection in project bullet-core by yahoo.
the class ByteArrayPubSubMessageSerDeTest method testLazyMessage.
@Test
public void testLazyMessage() {
ByteArrayPubSubMessageSerDe serDe = new ByteArrayPubSubMessageSerDe(null);
Query query = new Query(new Projection(), null, new Raw(1), null, new Window(), 1L);
PubSubMessage converted = serDe.toMessage("id", query, "foo");
PubSubMessage reverted = serDe.fromMessage(converted);
Assert.assertSame(reverted, converted);
// Starts off as byte[]
Assert.assertEquals(reverted.getContent(), SerializerDeserializer.toBytes(query));
// Payload is now made a Query
Query revertedQuery = reverted.getContentAsQuery();
Assert.assertEquals(revertedQuery.getProjection().getType(), Projection.Type.PASS_THROUGH);
Assert.assertEquals(revertedQuery.getAggregation().getType(), AggregationType.RAW);
Assert.assertEquals((long) revertedQuery.getAggregation().getSize(), 1L);
Assert.assertEquals((long) revertedQuery.getDuration(), 1L);
Assert.assertSame(reverted.getContent(), revertedQuery);
// Payload is now made a byte[]
byte[] revertedByteArray = reverted.getContentAsByteArray();
Assert.assertEquals(revertedByteArray, SerializerDeserializer.toBytes(query));
Assert.assertSame(reverted.getContent(), revertedByteArray);
}
use of com.yahoo.bullet.query.Projection in project bullet-core by yahoo.
the class ByteArrayPubSubMessageSerDeTest method testConvertingQuery.
@Test
public void testConvertingQuery() {
ByteArrayPubSubMessageSerDe serDe = new ByteArrayPubSubMessageSerDe(null);
Query query = new Query(new Projection(), null, new Raw(1), null, new Window(), 1L);
PubSubMessage actual = serDe.toMessage("id", query, "foo");
Assert.assertEquals(actual.getId(), "id");
Assert.assertEquals(actual.getContent(), SerializerDeserializer.toBytes(query));
Assert.assertEquals(actual.getMetadata().getContent(), "foo");
}
use of com.yahoo.bullet.query.Projection in project bullet-core by yahoo.
the class SimpleEqualityPartitionerTest method createQuery.
private Query createQuery() {
Query query = new Query(new Projection(), null, new Raw(null), null, new Window(), null);
query.configure(config);
return query;
}
use of com.yahoo.bullet.query.Projection in project bullet-core by yahoo.
the class SimpleEqualityPartitionerTest method createQuery.
private Query createQuery(Expression filter) {
Query query = new Query(new Projection(), filter, new Raw(null), null, new Window(), null);
query.configure(config);
return query;
}
Aggregations