@RequestMapping(value = "/product/{prod}", method = RequestMethod.DELETE)
  @Transactional
  public ResponseEntity<ProductResult> doIt(
      @PathVariable("prod") String product, Authentication auth) {

    if (!ApplicationSecurity.isRoot(auth)) {
      return new ResponseEntity<ProductResult>(HttpStatus.FORBIDDEN);
    }

    Product reqProduct = new Product(product, null);
    List<String> errors = DomainValidator.checkForErrors(reqProduct);

    if (!errors.isEmpty()) {
      return new ResponseEntity<ProductResult>(
          new ProductResult(reqProduct, errors), HttpStatus.BAD_REQUEST);
    }

    if (!products.exists(reqProduct.getName())) {
      return new ResponseEntity<ProductResult>(
          new ProductResult(reqProduct, Product.NOT_FOUND), HttpStatus.NOT_FOUND);
    }

    products.delete(reqProduct.getName());
    components.deleteByKeyProduct(reqProduct.getName());
    properties.deleteByKeyProduct(reqProduct.getName());
    userProducts.deleteByKeyProduct(reqProduct.getName());
    return new ResponseEntity<ProductResult>(HttpStatus.OK);
  }
 @Test
 public void testExistsOneThatDoesNotExist() {
   Assert.assertFalse(repo.exists(POPULAR_AVAILABLE_PRODUCT.getId().concat("XX-XX-XX")));
 }
 @Test
 public void testExists() {
   Assert.assertTrue(repo.exists(POPULAR_AVAILABLE_PRODUCT.getId()));
 }