@Test
public void testStreamInputPacketIndexEntry_1() {
String expectedResult = "StreamInputPacketIndexEntry [offsetBits=1, " +
- "timestampBegin=" + Long.MIN_VALUE +
+ "timestampBegin=" + 0 +
", timestampEnd=" + Long.MAX_VALUE +
"]";
sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
sd.addField("load_factor", new FloatDeclaration(24, 8, ByteOrder.nativeOrder(), 8));
sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII));
- sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
- @SuppressWarnings("null")
+ final EnumDeclaration declaration = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
+ declaration.add(-100, 100, "");
+ sd.addField("Enum", declaration);
BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
bb.getByteBuffer().putInt(100);
bb.getByteBuffer().putInt(200);
sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII));
- sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
- @SuppressWarnings("null")
+ final EnumDeclaration declaration = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
+ declaration.add(-100, 100, "");
+ sd.addField("Enum", declaration);
BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
bb.getByteBuffer().putInt(100);
bb.getByteBuffer().putInt(200);
sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
sd.addField("packet_size", IntegerDeclaration.INT_32B_DECL);
sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII));
- sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
+ final EnumDeclaration declaration = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
+ declaration.add(-100, 100, "");
+ sd.addField("Enum", declaration);
sd.addField("intruder", new StructDeclaration(8));
- @SuppressWarnings("null")
BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
bb.getByteBuffer().putInt(100);
bb.getByteBuffer().putInt(200);
StructDeclaration sd = new StructDeclaration(8);
sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII));
- sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
- @SuppressWarnings("null")
+ final EnumDeclaration declaration = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
+ declaration.add(-100, 100, "");
+ sd.addField("Enum", declaration);
BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
bb.getByteBuffer().putInt(0);
bb.getByteBuffer().put(("Test").getBytes());
StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
assertNull(sipie.getTarget());
- assertEquals(Long.MIN_VALUE, sipie.getTimestampBegin());
+ assertEquals(0, sipie.getTimestampBegin());
assertEquals(Long.MAX_VALUE, sipie.getTimestampEnd());
}
sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
sd.addField("device", StringDeclaration.getStringDeclaration(Encoding.ASCII));
- sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
- @SuppressWarnings("null")
+ final EnumDeclaration declaration = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
+ declaration.add(-100, 100, "");
+ sd.addField("Enum", declaration);
BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
bb.getByteBuffer().putInt(-1);
bb.getByteBuffer().putInt(0);
bb.getByteBuffer().put((byte) 0);
StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
- assertEquals(Long.MIN_VALUE, sipie.getTimestampBegin());
+ assertEquals(0, sipie.getTimestampBegin());
assertEquals(Long.MAX_VALUE, sipie.getTimestampEnd());
assertEquals("Test66", sipie.getTarget());
assertEquals(66, sipie.getTargetId());
sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
sd.addField("cpu_id", IntegerDeclaration.INT_32B_DECL);
sd.addField("events_discarded", IntegerDeclaration.INT_32B_DECL);
- @SuppressWarnings("null")
BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
bb.getByteBuffer().putInt(-1);
bb.getByteBuffer().putInt(0);
bb.getByteBuffer().putInt(300);
StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 100);
- assertEquals(Long.MIN_VALUE, sipie.getTimestampBegin());
+ assertEquals(0, sipie.getTimestampBegin());
assertEquals(Long.MAX_VALUE, sipie.getTimestampEnd());
assertEquals("CPU66", sipie.getTarget());
assertEquals(66, sipie.getTargetId());
final EnumDeclaration declaration = new EnumDeclaration(IntegerDeclaration.createDeclaration(16, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 8));
declaration.add(313, 315, "CPU-PI");
sd.addField("device", declaration);
- @SuppressWarnings("null")
BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
bb.getByteBuffer().putInt(-1);
bb.getByteBuffer().putInt(0);
bb.getByteBuffer().putShort((short) 314);
StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
- assertEquals(Long.MIN_VALUE, sipie.getTimestampBegin());
+ assertEquals(0, sipie.getTimestampBegin());
assertEquals(Long.MAX_VALUE, sipie.getTimestampEnd());
assertEquals("CPU-PI", sipie.getTarget());
assertEquals(314, sipie.getTargetId());
sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
final IDeclaration declaration = IntegerDeclaration.createDeclaration(16, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 8);
sd.addField("device", declaration);
- @SuppressWarnings("null")
BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
bb.getByteBuffer().putInt(-1);
bb.getByteBuffer().putInt(0);
bb.getByteBuffer().putShort((short) 314);
StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
- assertEquals(Long.MIN_VALUE, sipie.getTimestampBegin());
+ assertEquals(0, sipie.getTimestampBegin());
assertEquals(Long.MAX_VALUE, sipie.getTimestampEnd());
assertEquals("314", sipie.getTarget());
assertEquals(314, sipie.getTargetId());
StructDeclaration sd = new StructDeclaration(8);
sd.addField("timestamp_begin", IntegerDeclaration.INT_32B_DECL);
sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
- @SuppressWarnings("null")
BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);