r626 - in trunk/simexplorer-is-service/src: java/fr/cemagref/simexplorer/is/service java/fr/cemagref/simexplorer/is/storage/engine test/fr/cemagref/simexplorer/is/service
Author: glandais Date: 2008-02-04 14:39:44 +0000 (Mon, 04 Feb 2008) New Revision: 626 Removed: trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/test/ Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/ElementGenerator.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockAuthenticationServiceImpl.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/SimExplorerServiceException.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityEqualsTestCase.java trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityTestCase.java trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceMassInsert.java trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceServerTest.java trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceTest.java Log: Javadoc Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java 2008-02-04 14:39:44 UTC (rev 626) @@ -23,80 +23,397 @@ import fr.cemagref.simexplorer.is.security.entities.Permission; import fr.cemagref.simexplorer.is.security.entities.User; +/** + * The Interface AuthenticationService. + */ @Remote public interface AuthenticationService { + /** + * Login user. + * + * @param login + * the login + * @param password + * the password + * + * @return the string + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public String loginUser(String login, String password) throws SimExplorerServiceException; + /** + * Request account. + * + * @param login + * the login + * @param mail + * the mail + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public void requestAccount(String login, String mail) throws SimExplorerServiceException; + /** + * Save user. + * + * @param token + * the token + * @param login + * the login + * @param mail + * the mail + * + * @return the user + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public User saveUser(String token, String login, String mail) throws SimExplorerServiceException; + /** + * Reset password. + * + * @param token + * the token + * @param login + * the login + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public void resetPassword(String token, String login) throws SimExplorerServiceException; + /** + * Change password. + * + * @param token + * the token + * @param password + * the password + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public void changePassword(String token, String password) throws SimExplorerServiceException; + /** + * Gets the user. + * + * @param token + * the token + * @param id + * the id + * + * @return the user + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public User getUser(String token, Integer id) throws SimExplorerServiceException; + /** + * Gets the user. + * + * @param token + * the token + * @param login + * the login + * + * @return the user + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public User getUser(String token, String login) throws SimExplorerServiceException; + /** + * Update user. + * + * @param token + * the token + * @param user + * the user + * + * @return the user + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public User updateUser(String token, User user) throws SimExplorerServiceException; + /** + * Delete user. + * + * @param token + * the token + * @param id + * the id + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public void deleteUser(String token, Integer id) throws SimExplorerServiceException; + /** + * Gets the users. + * + * @param token + * the token + * + * @return the users + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public User[] getUsers(String token) throws SimExplorerServiceException; + /** + * Gets the users of group. + * + * @param token + * the token + * @param group + * the group + * + * @return the users of group + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public User[] getUsersOfGroup(String token, Group group) throws SimExplorerServiceException; + /** + * Sets the users of group. + * + * @param token + * the token + * @param group + * the group + * @param usersInGroup + * the users in group + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public void setUsersOfGroup(String token, Group group, Integer[] usersInGroup) throws SimExplorerServiceException; + /** + * Sets the groups of group. + * + * @param token + * the token + * @param group + * the group + * @param groupsIds + * the groups ids + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public void setGroupsOfGroup(String token, Group group, Integer[] groupsIds) throws SimExplorerServiceException; + /** + * Gets the groups of user. + * + * @param token + * the token + * @param user + * the user + * + * @return the groups of user + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public Group[] getGroupsOfUser(String token, User user) throws SimExplorerServiceException; + /** + * Gets the groups of group. + * + * @param token + * the token + * @param group + * the group + * + * @return the groups of group + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public Group[] getGroupsOfGroup(String token, Group group) throws SimExplorerServiceException; + /** + * Sets the groups of user. + * + * @param token + * the token + * @param user + * the user + * @param groupsIds + * the groups ids + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public void setGroupsOfUser(String token, User user, Integer[] groupsIds) throws SimExplorerServiceException; + /** + * Save group. + * + * @param token + * the token + * @param name + * the name + * + * @return the group + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public Group saveGroup(String token, String name) throws SimExplorerServiceException; + /** + * Gets the group. + * + * @param token + * the token + * @param id + * the id + * + * @return the group + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public Group getGroup(String token, Integer id) throws SimExplorerServiceException; + /** + * Gets the group. + * + * @param token + * the token + * @param name + * the name + * + * @return the group + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public Group getGroup(String token, String name) throws SimExplorerServiceException; + /** + * Update group. + * + * @param token + * the token + * @param group + * the group + * + * @return the group + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public Group updateGroup(String token, Group group) throws SimExplorerServiceException; + /** + * Delete group. + * + * @param token + * the token + * @param id + * the id + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public void deleteGroup(String token, Integer id) throws SimExplorerServiceException; + /** + * Gets the groups. + * + * @param token + * the token + * + * @return the groups + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public Group[] getGroups(String token) throws SimExplorerServiceException; + /** + * Gets the groups owned by. + * + * @param token + * the token + * @param user + * the user + * + * @return the groups owned by + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public Group[] getGroupsOwnedBy(String token, User user) throws SimExplorerServiceException; + /** + * Gets the logged user. + * + * @param token + * the token + * + * @return the logged user + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public User getLoggedUser(String token) throws SimExplorerServiceException; + /** + * Gets the permissions. + * + * @param uuid + * the uuid + * + * @return the permissions + */ public Permission[] getPermissions(String uuid); + /** + * Sets the permissions. + * + * @param uuid + * the uuid + * @param permissions + * the permissions + */ public void setPermissions(String uuid, Permission[] permissions); } Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java 2008-02-04 14:39:44 UTC (rev 626) @@ -27,10 +27,8 @@ import java.util.List; import java.util.UUID; -import javax.annotation.Resource; import javax.ejb.EJB; import javax.ejb.Remote; -import javax.ejb.SessionContext; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; @@ -49,20 +47,32 @@ import fr.cemagref.simexplorer.is.security.entities.Permission; import fr.cemagref.simexplorer.is.security.entities.User; +/** + * The Class AuthenticationServiceImpl. + */ @Stateless(name = "AuthenticationService") @Remote(AuthenticationService.class) @RemoteBinding(jndiBinding = "AuthenticationService") @TransactionAttribute(TransactionAttributeType.REQUIRED) public class AuthenticationServiceImpl implements AuthenticationService { + /** The dao. */ @EJB private DaoSecurity dao; - @Resource - private SessionContext sessionContext; - + /** The super admin check. */ private static boolean superAdminCheck = false; + /** + * Gets the mail content with password. + * + * @param login + * the login + * @param password + * the password + * + * @return the mail content with password + */ private String getMailContentWithPassword(String login, String password) { StringBuffer sb = new StringBuffer(""); sb.append(_("simexplorer.service.mail.header")).append("\n"); @@ -74,6 +84,19 @@ return sb.toString(); } + /** + * Send mail. + * + * @param mail + * the mail + * @param subject + * the subject + * @param content + * the content + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ private void sendMail(String mail, String subject, String content) throws SimExplorerServiceException { try { @@ -94,6 +117,17 @@ } } + /** + * Compute hash. + * + * @param clearString + * the clear string + * + * @return the string + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ private String computeHash(String clearString) throws SimExplorerServiceException { MessageDigest messageDigest = null; @@ -109,11 +143,29 @@ return hashedPassword; } + /** + * Generate password. + * + * @return the string + */ private String generatePassword() { // FIXME return "password"; } + /** + * Can admin group. + * + * @param token + * the token + * @param id + * the id + * + * @return true, if successful + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ private boolean canAdminGroup(String token, Integer id) throws SimExplorerServiceException { User loggedUser = getLoggedUser(token); @@ -128,6 +180,16 @@ return false; } + /** + * User owner of group. + * + * @param loggedUser + * the logged user + * @param group + * the group + * + * @return true, if successful + */ private boolean userOwnerOfGroup(User loggedUser, Group group) { if (group.getOwner().getId() == loggedUser.getId()) { return true; @@ -141,6 +203,19 @@ return false; } + /** + * Can admin user. + * + * @param token + * the token + * @param id + * the id + * + * @return true, if successful + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ private boolean canAdminUser(String token, Integer id) throws SimExplorerServiceException { User loggedUser = getLoggedUser(token); @@ -161,6 +236,14 @@ return false; } + /** + * Removes the user from group. + * + * @param user + * the user + * @param group + * the group + */ private void removeUserFromGroup(User user, Group group) { List<Group> toRemove = new ArrayList<Group>(); for (Group testGroup : user.getGroups()) { @@ -173,6 +256,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#deleteGroup(java.lang.String, java.lang.Integer) + */ public void deleteGroup(String token, Integer id) throws SimExplorerServiceException { if (canAdminGroup(token, id)) { @@ -182,6 +268,9 @@ _("simexplorer.service.security.norights")); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#deleteUser(java.lang.String, java.lang.Integer) + */ public void deleteUser(String token, Integer id) throws SimExplorerServiceException { if (canAdminUser(token, id)) { @@ -191,6 +280,9 @@ _("simexplorer.service.security.norights")); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroup(java.lang.String, java.lang.Integer) + */ public Group getGroup(String token, Integer id) throws SimExplorerServiceException { if (canAdminGroup(token, id)) { @@ -200,6 +292,9 @@ _("simexplorer.service.security.norights")); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroup(java.lang.String, java.lang.String) + */ public Group getGroup(String token, String name) throws SimExplorerServiceException { Group group = dao.getGroup(name); @@ -210,6 +305,9 @@ _("simexplorer.service.security.norights")); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUser(java.lang.String, java.lang.Integer) + */ public User getUser(String token, Integer id) throws SimExplorerServiceException { if (canAdminUser(token, id)) { @@ -219,6 +317,9 @@ _("simexplorer.service.security.norights")); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUser(java.lang.String, java.lang.String) + */ public User getUser(String token, String login) throws SimExplorerServiceException { User user = dao.getUser(login); @@ -229,6 +330,9 @@ _("simexplorer.service.security.norights")); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#saveGroup(java.lang.String, java.lang.String) + */ public Group saveGroup(String token, String name) throws SimExplorerServiceException { User loggedUser = getLoggedUser(token); @@ -244,6 +348,9 @@ _("simexplorer.service.security.norights")); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#saveUser(java.lang.String, java.lang.String, java.lang.String) + */ public User saveUser(String token, String login, String mail) throws SimExplorerServiceException { User loggedUser = getLoggedUser(token); @@ -266,6 +373,9 @@ _("simexplorer.service.security.norights")); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#updateGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group) + */ public Group updateGroup(String token, Group group) throws SimExplorerServiceException { if (canAdminGroup(token, group.getId())) { @@ -275,6 +385,9 @@ _("simexplorer.service.security.norights")); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#updateUser(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User) + */ public User updateUser(String token, User user) throws SimExplorerServiceException { if (canAdminUser(token, user.getId())) { @@ -284,6 +397,9 @@ _("simexplorer.service.security.norights")); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getLoggedUser(java.lang.String) + */ public User getLoggedUser(String token) throws SimExplorerServiceException { if (token == null || token.equals("")) { return null; @@ -297,6 +413,12 @@ _("simexplorer.service.security.norights")); } + /** + * Check super admin. + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ private void checkSuperAdmin() throws SimExplorerServiceException { if (dao.getUser("superadmin") == null) { User user = new User(); @@ -311,6 +433,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#loginUser(java.lang.String, java.lang.String) + */ public String loginUser(String login, String password) throws SimExplorerServiceException { if (!superAdminCheck) { @@ -332,6 +457,9 @@ return token; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#requestAccount(java.lang.String, java.lang.String) + */ public void requestAccount(String login, String mail) throws SimExplorerServiceException { // FIXME send mail to superadmin @@ -348,6 +476,9 @@ */ } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#changePassword(java.lang.String, java.lang.String) + */ public void changePassword(String token, String password) throws SimExplorerServiceException { User user = getLoggedUser(token); @@ -356,6 +487,9 @@ dao.updateUser(user); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#resetPassword(java.lang.String, java.lang.String) + */ public void resetPassword(String token, String login) throws SimExplorerServiceException { User user = getUser(token, login); @@ -371,6 +505,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroups(java.lang.String) + */ public Group[] getGroups(String token) { List<Group> groups = dao.getGroups(); Group[] result; @@ -378,21 +515,33 @@ return result; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroupsOwnedBy(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User) + */ public Group[] getGroupsOwnedBy(String token, User user) { List<Group> list = dao.getGroupsOwnedBy(user); return list.toArray(new Group[list.size()]); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUsers(java.lang.String) + */ public User[] getUsers(String token) { List<User> users = dao.getUsers(); return users.toArray(new User[users.size()]); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUsersOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group) + */ public User[] getUsersOfGroup(String token, Group group) { List<User> usersOfGroup = dao.getUsersOfGroup(group); return usersOfGroup.toArray(new User[usersOfGroup.size()]); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#setUsersOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group, java.lang.Integer[]) + */ public void setUsersOfGroup(String token, Group group, Integer[] usersInGroup) { List<Integer> newUsers = new ArrayList<Integer>(); @@ -431,6 +580,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#setGroupsOfUser(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User, java.lang.Integer[]) + */ public void setGroupsOfUser(String token, User user, Integer[] groupsIds) { User realUser = dao.getUser(user.getId()); realUser.getGroups().clear(); @@ -442,16 +594,25 @@ } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroupsOfUser(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User) + */ public Group[] getGroupsOfUser(String token, User user) { List<Group> list = dao.getGroupsOfUser(user); return list.toArray(new Group[list.size()]); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroupsOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group) + */ public Group[] getGroupsOfGroup(String token, Group group) { List<Group> groupsOfGroup = dao.getGroupsOfGroup(group); return groupsOfGroup.toArray(new Group[groupsOfGroup.size()]); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#setGroupsOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group, java.lang.Integer[]) + */ public void setGroupsOfGroup(String token, Group group, Integer[] groupsIds) { Group realGroup = dao.getGroup(group.getId()); realGroup.getGroups().clear(); @@ -462,11 +623,17 @@ dao.updateGroup(realGroup); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getPermissions(java.lang.String) + */ public Permission[] getPermissions(String uuid) { List<Permission> permissions = dao.getPermissions(uuid); return permissions.toArray(new Permission[permissions.size()]); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#setPermissions(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Permission[]) + */ public void setPermissions(String uuid, Permission[] permissions) { dao.setPermissions(uuid, permissions); } Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/ElementGenerator.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/ElementGenerator.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/ElementGenerator.java 2008-02-04 14:39:44 UTC (rev 626) @@ -46,22 +46,42 @@ import fr.cemagref.simexplorer.is.entities.metadata.Version; import fr.cemagref.simexplorer.is.factories.BaseEntityFactory; +/** + * The Class ElementGenerator. + */ public class ElementGenerator { + /** The r. */ private Random r = new Random(); + /** The cs. */ private static int cs; + + /** The randomstrings. */ private static String[] randomstrings; + /** + * Instantiates a new element generator. + */ public ElementGenerator() { super(); initializeStrings(); } + /** + * Short string. + * + * @return the string + */ private String shortString() { return RandomStringUtils.randomAlphabetic(r.nextInt(5) + 5); } + /** + * Long string. + * + * @return the string + */ private String longString() { /* StringBuilder sb = new StringBuilder(); @@ -75,6 +95,9 @@ return RandomStringUtils.randomAlphabetic(r.nextInt(10) + 10); } + /** + * Initialize strings. + */ private void initializeStrings() { cs = 150000; randomstrings = new String[cs]; @@ -83,6 +106,15 @@ } } + /** + * Update. + * + * @param element + * the element + * + * @throws Exception + * the exception + */ private void update(LoggableElement element) throws Exception { MetaData metaData = new MetaData(); metaData.setUuid(UUID.randomUUID().toString()); @@ -116,6 +148,20 @@ element.setMetaData(metaData); } + /** + * Generate array. + * + * @param <T> + * clazz Class + * + * @param clazz + * the clazz + * + * @return the set< t> + * + * @throws Exception + * the exception + */ private <T extends DataEntity> Set<T> generateArray(Class<T> clazz) throws Exception { Set<T> elements = new HashSet<T>(); @@ -131,6 +177,14 @@ return elements; } + /** + * Generate random ea. + * + * @return the exploration application + * + * @throws Exception + * the exception + */ public ExplorationApplication generateRandomEA() throws Exception { ExplorationApplication ea = new ExplorationApplication(); update(ea); @@ -147,6 +201,15 @@ return ea; } + /** + * Process component. + * + * @param component + * the component + * + * @throws Exception + * the exception + */ private void processComponent(Component component) throws Exception { Set<Constant> constants = generateArray(Constant.class); for (Constant constant : constants) { @@ -170,6 +233,14 @@ } + /** + * Generate attachment. + * + * @return the attachment + * + * @throws Exception + * the exception + */ private Attachment generateAttachment() throws Exception { Attachment attachment = new Attachment(); attachment.setContentType(ContentTypeFactory @@ -179,20 +250,50 @@ return attachment; } + /** + * Process library. + * + * @param library + * the library + * + * @throws Exception + * the exception + */ private void processLibrary(Library library) throws Exception { library.getMetaData().getAttachments().add(generateAttachment()); } + /** + * Process code. + * + * @param code + * the code + */ private void processCode(Code code) { code.setCode(shortString()); code.setLanguage(shortString()); } + /** + * Process constant. + * + * @param constant + * the constant + */ private void processConstant(Constant constant) { constant.setName(shortString()); constant.setType(String.class); } + /** + * Process exploration data. + * + * @param explorationData + * the exploration data + * + * @throws Exception + * the exception + */ private void processExplorationData(ExplorationData explorationData) throws Exception { Result result = new Result(); @@ -208,6 +309,12 @@ } + /** + * Process constant value. + * + * @param constantValue + * the constant value + */ private void processConstantValue(ConstantValue constantValue) { Constant constant = new Constant(); constant.setName(shortString()); @@ -217,6 +324,14 @@ constantValue.setValue(Integer.toString(r.nextInt())); } + /** + * Generate text stream. + * + * @return the input stream + * + * @throws Exception + * the exception + */ public InputStream generateTextStream() throws Exception { int wordcount = 300 + r.nextInt(300); StringBuffer sb = new StringBuffer(); Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockAuthenticationServiceImpl.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockAuthenticationServiceImpl.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockAuthenticationServiceImpl.java 2008-02-04 14:39:44 UTC (rev 626) @@ -21,118 +21,210 @@ import fr.cemagref.simexplorer.is.security.entities.Permission; import fr.cemagref.simexplorer.is.security.entities.User; +/** + * The Class MockAuthenticationServiceImpl. + */ public class MockAuthenticationServiceImpl implements AuthenticationService { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#loginUser(java.lang.String, java.lang.String) + */ public String loginUser(String login, String password) { return (String) checkImplemented(); } + /** + * Close session timer. + * + * @param token + * the token + */ public void closeSessionTimer(String token) { checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#requestAccount(java.lang.String, java.lang.String) + */ public void requestAccount(String login, String mail) { checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#saveUser(java.lang.String, java.lang.String, java.lang.String) + */ public User saveUser(String token, String login, String mail) { return (User) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#resetPassword(java.lang.String, java.lang.String) + */ public void resetPassword(String token, String login) { checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#changePassword(java.lang.String, java.lang.String) + */ public void changePassword(String token, String password) { checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUser(java.lang.String, java.lang.Integer) + */ public User getUser(String token, Integer id) { return (User) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUser(java.lang.String, java.lang.String) + */ public User getUser(String token, String login) { return (User) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#updateUser(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User) + */ public User updateUser(String token, User user) { return (User) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#deleteUser(java.lang.String, java.lang.Integer) + */ public void deleteUser(String token, Integer id) { checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUsers(java.lang.String) + */ public User[] getUsers(String token) { return (User[]) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUsersOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group) + */ public User[] getUsersOfGroup(String token, Group group) { return (User[]) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#setUsersOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group, java.lang.Integer[]) + */ public void setUsersOfGroup(String token, Group group, Integer[] usersInGroup) { checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#setGroupsOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group, java.lang.Integer[]) + */ public void setGroupsOfGroup(String token, Group group, Integer[] groupsIds) { checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroupsOfUser(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User) + */ public Group[] getGroupsOfUser(String token, User user) { return (Group[]) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroupsOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group) + */ public Group[] getGroupsOfGroup(String token, Group group) { return (Group[]) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#setGroupsOfUser(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User, java.lang.Integer[]) + */ public void setGroupsOfUser(String token, User user, Integer[] groupsIds) { checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#saveGroup(java.lang.String, java.lang.String) + */ public Group saveGroup(String token, String name) { return (Group) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroup(java.lang.String, java.lang.Integer) + */ public Group getGroup(String token, Integer id) { return (Group) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroup(java.lang.String, java.lang.String) + */ public Group getGroup(String token, String name) { return (Group) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#updateGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group) + */ public Group updateGroup(String token, Group group) { return (Group) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#deleteGroup(java.lang.String, java.lang.Integer) + */ public void deleteGroup(String token, Integer id) { checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroups(java.lang.String) + */ public Group[] getGroups(String token) { return (Group[]) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroupsOwnedBy(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User) + */ public Group[] getGroupsOwnedBy(String token, User user) { return (Group[]) checkImplemented(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getLoggedUser(java.lang.String) + */ public User getLoggedUser(String token) { return (User) checkImplemented(); } + /** + * Check implemented. + * + * @return the object + */ private Object checkImplemented() { throw new IllegalStateException("not implemented"); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getPermissions(java.lang.String) + */ public Permission[] getPermissions(String uuid) { // TODO Auto-generated method stub return null; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.AuthenticationService#setPermissions(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Permission[]) + */ public void setPermissions(String uuid, Permission[] permissions) { // TODO Auto-generated method stub Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockStorageServiceImpl.java 2008-02-04 14:39:44 UTC (rev 626) @@ -31,18 +31,33 @@ import java.util.SortedMap; import java.util.TreeMap; -/** @author tony */ +/** + * The Class MockStorageServiceImpl. + * + * @author tony + */ public class MockStorageServiceImpl implements StorageService { + /** The Constant SIZE. */ static final int SIZE = 400; + /** The mock data. */ protected SortedMap<String, MetaData> mockData; + /** The mock data index. */ protected List<String> mockDataIndex; + /** The meta generator. */ protected MetaDataGenerator metaGenerator; + + /** The generator. */ protected ElementGenerator generator; + /** + * Mock data. + * + * @return the sorted map< string, meta data> + */ public SortedMap<String, MetaData> mockData() { if (mockData == null) { mockData = new TreeMap<String, MetaData>(); @@ -58,57 +73,113 @@ return mockData; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#commit() + */ public void commit() throws SimExplorerServiceException { checkImplemented(); } + /** + * Check implemented. + * + * @return the object + */ private Object checkImplemented() { throw new IllegalStateException("not implemented"); } - public MetaData saveElement(String token, RemoteInputStream zipRemoteStream) throws SimExplorerServiceException { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#saveElement(java.lang.String, com.healthmarketscience.rmiio.RemoteInputStream) + */ + public MetaData saveElement(String token, RemoteInputStream zipRemoteStream) + throws SimExplorerServiceException { return (MetaData) checkImplemented(); } - public MetaData saveElement(String token, RemoteInputStream xmlRemoteStream, Map<String, RemoteInputStream> attachmentsRemoteStream) throws SimExplorerServiceException { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#saveElement(java.lang.String, com.healthmarketscience.rmiio.RemoteInputStream, java.util.Map) + */ + public MetaData saveElement(String token, + RemoteInputStream xmlRemoteStream, + Map<String, RemoteInputStream> attachmentsRemoteStream) + throws SimExplorerServiceException { return (MetaData) checkImplemented(); } - public MetaData getMetadata(String token, String uuid) throws SimExplorerServiceException { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#getMetadata(java.lang.String, java.lang.String) + */ + public MetaData getMetadata(String token, String uuid) + throws SimExplorerServiceException { return mockData().get(uuid); } - public MetaData getMetadata(String token, String uuid, String version) throws SimExplorerServiceException { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#getMetadata(java.lang.String, java.lang.String, java.lang.String) + */ + public MetaData getMetadata(String token, String uuid, String version) + throws SimExplorerServiceException { return mockData().get(uuid); } - public RemoteInputStream exportElement(String token, String uuid, String version) throws SimExplorerServiceException { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#exportElement(java.lang.String, java.lang.String, java.lang.String) + */ + public RemoteInputStream exportElement(String token, String uuid, + String version) throws SimExplorerServiceException { return (RemoteInputStream) checkImplemented(); } - public RemoteInputStream exportFull(String token, String uuid, String version) throws SimExplorerServiceException { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#exportFull(java.lang.String, java.lang.String, java.lang.String) + */ + public RemoteInputStream exportFull(String token, String uuid, + String version) throws SimExplorerServiceException { return (RemoteInputStream) checkImplemented(); } - - public RemoteInputStream retrieveData(String token, String uuid, String version, String dataKey) throws SimExplorerServiceException { + + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#retrieveData(java.lang.String, java.lang.String, java.lang.String, java.lang.String) + */ + public RemoteInputStream retrieveData(String token, String uuid, + String version, String dataKey) throws SimExplorerServiceException { return null; } - public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerServiceException { - //TODO Changer + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#findFullTextCount(java.lang.String, java.lang.String, boolean) + */ + public int findFullTextCount(String token, String query, boolean onlyLatest) + throws SimExplorerServiceException { + // TODO Changer return findApplicationsCount(token, onlyLatest); } - public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count, int dateOrder) throws SimExplorerServiceException { - //TODO Changer + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#findFullText(java.lang.String, java.lang.String, boolean, int, int, int) + */ + public MetaData[] findFullText(String token, String query, + boolean onlyLatest, int indexStart, int count, int dateOrder) + throws SimExplorerServiceException { + // TODO Changer return findApplications(token, onlyLatest, indexStart, count, dateOrder); } - public int findApplicationsCount(String token, boolean onlyLatest) throws SimExplorerServiceException { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#findApplicationsCount(java.lang.String, boolean) + */ + public int findApplicationsCount(String token, boolean onlyLatest) + throws SimExplorerServiceException { return mockData().size(); } - public MetaData[] findApplications(String token, boolean onlyLatest, int start, int count, int dateOrder) throws SimExplorerServiceException { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#findApplications(java.lang.String, boolean, int, int, int) + */ + public MetaData[] findApplications(String token, boolean onlyLatest, + int start, int count, int dateOrder) + throws SimExplorerServiceException { int last = start + count; System.out.println("ask data from " + start + " width:" + count); SortedMap<String, MetaData> map = mockData(); @@ -123,9 +194,14 @@ return result; } - public LoggableElement getElement(String token, String uuid, String version) throws SimExplorerServiceException { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#getElement(java.lang.String, java.lang.String, java.lang.String) + */ + public LoggableElement getElement(String token, String uuid, String version) + throws SimExplorerServiceException { try { - ExplorationApplication explorationApplication = getGenerator().generateRandomEA(); + ExplorationApplication explorationApplication = getGenerator() + .generateRandomEA(); explorationApplication.getMetaData().setUuid(uuid); explorationApplication.getMetaData().setVersion(version); return explorationApplication; @@ -134,10 +210,14 @@ } } - public MetaData[] getVersions(String token, String uuid) throws SimExplorerServiceException { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#getVersions(java.lang.String, java.lang.String) + */ + public MetaData[] getVersions(String token, String uuid) + throws SimExplorerServiceException { MetaData meta = mockData().get(uuid); Version version; - if (meta==null) { + if (meta == null) { version = Version.valueOf("1.0"); } else { version = meta.getVersion(); @@ -145,13 +225,23 @@ return getMetaGenerator().generateVersionnedMetaData(version); } - public String loginUser(String login, String password) throws SimExplorerServiceException { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#loginUser(java.lang.String, java.lang.String) + */ + public String loginUser(String login, String password) + throws SimExplorerServiceException { if (login == null) { - throw new SimExplorerServiceException(new NullPointerException("login can not be null")); + throw new SimExplorerServiceException(new NullPointerException( + "login can not be null")); } return "password"; } + /** + * Gets the generator. + * + * @return the generator + */ protected ElementGenerator getGenerator() { if (generator == null) { generator = new ElementGenerator(); @@ -159,6 +249,11 @@ return generator; } + /** + * Gets the meta generator. + * + * @return the meta generator + */ public MetaDataGenerator getMetaGenerator() { if (metaGenerator == null) { metaGenerator = new MetaDataGenerator(); @@ -166,11 +261,17 @@ return metaGenerator; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#deleteElement(java.lang.String, java.lang.String, java.lang.String) + */ public void deleteElement(String token, String uuid, String version) { // TODO Auto-generated method stub } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#deleteElement(java.lang.String, java.lang.String) + */ public void deleteElement(String token, String uuid) { // TODO Auto-generated method stub Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/SimExplorerServiceException.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/SimExplorerServiceException.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/SimExplorerServiceException.java 2008-02-04 14:39:44 UTC (rev 626) @@ -20,23 +20,49 @@ /** * Exception de base pour toute erreur rencontrée dans un service. - * + * * @author chemit */ public class SimExplorerServiceException extends Exception { + + /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1054522404126322604L; + /** + * Instantiates a new sim explorer service exception. + */ public SimExplorerServiceException() { + // nothing yet } + /** + * Instantiates a new sim explorer service exception. + * + * @param cause + * the cause + */ public SimExplorerServiceException(Throwable cause) { super(cause); } + /** + * Instantiates a new sim explorer service exception. + * + * @param message + * the message + */ public SimExplorerServiceException(String message) { super(message); } + /** + * Instantiates a new sim explorer service exception. + * + * @param message + * the message + * @param cause + * the cause + */ public SimExplorerServiceException(String message, Throwable cause) { super(message, cause); } Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageService.java 2008-02-04 14:39:44 UTC (rev 626) @@ -27,7 +27,7 @@ import fr.cemagref.simexplorer.is.entities.metadata.MetaData; /** - * Service interface + * Service interface. * * @author glandais */ @@ -35,201 +35,296 @@ public interface StorageService { /** - * Commit in storage + * Commit in storage. * * @throws SimExplorerServiceException + * the sim explorer service exception */ void commit() throws SimExplorerServiceException; /** - * Login user onto system Not used for local usages + * Login user onto system Not used for local usages. * * @param login * Login * @param password * Password + * * @return Token as logon evidence + * * @throws SimExplorerServiceException + * the sim explorer service exception */ String loginUser(String login, String password) throws SimExplorerServiceException; /** - * Save a remote element + * Save a remote element. * * @param token + * the token * @param zipRemoteStream * RIIO stream containing data inside a zip + * * @return Metadata of element imported + * * @throws SimExplorerServiceException + * the sim explorer service exception */ MetaData saveElement(String token, RemoteInputStream zipRemoteStream) throws SimExplorerServiceException; /** - * Save a remote element + * Save a remote element. * * @param token + * the token * @param xmlRemoteStream * RIIO stream containing XML Stream * @param attachmentsRemoteStream * RIIO stream containing attached data. Key matches metadata * attachment keys + * * @return Metadata of element saved + * * @throws SimExplorerServiceException + * the sim explorer service exception */ MetaData saveElement(String token, RemoteInputStream xmlRemoteStream, Map<String, RemoteInputStream> attachmentsRemoteStream) throws SimExplorerServiceException; /** - * Retrieve metadata (latest version) + * Retrieve metadata (latest version). * * @param token + * the token * @param uuid - * @return + * the uuid + * + * @return the metadata + * * @throws SimExplorerServiceException + * the sim explorer service exception */ MetaData getMetadata(String token, String uuid) throws SimExplorerServiceException; /** - * Retrieve metadata + * Retrieve metadata. * * @param token + * the token * @param uuid + * the uuid * @param version - * @return + * the version + * + * @return the metadata + * * @throws SimExplorerServiceException + * the sim explorer service exception */ MetaData getMetadata(String token, String uuid, String version) throws SimExplorerServiceException; /** - * Export XML of element to a remote stream + * Export XML of element to a remote stream. * * @param token + * the token * @param uuid + * the uuid * @param version + * the version + * * @return RMIIO stream with data + * * @throws SimExplorerServiceException + * the sim explorer service exception */ RemoteInputStream exportElement(String token, String uuid, String version) throws SimExplorerServiceException; /** - * Export full element to a remote stream as a zip + * Export full element to a remote stream as a zip. * * @param token + * the token * @param uuid + * the uuid * @param version + * the version + * * @return RMIIO stream with data + * * @throws SimExplorerServiceException + * the sim explorer service exception */ RemoteInputStream exportFull(String token, String uuid, String version) throws SimExplorerServiceException; /** - * Retrieve data related to an entity + * Retrieve data related to an entity. * * @param token + * the token * @param uuid + * the uuid * @param version + * the version * @param dataKey - * @return + * the data key + * + * @return the remote input stream + * * @throws SimExplorerServiceException + * the sim explorer service exception */ RemoteInputStream retrieveData(String token, String uuid, String version, String dataKey) throws SimExplorerServiceException; /** - * Retrieve number of elements matching query + * Retrieve number of elements matching query. * * @param token + * the token * @param query + * the query * @param onlyLatest - * @return + * the only latest + * + * @return the int + * * @throws SimExplorerServiceException + * the sim explorer service exception */ int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerServiceException; /** - * Find elements matching query + * Find elements matching query. * * @param token + * the token * @param query + * the query * @param onlyLatest + * the only latest * @param indexStart + * the index start * @param count + * the count * @param dateOrder - * @return + * the date order + * + * @return the meta data[] + * * @throws SimExplorerServiceException + * the sim explorer service exception */ - MetaData[] findFullText(String token, String query, - boolean onlyLatest, int indexStart, int count, int dateOrder) + MetaData[] findFullText(String token, String query, boolean onlyLatest, + int indexStart, int count, int dateOrder) throws SimExplorerServiceException; /** - * Retrieve number of applications + * Retrieve number of applications. * * @param token + * the token * @param onlyLatest - * @return + * the only latest + * + * @return the int + * * @throws SimExplorerServiceException + * the sim explorer service exception */ int findApplicationsCount(String token, boolean onlyLatest) throws SimExplorerServiceException; /** - * Get a list of applications + * Get a list of applications. * * @param token + * the token * @param onlyLatest + * the only latest * @param start + * the start * @param count + * the count * @param dateOrder - * @return + * the date order + * + * @return the meta data[] + * * @throws SimExplorerServiceException + * the sim explorer service exception */ - MetaData[] findApplications(String token, boolean onlyLatest, - int start, int count, int dateOrder) - throws SimExplorerServiceException; + MetaData[] findApplications(String token, boolean onlyLatest, int start, + int count, int dateOrder) throws SimExplorerServiceException; /** - * Fully load an element + * Fully load an element. * * @param token + * the token * @param uuid + * the uuid * @param version - * @return + * the version + * + * @return the element + * * @throws SimExplorerServiceException + * the sim explorer service exception */ LoggableElement getElement(String token, String uuid, String version) throws SimExplorerServiceException; /** - * Get all version of an element + * Get all version of an element. * * @param token + * the token * @param uuid - * @return + * the uuid + * + * @return the versions + * * @throws SimExplorerServiceException + * the sim explorer service exception */ MetaData[] getVersions(String token, String uuid) throws SimExplorerServiceException; /** + * Delete element. + * * @param token + * the token * @param uuid + * the uuid * @param version + * the version + * + * @throws SimExplorerServiceException + * the sim explorer service exception */ void deleteElement(String token, String uuid, String version) throws SimExplorerServiceException; /** + * Delete element. + * * @param token + * the token * @param uuid + * the uuid + * + * @throws SimExplorerServiceException + * the sim explorer service exception */ void deleteElement(String token, String uuid) throws SimExplorerServiceException; Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceClient.java 2008-02-04 14:39:44 UTC (rev 626) @@ -21,17 +21,28 @@ import fr.cemagref.simexplorer.is.storage.engine.StorageEngine; import fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl; +/** + * The Class StorageServiceClient. + */ public class StorageServiceClient extends StorageServiceCommon { + /** The storage engine. */ private static StorageEngine storageEngine; + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#loginUser(java.lang.String, java.lang.String) + */ public String loginUser(String login, String password) throws SimExplorerServiceException { throw new SimExplorerServiceException("can not log to local service"); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageServiceCommon#getStorageEngine() + */ @Override - protected StorageEngine getStorageEngine() throws SimExplorerStorageException { + protected StorageEngine getStorageEngine() + throws SimExplorerStorageException { if (storageEngine == null) { storageEngine = new StorageEngineImpl(); storageEngine.open(); Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceCommon.java 2008-02-04 14:39:44 UTC (rev 626) @@ -48,17 +48,39 @@ import fr.cemagref.simexplorer.is.storage.engine.StorageEngine; import fr.cemagref.simexplorer.is.storage.util.ZipStreamEncoder; +/** + * The Class StorageServiceCommon. + */ public abstract class StorageServiceCommon implements StorageService, XmlConstants { + /** The Constant KEY_XML. */ private static final String KEY_XML = "_xml"; - protected abstract StorageEngine getStorageEngine() throws SimExplorerStorageException; + /** + * Gets the storage engine. + * + * @return the storage engine + * + * @throws SimExplorerStorageException + * the sim explorer storage exception + */ + protected abstract StorageEngine getStorageEngine() + throws SimExplorerStorageException; + /** + * Close. + * + * @throws Exception + * the exception + */ public void close() throws Exception { getStorageEngine().close(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#commit() + */ public void commit() throws SimExplorerServiceException { try { getStorageEngine().commit(); @@ -67,6 +89,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#saveElement(java.lang.String, com.healthmarketscience.rmiio.RemoteInputStream) + */ public MetaData saveElement(String token, RemoteInputStream zipRemoteStream) throws SimExplorerServiceException { InputStream zipStream; @@ -78,6 +103,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#saveElement(java.lang.String, com.healthmarketscience.rmiio.RemoteInputStream, java.util.Map) + */ public MetaData saveElement(String token, RemoteInputStream xmlRemoteStream, Map<String, RemoteInputStream> attachmentsRemoteStream) @@ -98,6 +126,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#getMetadata(java.lang.String, java.lang.String) + */ public MetaData getMetadata(String token, String uuid) throws SimExplorerServiceException { try { @@ -107,6 +138,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#getMetadata(java.lang.String, java.lang.String, java.lang.String) + */ public MetaData getMetadata(String token, String uuid, String version) throws SimExplorerServiceException { try { @@ -117,6 +151,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#findFullText(java.lang.String, java.lang.String, boolean, int, int, int) + */ public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count, int dateOrder) throws SimExplorerServiceException { @@ -128,6 +165,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#findFullTextCount(java.lang.String, java.lang.String, boolean) + */ public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerServiceException { try { @@ -138,6 +178,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#findApplicationsCount(java.lang.String, boolean) + */ public int findApplicationsCount(String token, boolean onlyLatest) throws SimExplorerServiceException { try { @@ -148,6 +191,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#findApplications(java.lang.String, boolean, int, int, int) + */ public MetaData[] findApplications(String token, boolean onlyLatest, int start, int count, int dateOrder) throws SimExplorerServiceException { @@ -160,6 +206,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#getElement(java.lang.String, java.lang.String, java.lang.String) + */ public LoggableElement getElement(String token, String uuid, String version) throws SimExplorerServiceException { MetaData mde = getMetadata(token, uuid, version); @@ -177,6 +226,19 @@ } } + /** + * Save element. + * + * @param token + * the token + * @param zipStream + * the zip stream + * + * @return the meta data + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ private MetaData saveElement(String token, InputStream zipStream) throws SimExplorerServiceException { String xmlFile = null; @@ -213,6 +275,21 @@ } } + /** + * Save element. + * + * @param token + * the token + * @param xmlFile + * the xml file + * @param attachments + * the attachments + * + * @return the meta data + * + * @throws Exception + * the exception + */ private MetaData saveElement(String token, InputStream xmlFile, Map<String, InputStream> attachments) throws Exception { // Store temporary data @@ -231,6 +308,9 @@ return elementSaved; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#retrieveData(java.lang.String, java.lang.String, java.lang.String, java.lang.String) + */ public RemoteInputStream retrieveData(String token, String uuid, String version, String dataKey) throws SimExplorerServiceException { try { @@ -247,6 +327,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#exportElement(java.lang.String, java.lang.String, java.lang.String) + */ public RemoteInputStream exportElement(String token, String uuid, String version) throws SimExplorerServiceException { MetaData mde = getMetadata(token, uuid, version); @@ -264,6 +347,9 @@ } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#exportFull(java.lang.String, java.lang.String, java.lang.String) + */ public RemoteInputStream exportFull(String token, String uuid, String version) throws SimExplorerServiceException { LoggableElement element = getElement(token, uuid, version); @@ -304,18 +390,25 @@ } /** - * Real implementation of saveElement + * Real implementation of saveElement. * * @param token + * the token * @param idxml + * the idxml * @param idsattachment - * @return + * the idsattachment + * + * @return the meta data + * * @throws Exception + * the exception */ private MetaData saveElement(String token, String idxml, Map<String, String> idsattachment) throws Exception { // Load metadata xml - MetaDataFactory mdeFactory = MetaDataFactory.getFactory(MetaData.class); + MetaDataFactory<MetaData> mdeFactory = MetaDataFactory + .getFactory(MetaData.class); MetaData metaData = mdeFactory .loadElementFromParentXML(getStorageEngine().retrieveTempData( idxml)); @@ -359,6 +452,23 @@ return metaData; } + /** + * Save sub elements. + * + * @param token + * the token + * @param idxml + * the idxml + * @param entitiesNode + * the entities node + * @param entityNode + * the entity node + * @param idsattachment + * the idsattachment + * + * @throws Exception + * the exception + */ private void saveSubElements(String token, String idxml, String entitiesNode, String entityNode, Map<String, String> idsattachment) throws Exception { @@ -385,6 +495,17 @@ } + /** + * Process version rules. + * + * @param token + * the token + * @param metaData + * the meta data + * + * @throws Exception + * the exception + */ private void processVersionRules(String token, MetaData metaData) throws Exception { @@ -408,6 +529,9 @@ } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#getVersions(java.lang.String, java.lang.String) + */ public MetaData[] getVersions(String token, String uuid) throws SimExplorerServiceException { try { @@ -419,6 +543,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#deleteElement(java.lang.String, java.lang.String, java.lang.String) + */ public void deleteElement(String token, String uuid, String version) throws SimExplorerServiceException { try { @@ -428,6 +555,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#deleteElement(java.lang.String, java.lang.String) + */ public void deleteElement(String token, String uuid) throws SimExplorerServiceException { try { Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/StorageServiceServer.java 2008-02-04 14:39:44 UTC (rev 626) @@ -27,25 +27,37 @@ import fr.cemagref.simexplorer.is.storage.engine.StorageEngine; import fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl; +/** + * The Class StorageServiceServer. + */ @Stateless(name = "StorageService") @Remote(StorageService.class) @RemoteBinding(jndiBinding = "StorageService") public class StorageServiceServer extends StorageServiceCommon { + /** The authentication service. */ @EJB private AuthenticationService authenticationService; + /** The storage engine. */ @EJB private StorageEngine storageEngine; + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageService#loginUser(java.lang.String, java.lang.String) + */ public String loginUser(String login, String password) throws SimExplorerServiceException { String token = authenticationService.loginUser(login, password); return token; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.service.StorageServiceCommon#getStorageEngine() + */ @Override - protected StorageEngine getStorageEngine() throws SimExplorerStorageException { + protected StorageEngine getStorageEngine() + throws SimExplorerStorageException { storageEngine.open(); return storageEngine; } Modified: trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java =================================================================== --- trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/storage/engine/StorageEngineSecuImpl.java 2008-02-04 14:39:44 UTC (rev 626) @@ -31,13 +31,20 @@ import fr.cemagref.simexplorer.is.security.entities.Permission; import fr.cemagref.simexplorer.is.storage.SimExplorerStorageException; +/** + * The Class StorageEngineSecuImpl. + */ @Stateless(name = "StorageEngine") @Local(StorageEngine.class) public class StorageEngineSecuImpl extends StorageEngineImpl { + /** The credential manager. */ @EJB private CredentialManager credentialManager; + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#deleteElement(java.lang.String, java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version) + */ @Override public void deleteElement(String token, String uuid, Version version) throws SimExplorerStorageException { @@ -50,6 +57,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#deleteElements(java.lang.String, java.lang.String) + */ @Override public void deleteElements(String token, String uuid) throws SimExplorerStorageException { @@ -62,6 +72,9 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#findElementsByType(java.lang.String, java.lang.String, boolean, int, int, int) + */ @Override public MetaData[] findElementsByType(String token, String type, boolean onlyLatest, int start, int count, int dateOrder) @@ -73,6 +86,9 @@ return list; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#findElementsByTypeCount(java.lang.String, java.lang.String, boolean) + */ @Override public int findElementsByTypeCount(String token, String type, boolean onlyLatest) throws SimExplorerStorageException { @@ -80,6 +96,9 @@ return super.findElementsByTypeCount(token, type, onlyLatest); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#findFullText(java.lang.String, java.lang.String, boolean, int, int, int) + */ @Override public MetaData[] findFullText(String token, String query, boolean onlyLatest, int indexStart, int count, int dateOrder) @@ -89,6 +108,9 @@ dateOrder); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#findFullTextCount(java.lang.String, java.lang.String, boolean) + */ @Override public int findFullTextCount(String token, String query, boolean onlyLatest) throws SimExplorerStorageException { @@ -96,6 +118,9 @@ return super.findFullTextCount(token, query, onlyLatest); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#getMetadata(java.lang.String, java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.Version) + */ @Override public MetaData getMetadata(String token, String uuid, Version version) throws SimExplorerStorageException { @@ -109,6 +134,9 @@ return mde; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#getMetadata(java.lang.String, java.lang.String) + */ @Override public MetaData getMetadata(String token, String uuid) throws SimExplorerStorageException { @@ -122,6 +150,9 @@ return mde; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#getVersions(java.lang.String, java.lang.String) + */ @Override public List<Version> getVersions(String token, String uuid) throws SimExplorerStorageException { @@ -135,9 +166,12 @@ return versions; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#retrieveData(java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.lang.String) + */ @Override - public InputStream retrieveData(String token, MetaData entity, - String field) throws SimExplorerStorageException { + public InputStream retrieveData(String token, MetaData entity, String field) + throws SimExplorerStorageException { InputStream stream; Permission permission = credentialManager.getPermission(token, entity .getUuid()); @@ -149,9 +183,13 @@ return stream; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.storage.engine.StorageEngineImpl#saveElement(java.lang.String, fr.cemagref.simexplorer.is.entities.metadata.MetaData, java.util.Map) + */ @Override public void saveElement(String token, MetaData element, - Map<String, InputStream> attachments) throws SimExplorerStorageException { + Map<String, InputStream> attachments) + throws SimExplorerStorageException { Permission permission = credentialManager.getPermission(token, element .getUuid()); if (permission != null && permission.isCanWrite()) { Modified: trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityEqualsTestCase.java =================================================================== --- trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityEqualsTestCase.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityEqualsTestCase.java 2008-02-04 14:39:44 UTC (rev 626) @@ -25,10 +25,17 @@ import junit.framework.TestCase; import fr.cemagref.simexplorer.is.security.entities.User; +/** + * The Class SecurityEqualsTestCase. + */ public class SecurityEqualsTestCase extends TestCase { + /** The authentication service. */ AuthenticationService authenticationService = null; + /* (non-Javadoc) + * @see junit.framework.TestCase#setUp() + */ @Override protected void setUp() throws Exception { super.setUp(); @@ -43,18 +50,25 @@ .lookup("AuthenticationService"); } - + + /** + * Test hash code. + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public void testHashCode() throws SimExplorerServiceException { - String token = authenticationService.loginUser("superadmin", "password"); + String token = authenticationService + .loginUser("superadmin", "password"); User[] users1 = authenticationService.getUsers(token); User[] users2 = authenticationService.getUsers(token); for (int i = 0; i < users1.length; i++) { User user1 = users1[i]; User user2 = users2[i]; System.out.println("User " + i + " :"); - System.out.println(user1.hashCode() + " " + user2.hashCode()); - assertEquals(user1.hashCode(),user2.hashCode()); - assertEquals(user1,user2); + System.out.println(user1.hashCode() + " " + user2.hashCode()); + assertEquals(user1.hashCode(), user2.hashCode()); + assertEquals(user1, user2); } } Modified: trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityTestCase.java =================================================================== --- trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityTestCase.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/SecurityTestCase.java 2008-02-04 14:39:44 UTC (rev 626) @@ -26,10 +26,17 @@ import fr.cemagref.simexplorer.is.security.entities.Group; import fr.cemagref.simexplorer.is.security.entities.User; +/** + * The Class SecurityTestCase. + */ public class SecurityTestCase extends TestCase { + /** The authentication service. */ AuthenticationService authenticationService = null; + /* (non-Javadoc) + * @see junit.framework.TestCase#setUp() + */ @Override protected void setUp() throws Exception { super.setUp(); @@ -45,6 +52,12 @@ } + /** + * Test security entities. + * + * @throws SimExplorerServiceException + * the sim explorer service exception + */ public void testSecurityEntities() throws SimExplorerServiceException { /* User user = authenticationService.getUser("user3"); Modified: trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceMassInsert.java =================================================================== --- trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceMassInsert.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceMassInsert.java 2008-02-04 14:39:44 UTC (rev 626) @@ -37,7 +37,6 @@ import com.healthmarketscience.rmiio.SimpleRemoteInputStream; import fr.cemagref.simexplorer.is.attachment.Attachment; -import fr.cemagref.simexplorer.is.attachment.ContentType; import fr.cemagref.simexplorer.is.entities.data.Component; import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication; import fr.cemagref.simexplorer.is.entities.data.ExplorationData; @@ -45,13 +44,23 @@ import fr.cemagref.simexplorer.is.factories.BaseEntityFactory; import fr.cemagref.simexplorer.is.factories.XmlConstants; +/** + * The Class StorageServiceMassInsert. + */ public class StorageServiceMassInsert extends TestCase { + /** The storage service. */ private StorageService storageService; + + /** The element generator. */ private ElementGenerator elementGenerator; + /** The r. */ private Random r = new Random(); + /* (non-Javadoc) + * @see junit.framework.TestCase#setUp() + */ @Override protected void setUp() throws Exception { super.setUp(); @@ -90,6 +99,12 @@ } */ + /** + * Test mass insert. + * + * @throws Exception + * the exception + */ public void testMassInsert() throws Exception { int c = 5; @@ -140,7 +155,8 @@ InputStream stream = elementGenerator.generateTextStream(); RemoteInputStreamServer remoteStream = new SimpleRemoteInputStream( stream); - attachments.put(attachment.getUniqueId(), remoteStream.export()); + attachments.put(attachment.getUniqueId(), remoteStream + .export()); } RemoteInputStreamServer xmlRemoteStream = new SimpleRemoteInputStream( Modified: trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceServerTest.java =================================================================== --- trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceServerTest.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceServerTest.java 2008-02-04 14:39:44 UTC (rev 626) @@ -25,10 +25,17 @@ import junit.framework.TestCase; import fr.cemagref.simexplorer.is.service.StorageService; +/** + * The Class StorageServiceServerTest. + */ public class StorageServiceServerTest extends TestCase { + /** The storage service. */ private StorageService storageService; + /* (non-Javadoc) + * @see junit.framework.TestCase#setUp() + */ @Override protected void setUp() throws Exception { super.setUp(); @@ -43,7 +50,10 @@ storageService = (StorageService) context.lookup("StorageService"); } - + + /** + * Test login. + */ public void testLogin() { try { String token = storageService.loginUser("superadmin", "password"); Modified: trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceTest.java =================================================================== --- trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceTest.java 2008-02-04 14:34:43 UTC (rev 625) +++ trunk/simexplorer-is-service/src/test/fr/cemagref/simexplorer/is/service/StorageServiceTest.java 2008-02-04 14:39:44 UTC (rev 626) @@ -34,11 +34,20 @@ import fr.cemagref.simexplorer.is.service.StorageService; import fr.cemagref.simexplorer.is.service.StorageServiceClient; +/** + * The Class StorageServiceTest. + */ public class StorageServiceTest extends TestCase { + /** The storage service. */ private StorageService storageService; + + /** The r. */ private Random r = new Random(); + /* (non-Javadoc) + * @see junit.framework.TestCase#setUp() + */ @Override protected void setUp() throws Exception { super.setUp(); @@ -46,11 +55,20 @@ storageService = new StorageServiceClient(); } + /* (non-Javadoc) + * @see junit.framework.TestCase#tearDown() + */ @Override protected void tearDown() throws Exception { super.tearDown(); } + /** + * Test insert element zip. + * + * @throws Exception + * the exception + */ public void testInsertElementZip() throws Exception { InputStream zipStream = new FileInputStream( "./src/ressources/testImport/test.zip"); @@ -61,6 +79,12 @@ assertNotNull(storageService.getMetadata(null, "abcd")); } + /** + * Test insert element streams. + * + * @throws Exception + * the exception + */ public void testInsertElementStreams() throws Exception { String id = UUID.randomUUID().toString(); String[] randomcontent = new String[2];
participants (1)
-
glandais@users.labs.libre-entreprise.org