@Test public void processEntityLinks() { final Connector connector = createConnector(); connector.setLinksToProcessPerTick( 1 ); final Connection connection = newConnection( connector ); final MessageResponse response = setCurrentMessageResponse( connection, ChangeSetMessage.create( null, null, new String[ 0 ], null, new EntityChange[ 0 ] ) ); final Linkable entity1 = mock( Linkable.class ); final Linkable entity2 = mock( Linkable.class ); final Linkable entity3 = mock( Linkable.class ); final Linkable entity4 = mock( Linkable.class ); response.changeProcessed( entity1 ); response.changeProcessed( entity2 ); response.changeProcessed( entity3 ); response.changeProcessed( entity4 ); verify( entity1, never() ).link(); verify( entity2, never() ).link(); verify( entity3, never() ).link(); verify( entity4, never() ).link(); assertEquals( response.getEntityLinkCount(), 0 ); connector.setLinksToProcessPerTick( 1 ); connector.processEntityLinks(); assertEquals( response.getEntityLinkCount(), 1 ); verify( entity1, times( 1 ) ).link(); verify( entity2, never() ).link(); verify( entity3, never() ).link(); verify( entity4, never() ).link(); connector.setLinksToProcessPerTick( 2 ); connector.processEntityLinks(); assertEquals( response.getEntityLinkCount(), 3 ); verify( entity1, times( 1 ) ).link(); verify( entity2, times( 1 ) ).link(); verify( entity3, times( 1 ) ).link(); verify( entity4, never() ).link(); }
@Action( verifyRequired = false ) void processEntityLinks() { final MessageResponse response = ensureCurrentMessageResponse(); Linkable linkable; for ( int i = 0; i < _linksToProcessPerTick && null != ( linkable = response.nextEntityToLink() ); i++ ) { linkable.link(); response.incEntityLinkCount(); } }
Connector extends ReplicantService { @Action( verifyRequired = false ) void processEntityLinks() { final MessageResponse response = ensureCurrentMessageResponse(); Linkable linkable; for ( int i = 0; i < _linksToProcessPerTick && null != ( linkable = response.nextEntityToLink() ); i++ ) { linkable.link(); response.incEntityLinkCount(); } } }
Connector extends ReplicantService { @Action( verifyRequired = false ) void processEntityLinks() { final MessageResponse response = ensureCurrentMessageResponse(); Linkable linkable; for ( int i = 0; i < _linksToProcessPerTick && null != ( linkable = response.nextEntityToLink() ); i++ ) { linkable.link(); response.incEntityLinkCount(); } } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); }
Connector extends ReplicantService { @Action( verifyRequired = false ) void processEntityLinks() { final MessageResponse response = ensureCurrentMessageResponse(); Linkable linkable; for ( int i = 0; i < _linksToProcessPerTick && null != ( linkable = response.nextEntityToLink() ); i++ ) { linkable.link(); response.incEntityLinkCount(); } } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); @Override String toString(); }
Connector extends ReplicantService { @Action( verifyRequired = false ) void processEntityLinks() { final MessageResponse response = ensureCurrentMessageResponse(); Linkable linkable; for ( int i = 0; i < _linksToProcessPerTick && null != ( linkable = response.nextEntityToLink() ); i++ ) { linkable.link(); response.incEntityLinkCount(); } } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); @Override String toString();  }