@Test public void canGroupRequests_presentInCache() { final Connection connection = createConnection(); final ChannelAddress addressA = new ChannelAddress( 1, 1, 1 ); final ChannelAddress addressB = new ChannelAddress( 1, 1, 2 ); final AreaOfInterestRequest requestA = new AreaOfInterestRequest( addressA, AreaOfInterestRequest.Type.ADD, null ); final AreaOfInterestRequest requestB = new AreaOfInterestRequest( addressB, AreaOfInterestRequest.Type.ADD, null ); assertTrue( connection.canGroupRequests( requestA, requestB ) ); assertTrue( connection.canGroupRequests( requestB, requestA ) ); final TestCacheService cacheService = new TestCacheService(); Replicant.context().setCacheService( cacheService ); cacheService.store( addressA, ValueUtil.randomString(), ValueUtil.randomString() ); assertFalse( connection.canGroupRequests( requestA, requestB ) ); assertFalse( connection.canGroupRequests( requestB, requestA ) ); }
boolean canGroupRequests( @Nonnull final AreaOfInterestRequest template, @Nonnull final AreaOfInterestRequest match ) { final CacheService cacheService = _connector.getReplicantContext().getCacheService(); return null != template.getAddress().getId() && null != match.getAddress().getId() && ( null == cacheService || null == cacheService.lookup( template.getAddress() ) ) && ( null == cacheService || null == cacheService.lookup( match.getAddress() ) ) && template.getType().equals( match.getType() ) && template.getAddress().getChannelId() == match.getAddress().getChannelId() && ( AreaOfInterestRequest.Type.REMOVE == match.getType() || FilterUtil.filtersEqual( match.getFilter(), template.getFilter() ) ); }
Connection { boolean canGroupRequests( @Nonnull final AreaOfInterestRequest template, @Nonnull final AreaOfInterestRequest match ) { final CacheService cacheService = _connector.getReplicantContext().getCacheService(); return null != template.getAddress().getId() && null != match.getAddress().getId() && ( null == cacheService || null == cacheService.lookup( template.getAddress() ) ) && ( null == cacheService || null == cacheService.lookup( match.getAddress() ) ) && template.getType().equals( match.getType() ) && template.getAddress().getChannelId() == match.getAddress().getChannelId() && ( AreaOfInterestRequest.Type.REMOVE == match.getType() || FilterUtil.filtersEqual( match.getFilter(), template.getFilter() ) ); } }
Connection { boolean canGroupRequests( @Nonnull final AreaOfInterestRequest template, @Nonnull final AreaOfInterestRequest match ) { final CacheService cacheService = _connector.getReplicantContext().getCacheService(); return null != template.getAddress().getId() && null != match.getAddress().getId() && ( null == cacheService || null == cacheService.lookup( template.getAddress() ) ) && ( null == cacheService || null == cacheService.lookup( match.getAddress() ) ) && template.getType().equals( match.getType() ) && template.getAddress().getChannelId() == match.getAddress().getChannelId() && ( AreaOfInterestRequest.Type.REMOVE == match.getType() || FilterUtil.filtersEqual( match.getFilter(), template.getFilter() ) ); } Connection( @Nonnull final Connector connector ); }
Connection { boolean canGroupRequests( @Nonnull final AreaOfInterestRequest template, @Nonnull final AreaOfInterestRequest match ) { final CacheService cacheService = _connector.getReplicantContext().getCacheService(); return null != template.getAddress().getId() && null != match.getAddress().getId() && ( null == cacheService || null == cacheService.lookup( template.getAddress() ) ) && ( null == cacheService || null == cacheService.lookup( match.getAddress() ) ) && template.getType().equals( match.getType() ) && template.getAddress().getChannelId() == match.getAddress().getChannelId() && ( AreaOfInterestRequest.Type.REMOVE == match.getType() || FilterUtil.filtersEqual( match.getFilter(), template.getFilter() ) ); } Connection( @Nonnull final Connector connector );  }
Connection { boolean canGroupRequests( @Nonnull final AreaOfInterestRequest template, @Nonnull final AreaOfInterestRequest match ) { final CacheService cacheService = _connector.getReplicantContext().getCacheService(); return null != template.getAddress().getId() && null != match.getAddress().getId() && ( null == cacheService || null == cacheService.lookup( template.getAddress() ) ) && ( null == cacheService || null == cacheService.lookup( match.getAddress() ) ) && template.getType().equals( match.getType() ) && template.getAddress().getChannelId() == match.getAddress().getChannelId() && ( AreaOfInterestRequest.Type.REMOVE == match.getType() || FilterUtil.filtersEqual( match.getFilter(), template.getFilter() ) ); } Connection( @Nonnull final Connector connector );   }