Skip to content
Snippets Groups Projects
Commit 8af1bed1 authored by buczekp's avatar buczekp
Browse files

[LMS-980] fixed download attachment test; minor added download attachment button

SVN: 11577
parent 31a674aa
No related branches found
No related tags found
No related merge requests found
...@@ -330,6 +330,8 @@ public abstract class Dict ...@@ -330,6 +330,8 @@ public abstract class Dict
public static final String SHOW_ALL_VERSIONS = "show_all_versions"; public static final String SHOW_ALL_VERSIONS = "show_all_versions";
public static final String BUTTON_DOWNLOAD = "button_download";
public static final String BUTTON_SHOW_ALL_VERSIONS = "button_show_all_versions"; public static final String BUTTON_SHOW_ALL_VERSIONS = "button_show_all_versions";
public static final String NO_ATTACHMENTS_FOUND = "no_attachments_found"; public static final String NO_ATTACHMENTS_FOUND = "no_attachments_found";
...@@ -579,7 +581,7 @@ public abstract class Dict ...@@ -579,7 +581,7 @@ public abstract class Dict
public static final String TITLE_CHOOSE_EXPERIMENT = "TITLE_CHOOSE_EXPERIMENT"; public static final String TITLE_CHOOSE_EXPERIMENT = "TITLE_CHOOSE_EXPERIMENT";
public static final String INCORRECT_EXPERIMENT_SYNTAX = "incorrect_experiment_syntax"; public static final String INCORRECT_EXPERIMENT_SYNTAX = "incorrect_experiment_syntax";
public static final String TITLE_CHOOSE_SAMPLE = "title_choose_sample"; public static final String TITLE_CHOOSE_SAMPLE = "title_choose_sample";
// //
......
...@@ -90,7 +90,9 @@ public class AttachmentBrowser extends AbstractSimpleBrowserGrid<AttachmentVersi ...@@ -90,7 +90,9 @@ public class AttachmentBrowser extends AbstractSimpleBrowserGrid<AttachmentVersi
private static final String ID_PREFIX = GenericConstants.ID_PREFIX + PREFIX; private static final String ID_PREFIX = GenericConstants.ID_PREFIX + PREFIX;
private IDelegatedAction postRegistrationCallback; public static final String DOWNLOAD_BUTTON_ID_SUFFIX = "_download-button";
private final IDelegatedAction postRegistrationCallback;
public static IDisposableComponent create( public static IDisposableComponent create(
final IViewContext<ICommonClientServiceAsync> viewContext, final IViewContext<ICommonClientServiceAsync> viewContext,
...@@ -169,6 +171,12 @@ public class AttachmentBrowser extends AbstractSimpleBrowserGrid<AttachmentVersi ...@@ -169,6 +171,12 @@ public class AttachmentBrowser extends AbstractSimpleBrowserGrid<AttachmentVersi
{ {
addEntityOperationsLabel(); addEntityOperationsLabel();
String downloadTitle = viewContext.getMessage(Dict.BUTTON_DOWNLOAD);
Button downloadButton =
createSelectedItemButton(downloadTitle, asDownloadAttachmentInvoker());
downloadButton.setId(createBrowserId(attachmentHolder) + DOWNLOAD_BUTTON_ID_SUFFIX);
addButton(downloadButton);
String showAllVersionsTitle = viewContext.getMessage(Dict.BUTTON_SHOW_ALL_VERSIONS); String showAllVersionsTitle = viewContext.getMessage(Dict.BUTTON_SHOW_ALL_VERSIONS);
Button showAllVersionsButton = Button showAllVersionsButton =
createSelectedItemButton(showAllVersionsTitle, asShowEntityInvoker(false)); createSelectedItemButton(showAllVersionsTitle, asShowEntityInvoker(false));
...@@ -202,6 +210,20 @@ public class AttachmentBrowser extends AbstractSimpleBrowserGrid<AttachmentVersi ...@@ -202,6 +210,20 @@ public class AttachmentBrowser extends AbstractSimpleBrowserGrid<AttachmentVersi
addEntityOperationsSeparator(); addEntityOperationsSeparator();
} }
protected final ISelectedEntityInvoker<BaseEntityModel<AttachmentVersions>> asDownloadAttachmentInvoker()
{
return new ISelectedEntityInvoker<BaseEntityModel<AttachmentVersions>>()
{
public void invoke(BaseEntityModel<AttachmentVersions> selectedItem)
{
AttachmentVersions versions = selectedItem.getBaseObject();
final String fileName = versions.getCurrent().getFileName();
final int version = versions.getCurrent().getVersion();
downloadAttachment(fileName, version, attachmentHolder);
}
};
}
private Window createEditAttachmentDialog(final AttachmentVersions versions) private Window createEditAttachmentDialog(final AttachmentVersions versions)
{ {
final Attachment current = versions.getCurrent(); final Attachment current = versions.getCurrent();
......
...@@ -410,6 +410,7 @@ incorrect_experiment_syntax: "Incorrect experiment specification. Please provide ...@@ -410,6 +410,7 @@ incorrect_experiment_syntax: "Incorrect experiment specification. Please provide
version: "Version", version: "Version",
show_all_versions: "show all versions", show_all_versions: "show all versions",
button_show_all_versions: "Show All Versions", button_show_all_versions: "Show All Versions",
button_download: "Download",
// //
// Grid Column Chooser // Grid Column Chooser
......
...@@ -37,6 +37,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.SampleBrow ...@@ -37,6 +37,7 @@ 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.SearchTest;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.VocabularyBrowserTest; 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.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.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.experiment.GenericExperimentViewerTest;
import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.sample.GenericSampleRegistrationTest; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.sample.GenericSampleRegistrationTest;
...@@ -71,8 +72,7 @@ public class SystemTestSuite extends GWTTestSuite ...@@ -71,8 +72,7 @@ public class SystemTestSuite extends GWTTestSuite
testSuite.addTestSuite(EntityTypePropertyTypeAssignmentTest.class); testSuite.addTestSuite(EntityTypePropertyTypeAssignmentTest.class);
testSuite.addTestSuite(VocabularyRegistrationTest.class); testSuite.addTestSuite(VocabularyRegistrationTest.class);
testSuite.addTestSuite(PropertyTypeRegistrationTest.class); testSuite.addTestSuite(PropertyTypeRegistrationTest.class);
// TODO 2009-06-24, Piotr Buczek: fix clicking on cell with anchor or add a download button testSuite.addTestSuite(GenericExperimentAttachmentDownloadTest.class);
// testSuite.addTestSuite(GenericExperimentAttachmentDownloadTest.class);
testSuite.addTestSuite(ProjectRegistrationTest.class); testSuite.addTestSuite(ProjectRegistrationTest.class);
testSuite.addTestSuite(EntityTypeBrowserTest.class); testSuite.addTestSuite(EntityTypeBrowserTest.class);
return testSuite; return testSuite;
......
...@@ -30,17 +30,17 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.GWTTestU ...@@ -30,17 +30,17 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.GWTTestU
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
/** /**
* Simulates clicking on the specified attachment in the experiment info window. * Simulates downloading of the specified attachment in the experiment detail view.
* *
* @author Tomasz Pylak * @author Tomasz Pylak
*/ */
public class ClickDownloadAttachmentCmdTest extends AbstractDefaultTestCommand public class DownloadAttachment extends AbstractDefaultTestCommand
{ {
private final String fileName; private final String fileName;
private final TechId experimentId; private final TechId experimentId;
public ClickDownloadAttachmentCmdTest(final String fileName, final TechId experimentId) public DownloadAttachment(final String fileName, final TechId experimentId)
{ {
this.fileName = fileName; this.fileName = fileName;
this.experimentId = experimentId; this.experimentId = experimentId;
...@@ -56,6 +56,10 @@ public class ClickDownloadAttachmentCmdTest extends AbstractDefaultTestCommand ...@@ -56,6 +56,10 @@ public class ClickDownloadAttachmentCmdTest extends AbstractDefaultTestCommand
final Widget widget = GWTTestUtil.getWidgetWithID(attachmentGridId); final Widget widget = GWTTestUtil.getWidgetWithID(attachmentGridId);
final Grid<BaseEntityModel<AttachmentVersions>> table = final Grid<BaseEntityModel<AttachmentVersions>> table =
(Grid<BaseEntityModel<AttachmentVersions>>) widget; (Grid<BaseEntityModel<AttachmentVersions>>) widget;
GridTestUtils.fireSingleClick(table, AttachmentColDefKind.FILE_NAME.id(), fileName); GridTestUtils.fireSelectRow(table, AttachmentColDefKind.FILE_NAME.id(), fileName);
String downloadButtonId =
AttachmentBrowser.createBrowserId(experimentId, AttachmentHolderKind.EXPERIMENT)
+ AttachmentBrowser.DOWNLOAD_BUTTON_ID_SUFFIX;
GWTTestUtil.clickButtonWithID(downloadButtonId);
} }
} }
\ No newline at end of file
...@@ -59,7 +59,7 @@ public class GenericExperimentAttachmentDownloadTest extends AbstractGWTTestCase ...@@ -59,7 +59,7 @@ public class GenericExperimentAttachmentDownloadTest extends AbstractGWTTestCase
// //
// Assumption: technicalId(CISD:/CISD/DEFAULT/EXP_REUSE) = 8 // Assumption: technicalId(CISD:/CISD/DEFAULT/EXP_REUSE) = 8
// //
remoteConsole.prepare(new ClickDownloadAttachmentCmdTest("cellPlates.txt", new TechId(8L))); remoteConsole.prepare(new DownloadAttachment("cellPlates.txt", new TechId(8L)));
// this callback will be used when the attempt to open an URL will occur // this callback will be used when the attempt to open an URL will occur
OpenedUrlCallback openedUrlCallback = new OpenedUrlCallback(client.tryToGetViewContext()); OpenedUrlCallback openedUrlCallback = new OpenedUrlCallback(client.tryToGetViewContext());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment