ResourceServiceImpl implements ResourceService { @Override public long getCount(String nameLike) { Search searchCriteria = new Search(Resource.class); if (nameLike != null) { searchCriteria.addFilterILike("name", nameLike); } return resourceDAO.count(searchCriteria); }  void setSecurityDAO(SecurityDAO securityDAO); void setStoredDataDAO(StoredDataDAO storedDataDAO); void setResourceDAO(ResourceDAO resourceDAO); void setAttributeDAO(AttributeDAO attributeDAO); void setCategoryDAO(CategoryDAO categoryDAO); void setUserGroupDAO(UserGroupDAO userGroupDAO); @Override long insert(Resource resource); @Override long update(Resource resource); @Override void updateAttributes(long id, List<Attribute> attributes); @Override Resource get(long id); @Override boolean delete(long id); @Override void deleteResources(SearchFilter filter); @Override List<ShortResource> getList(String nameLike, Integer page, Integer entries, User authUser); @Override List<ShortResource> getAll(Integer page, Integer entries, User authUser); @Override long getCount(String nameLike); @Override long getCountByFilter(SearchFilter filter); static List<String> extratcGroupNames(Set<UserGroup> groups); @Override List<ShortAttribute> getAttributes(long id); @Override ShortAttribute getAttribute(long id, String name); @Override long updateAttribute(long id, String name, String value); @Override long insertAttribute(long id, String name, String value, DataType type); @Override List<ShortResource> getResources(SearchFilter filter, User authUser); List<Resource> getResources(SearchFilter filter, Integer page, Integer entries,
            boolean includeAttributes, boolean includeData, User authUser); @Override List<ShortResource> getResources(SearchFilter filter, Integer page, Integer entries,
            User authUser); @Override List<Resource> getResourcesFull(SearchFilter filter, User authUser); @Override List<SecurityRule> getUserSecurityRule(String userName, long resourceId); @Override List<SecurityRule> getGroupSecurityRule(List<String> groupNames, long resourceId); @Override List<SecurityRule> getSecurityRules(long id); @Override void updateSecurityRules(long id, List<SecurityRule> rules); long getCountByFilterAndUser(SearchFilter filter, User user); long getCountByFilterAndUser(String nameLike, User user);  }
@Test public void testInsertTooBigResource() throws Exception { final String ORIG_RES_NAME = "testRes"; final String DESCRIPTION = "description"; final String CATEGORY_NAME = "MAP"; String bigData = createDataSize(100000000); boolean error = false; assertEquals(0, resourceService.getCount(null)); try { createResource(ORIG_RES_NAME, DESCRIPTION, CATEGORY_NAME, bigData); } catch(Exception e) { error = true; } assertEquals(0, resourceService.getCount(null)); assertTrue(error); }