BlobStoreResource extends ComponentSupport implements Resource, BlobStoreResourceDoc { @RequiresAuthentication @RequiresPermissions("nexus:blobstores:read") @GET @Path("/{name}/quota-status") public BlobStoreQuotaResultXO quotaStatus(@PathParam("name") final String name) { BlobStore blobStore = blobStoreManager.get(name); if (blobStore == null) { throw new WebApplicationException(format("No blob store found for id '%s' ", name), NOT_FOUND); } BlobStoreQuotaResult result = quotaService.checkQuota(blobStore); return result != null ? BlobStoreQuotaResultXO.asQuotaXO(result) : BlobStoreQuotaResultXO.asNoQuotaXO(name); } BlobStoreResource(final BlobStoreManager blobStoreManager, final BlobStoreQuotaService quotaService); @Override @RequiresAuthentication @RequiresPermissions("nexus:blobstores:read") @GET List<GenericBlobStoreApiResponse> listBlobStores(); @Override @RequiresAuthentication @RequiresPermissions("nexus:blobstores:delete") @DELETE @Path("/{name}") void deleteBlobStore(@PathParam("name") final String name); @RequiresAuthentication @RequiresPermissions("nexus:blobstores:read") @GET @Path("/{name}/quota-status") BlobStoreQuotaResultXO quotaStatus(@PathParam("name") final String name);  }
@Test public void passingTest() { BlobStoreQuotaResultXO resultXO = resource.quotaStatus("passing"); assertFalse(resultXO.getIsViolation()); assertEquals(resultXO.getBlobStoreName(), "passing"); }
@Test public void failingTest() { BlobStoreQuotaResultXO resultXO = resource.quotaStatus("failing"); assertTrue(resultXO.getIsViolation()); assertEquals(resultXO.getBlobStoreName(), "failing"); }
@Test public void noQuotaTest() { BlobStoreQuotaResultXO resultXO = resource.quotaStatus("noQuota"); assertFalse(resultXO.getIsViolation()); assertEquals(resultXO.getBlobStoreName(), "noQuota"); }