@Test public void shouldTrimNumberOfAssetsToLimit() { when(assetContinuation.isEmpty()).thenReturn(false); when(contentAuthHelper.checkPathPermissions(ASSET_PATH, A_FORMAT, REPOSITORY_NAME)).thenReturn(true); List<FluentAsset> assets = underTest.browse(repository, null); assertThat(assets, hasSize(AssetsResource.PAGE_SIZE)); verify(contentAuthHelper, times(NUMBER_OF_ASSETS)).checkPathPermissions(ASSET_PATH, A_FORMAT, REPOSITORY_NAME); }
List<FluentAsset> browse(final Repository repository, final String continuationToken) { List<FluentAsset> permittedAssets = new ArrayList<>(); String internalToken = toInternalToken(continuationToken); Continuation<FluentAsset> assetContinuation = getAssets(repository, internalToken); while (permittedAssets.size() < PAGE_SIZE && !assetContinuation.isEmpty()) { permittedAssets.addAll(removeAssetsNotPermitted(repository, assetContinuation)); assetContinuation = getAssets(repository, assetContinuation.nextContinuationToken()); } return trim(permittedAssets, PAGE_SIZE); }
AssetsResourceSupport extends ComponentSupport { List<FluentAsset> browse(final Repository repository, final String continuationToken) { List<FluentAsset> permittedAssets = new ArrayList<>(); String internalToken = toInternalToken(continuationToken); Continuation<FluentAsset> assetContinuation = getAssets(repository, internalToken); while (permittedAssets.size() < PAGE_SIZE && !assetContinuation.isEmpty()) { permittedAssets.addAll(removeAssetsNotPermitted(repository, assetContinuation)); assetContinuation = getAssets(repository, assetContinuation.nextContinuationToken()); } return trim(permittedAssets, PAGE_SIZE); } }
AssetsResourceSupport extends ComponentSupport { List<FluentAsset> browse(final Repository repository, final String continuationToken) { List<FluentAsset> permittedAssets = new ArrayList<>(); String internalToken = toInternalToken(continuationToken); Continuation<FluentAsset> assetContinuation = getAssets(repository, internalToken); while (permittedAssets.size() < PAGE_SIZE && !assetContinuation.isEmpty()) { permittedAssets.addAll(removeAssetsNotPermitted(repository, assetContinuation)); assetContinuation = getAssets(repository, assetContinuation.nextContinuationToken()); } return trim(permittedAssets, PAGE_SIZE); } AssetsResourceSupport(final ContentAuthHelper contentAuthHelper); }
AssetsResourceSupport extends ComponentSupport { List<FluentAsset> browse(final Repository repository, final String continuationToken) { List<FluentAsset> permittedAssets = new ArrayList<>(); String internalToken = toInternalToken(continuationToken); Continuation<FluentAsset> assetContinuation = getAssets(repository, internalToken); while (permittedAssets.size() < PAGE_SIZE && !assetContinuation.isEmpty()) { permittedAssets.addAll(removeAssetsNotPermitted(repository, assetContinuation)); assetContinuation = getAssets(repository, assetContinuation.nextContinuationToken()); } return trim(permittedAssets, PAGE_SIZE); } AssetsResourceSupport(final ContentAuthHelper contentAuthHelper);  }
AssetsResourceSupport extends ComponentSupport { List<FluentAsset> browse(final Repository repository, final String continuationToken) { List<FluentAsset> permittedAssets = new ArrayList<>(); String internalToken = toInternalToken(continuationToken); Continuation<FluentAsset> assetContinuation = getAssets(repository, internalToken); while (permittedAssets.size() < PAGE_SIZE && !assetContinuation.isEmpty()) { permittedAssets.addAll(removeAssetsNotPermitted(repository, assetContinuation)); assetContinuation = getAssets(repository, assetContinuation.nextContinuationToken()); } return trim(permittedAssets, PAGE_SIZE); } AssetsResourceSupport(final ContentAuthHelper contentAuthHelper);   }