@Override public String getString(int i) { return getValue(i).toString(); }
@BeforeMethod public void setup() { data = new ArrayList<>(); data.add("foo"); data.add(1); tuple = new DRPCTuple(data); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void testFieldIndex() { tuple.fieldIndex(null); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void testGetBinaryByField() { tuple.getBinaryByField(null); } }
@Test(expectedExceptions = UnsupportedOperationException.class) public void testContains() { tuple.contains(null); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void testGetBoolean() { tuple.getBoolean(0); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void testGetBooleanByField() { tuple.getBooleanByField(null); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void testGetByte() { tuple.getByte(0); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void testGetByteByField() { tuple.getByteByField(null); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void testGetBinary() { tuple.getBinary(0); }
@Override public void send(PubSubMessage message) throws PubSubException { Metadata metadata = message.getMetadata(); // Remove the content String content = metadata.getContent().toString(); log.debug("Removing metadata {} for result {}@{}: {}", content, message.getId(), message.getSequence(), message.getContent()); metadata.setContent(null); String serializedMessage = message.asJSON(); Tuple tuple = new DRPCTuple(new Values(serializedMessage, content)); // This sends the message through DRPC and not to the collector but it acks or fails accordingly. bolt.execute(tuple); if (!collector.isAcked()) { throw new PubSubException("Message not acked. Unable to send message through DRPC:\n " + serializedMessage); } // Otherwise, we're good to proceed collector.reset(); }
@Override public String getString(int i) { return getValue(i).toString(); }
@Override public void send(PubSubMessage message) throws PubSubException { Metadata metadata = message.getMetadata(); // Remove the content String content = metadata.getContent().toString(); log.debug("Removing metadata {} for result {}@{}: {}", content, message.getId(), message.getSequence(), message.getContent()); metadata.setContent(null); String serializedMessage = message.asJSON(); Tuple tuple = new DRPCTuple(new Values(serializedMessage, content)); // This sends the message through DRPC and not to the collector but it acks or fails accordingly. bolt.execute(tuple); if (!collector.isAcked()) { throw new PubSubException("Message not acked. Unable to send message through DRPC:\n " + serializedMessage); } // Otherwise, we're good to proceed collector.reset(); }
@Test(expectedExceptions = IndexOutOfBoundsException.class) public void gettingOutOfRangeValue() { tuple.getValue(2); }