@Test public void browseShouldReturnPermittedAssets() { int numberOfAssetsNotPermitted = 4; int numberOfPermittedAssets = NUMBER_OF_ASSETS - numberOfAssetsNotPermitted; when(assetContinuation.isEmpty()).thenReturn(false).thenReturn(true); when(contentAuthHelper.checkPathPermissions(ASSET_PATH, A_FORMAT, REPOSITORY_NAME)) .thenReturn(false).thenReturn(false, false, false, true); List<FluentAsset> assets = underTest.browse(repository, null); assertThat(assets, hasSize(numberOfPermittedAssets)); verify(fluentAssets, times(2)).browse(LIMIT, null); 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);   }