From cfa2842e01aea29cfa65a98fb5840de5981645a8 Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Wed, 24 Jun 2009 11:28:44 +0000 Subject: [PATCH] [LMS-944] added usage of static constant value for max description length SVN: 11531 --- .../generic/shared/dto/AbstractTypePE.java | 3 +- .../generic/shared/dto/DataTypePE.java | 3 +- .../openbis/generic/shared/dto/EventPE.java | 5 +- .../openbis/generic/shared/dto/GroupPE.java | 3 +- .../generic/shared/dto/InvalidationPE.java | 3 +- .../generic/shared/dto/PropertyTypePE.java | 3 +- .../generic/shared/dto/VocabularyPE.java | 3 +- .../cisd/openbis/generic/SystemTestSuite.java | 1 - ...nericExperimentAttachmentDownloadTest.java | 57 +++++++++---------- 9 files changed, 43 insertions(+), 38 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AbstractTypePE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AbstractTypePE.java index 1f97d7eb8d4..2fe37b19423 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AbstractTypePE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AbstractTypePE.java @@ -27,6 +27,7 @@ import org.hibernate.validator.Length; import org.hibernate.validator.NotNull; import org.hibernate.validator.Pattern; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.shared.IServer; import ch.systemsx.cisd.openbis.generic.shared.dto.hibernate.SearchFieldConstants; @@ -57,7 +58,7 @@ public abstract class AbstractTypePE extends AbstractIdAndCodeHolder<AbstractTyp } @Column(name = ColumnNames.DESCRIPTION_COLUMN) - @Length(max = 250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) + @Length(max = GenericConstants.DESCRIPTION_250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) public String getDescription() { return description; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataTypePE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataTypePE.java index b0de652bdf4..407baa3ba25 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataTypePE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataTypePE.java @@ -37,6 +37,7 @@ import org.hibernate.validator.NotNull; import org.hibernate.validator.Pattern; import ch.systemsx.cisd.common.utilities.ModifiedShortPrefixToStringStyle; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.shared.IServer; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder; import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityDataType; @@ -91,7 +92,7 @@ public final class DataTypePE implements IIdHolder, Serializable, Comparable<Dat @NotNull(message = ValidationMessages.DESCRIPTION_NOT_NULL_MESSAGE) @Column(name = ColumnNames.DESCRIPTION_COLUMN) - @Length(max = 250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) + @Length(max = GenericConstants.DESCRIPTION_250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) public final String getDescription() { return description; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EventPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EventPE.java index 870960972c9..15acd03214b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EventPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EventPE.java @@ -36,6 +36,7 @@ import org.hibernate.validator.NotNull; import ch.rinn.restrictions.Friend; import ch.systemsx.cisd.common.utilities.ModifiedShortPrefixToStringStyle; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.shared.IServer; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder; @@ -119,7 +120,7 @@ public class EventPE extends HibernateAbstractRegistrationHolder implements IIdH this.identifier = identifier; } - @Length(max = 250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) + @Length(max = GenericConstants.DESCRIPTION_250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) public final String getDescription() { return description; @@ -130,7 +131,7 @@ public class EventPE extends HibernateAbstractRegistrationHolder implements IIdH this.description = description; } - @Length(max = 250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) + @Length(max = GenericConstants.DESCRIPTION_250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) public final String getReason() { return reason; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/GroupPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/GroupPE.java index 0ebb1ac62fc..9c92618b955 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/GroupPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/GroupPE.java @@ -42,6 +42,7 @@ import org.hibernate.validator.NotNull; import org.hibernate.validator.Pattern; import ch.systemsx.cisd.common.utilities.ModifiedShortPrefixToStringStyle; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.shared.IServer; import ch.systemsx.cisd.openbis.generic.shared.dto.hibernate.SearchFieldConstants; @@ -82,7 +83,7 @@ public final class GroupPE extends HibernateAbstractRegistrationHolder implement } @Column(name = ColumnNames.DESCRIPTION_COLUMN) - @Length(max = 250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) + @Length(max = GenericConstants.DESCRIPTION_250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) public final String getDescription() { return description; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/InvalidationPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/InvalidationPE.java index ffe60bda235..2d2a4133185 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/InvalidationPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/InvalidationPE.java @@ -31,6 +31,7 @@ import org.apache.commons.lang.builder.ToStringBuilder; import org.hibernate.validator.Length; import ch.systemsx.cisd.common.utilities.ModifiedShortPrefixToStringStyle; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.shared.IServer; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder; @@ -63,7 +64,7 @@ public class InvalidationPE extends HibernateAbstractRegistrationHolder implemen return id; } - @Length(max = 250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) + @Length(max = GenericConstants.DESCRIPTION_250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) public String getReason() { return reason; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/PropertyTypePE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/PropertyTypePE.java index 777af3286dd..70b55a0e785 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/PropertyTypePE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/PropertyTypePE.java @@ -41,6 +41,7 @@ import org.hibernate.validator.NotNull; import org.hibernate.validator.Pattern; import ch.systemsx.cisd.common.collections.UnmodifiableSetDecorator; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.shared.IServer; import ch.systemsx.cisd.openbis.generic.shared.dto.hibernate.InternalNamespace; @@ -188,7 +189,7 @@ public final class PropertyTypePE extends HibernateAbstractRegistrationHolder im @NotNull(message = ValidationMessages.DESCRIPTION_NOT_NULL_MESSAGE) @Column(name = ColumnNames.DESCRIPTION_COLUMN) - @Length(max = 250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) + @Length(max = GenericConstants.DESCRIPTION_250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) public final String getDescription() { return description; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyPE.java index c93b7b3e1ea..d9deb7af612 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyPE.java @@ -47,6 +47,7 @@ import org.hibernate.validator.Pattern; import ch.systemsx.cisd.common.collections.UnmodifiableSetDecorator; import ch.systemsx.cisd.common.utilities.ModifiedShortPrefixToStringStyle; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.shared.IServer; import ch.systemsx.cisd.openbis.generic.shared.dto.hibernate.InternalNamespace; @@ -146,7 +147,7 @@ public class VocabularyPE extends HibernateAbstractRegistrationHolder implements } @Column(name = ColumnNames.DESCRIPTION_COLUMN) - @Length(max = 250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) + @Length(max = GenericConstants.DESCRIPTION_250, message = ValidationMessages.DESCRIPTION_LENGTH_MESSAGE) public String getDescription() { return description; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/SystemTestSuite.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/SystemTestSuite.java index 6d49e81d3ae..92aa4b79fd4 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/SystemTestSuite.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/SystemTestSuite.java @@ -37,7 +37,6 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.SampleBrow import ch.systemsx.cisd.openbis.generic.client.web.client.application.SearchTest; import ch.systemsx.cisd.openbis.generic.client.web.client.application.VocabularyBrowserTest; import ch.systemsx.cisd.openbis.generic.client.web.client.application.VocabularyRegistrationTest; -import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.experiment.GenericExperimentAttachmentDownloadTest; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.experiment.GenericExperimentEditorTest; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.experiment.GenericExperimentViewerTest; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.sample.GenericSampleRegistrationTest; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentAttachmentDownloadTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentAttachmentDownloadTest.java index 77fb15da98d..9c03d02edad 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentAttachmentDownloadTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentAttachmentDownloadTest.java @@ -32,11 +32,11 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.experim import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.experiment.ShowExperiment; import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.AbstractDefaultTestCommand; import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.AbstractGWTTestCase; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; /** * @author Tomasz Pylak */ -@SuppressWarnings("unused") public class GenericExperimentAttachmentDownloadTest extends AbstractGWTTestCase { private static final String DEFAULT = "DEFAULT (CISD)"; @@ -53,34 +53,33 @@ public class GenericExperimentAttachmentDownloadTest extends AbstractGWTTestCase remoteConsole.prepare(new ShowExperiment(experimentCode)); } - // TODO 2009-06-24, Piotr Buczek: fix clicking on cell with anchor or add a download button - // public final void testDownloadAttachment() - // { - // prepareShowExperiment(DEFAULT, SIRNA_HCS, EXP_REUSE); - // // - // // Assumption: technicalId(CISD:/CISD/DEFAULT/EXP_REUSE) = 8 - // // - // remoteConsole.prepare(new ClickDownloadAttachmentCmdTest("cellPlates.txt", new TechId(8L))); - // - // // this callback will be used when the attempt to open an URL will occur - // OpenedUrlCallback openedUrlCallback = new OpenedUrlCallback(client.tryToGetViewContext()); - // UrlOpenedController controller = new UrlOpenedController(openedUrlCallback); - // - // remoteConsole.prepare(new CheckUrlContentCmdTest(openedUrlCallback, "3VCP1\n3VCP2\n3VCP3")); - // - // // wait for the command which fetches URL content to finish - // AbstractDefaultTestCommand waitForPrevCmd = new AbstractDefaultTestCommand() - // { - // public void execute() - // { - // } - // }; - // waitForPrevCmd.addCallbackClass(CheckStringsEqualCallback.class); - // remoteConsole.prepare(waitForPrevCmd); - // - // remoteConsole.finish(20000); - // client.onModuleLoad(controller); - // } + public final void testDownloadAttachment() + { + prepareShowExperiment(DEFAULT, SIRNA_HCS, EXP_REUSE); + // + // Assumption: technicalId(CISD:/CISD/DEFAULT/EXP_REUSE) = 8 + // + remoteConsole.prepare(new ClickDownloadAttachmentCmdTest("cellPlates.txt", new TechId(8L))); + + // this callback will be used when the attempt to open an URL will occur + OpenedUrlCallback openedUrlCallback = new OpenedUrlCallback(client.tryToGetViewContext()); + UrlOpenedController controller = new UrlOpenedController(openedUrlCallback); + + remoteConsole.prepare(new CheckUrlContentCmdTest(openedUrlCallback, "3VCP1\n3VCP2\n3VCP3")); + + // wait for the command which fetches URL content to finish + AbstractDefaultTestCommand waitForPrevCmd = new AbstractDefaultTestCommand() + { + public void execute() + { + } + }; + waitForPrevCmd.addCallbackClass(CheckStringsEqualCallback.class); + remoteConsole.prepare(waitForPrevCmd); + + remoteConsole.finish(20000); + client.onModuleLoad(controller); + } // called automatically by the controller when any URL is contacted private static class OpenedUrlCallback extends AbstractAsyncCallback<String> -- GitLab