Author: glandais Date: 2008-03-20 14:34:47 +0000 (Thu, 20 Mar 2008) New Revision: 1420 Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/random/ElementGenerator.java trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/random/StorageServiceGenerator.java Log: Generation update Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/random/ElementGenerator.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/random/ElementGenerator.java 2008-03-20 14:34:04 UTC (rev 1419) +++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/random/ElementGenerator.java 2008-03-20 14:34:47 UTC (rev 1420) @@ -386,4 +386,18 @@ return rs; } + + /** + * Generate version. + * + * @return the version + */ + public Version generateVersion() { + StringBuilder sb = new StringBuilder(); + for (int i = 0, size = 1+r.nextInt(3); i < size; i++) { + sb.append('.').append(r.nextInt(20)); + } + return Version.valueOf(sb.substring(1)); + } + } Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/random/StorageServiceGenerator.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/random/StorageServiceGenerator.java 2008-03-20 14:34:04 UTC (rev 1419) +++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/random/StorageServiceGenerator.java 2008-03-20 14:34:47 UTC (rev 1420) @@ -19,7 +19,6 @@ import fr.cemagref.simexplorer.is.factories.LoggableElementFactory; import fr.cemagref.simexplorer.is.service.StorageService; import fr.cemagref.simexplorer.is.service.random.ElementGenerator.RandomStream; -import fr.cemagref.simexplorer.is.storage.VersionGenerator; /** * The Class StorageServiceGenerator. Aimed to generate random elements for a service. @@ -35,15 +34,15 @@ /** * Save ea. * - * @param ea - * the ea - * @param computeAttachments - * the compute attachments + * @param ea the ea + * @param computeAttachments the compute attachments + * @param storageService the storage service + * @param token the token + * @param attachments the attachments * * @return the meta data * - * @throws Exception - * the exception + * @throws Exception the exception */ private LoggableElement saveEa(StorageService storageService, String token, ExplorationApplication ea, boolean computeAttachments, Map<Attachment, ElementGenerator.RandomStream> attachments) throws Exception { @@ -77,19 +76,15 @@ /** * Test version update. * - * @param firstVersion - * the first version - * @param secondVersion - * the second version - * @param different - * the different - * @param versions - * the versions + * @param firstVersion the first version + * @param secondVersion the second version + * @param different the different + * @param storageService the storage service + * @param token the token * * @return the string * - * @throws Exception - * the exception + * @throws Exception the exception */ public String generateTwoExplorationApplications(StorageService storageService, String token, String firstVersion, String secondVersion, boolean different) throws Exception { @@ -144,11 +139,20 @@ return ea.getMetaData().getUuid(); } + /** + * Generate lots exploration application. + * + * @param storageService the storage service + * @param token the token + * @param c the c + * + * @throws Exception the exception + */ public void generateLotsExplorationApplication(StorageService storageService, String token, int c) throws Exception { Random r = new Random(); for (int i = 0; i < c; i++) { - generateTwoExplorationApplications(storageService, token, VersionGenerator.getInstance().generateVersion().toString(), - VersionGenerator.getInstance().generateVersion().toString(), r.nextBoolean()); + generateTwoExplorationApplications(storageService, token, elementGenerator.generateVersion().toString(), + elementGenerator.generateVersion().toString(), r.nextBoolean()); } }