ProductDao extends HibernateDao<Product, Long> { public Product getProductByPath (final URL path) { if (path == null) return null; Product p = (Product)DataAccessUtils.uniqueResult(getHibernateTemplate(). find("from Product where path=? AND processed=true",path)); return p; }  static int getMaxPageSize(); Product getProductByPath(final URL path); @Override List<Product> listCriteria(DetachedCriteria detached, int skip,
         int top); @SuppressWarnings ("unchecked") List<Product> read(List<Long>ids); boolean exists(URL url); @Override List<Product> scroll(String clauses, int skip, int n); Iterator<Product> scrollFiltered(String filter, final Long collection_id, int skip); int count(String filter, final String collection_uuid); @Override void deleteAll(); @Override void delete(Product product); void setIndexes(Product product, List<MetadataIndex>indexes); void setIndexes(Long id, List<MetadataIndex>indexes); Iterator<Product> getProductsByIngestionDate(Date max_date); Iterator<Product> getProductsLowerAccess(Date max_date); static String getPathFromProduct(Product product); static String getPathFromURL(URL product); @SuppressWarnings ("unchecked") List<Long> getAuthorizedProducts(String user_uuid); @SuppressWarnings ("unchecked") Product getProductByDownloadableFilename(final String filename,
         final Collection collection); Product getProductByUuid(String uuid); List<Product> getNoCollectionProducts(User user); List<Product> scrollUploadedProducts(final User user, final int skip,
      final int top); @SuppressWarnings ("unchecked") List<Product> getUploadedProducts(final User user); User getOwnerOfProduct(final Product product); boolean isAuthorized(final String user_uuid, final long product_id); Iterator<Product> getUnprocessedProducts(); Iterator<Product> getAllProducts(); Product getProductByIdentifier(String identifier);  }
@Test public void getProductByPath () { URL valid = null; URL invalid = null; try { valid = new URL ("file:/home/lambert/test/prod5"); invalid = new URL ("file:/home/lambert/test/prod512"); } catch (MalformedURLException e) { Assert.fail ("Malformed URL !", e); } Product product = dao.getProductByPath (valid); Assert.assertNotNull (product); Assert.assertEquals (product.getId ().intValue (), 5); product = dao.getProductByPath (invalid); Assert.assertNull (product); product = dao.getProductByPath (null); Assert.assertNull (product); }