public static WireCommand readFrom(DataInput in, int length) throws IOException { long requestId = in.readLong(); boolean success = in.readBoolean(); return new SegmentAttributeUpdated(requestId, success); } }
order.verify(connection).send(new WireCommands.SegmentAttributeUpdated(2, true)); processor.getSegmentAttribute(new WireCommands.GetSegmentAttribute(3, streamSegmentName, attribute, "")); order.verify(connection).send(new WireCommands.SegmentAttribute(3, 1)); order.verify(connection).send(new WireCommands.SegmentAttributeUpdated(4, false)); processor.getSegmentAttribute(new WireCommands.GetSegmentAttribute(5, streamSegmentName, attribute, "")); order.verify(connection).send(new WireCommands.SegmentAttribute(5, 1)); order.verify(connection).send(new WireCommands.SegmentAttributeUpdated(6, true)); processor.getSegmentAttribute(new WireCommands.GetSegmentAttribute(7, streamSegmentName, attribute, "")); order.verify(connection).send(new WireCommands.SegmentAttribute(7, 10)); order.verify(connection).send(new WireCommands.SegmentAttributeUpdated(8, true)); processor.getSegmentAttribute(new WireCommands.GetSegmentAttribute(9, streamSegmentName, attribute, "")); order.verify(connection).send(new WireCommands.SegmentAttribute(9, WireCommands.NULL_ATTRIBUTE_VALUE));
}; if (e == null) { invokeSafely(connection::send, new SegmentAttributeUpdated(requestId, true), failureHandler); } else { if (Exceptions.unwrap(e) instanceof BadAttributeUpdateException) { log.debug("Updating segment attribute {} failed due to: {}", update, e.getMessage()); invokeSafely(connection::send, new SegmentAttributeUpdated(requestId, false), failureHandler); } else { handleException(requestId, segmentName, operation, e);
@Override public boolean compareAndSetAttribute(SegmentAttribute attribute, long expectedValue, long newValue) { Exceptions.checkNotClosed(closed.get(), this); val future = RETRY_SCHEDULE.retryingOn(ConnectionFailedException.class) .throwingOn(NoSuchSegmentException.class) .runAsync(() -> updatePropertyAsync(attribute.getValue(), expectedValue, newValue, delegationToken), connectionFactory.getInternalExecutor()); return Futures.getThrowingException(future).isSuccess(); }
@Override public Void answer(InvocationOnMock invocation) throws Throwable { processor.process(new SegmentAttributeUpdated(1, true)); return null; } }).when(connection).sendAsync(Mockito.eq(new WireCommands.UpdateSegmentAttribute(1, segment.getScopedName(), attributeId, 1234,
@Test public void testSegmentAttributeUpdated() throws IOException { testCommand(new WireCommands.SegmentAttributeUpdated(l, true)); testCommand(new WireCommands.SegmentAttributeUpdated(l, false)); }