From 05cf4667f676390c9849ed5a52c33b3d92a6ecf2 Mon Sep 17 00:00:00 2001 From: anttil <anttil> Date: Fri, 26 Oct 2012 14:12:22 +0000 Subject: [PATCH] BIS-178 / SP-347: MetaProject information added to DataSet and Experiment DTOs + refactoring of tests. SVN: 27376 --- .../openbis/generic/server/CommonServer.java | 15 +- .../predicate/SampleListPredicate.java | 7 +- .../generic/shared/api/v1/Translator.java | 17 + .../generic/shared/basic/dto/Experiment.java | 2 +- .../generic/shared/api/v1/dto/DataSet.java | 33 ++ .../generic/shared/api/v1/dto/Experiment.java | 37 ++ .../cisd/openbis/uitest/dsl/Application.java | 105 +++--- .../EmptyTrash.java => dsl/Command.java} | 5 +- .../cisd/openbis/uitest/dsl/Executor.java | 113 ------- .../ListMetaProjects.java => dsl/Inject.java} | 17 +- .../cisd/openbis/uitest/dsl/SeleniumTest.java | 316 ++++-------------- .../{request/Request.java => dsl/Ui.java} | 5 +- .../cisd/openbis/uitest/dsl/type/Builder.java | 3 +- .../uitest/dsl/type/DataSetBuilder.java | 11 +- .../uitest/dsl/type/DataSetTypeBuilder.java | 7 +- .../uitest/dsl/type/ExperimentBuilder.java | 26 +- .../dsl/type/ExperimentTypeBuilder.java | 19 +- .../uitest/dsl/type/MaterialBuilder.java | 72 ++++ .../openbis/uitest/dsl/type/MaterialDsl.java | 72 ++++ .../uitest/dsl/type/MaterialTypeBuilder.java | 52 +++ .../type/MaterialTypeDsl.java} | 16 +- .../uitest/dsl/type/MetaProjectBuilder.java | 18 +- .../uitest/dsl/type/ProjectBuilder.java | 21 +- .../type/PropertyTypeAssignmentBuilder.java | 22 +- .../uitest/dsl/type/PropertyTypeBuilder.java | 19 +- .../uitest/dsl/type/SampleBuilder.java | 26 +- .../uitest/dsl/type/SampleTypeBuilder.java | 21 +- .../dsl/type/SampleTypeUpdateBuilder.java | 7 +- .../uitest/dsl/type/ScriptBuilder.java | 15 +- .../openbis/uitest/dsl/type/SpaceBuilder.java | 19 +- .../uitest/dsl/type/UpdateBuilder.java | 3 +- .../openbis/uitest/dsl/type/UserBuilder.java | 16 +- .../uitest/dsl/type/VocabularyBuilder.java | 9 +- .../uitest/gui/CreateExperimentGui.java | 22 +- .../uitest/gui/CreateExperimentTypeGui.java | 26 +- .../openbis/uitest/gui/CreateProjectGui.java | 21 +- .../gui/CreatePropertyTypeAssignmentGui.java | 23 +- .../uitest/gui/CreatePropertyTypeGui.java | 26 +- .../openbis/uitest/gui/CreateSampleGui.java | 21 +- .../uitest/gui/CreateSampleTypeGui.java | 25 +- .../openbis/uitest/gui/CreateScriptGui.java | 22 +- .../openbis/uitest/gui/CreateSpaceGui.java | 24 +- .../uitest/gui/CreateVocabularyGui.java | 22 +- .../uitest/gui/DeleteExperimentTypeGui.java | 23 +- .../gui/DeleteExperimentsOfProjectGui.java | 25 +- .../openbis/uitest/gui/DeleteProjectGui.java | 24 +- .../uitest/gui/DeletePropertyTypeGui.java | 23 +- .../uitest/gui/DeleteSampleTypeGui.java | 23 +- .../openbis/uitest/gui/DeleteSpaceGui.java | 23 +- .../uitest/gui/DeleteVocabularyGui.java | 23 +- .../openbis/uitest/gui/EmptyTrashGui.java | 14 +- .../cisd/openbis/uitest/gui/LoginGui.java | 25 +- .../cisd/openbis/uitest/gui/LogoutGui.java | 18 +- .../uitest/gui/UpdateSampleTypeGui.java | 28 +- .../openbis/uitest/page/AddPropertyType.java | 10 + .../uitest/page/AssignSamplePropertyType.java | 11 +- .../uitest/page/RegisterExperiment.java | 9 + .../openbis/uitest/page/RegisterProject.java | 9 + .../openbis/uitest/page/RegisterSample.java | 9 + .../openbis/uitest/request/CreateDataSet.java | 37 -- .../uitest/request/CreateDataSetType.java | 37 -- .../uitest/request/CreateExperiment.java | 37 -- .../uitest/request/CreateExperimentType.java | 37 -- .../uitest/request/CreateMetaProject.java | 38 --- .../uitest/request/CreatePropertyType.java | 37 -- .../request/CreatePropertyTypeAssignment.java | 37 -- .../openbis/uitest/request/CreateSample.java | 37 -- .../uitest/request/CreateSampleType.java | 37 -- .../openbis/uitest/request/CreateScript.java | 37 -- .../openbis/uitest/request/CreateSpace.java | 37 -- .../openbis/uitest/request/CreateUser.java | 37 -- .../uitest/request/CreateVocabulary.java | 37 -- .../uitest/request/DeleteExperimentType.java | 37 -- .../request/DeleteExperimentsOfProject.java | 37 -- .../openbis/uitest/request/DeleteProject.java | 37 -- .../uitest/request/DeletePropertyType.java | 37 -- .../uitest/request/DeleteSampleType.java | 37 -- .../openbis/uitest/request/DeleteSpace.java | 37 -- .../uitest/request/DeleteVocabulary.java | 37 -- .../uitest/request/ListDataSetsOfSample.java | 41 --- .../uitest/request/ListExperiments.java | 53 --- .../request/ListSamplesOfExperiment.java | 41 --- .../cisd/openbis/uitest/request/Logout.java | 24 -- .../uitest/request/SearchForDataSets.java | 40 --- .../uitest/request/UpdateSampleType.java | 37 -- .../rmi/AddEntitiesToMetaProjectRmi.java | 60 +++- .../openbis/uitest/rmi/CreateDataSetRmi.java | 31 +- .../uitest/rmi/CreateDataSetTypeRmi.java | 26 +- .../uitest/rmi/CreateExperimentRmi.java | 33 +- .../uitest/rmi/CreateExperimentTypeRmi.java | 23 +- .../openbis/uitest/rmi/CreateMaterialRmi.java | 75 +++++ .../uitest/rmi/CreateMaterialTypeRmi.java | 57 ++++ .../uitest/rmi/CreateMetaProjectRmi.java | 26 +- .../openbis/uitest/rmi/CreateProjectRmi.java | 23 +- .../openbis/uitest/rmi/CreateSampleRmi.java | 36 +- .../uitest/rmi/CreateSampleTypeRmi.java | 36 +- .../openbis/uitest/rmi/CreateSpaceRmi.java | 23 +- .../openbis/uitest/rmi/CreateUserRmi.java | 23 +- .../uitest/rmi/ListDataSetsOfSampleRmi.java | 56 ++-- .../uitest/rmi/ListExperimentsRmi.java | 32 +- .../uitest/rmi/ListMetaProjectsRmi.java | 15 +- .../rmi/ListSamplesOfExperimentRmi.java | 28 +- .../uitest/rmi/SearchForDataSetsRmi.java | 28 +- .../uitest/rmi/SearchForSamplesRmi.java | 28 +- .../openbis/uitest/rmi/eager/DataSetRmi.java | 5 +- .../uitest/rmi/eager/ExperimentRmi.java | 17 +- ...DataSetsContainMetaProjectInformation.java | 6 +- ...erimentsContainMetaProjectInformation.java | 4 +- ...terialsContainMetaProjectInformation.java} | 34 +- .../metaproject/MetaProjectCreation.java | 6 +- .../SamplesContainMetaProjectInformation.java | 4 +- .../CreateProject.java => type/Material.java} | 29 +- .../Login.java => type/MaterialType.java} | 27 +- .../cisd/openbis/uitest/widget/DropDown.java | 5 + 114 files changed, 1632 insertions(+), 1816 deletions(-) rename ui-test/source/java/ch/systemsx/cisd/openbis/uitest/{request/EmptyTrash.java => dsl/Command.java} (86%) delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Executor.java rename ui-test/source/java/ch/systemsx/cisd/openbis/uitest/{request/ListMetaProjects.java => dsl/Inject.java} (67%) rename ui-test/source/java/ch/systemsx/cisd/openbis/uitest/{request/Request.java => dsl/Ui.java} (87%) create mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialBuilder.java create mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialDsl.java create mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialTypeBuilder.java rename ui-test/source/java/ch/systemsx/cisd/openbis/uitest/{request/SearchForSamples.java => dsl/type/MaterialTypeDsl.java} (71%) delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateDataSet.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateDataSetType.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateExperiment.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateExperimentType.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateMetaProject.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreatePropertyType.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreatePropertyTypeAssignment.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateSample.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateSampleType.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateScript.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateSpace.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateUser.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateVocabulary.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteExperimentType.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteExperimentsOfProject.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteProject.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeletePropertyType.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteSampleType.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteSpace.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteVocabulary.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListDataSetsOfSample.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListExperiments.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListSamplesOfExperiment.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/Logout.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/SearchForDataSets.java delete mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/UpdateSampleType.java create mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateMaterialRmi.java create mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateMaterialTypeRmi.java rename ui-test/source/java/ch/systemsx/cisd/openbis/uitest/{request/AddEntitiesToMetaProject.java => suite/metaproject/MaterialsContainMetaProjectInformation.java} (53%) rename ui-test/source/java/ch/systemsx/cisd/openbis/uitest/{request/CreateProject.java => type/Material.java} (52%) rename ui-test/source/java/ch/systemsx/cisd/openbis/uitest/{request/Login.java => type/MaterialType.java} (55%) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java index 97a9a9cabac..160e643fbc5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java @@ -914,7 +914,6 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt experimentTable.load(experimentType.getCode(), spaceIdentifierOrNull); } final List<ExperimentPE> experiments = experimentTable.getExperiments(); - final Collection<MetaprojectAssignmentPE> assignmentPEs = getDAOFactory() .getMetaprojectDAO() @@ -924,7 +923,6 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind.EXPERIMENT); Map<Long, Set<Metaproject>> assignments = MetaprojectTranslator.translateMetaprojectAssignments(assignmentPEs); - Collections.sort(experiments); return ExperimentTranslator.translate(experiments, session.getBaseIndexURL(), assignments); } @@ -1326,11 +1324,22 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt final Set<DataPE> resultSet = new LinkedHashSet<DataPE>(); // TODO 2009-08-17, Piotr Buczek: [LMS-1149] optimize performance addRelatedDataSets(resultSet, relatedEntities.getEntities()); + + IMetaprojectDAO mpd = this.getDAOFactory().getMetaprojectDAO(); + + Collection<MetaprojectAssignmentPE> assignments = + mpd.listMetaprojectAssignmentsForEntities(session.tryGetPerson(), resultSet, + ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind.DATA_SET); + + Map<Long, Set<Metaproject>> translation = + MetaprojectTranslator.translateMetaprojectAssignments(assignments); + final List<ExternalData> list = new ArrayList<ExternalData>(resultSet.size()); for (final DataPE hit : resultSet) { HibernateUtils.initialize(hit.getChildRelationships()); - list.add(DataSetTranslator.translate(hit, session.getBaseIndexURL(), withDetails, null)); + list.add(DataSetTranslator.translate(hit, session.getBaseIndexURL(), withDetails, + translation.get(hit.getId()))); } return list; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleListPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleListPredicate.java index be9511988d0..f3f1ef5066f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleListPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleListPredicate.java @@ -40,9 +40,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifierFa import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleOwnerIdentifier; /** - * A predicate for lists of entities of {@link Sample}s. This - * predicate authorizes for read-only access, i.e. it will allow access to shared samples for all - * users. + * A predicate for lists of entities of {@link Sample}s. This predicate authorizes for read-only + * access, i.e. it will allow access to shared samples for all users. * <p> * <i>This is an internal class. Do not use it as a user of the API.</i> * @@ -136,7 +135,7 @@ public class SampleListPredicate extends AbstractSpacePredicate<List<Sample>> private final static int ARRAY_SIZE_LIMIT = 999; - interface ISampleToSpaceQuery extends BaseQuery + public static interface ISampleToSpaceQuery extends BaseQuery { @Select(sql = "select distinct space_id from samples where id = any(?{1}) " + "union select distinct space_id from samples where perm_id = any(?{2})", parameterBindings = diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/Translator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/Translator.java index af232fedeea..f39dec29c6c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/Translator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/Translator.java @@ -61,6 +61,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.LinkDataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.LinkDataSetUrl; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Metaproject; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy.RoleCode; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy.RoleLevel; @@ -185,6 +186,14 @@ public class Translator translateRegistrationDetailsWithModificationDate(privateExperiment); initializer.setRegistrationDetails(registrationDetails); + if (privateExperiment.getMetaprojects() != null) + { + for (Metaproject metaproject : privateExperiment.getMetaprojects()) + { + initializer.addMetaproject(metaproject); + } + } + return new Experiment(initializer); } @@ -419,6 +428,14 @@ public class Translator translateRegistrationDetailsWithModificationDate(externalDatum); initializer.setRegistrationDetails(registrationDetails); + if (externalDatum.getMetaprojects() != null) + { + for (Metaproject mp : externalDatum.getMetaprojects()) + { + initializer.addMetaproject(mp); + } + } + return new DataSet(initializer); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Experiment.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Experiment.java index 9ebece2b244..a0986632e5c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Experiment.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Experiment.java @@ -225,7 +225,7 @@ public class Experiment extends CodeWithRegistrationAndModificationDate<Experime return isStub; } - public Collection<Metaproject> getMetaprojecs() + public Collection<Metaproject> getMetaprojects() { return metaprojects; } diff --git a/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSet.java b/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSet.java index d591588580d..72fd5258859 100644 --- a/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSet.java +++ b/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSet.java @@ -31,10 +31,12 @@ import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; import ch.systemsx.cisd.base.annotation.JsonObject; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalDataManagementSystem; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Metaproject; /** * Immutable value object representing a data set. @@ -91,6 +93,8 @@ public final class DataSet implements Serializable, IIdHolder private HashMap<String, String> properties = new HashMap<String, String>(); + private List<Metaproject> metaprojects = new ArrayList<Metaproject>(); + private EntityRegistrationDetails registrationDetails; private boolean isStorageConfirmed = true; @@ -157,6 +161,16 @@ public final class DataSet implements Serializable, IIdHolder properties.put(propCode, value); } + public List<Metaproject> getMetaprojects() + { + return metaprojects; + } + + public void addMetaproject(Metaproject metaproject) + { + metaprojects.add(metaproject); + } + public void setRetrievedConnections(EnumSet<Connections> retrievedConnections) { this.retrievedConnections = @@ -301,6 +315,8 @@ public final class DataSet implements Serializable, IIdHolder private HashMap<String, String> properties; + private List<Metaproject> metaprojects; + // For handling connections to entities private EnumSet<Connections> retrievedConnections; @@ -344,6 +360,8 @@ public final class DataSet implements Serializable, IIdHolder this.properties = initializer.getProperties(); + this.metaprojects = initializer.getMetaprojects(); + this.parentCodes = initializer.getParentCodes(); this.childrenCodes = initializer.getChildrenCodes(); @@ -412,6 +430,15 @@ public final class DataSet implements Serializable, IIdHolder return properties; } + public List<Metaproject> getMetaprojects() throws IllegalArgumentException + { + if (metaprojects == null) + { + return new ArrayList<Metaproject>(); + } + return Collections.unmodifiableList(metaprojects); + } + public EnumSet<Connections> getRetrievedConnections() { return retrievedConnections; @@ -584,6 +611,12 @@ public final class DataSet implements Serializable, IIdHolder this.properties = properties; } + @JsonProperty("metaprojects") + private void setMetaprojectsJson(List<Metaproject> metaprojects) + { + this.metaprojects = metaprojects; + } + private void setRetrievedConnections(EnumSet<Connections> retrievedConnections) { this.retrievedConnections = retrievedConnections; diff --git a/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/Experiment.java b/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/Experiment.java index 6d2f343eab4..fa8a07da718 100644 --- a/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/Experiment.java +++ b/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/Experiment.java @@ -17,8 +17,10 @@ package ch.systemsx.cisd.openbis.generic.shared.api.v1.dto; import java.io.Serializable; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.apache.commons.lang.builder.EqualsBuilder; @@ -26,9 +28,12 @@ import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; +import com.fasterxml.jackson.annotation.JsonProperty; + import ch.systemsx.cisd.base.annotation.JsonObject; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifierHolder; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Metaproject; /** * Immutable value object representing an experiment. @@ -68,6 +73,8 @@ public final class Experiment implements Serializable, IIdentifierHolder, IIdHol private HashMap<String, String> properties = new HashMap<String, String>(); + private List<Metaproject> metaprojects = new ArrayList<Metaproject>(); + public void setId(Long id) { this.id = id; @@ -128,6 +135,16 @@ public final class Experiment implements Serializable, IIdentifierHolder, IIdHol properties.put(propCode, value); } + public List<Metaproject> getMetaprojects() + { + return metaprojects; + } + + public void addMetaproject(Metaproject metaproject) + { + metaprojects.add(metaproject); + } + public void setRegistrationDetails(EntityRegistrationDetails registrationDetails) { this.registrationDetails = registrationDetails; @@ -158,6 +175,8 @@ public final class Experiment implements Serializable, IIdentifierHolder, IIdHol private HashMap<String, String> properties; + private List<Metaproject> metaprojects; + private boolean isStub; /** @@ -189,6 +208,8 @@ public final class Experiment implements Serializable, IIdentifierHolder, IIdHol "Unspecified experiment type code."); this.experimentTypeCode = initializer.getExperimentTypeCode(); + this.metaprojects = initializer.getMetaprojects(); + InitializingChecks.checkValidRegistrationDetails(initializer.getRegistrationDetails(), "Unspecified entity registration details."); this.registrationDetails = initializer.getRegistrationDetails(); @@ -250,6 +271,15 @@ public final class Experiment implements Serializable, IIdentifierHolder, IIdHol return Collections.unmodifiableMap(properties); } + public List<Metaproject> getMetaprojects() throws IllegalArgumentException + { + if (metaprojects == null) + { + return new ArrayList<Metaproject>(); + } + return Collections.unmodifiableList(metaprojects); + } + public boolean isStub() { return isStub; @@ -344,4 +374,11 @@ public final class Experiment implements Serializable, IIdentifierHolder, IIdHol { this.isStub = isStub; } + + @JsonProperty("metaprojects") + private void setMetaprojectsJson(List<Metaproject> metaprojects) + { + this.metaprojects = metaprojects; + } + } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Application.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Application.java index 2391b3fe22c..f6779ae74b4 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Application.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Application.java @@ -16,8 +16,7 @@ package ch.systemsx.cisd.openbis.uitest.dsl; -import java.util.HashMap; -import java.util.Map; +import java.lang.reflect.Field; import ch.systemsx.cisd.common.spring.HttpInvokerUtils; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric; @@ -26,7 +25,6 @@ import ch.systemsx.cisd.openbis.generic.shared.IETLLIMSService; import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationChangingService; import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService; import ch.systemsx.cisd.openbis.plugin.generic.shared.IGenericServer; -import ch.systemsx.cisd.openbis.uitest.request.Request; import ch.systemsx.cisd.openbis.uitest.type.User; import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; @@ -35,9 +33,6 @@ import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; */ public class Application { - - private Map<String, Object> map; - private Pages pages; private ICommonServer commonServer; @@ -54,10 +49,10 @@ public class Application private IGeneralInformationChangingService generalInformationChangingService; + private User user; + public Application(String asUrl, String dssUrl, Pages pages) { - map = new HashMap<String, Object>(); - this.pages = pages; this.commonServer = HttpInvokerUtils.createServiceStub(ICommonServer.class, @@ -87,46 +82,78 @@ public class Application commonServer .tryToAuthenticate(SeleniumTest.ADMIN_USER, SeleniumTest.ADMIN_PASSWORD) .getSessionToken(); + this.user = new User() + { + @Override + public String getName() + { + return SeleniumTest.ADMIN_USER; + } + }; } - public Application() - { - map = new HashMap<String, Object>(); - } - - public <T extends Request<U>, U> void setExecutor(Class<? extends Request<U>> clazz, - Executor<T, U> execution) - { - map.put(clazz.getName(), execution); - } - - public void changeLogin(User user) + public void changeLogin(User newUser) { this.session = commonServer - .tryToAuthenticate(user.getName(), "pwd") + .tryToAuthenticate(newUser.getName(), "pwd") .getSessionToken(); + this.user = newUser; } - public <T extends Request<U>, U> U execute(T request) + public <T extends Command<U>, U> U execute(T command) { - - // There is no way to express this in type of field 'map'. - // But as the field 'map' is private and the methods manipulating it are defined to ensure - // this requirement, we can safely do the unchecked cast. - @SuppressWarnings("unchecked") - Executor<T, U> execution = - (Executor<T, U>) map.get(request.getClass().getName()); - execution.setApplicationRunner(this); - execution.setPages(pages); - execution.setCommonServer(commonServer); - execution.setDss(dss); - execution.setEtlService(etlService); - execution.setSession(session); - execution.setGenericServer(genericServer); - execution.setGeneralInformationService(generalInformationService); - execution.setGeneralInformationChangingService(generalInformationChangingService); - return execution.run(request); + for (Field field : command.getClass().getDeclaredFields()) + { + Inject inject = field.getAnnotation(Inject.class); + if (inject == null) + { + continue; + } + + Class<?> fieldType = field.getType(); + field.setAccessible(true); + try + { + if (fieldType.equals(ICommonServer.class)) + { + field.set(command, commonServer); + } else if (fieldType.equals(String.class)) + { + field.set(command, session); + } else if (fieldType.equals(Pages.class)) + { + field.set(command, pages); + } else if (fieldType.equals(User.class)) + { + field.set(command, user); + } else if (fieldType.equals(IGeneralInformationService.class)) + { + field.set(command, generalInformationService); + } else if (fieldType.equals(IGeneralInformationChangingService.class)) + { + field.set(command, generalInformationChangingService); + } else if (fieldType.equals(IGenericServer.class)) + { + field.set(command, genericServer); + } else if (fieldType.equals(IETLLIMSService.class)) + { + field.set(command, etlService); + } else if (fieldType.equals(IDssServiceRpcGeneric.class)) + { + field.set(command, dss); + } else + { + throw new UnsupportedOperationException(fieldType.getCanonicalName()); + } + } catch (Exception ex) + { + throw new RuntimeException(ex); + } + + } + + return command.execute(); } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/EmptyTrash.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Command.java similarity index 86% rename from ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/EmptyTrash.java rename to ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Command.java index 3bb315f27de..1165d196825 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/EmptyTrash.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Command.java @@ -14,11 +14,12 @@ * limitations under the License. */ -package ch.systemsx.cisd.openbis.uitest.request; +package ch.systemsx.cisd.openbis.uitest.dsl; /** * @author anttil */ -public class EmptyTrash implements Request<Void> +public interface Command<U> { + public U execute(); } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Executor.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Executor.java deleted file mode 100644 index 775d43d1816..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Executor.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.dsl; - -import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric; -import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; -import ch.systemsx.cisd.openbis.generic.shared.IETLLIMSService; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationChangingService; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService; -import ch.systemsx.cisd.openbis.plugin.generic.shared.IGenericServer; -import ch.systemsx.cisd.openbis.uitest.layout.Location; -import ch.systemsx.cisd.openbis.uitest.request.Request; -import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; - -/** - * @author anttil - */ -public abstract class Executor<T extends Request<U>, U> -{ - private Application openbis; - - protected ICommonServer commonServer; - - protected IETLLIMSService etlService; - - protected IGenericServer genericServer; - - protected IGeneralInformationService generalInformationService; - - protected IGeneralInformationChangingService generalInformationChangingService; - - protected IDssServiceRpcGeneric dss; - - protected String session; - - private Pages pages; - - abstract public U run(T request); - - protected <V> V load(Class<V> pageClass) - { - return pages.load(pageClass); - } - - protected <V> V goTo(Location<V> location) - { - return pages.goTo(location); - } - - protected <V> V execute(Request<V> function) - { - return openbis.execute(function); - } - - public void setPages(Pages pages) - { - this.pages = pages; - } - - public void setCommonServer(ICommonServer commonServer) - { - this.commonServer = commonServer; - } - - public void setEtlService(IETLLIMSService etlService) - { - this.etlService = etlService; - } - - public void setDss(IDssServiceRpcGeneric dss) - { - this.dss = dss; - } - - public void setSession(String session) - { - this.session = session; - } - - public void setApplicationRunner(Application openbis) - { - this.openbis = openbis; - } - - public void setGenericServer(IGenericServer genericServer) - { - this.genericServer = genericServer; - } - - public void setGeneralInformationService(IGeneralInformationService info) - { - this.generalInformationService = info; - } - - public void setGeneralInformationChangingService(IGeneralInformationChangingService change) - { - this.generalInformationChangingService = change; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListMetaProjects.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Inject.java similarity index 67% rename from ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListMetaProjects.java rename to ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Inject.java index 62368e64506..1174845c0cd 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListMetaProjects.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Inject.java @@ -14,16 +14,15 @@ * limitations under the License. */ -package ch.systemsx.cisd.openbis.uitest.request; +package ch.systemsx.cisd.openbis.uitest.dsl; -import java.util.List; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; -import ch.systemsx.cisd.openbis.uitest.type.MetaProject; - -/** - * @author anttil - */ -public class ListMetaProjects implements Request<List<MetaProject>> +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Inject { - } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/SeleniumTest.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/SeleniumTest.java index 48629017a95..4878bdf3a84 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/SeleniumTest.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/SeleniumTest.java @@ -57,6 +57,8 @@ import ch.systemsx.cisd.openbis.uitest.dsl.type.DataSetBuilder; import ch.systemsx.cisd.openbis.uitest.dsl.type.DataSetTypeBuilder; import ch.systemsx.cisd.openbis.uitest.dsl.type.ExperimentBuilder; import ch.systemsx.cisd.openbis.uitest.dsl.type.ExperimentTypeBuilder; +import ch.systemsx.cisd.openbis.uitest.dsl.type.MaterialBuilder; +import ch.systemsx.cisd.openbis.uitest.dsl.type.MaterialTypeBuilder; import ch.systemsx.cisd.openbis.uitest.dsl.type.MetaProjectBuilder; import ch.systemsx.cisd.openbis.uitest.dsl.type.ProjectBuilder; import ch.systemsx.cisd.openbis.uitest.dsl.type.PropertyTypeAssignmentBuilder; @@ -69,16 +71,6 @@ import ch.systemsx.cisd.openbis.uitest.dsl.type.SpaceBuilder; import ch.systemsx.cisd.openbis.uitest.dsl.type.UpdateBuilder; import ch.systemsx.cisd.openbis.uitest.dsl.type.UserBuilder; import ch.systemsx.cisd.openbis.uitest.dsl.type.VocabularyBuilder; -import ch.systemsx.cisd.openbis.uitest.gui.CreateExperimentGui; -import ch.systemsx.cisd.openbis.uitest.gui.CreateExperimentTypeGui; -import ch.systemsx.cisd.openbis.uitest.gui.CreateProjectGui; -import ch.systemsx.cisd.openbis.uitest.gui.CreatePropertyTypeAssignmentGui; -import ch.systemsx.cisd.openbis.uitest.gui.CreatePropertyTypeGui; -import ch.systemsx.cisd.openbis.uitest.gui.CreateSampleGui; -import ch.systemsx.cisd.openbis.uitest.gui.CreateSampleTypeGui; -import ch.systemsx.cisd.openbis.uitest.gui.CreateScriptGui; -import ch.systemsx.cisd.openbis.uitest.gui.CreateSpaceGui; -import ch.systemsx.cisd.openbis.uitest.gui.CreateVocabularyGui; import ch.systemsx.cisd.openbis.uitest.gui.DeleteExperimentTypeGui; import ch.systemsx.cisd.openbis.uitest.gui.DeleteExperimentsOfProjectGui; import ch.systemsx.cisd.openbis.uitest.gui.DeleteProjectGui; @@ -89,7 +81,6 @@ import ch.systemsx.cisd.openbis.uitest.gui.DeleteVocabularyGui; import ch.systemsx.cisd.openbis.uitest.gui.EmptyTrashGui; import ch.systemsx.cisd.openbis.uitest.gui.LoginGui; import ch.systemsx.cisd.openbis.uitest.gui.LogoutGui; -import ch.systemsx.cisd.openbis.uitest.gui.UpdateSampleTypeGui; import ch.systemsx.cisd.openbis.uitest.layout.Location; import ch.systemsx.cisd.openbis.uitest.layout.RegisterSampleLocation; import ch.systemsx.cisd.openbis.uitest.layout.SampleBrowserLocation; @@ -99,49 +90,8 @@ import ch.systemsx.cisd.openbis.uitest.page.Browsable; import ch.systemsx.cisd.openbis.uitest.page.BrowserRow; import ch.systemsx.cisd.openbis.uitest.page.RegisterSample; import ch.systemsx.cisd.openbis.uitest.page.SampleDetails; -import ch.systemsx.cisd.openbis.uitest.request.AddEntitiesToMetaProject; -import ch.systemsx.cisd.openbis.uitest.request.CreateDataSet; -import ch.systemsx.cisd.openbis.uitest.request.CreateDataSetType; -import ch.systemsx.cisd.openbis.uitest.request.CreateExperiment; -import ch.systemsx.cisd.openbis.uitest.request.CreateExperimentType; -import ch.systemsx.cisd.openbis.uitest.request.CreateMetaProject; -import ch.systemsx.cisd.openbis.uitest.request.CreateProject; -import ch.systemsx.cisd.openbis.uitest.request.CreatePropertyType; -import ch.systemsx.cisd.openbis.uitest.request.CreatePropertyTypeAssignment; -import ch.systemsx.cisd.openbis.uitest.request.CreateSample; -import ch.systemsx.cisd.openbis.uitest.request.CreateSampleType; -import ch.systemsx.cisd.openbis.uitest.request.CreateScript; -import ch.systemsx.cisd.openbis.uitest.request.CreateSpace; -import ch.systemsx.cisd.openbis.uitest.request.CreateUser; -import ch.systemsx.cisd.openbis.uitest.request.CreateVocabulary; -import ch.systemsx.cisd.openbis.uitest.request.DeleteExperimentType; -import ch.systemsx.cisd.openbis.uitest.request.DeleteExperimentsOfProject; -import ch.systemsx.cisd.openbis.uitest.request.DeleteProject; -import ch.systemsx.cisd.openbis.uitest.request.DeletePropertyType; -import ch.systemsx.cisd.openbis.uitest.request.DeleteSampleType; -import ch.systemsx.cisd.openbis.uitest.request.DeleteSpace; -import ch.systemsx.cisd.openbis.uitest.request.DeleteVocabulary; -import ch.systemsx.cisd.openbis.uitest.request.EmptyTrash; -import ch.systemsx.cisd.openbis.uitest.request.ListDataSetsOfSample; -import ch.systemsx.cisd.openbis.uitest.request.ListExperiments; -import ch.systemsx.cisd.openbis.uitest.request.ListMetaProjects; -import ch.systemsx.cisd.openbis.uitest.request.ListSamplesOfExperiment; -import ch.systemsx.cisd.openbis.uitest.request.Login; -import ch.systemsx.cisd.openbis.uitest.request.Logout; -import ch.systemsx.cisd.openbis.uitest.request.SearchForDataSets; -import ch.systemsx.cisd.openbis.uitest.request.SearchForSamples; -import ch.systemsx.cisd.openbis.uitest.request.UpdateSampleType; import ch.systemsx.cisd.openbis.uitest.rmi.AddEntitiesToMetaProjectRmi; -import ch.systemsx.cisd.openbis.uitest.rmi.CreateDataSetRmi; -import ch.systemsx.cisd.openbis.uitest.rmi.CreateDataSetTypeRmi; -import ch.systemsx.cisd.openbis.uitest.rmi.CreateExperimentRmi; -import ch.systemsx.cisd.openbis.uitest.rmi.CreateExperimentTypeRmi; -import ch.systemsx.cisd.openbis.uitest.rmi.CreateMetaProjectRmi; -import ch.systemsx.cisd.openbis.uitest.rmi.CreateProjectRmi; -import ch.systemsx.cisd.openbis.uitest.rmi.CreateSampleRmi; -import ch.systemsx.cisd.openbis.uitest.rmi.CreateSampleTypeRmi; -import ch.systemsx.cisd.openbis.uitest.rmi.CreateSpaceRmi; -import ch.systemsx.cisd.openbis.uitest.rmi.CreateUserRmi; +import ch.systemsx.cisd.openbis.uitest.rmi.Identifiers; import ch.systemsx.cisd.openbis.uitest.rmi.ListDataSetsOfSampleRmi; import ch.systemsx.cisd.openbis.uitest.rmi.ListExperimentsRmi; import ch.systemsx.cisd.openbis.uitest.rmi.ListMetaProjectsRmi; @@ -187,7 +137,9 @@ public abstract class SeleniumTest private static Application openbis; - private static Application defaultApplication; + private static Ui ui; + + private static Ui defaultUi; private static Pages pages; @@ -241,6 +193,8 @@ public abstract class SeleniumTest System.out.println("startPage: " + startPage); pages = new Pages(); + openbis = new Application(asUrl, dssUrl, pages); + } private void startWebDriver() @@ -337,9 +291,9 @@ public abstract class SeleniumTest f.delete(); } - public <T> T using(Application application, T t) + public <T> T using(Void anything, T t) { - openbis = defaultApplication; + ui = defaultUi; return t; } @@ -367,12 +321,12 @@ public abstract class SeleniumTest public void logout() { - openbis.execute(new Logout()); + openbis.execute(new LogoutGui()); } protected void login(String user, String password) { - openbis.execute(new Login(user, password)); + openbis.execute(new LoginGui(user, password)); } public String loggedInAs() @@ -418,7 +372,7 @@ public abstract class SeleniumTest protected List<MetaProject> listOfAllMetaProjects() { - return openbis.execute(new ListMetaProjects()); + return openbis.execute(new ListMetaProjectsRmi()); } protected Pages browser() @@ -489,7 +443,7 @@ public abstract class SeleniumTest protected void emptyTrash() { - openbis.execute(new EmptyTrash()); + openbis.execute(new EmptyTrashGui()); } public RegisterSample sampleRegistrationPageFor(SampleType type) @@ -563,50 +517,50 @@ public abstract class SeleniumTest return new CollectionContainsExactlyMatcher<T>(t); } - protected <T> T create(Builder<T> builder) + public <T> T create(Builder<T> builder) { - return builder.build(openbis); + return builder.build(openbis, ui); } protected <T> T assume(Builder<T> builder) { - return using(dummyApplication(), builder.build(openbis)); + return using(dummyApplication(), builder.build(openbis, ui)); } protected Void delete(Space space) { - openbis.execute(new DeleteSpace(space)); + openbis.execute(new DeleteSpaceGui(space)); return null; } protected void deleteExperimentsFrom(Project project) { - openbis.execute(new DeleteExperimentsOfProject(project)); + openbis.execute(new DeleteExperimentsOfProjectGui(project)); } protected void delete(Project project) { - openbis.execute(new DeleteProject(project)); + openbis.execute(new DeleteProjectGui(project)); } protected void delete(SampleType sampleType) { - openbis.execute(new DeleteSampleType(sampleType)); + openbis.execute(new DeleteSampleTypeGui(sampleType)); } protected void delete(ExperimentType experimentType) { - openbis.execute(new DeleteExperimentType(experimentType)); + openbis.execute(new DeleteExperimentTypeGui(experimentType)); } protected void delete(PropertyType propertyType) { - openbis.execute(new DeletePropertyType(propertyType)); + openbis.execute(new DeletePropertyTypeGui(propertyType)); } protected void delete(Vocabulary vocabulary) { - openbis.execute(new DeleteVocabulary(vocabulary)); + openbis.execute(new DeleteVocabularyGui(vocabulary)); } protected UserBuilder aUser() @@ -614,7 +568,7 @@ public abstract class SeleniumTest return new UserBuilder(uid); } - protected SpaceBuilder aSpace() + public SpaceBuilder aSpace() { return new SpaceBuilder(uid); } @@ -694,6 +648,16 @@ public abstract class SeleniumTest return new DataSetBuilder(uid); } + protected MaterialTypeBuilder aMaterialType() + { + return new MaterialTypeBuilder(uid); + } + + protected MaterialBuilder aMaterial() + { + return new MaterialBuilder(uid); + } + protected ScriptBuilder anEntityValidationScript() { return new ScriptBuilder(uid, ScriptType.ENTITY_VALIDATOR); @@ -716,195 +680,44 @@ public abstract class SeleniumTest protected void perform(UpdateBuilder builder) { - builder.update(openbis); + builder.update(openbis, ui); } - protected Void addTo(MetaProject metaProject, Entity... entities) + protected Void tagWith(MetaProject metaProject, Entity... entities) { - openbis.execute(new AddEntitiesToMetaProject(metaProject, Arrays.asList(entities))); + openbis.execute(new AddEntitiesToMetaProjectRmi(metaProject, Arrays.asList(entities))); return null; } - public Application publicApi() - { - Application application = new Application(asUrl, dssUrl, pages); - application.setExecutor(CreateSpace.class, new CreateSpaceRmi()); - application.setExecutor(CreateSampleType.class, new CreateSampleTypeRmi()); - application.setExecutor(CreateSample.class, new CreateSampleRmi()); - application.setExecutor(CreateDataSet.class, new CreateDataSetRmi()); - application.setExecutor(CreateDataSetType.class, new CreateDataSetTypeRmi()); - application.setExecutor(CreateMetaProject.class, new CreateMetaProjectRmi()); - application.setExecutor(CreateExperiment.class, new CreateExperimentRmi()); - application.setExecutor(CreateExperimentType.class, new CreateExperimentTypeRmi()); - application.setExecutor(CreateProject.class, new CreateProjectRmi()); - application.setExecutor(ListMetaProjects.class, new ListMetaProjectsRmi()); - application.setExecutor(AddEntitiesToMetaProject.class, new AddEntitiesToMetaProjectRmi()); - application.setExecutor(SearchForSamples.class, new SearchForSamplesRmi()); - application.setExecutor(ListSamplesOfExperiment.class, new ListSamplesOfExperimentRmi()); - application.setExecutor(ListExperiments.class, new ListExperimentsRmi()); - application.setExecutor(ListDataSetsOfSample.class, new ListDataSetsOfSampleRmi()); - application.setExecutor(SearchForDataSets.class, new SearchForDataSetsRmi()); - application.setExecutor(CreateUser.class, new CreateUserRmi()); - openbis = application; - return application; - } - - public Application dummyApplication() - { - Application application = new Application(); - application.setExecutor(CreateExperiment.class, - new Executor<CreateExperiment, Experiment>() - { - @Override - public Experiment run(CreateExperiment request) - { - return request.getExperiment(); - } - }); - application.setExecutor(CreateExperimentType.class, - new Executor<CreateExperimentType, ExperimentType>() - { - @Override - public ExperimentType run(CreateExperimentType request) - { - return request.getType(); - } - }); - application.setExecutor(CreateProject.class, - new Executor<CreateProject, Project>() - { - @Override - public Project run(CreateProject request) - { - return request.getProject(); - } - }); - application.setExecutor(CreatePropertyTypeAssignment.class, - new Executor<CreatePropertyTypeAssignment, PropertyTypeAssignment>() - { - @Override - public PropertyTypeAssignment run(CreatePropertyTypeAssignment request) - { - return request.getAssignment(); - } - }); - application.setExecutor(CreatePropertyType.class, - new Executor<CreatePropertyType, PropertyType>() - { - @Override - public PropertyType run(CreatePropertyType request) - { - return request.getType(); - } - }); - application.setExecutor(CreateSample.class, - new Executor<CreateSample, Sample>() - { - @Override - public Sample run(CreateSample request) - { - return request.getSample(); - } - }); - application.setExecutor(CreateSampleType.class, - new Executor<CreateSampleType, SampleType>() - { - @Override - public SampleType run(CreateSampleType request) - { - System.out.println("RETURNING SAMPLE TYPE " + request.getType()); - return request.getType(); - } - }); - application.setExecutor(CreateScript.class, - new Executor<CreateScript, Script>() - { - @Override - public Script run(CreateScript request) - { - return request.getScript(); - } - }); - application.setExecutor(CreateSpace.class, - new Executor<CreateSpace, Space>() - { - @Override - public Space run(CreateSpace request) - { - return request.getSpace(); - } - }); - application.setExecutor(CreateVocabulary.class, - new Executor<CreateVocabulary, Vocabulary>() - { - @Override - public Vocabulary run(CreateVocabulary request) - { - return request.getVocabulary(); - } - }); - application.setExecutor(CreateMetaProject.class, - new Executor<CreateMetaProject, MetaProject>() - { - @Override - public MetaProject run(CreateMetaProject request) - { - return request.getMetaProject(); - } - }); - application.setExecutor(CreateUser.class, new Executor<CreateUser, User>() - { - @Override - public User run(CreateUser request) - { - return request.getUser(); - } - }); - openbis = application; - return application; + public Void gui() + { + ui = Ui.WEB; + return null; + } + + public Void publicApi() + { + ui = Ui.PUBLIC_API; + return null; + } + + public Void dummyApplication() + { + ui = Ui.DUMMY; + return null; } protected void useGui() { startWebDriver(); - openbis = gui(); - defaultApplication = openbis; + ui = Ui.WEB; + defaultUi = ui; } protected void usePublicApi() { - openbis = publicApi(); - defaultApplication = openbis; - } - - public Application gui() - { - Application application = new Application(asUrl, dssUrl, pages); - application.setExecutor(CreateExperiment.class, new CreateExperimentGui()); - application.setExecutor(CreateExperimentType.class, new CreateExperimentTypeGui()); - application.setExecutor(CreateProject.class, new CreateProjectGui()); - application.setExecutor(CreatePropertyTypeAssignment.class, - new CreatePropertyTypeAssignmentGui()); - application.setExecutor(CreatePropertyType.class, new CreatePropertyTypeGui()); - application.setExecutor(CreateSample.class, new CreateSampleGui()); - application.setExecutor(CreateSampleType.class, new CreateSampleTypeGui()); - application.setExecutor(CreateScript.class, new CreateScriptGui()); - application.setExecutor(CreateSpace.class, new CreateSpaceGui()); - application.setExecutor(CreateVocabulary.class, new CreateVocabularyGui()); - application.setExecutor(DeleteExperimentsOfProject.class, - new DeleteExperimentsOfProjectGui()); - application.setExecutor(DeleteExperimentType.class, new DeleteExperimentTypeGui()); - application.setExecutor(DeleteProject.class, new DeleteProjectGui()); - application.setExecutor(DeletePropertyType.class, new DeletePropertyTypeGui()); - application.setExecutor(DeleteSampleType.class, new DeleteSampleTypeGui()); - application.setExecutor(DeleteSpace.class, new DeleteSpaceGui()); - application.setExecutor(DeleteVocabulary.class, new DeleteVocabularyGui()); - application.setExecutor(EmptyTrash.class, new EmptyTrashGui()); - application.setExecutor(Login.class, new LoginGui()); - application.setExecutor(Logout.class, new LogoutGui()); - application.setExecutor(UpdateSampleType.class, new UpdateSampleTypeGui()); - openbis = application; - return application; + ui = Ui.PUBLIC_API; + defaultUi = ui; } public static void mouseOver(WebElement element) @@ -922,7 +735,7 @@ public abstract class SeleniumTest public Sample searchSample(Sample sample) { - List<Sample> samples = openbis.execute(new SearchForSamples(sample.getCode())); + List<Sample> samples = openbis.execute(new SearchForSamplesRmi(sample.getCode())); if (samples.size() != 1) { throw new IllegalStateException("Got wrong amount of samples: " + samples); @@ -937,7 +750,8 @@ public abstract class SeleniumTest public Sample listSample(Sample sample) { - List<Sample> samples = openbis.execute(new ListSamplesOfExperiment(sample.getExperiment())); + List<Sample> samples = + openbis.execute(new ListSamplesOfExperimentRmi(sample.getExperiment())); if (samples.size() != 1) { throw new IllegalStateException("Got wrong amount of samples: " + samples); @@ -952,7 +766,8 @@ public abstract class SeleniumTest public Experiment listExperiment(Experiment experiment) { - List<Experiment> experiments = openbis.execute(new ListExperiments(experiment)); + List<Experiment> experiments = + openbis.execute(new ListExperimentsRmi(Identifiers.get(experiment).toString())); if (experiments.size() != 1) { throw new IllegalStateException("Got wrong amount of experiments: " + experiments); @@ -967,7 +782,7 @@ public abstract class SeleniumTest public DataSet listDataSet(DataSet dataSet) { - List<DataSet> dataSets = openbis.execute(new ListDataSetsOfSample(dataSet.getSample())); + List<DataSet> dataSets = openbis.execute(new ListDataSetsOfSampleRmi(dataSet.getSample())); if (dataSets.size() != 1) { throw new IllegalStateException("Got wrong amount of datasets: " + dataSets); @@ -982,7 +797,7 @@ public abstract class SeleniumTest public DataSet searchDataSet(DataSet dataSet) { - List<DataSet> dataSets = openbis.execute(new SearchForDataSets(dataSet.getCode())); + List<DataSet> dataSets = openbis.execute(new SearchForDataSetsRmi(dataSet.getCode())); if (dataSets.size() != 1) { throw new IllegalStateException("Got wrong amount of datasets: " + dataSets); @@ -999,4 +814,5 @@ public abstract class SeleniumTest { return entity.getMetaProjects(); } + } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/Request.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Ui.java similarity index 87% rename from ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/Request.java rename to ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Ui.java index fc8da4b4dfa..36b8e731587 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/Request.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/Ui.java @@ -14,11 +14,12 @@ * limitations under the License. */ -package ch.systemsx.cisd.openbis.uitest.request; +package ch.systemsx.cisd.openbis.uitest.dsl; /** * @author anttil */ -public interface Request<T> +public enum Ui { + WEB, PUBLIC_API, DUMMY } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/Builder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/Builder.java index 77dd20387c5..5abcb5e01c4 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/Builder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/Builder.java @@ -17,11 +17,12 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import ch.systemsx.cisd.openbis.uitest.dsl.Application; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; /** * @author anttil */ public interface Builder<T> { - public T build(Application openbis); + public T build(Application openbis, Ui ui); } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/DataSetBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/DataSetBuilder.java index 841601e2f5e..dd137aa969e 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/DataSetBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/DataSetBuilder.java @@ -19,7 +19,8 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import java.util.HashSet; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreateDataSet; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.rmi.CreateDataSetRmi; import ch.systemsx.cisd.openbis.uitest.type.DataSet; import ch.systemsx.cisd.openbis.uitest.type.DataSetType; import ch.systemsx.cisd.openbis.uitest.type.Experiment; @@ -67,19 +68,19 @@ public class DataSetBuilder implements Builder<DataSet> } @Override - public DataSet build(Application openbis) + public DataSet build(Application openbis, Ui ui) { if (type == null) { - type = new DataSetTypeBuilder(uid).build(openbis); + type = new DataSetTypeBuilder(uid).build(openbis, ui); } if (sample == null && experiment == null) { - sample = new SampleBuilder(uid).build(openbis); + sample = new SampleBuilder(uid).build(openbis, ui); } - return openbis.execute(new CreateDataSet(new DataSetDsl(type, sample, experiment, + return openbis.execute(new CreateDataSetRmi(new DataSetDsl(type, sample, experiment, new HashSet<MetaProject>()))); } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/DataSetTypeBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/DataSetTypeBuilder.java index 996979de257..77a6cb14fcb 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/DataSetTypeBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/DataSetTypeBuilder.java @@ -17,7 +17,8 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreateDataSetType; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.rmi.CreateDataSetTypeRmi; import ch.systemsx.cisd.openbis.uitest.type.DataSetType; import ch.systemsx.cisd.openbis.uitest.uid.UidGenerator; @@ -45,8 +46,8 @@ public class DataSetTypeBuilder implements Builder<DataSetType> } @Override - public DataSetType build(Application openbis) + public DataSetType build(Application openbis, Ui ui) { - return openbis.execute(new CreateDataSetType(new DataSetTypeDsl(code, description))); + return openbis.execute(new CreateDataSetTypeRmi(new DataSetTypeDsl(code, description))); } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ExperimentBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ExperimentBuilder.java index e66e2760914..35b1fe729d3 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ExperimentBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ExperimentBuilder.java @@ -21,7 +21,9 @@ import java.util.Collection; import java.util.HashSet; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreateExperiment; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.gui.CreateExperimentGui; +import ch.systemsx.cisd.openbis.uitest.rmi.CreateExperimentRmi; import ch.systemsx.cisd.openbis.uitest.type.Experiment; import ch.systemsx.cisd.openbis.uitest.type.ExperimentType; import ch.systemsx.cisd.openbis.uitest.type.MetaProject; @@ -84,19 +86,29 @@ public class ExperimentBuilder implements Builder<Experiment> } @Override - public Experiment build(Application openbis) + public Experiment build(Application openbis, Ui ui) { if (type == null) { - type = new ExperimentTypeBuilder(uid).build(openbis); + type = new ExperimentTypeBuilder(uid).build(openbis, ui); } if (project == null) { - project = new ProjectBuilder(uid).build(openbis); + project = new ProjectBuilder(uid).build(openbis, ui); } - return openbis - .execute(new CreateExperiment(new ExperimentDsl(type, code, project, samples, - new HashSet<MetaProject>()))); + Experiment experiment = + new ExperimentDsl(type, code, project, samples, new HashSet<MetaProject>()); + + if (Ui.WEB.equals(ui)) + { + return openbis.execute(new CreateExperimentGui(experiment)); + } else if (Ui.PUBLIC_API.equals(ui)) + { + return openbis.execute(new CreateExperimentRmi(experiment)); + } else + { + return experiment; + } } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ExperimentTypeBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ExperimentTypeBuilder.java index f88b1e9f973..25e0d3d8cd8 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ExperimentTypeBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ExperimentTypeBuilder.java @@ -17,7 +17,9 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreateExperimentType; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.gui.CreateExperimentTypeGui; +import ch.systemsx.cisd.openbis.uitest.rmi.CreateExperimentTypeRmi; import ch.systemsx.cisd.openbis.uitest.type.ExperimentType; import ch.systemsx.cisd.openbis.uitest.uid.UidGenerator; @@ -45,8 +47,19 @@ public class ExperimentTypeBuilder implements Builder<ExperimentType> } @Override - public ExperimentType build(Application openbis) + public ExperimentType build(Application openbis, Ui ui) { - return openbis.execute(new CreateExperimentType(new ExperimentTypeDsl(code, description))); + ExperimentType type = new ExperimentTypeDsl(code, description); + + if (Ui.WEB.equals(ui)) + { + return openbis.execute(new CreateExperimentTypeGui(type)); + } else if (Ui.PUBLIC_API.equals(ui)) + { + return openbis.execute(new CreateExperimentTypeRmi(type)); + } else + { + return type; + } } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialBuilder.java new file mode 100644 index 00000000000..27f7eb4cc7b --- /dev/null +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialBuilder.java @@ -0,0 +1,72 @@ +/* + * Copyright 2012 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.uitest.dsl.type; + +import java.util.Collection; +import java.util.HashSet; + +import ch.systemsx.cisd.openbis.uitest.dsl.Application; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.rmi.CreateMaterialRmi; +import ch.systemsx.cisd.openbis.uitest.type.Material; +import ch.systemsx.cisd.openbis.uitest.type.MaterialType; +import ch.systemsx.cisd.openbis.uitest.type.MetaProject; +import ch.systemsx.cisd.openbis.uitest.uid.UidGenerator; + +/** + * @author anttil + */ +public class MaterialBuilder implements Builder<Material> +{ + + private String code; + + private MaterialType materialType; + + @SuppressWarnings("unused") + private Collection<MetaProject> metaProjects; + + private UidGenerator uid; + + public MaterialBuilder(UidGenerator uid) + { + this.uid = uid; + this.code = uid.uid(); + } + + @Override + public Material build(Application openbis, Ui ui) + { + if (materialType == null) + { + materialType = new MaterialTypeBuilder(uid).build(openbis, ui); + } + + Material material = new MaterialDsl(code, materialType, new HashSet<MetaProject>()); + + if (Ui.WEB.equals(ui)) + { + throw new UnsupportedOperationException(); + } else if (Ui.PUBLIC_API.equals(ui)) + { + return openbis.execute(new CreateMaterialRmi(material)); + } else + { + return material; + } + } +} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialDsl.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialDsl.java new file mode 100644 index 00000000000..18b2a87ffbe --- /dev/null +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialDsl.java @@ -0,0 +1,72 @@ +/* + * Copyright 2012 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.uitest.dsl.type; + +import java.util.Collection; + +import ch.systemsx.cisd.openbis.uitest.type.Material; +import ch.systemsx.cisd.openbis.uitest.type.MaterialType; +import ch.systemsx.cisd.openbis.uitest.type.MetaProject; + +/** + * @author anttil + */ +public class MaterialDsl extends Material +{ + + private final String code; + + private MaterialType type; + + private Collection<MetaProject> metaProjects; + + public MaterialDsl(String code, MaterialType type, Collection<MetaProject> metaProjects) + { + this.code = code; + this.type = type; + this.metaProjects = metaProjects; + } + + @Override + public String getCode() + { + return code; + } + + @Override + public MaterialType getType() + { + return type; + } + + @Override + public Collection<MetaProject> getMetaProjects() + { + return metaProjects; + } + + void setType(MaterialType type) + { + this.type = type; + } + + void setMetaProjects(Collection<MetaProject> metaProjects) + { + this.metaProjects = metaProjects; + } + +} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialTypeBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialTypeBuilder.java new file mode 100644 index 00000000000..e127d944ffe --- /dev/null +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialTypeBuilder.java @@ -0,0 +1,52 @@ +/* + * Copyright 2012 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.uitest.dsl.type; + +import ch.systemsx.cisd.openbis.uitest.dsl.Application; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.rmi.CreateMaterialTypeRmi; +import ch.systemsx.cisd.openbis.uitest.type.MaterialType; +import ch.systemsx.cisd.openbis.uitest.uid.UidGenerator; + +/** + * @author anttil + */ +public class MaterialTypeBuilder implements Builder<MaterialType> +{ + private String code; + + public MaterialTypeBuilder(UidGenerator uid) + { + this.code = uid.uid(); + } + + @Override + public MaterialType build(Application openbis, Ui ui) + { + MaterialType type = new MaterialTypeDsl(code); + if (Ui.WEB.equals(ui)) + { + throw new UnsupportedOperationException(); + } else if (Ui.PUBLIC_API.equals(ui)) + { + return openbis.execute(new CreateMaterialTypeRmi(type)); + } else + { + return type; + } + } +} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/SearchForSamples.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialTypeDsl.java similarity index 71% rename from ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/SearchForSamples.java rename to ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialTypeDsl.java index 4be3071c5a0..1e387878144 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/SearchForSamples.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MaterialTypeDsl.java @@ -14,27 +14,27 @@ * limitations under the License. */ -package ch.systemsx.cisd.openbis.uitest.request; +package ch.systemsx.cisd.openbis.uitest.dsl.type; -import java.util.List; - -import ch.systemsx.cisd.openbis.uitest.type.Sample; +import ch.systemsx.cisd.openbis.uitest.type.MaterialType; /** * @author anttil */ -public class SearchForSamples implements Request<List<Sample>> +public class MaterialTypeDsl extends MaterialType { - private final String code; + public String code; - public SearchForSamples(String code) + public MaterialTypeDsl(String code) { this.code = code; } + @Override public String getCode() { - return code; + return this.code; } + } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MetaProjectBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MetaProjectBuilder.java index 7a08b7d776a..90fdf5fb5da 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MetaProjectBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/MetaProjectBuilder.java @@ -17,7 +17,8 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreateMetaProject; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.rmi.CreateMetaProjectRmi; import ch.systemsx.cisd.openbis.uitest.type.MetaProject; import ch.systemsx.cisd.openbis.uitest.uid.UidGenerator; @@ -44,9 +45,20 @@ public class MetaProjectBuilder implements Builder<MetaProject> } @Override - public MetaProject build(Application openbis) + public MetaProject build(Application openbis, Ui ui) { - return openbis.execute(new CreateMetaProject(new MetaProjectDsl(name, description))); + MetaProject metaProject = new MetaProjectDsl(name, description); + + if (Ui.WEB.equals(ui)) + { + throw new UnsupportedOperationException(); + } else if (Ui.PUBLIC_API.equals(ui)) + { + return openbis.execute(new CreateMetaProjectRmi(metaProject)); + } else + { + return metaProject; + } } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ProjectBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ProjectBuilder.java index 4091a1c6113..cad815c704f 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ProjectBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ProjectBuilder.java @@ -17,7 +17,9 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreateProject; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.gui.CreateProjectGui; +import ch.systemsx.cisd.openbis.uitest.rmi.CreateProjectRmi; import ch.systemsx.cisd.openbis.uitest.type.Project; import ch.systemsx.cisd.openbis.uitest.type.Space; import ch.systemsx.cisd.openbis.uitest.uid.UidGenerator; @@ -58,12 +60,23 @@ public class ProjectBuilder implements Builder<Project> } @Override - public Project build(Application openbis) + public Project build(Application openbis, Ui ui) { if (space == null) { - space = new SpaceBuilder(uid).build(openbis); + space = new SpaceBuilder(uid).build(openbis, ui); + } + + Project project = new ProjectDsl(code, description, space); + if (Ui.WEB.equals(ui)) + { + return openbis.execute(new CreateProjectGui(project)); + } else if (Ui.PUBLIC_API.equals(ui)) + { + return openbis.execute(new CreateProjectRmi(project)); + } else + { + return project; } - return openbis.execute(new CreateProject(new ProjectDsl(code, description, space))); } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/PropertyTypeAssignmentBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/PropertyTypeAssignmentBuilder.java index f1a31344a37..12ea2ad19f0 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/PropertyTypeAssignmentBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/PropertyTypeAssignmentBuilder.java @@ -17,7 +17,8 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreatePropertyTypeAssignment; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.gui.CreatePropertyTypeAssignmentGui; import ch.systemsx.cisd.openbis.uitest.type.PropertyType; import ch.systemsx.cisd.openbis.uitest.type.PropertyTypeAssignment; import ch.systemsx.cisd.openbis.uitest.type.PropertyTypeDataType; @@ -75,26 +76,29 @@ public class PropertyTypeAssignmentBuilder implements Builder<PropertyTypeAssign } @Override - public PropertyTypeAssignment build(Application openbis) + public PropertyTypeAssignment build(Application openbis, Ui ui) { if (propertyType == null) { propertyType = - new PropertyTypeBuilder(uid, PropertyTypeDataType.BOOLEAN).build(openbis); + new PropertyTypeBuilder(uid, PropertyTypeDataType.BOOLEAN).build(openbis, ui); } if (entityType == null) { - entityType = new SampleTypeBuilder(uid).build(openbis); + entityType = new SampleTypeBuilder(uid).build(openbis, ui); } PropertyTypeAssignment assignment = - openbis.execute( - new CreatePropertyTypeAssignment( - new PropertyTypeAssignmentDsl(propertyType, entityType, mandatory, - initialValue))); + new PropertyTypeAssignmentDsl(propertyType, entityType, mandatory, initialValue); + if (Ui.WEB.equals(ui)) + { + assignment = openbis.execute(new CreatePropertyTypeAssignmentGui(assignment)); + } else + { + throw new UnsupportedOperationException(); + } entityType.getPropertyTypeAssignments().add(assignment); return assignment; } - } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/PropertyTypeBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/PropertyTypeBuilder.java index 27383cfafba..a88c1477f5f 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/PropertyTypeBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/PropertyTypeBuilder.java @@ -17,7 +17,8 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreatePropertyType; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.gui.CreatePropertyTypeGui; import ch.systemsx.cisd.openbis.uitest.type.PropertyType; import ch.systemsx.cisd.openbis.uitest.type.PropertyTypeDataType; import ch.systemsx.cisd.openbis.uitest.type.Vocabulary; @@ -74,10 +75,20 @@ public class PropertyTypeBuilder implements Builder<PropertyType> } @Override - public PropertyType build(Application openbis) + public PropertyType build(Application openbis, Ui ui) { - return openbis.execute(new CreatePropertyType(new PropertyTypeDsl(code, label, description, - dataType, vocabulary))); + PropertyType type = new PropertyTypeDsl(code, label, description, dataType, vocabulary); + + if (Ui.WEB.equals(ui)) + { + return openbis.execute(new CreatePropertyTypeGui(type)); + } else if (Ui.PUBLIC_API.equals(ui)) + { + throw new UnsupportedOperationException(); + } else + { + return type; + } } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SampleBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SampleBuilder.java index a94982d8d90..1509dc8401b 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SampleBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SampleBuilder.java @@ -22,7 +22,9 @@ import java.util.HashSet; import java.util.Map; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreateSample; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.gui.CreateSampleGui; +import ch.systemsx.cisd.openbis.uitest.rmi.CreateSampleRmi; import ch.systemsx.cisd.openbis.uitest.type.Experiment; import ch.systemsx.cisd.openbis.uitest.type.MetaProject; import ch.systemsx.cisd.openbis.uitest.type.PropertyType; @@ -91,19 +93,19 @@ public class SampleBuilder implements Builder<Sample> } @Override - public Sample build(Application openbis) + public Sample build(Application openbis, Ui ui) { if (experiment != null) { space = experiment.getProject().getSpace(); } else if (space == null) { - space = new SpaceBuilder(uid).build(openbis); + space = new SpaceBuilder(uid).build(openbis, ui); } if (type == null) { - type = new SampleTypeBuilder(uid).build(openbis); + type = new SampleTypeBuilder(uid).build(openbis, ui); } for (PropertyTypeAssignment assignment : type.getPropertyTypeAssignments()) @@ -115,7 +117,19 @@ public class SampleBuilder implements Builder<Sample> } } - return openbis.execute(new CreateSample(new SampleDsl(type, code, experiment, space, - parents, properties, new HashSet<MetaProject>()))); + Sample sample = + new SampleDsl(type, code, experiment, space, parents, properties, + new HashSet<MetaProject>()); + + if (Ui.WEB.equals(ui)) + { + return openbis.execute(new CreateSampleGui(sample)); + } else if (Ui.PUBLIC_API.equals(ui)) + { + return openbis.execute(new CreateSampleRmi(sample)); + } else + { + return sample; + } } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SampleTypeBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SampleTypeBuilder.java index d87ec28196c..3fd2f013f80 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SampleTypeBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SampleTypeBuilder.java @@ -20,7 +20,9 @@ import java.util.Collection; import java.util.HashSet; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreateSampleType; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.gui.CreateSampleTypeGui; +import ch.systemsx.cisd.openbis.uitest.rmi.CreateSampleTypeRmi; import ch.systemsx.cisd.openbis.uitest.type.PropertyTypeAssignment; import ch.systemsx.cisd.openbis.uitest.type.SampleType; import ch.systemsx.cisd.openbis.uitest.uid.UidGenerator; @@ -97,12 +99,21 @@ public class SampleTypeBuilder implements Builder<SampleType> } @Override - public SampleType build(Application openbis) + public SampleType build(Application openbis, Ui ui) { - return openbis.execute(new CreateSampleType( + SampleType type = new SampleTypeDsl(code, description, listable, showsContainer, showsParents, hasUniqueSubcodes, generatesCodes, showsParentMetadata, - generatedCodePrefix, - propertyTypeAssignments))); + generatedCodePrefix, propertyTypeAssignments); + if (Ui.WEB.equals(ui)) + { + return openbis.execute(new CreateSampleTypeGui(type)); + } else if (Ui.PUBLIC_API.equals(ui)) + { + return openbis.execute(new CreateSampleTypeRmi(type)); + } else + { + return type; + } } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SampleTypeUpdateBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SampleTypeUpdateBuilder.java index 4fd14f00a24..a8d6f20a2d4 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SampleTypeUpdateBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SampleTypeUpdateBuilder.java @@ -17,7 +17,8 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.UpdateSampleType; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.gui.UpdateSampleTypeGui; import ch.systemsx.cisd.openbis.uitest.type.SampleType; /** @@ -46,8 +47,8 @@ public class SampleTypeUpdateBuilder implements UpdateBuilder } @Override - public void update(Application openbis) + public void update(Application openbis, Ui ui) { - openbis.execute(new UpdateSampleType(type)); + openbis.execute(new UpdateSampleTypeGui(type)); } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ScriptBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ScriptBuilder.java index 6dc457b55b9..a260acf0b0d 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ScriptBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/ScriptBuilder.java @@ -17,7 +17,8 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreateScript; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.gui.CreateScriptGui; import ch.systemsx.cisd.openbis.uitest.type.EntityKind; import ch.systemsx.cisd.openbis.uitest.type.Script; import ch.systemsx.cisd.openbis.uitest.type.ScriptType; @@ -56,10 +57,14 @@ public class ScriptBuilder implements Builder<Script> } @Override - public Script build(Application openbis) + public Script build(Application openbis, Ui ui) { - return openbis - .execute(new CreateScript(new ScriptDsl(name, type, kind, description, content))); - } + Script script = new ScriptDsl(name, type, kind, description, content); + if (Ui.WEB.equals(ui)) + { + return openbis.execute(new CreateScriptGui(script)); + } + throw new UnsupportedOperationException(); + } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SpaceBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SpaceBuilder.java index a025902ded9..ed70c5a2061 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SpaceBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/SpaceBuilder.java @@ -17,7 +17,9 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreateSpace; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.gui.CreateSpaceGui; +import ch.systemsx.cisd.openbis.uitest.rmi.CreateSpaceRmi; import ch.systemsx.cisd.openbis.uitest.type.Space; import ch.systemsx.cisd.openbis.uitest.uid.UidGenerator; @@ -45,9 +47,18 @@ public class SpaceBuilder implements Builder<Space> } @Override - public Space build(Application openbis) + public Space build(Application openbis, Ui ui) { - return openbis.execute(new CreateSpace(new SpaceDsl(code, description))); - } + Space space = new SpaceDsl(code, description); + + if (Ui.WEB.equals(ui)) + { + openbis.execute(new CreateSpaceGui(space)); + } else if (Ui.PUBLIC_API.equals(ui)) + { + openbis.execute(new CreateSpaceRmi(space)); + } + return space; + } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/UpdateBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/UpdateBuilder.java index 4291b681050..452b44f59be 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/UpdateBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/UpdateBuilder.java @@ -17,11 +17,12 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import ch.systemsx.cisd.openbis.uitest.dsl.Application; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; /** * @author anttil */ public interface UpdateBuilder { - public void update(Application openbis); + public void update(Application openbis, Ui ui); } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/UserBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/UserBuilder.java index e3070cdebe8..8cf58389611 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/UserBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/UserBuilder.java @@ -17,7 +17,8 @@ package ch.systemsx.cisd.openbis.uitest.dsl.type; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreateUser; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.rmi.CreateUserRmi; import ch.systemsx.cisd.openbis.uitest.type.User; import ch.systemsx.cisd.openbis.uitest.uid.UidGenerator; @@ -46,8 +47,17 @@ public class UserBuilder implements Builder<User> } @Override - public User build(Application openbis) + public User build(Application openbis, Ui ui) { - return openbis.execute(new CreateUser(new UserDsl(name))); + if (Ui.PUBLIC_API.equals(ui)) + { + return openbis.execute(new CreateUserRmi(new UserDsl(name))); + } else if (Ui.DUMMY.equals(ui)) + { + return new UserDsl(name); + } else + { + throw new UnsupportedOperationException(); + } } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/VocabularyBuilder.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/VocabularyBuilder.java index eb6547d73a1..6a828fc538e 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/VocabularyBuilder.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/dsl/type/VocabularyBuilder.java @@ -20,7 +20,8 @@ import java.util.HashSet; import java.util.Set; import ch.systemsx.cisd.openbis.uitest.dsl.Application; -import ch.systemsx.cisd.openbis.uitest.request.CreateVocabulary; +import ch.systemsx.cisd.openbis.uitest.dsl.Ui; +import ch.systemsx.cisd.openbis.uitest.gui.CreateVocabularyGui; import ch.systemsx.cisd.openbis.uitest.type.Vocabulary; import ch.systemsx.cisd.openbis.uitest.uid.UidGenerator; @@ -71,9 +72,9 @@ public class VocabularyBuilder implements Builder<Vocabulary> } @Override - public Vocabulary build(Application openbis) + public Vocabulary build(Application openbis, Ui ui) { - return openbis.execute(new CreateVocabulary( - new VocabularyDsl(code, description, terms, url))); + Vocabulary vocabulary = new VocabularyDsl(code, description, terms, url); + return openbis.execute(new CreateVocabularyGui(vocabulary)); } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateExperimentGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateExperimentGui.java index 5833784a45b..ce218066e66 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateExperimentGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateExperimentGui.java @@ -16,22 +16,32 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.RegisterExperimentLocation; import ch.systemsx.cisd.openbis.uitest.page.RegisterExperiment; -import ch.systemsx.cisd.openbis.uitest.request.CreateExperiment; import ch.systemsx.cisd.openbis.uitest.type.Experiment; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class CreateExperimentGui extends Executor<CreateExperiment, Experiment> +public class CreateExperimentGui implements Command<Experiment> { + @Inject + private Pages pages; + + private Experiment experiment; + + public CreateExperimentGui(Experiment experiment) + { + this.experiment = experiment; + } + @Override - public Experiment run(CreateExperiment request) + public Experiment execute() { - Experiment experiment = request.getExperiment(); - RegisterExperiment register = goTo(new RegisterExperimentLocation()); + RegisterExperiment register = pages.goTo(new RegisterExperimentLocation()); register.selectExperimentType(experiment.getType()); register.fillWith(experiment); register.save(); diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateExperimentTypeGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateExperimentTypeGui.java index 2463cf492fe..c40baf596ab 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateExperimentTypeGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateExperimentTypeGui.java @@ -16,24 +16,34 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.AddExperimentTypeLocation; import ch.systemsx.cisd.openbis.uitest.page.AddExperimentTypeDialog; -import ch.systemsx.cisd.openbis.uitest.request.CreateExperimentType; import ch.systemsx.cisd.openbis.uitest.type.ExperimentType; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class CreateExperimentTypeGui extends Executor<CreateExperimentType, ExperimentType> +public class CreateExperimentTypeGui implements Command<ExperimentType> { + @Inject + private Pages pages; + + private ExperimentType type; + + public CreateExperimentTypeGui(ExperimentType type) + { + this.type = type; + } + @Override - public ExperimentType run(CreateExperimentType request) + public ExperimentType execute() { - ExperimentType experimentType = request.getType(); - AddExperimentTypeDialog dialog = goTo(new AddExperimentTypeLocation()); - dialog.fillWith(experimentType); + AddExperimentTypeDialog dialog = pages.goTo(new AddExperimentTypeLocation()); + dialog.fillWith(type); dialog.save(); - return experimentType; + return type; } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateProjectGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateProjectGui.java index fe4390c92f9..45291b4cbda 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateProjectGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateProjectGui.java @@ -16,23 +16,32 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.RegisterProjectLocation; import ch.systemsx.cisd.openbis.uitest.page.RegisterProject; -import ch.systemsx.cisd.openbis.uitest.request.CreateProject; import ch.systemsx.cisd.openbis.uitest.type.Project; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class CreateProjectGui extends Executor<CreateProject, Project> +public class CreateProjectGui implements Command<Project> { + @Inject + private Pages pages; + + private Project project; + + public CreateProjectGui(Project project) + { + this.project = project; + } @Override - public Project run(CreateProject request) + public Project execute() { - Project project = request.getProject(); - RegisterProject register = goTo(new RegisterProjectLocation()); + RegisterProject register = pages.goTo(new RegisterProjectLocation()); register.fillWith(project); register.save(); return project; diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreatePropertyTypeAssignmentGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreatePropertyTypeAssignmentGui.java index 4c7518c7d40..550c0b151b4 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreatePropertyTypeAssignmentGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreatePropertyTypeAssignmentGui.java @@ -16,24 +16,33 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.AssignSamplePropertyLocation; import ch.systemsx.cisd.openbis.uitest.page.AssignSamplePropertyType; -import ch.systemsx.cisd.openbis.uitest.request.CreatePropertyTypeAssignment; import ch.systemsx.cisd.openbis.uitest.type.PropertyTypeAssignment; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class CreatePropertyTypeAssignmentGui extends - Executor<CreatePropertyTypeAssignment, PropertyTypeAssignment> +public class CreatePropertyTypeAssignmentGui implements Command<PropertyTypeAssignment> { + @Inject + private Pages pages; + + private PropertyTypeAssignment assignment; + + public CreatePropertyTypeAssignmentGui(PropertyTypeAssignment assignment) + { + this.assignment = assignment; + } + @Override - public PropertyTypeAssignment run(CreatePropertyTypeAssignment request) + public PropertyTypeAssignment execute() { - PropertyTypeAssignment assignment = request.getAssignment(); - AssignSamplePropertyType assign = goTo(new AssignSamplePropertyLocation()); + AssignSamplePropertyType assign = pages.goTo(new AssignSamplePropertyLocation()); assign.fillWith(assignment); assign.save(); return assignment; diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreatePropertyTypeGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreatePropertyTypeGui.java index 03d77e9c0cb..cc6cbdd80f2 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreatePropertyTypeGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreatePropertyTypeGui.java @@ -16,26 +16,36 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.AddPropertyTypeLocation; import ch.systemsx.cisd.openbis.uitest.page.AddPropertyType; -import ch.systemsx.cisd.openbis.uitest.request.CreatePropertyType; import ch.systemsx.cisd.openbis.uitest.type.PropertyType; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class CreatePropertyTypeGui extends Executor<CreatePropertyType, PropertyType> +public class CreatePropertyTypeGui implements Command<PropertyType> { + @Inject + private Pages pages; + + private PropertyType type; + + public CreatePropertyTypeGui(PropertyType type) + { + this.type = type; + } + @Override - public PropertyType run(CreatePropertyType request) + public PropertyType execute() { - PropertyType propertyType = request.getType(); - AddPropertyType dialog = goTo(new AddPropertyTypeLocation()); - dialog.fillWith(propertyType); + AddPropertyType dialog = pages.goTo(new AddPropertyTypeLocation()); + dialog.fillWith(type); dialog.save(); - return propertyType; + return type; } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateSampleGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateSampleGui.java index 74d143d2f61..38ac3b4723e 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateSampleGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateSampleGui.java @@ -16,23 +16,32 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.RegisterSampleLocation; import ch.systemsx.cisd.openbis.uitest.page.RegisterSample; -import ch.systemsx.cisd.openbis.uitest.request.CreateSample; import ch.systemsx.cisd.openbis.uitest.type.Sample; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class CreateSampleGui extends Executor<CreateSample, Sample> +public class CreateSampleGui implements Command<Sample> { + @Inject + private Pages pages; + + private Sample sample; + + public CreateSampleGui(Sample sample) + { + this.sample = sample; + } @Override - public Sample run(CreateSample request) + public Sample execute() { - Sample sample = request.getSample(); - RegisterSample register = goTo(new RegisterSampleLocation()); + RegisterSample register = pages.goTo(new RegisterSampleLocation()); register.selectSampleType(sample.getType()); register.fillWith(sample); register.save(); diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateSampleTypeGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateSampleTypeGui.java index b366ae5733a..6d7615bbf16 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateSampleTypeGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateSampleTypeGui.java @@ -16,26 +16,35 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.AddSampleTypeLocation; import ch.systemsx.cisd.openbis.uitest.page.AddSampleTypeDialog; -import ch.systemsx.cisd.openbis.uitest.request.CreateSampleType; import ch.systemsx.cisd.openbis.uitest.type.SampleType; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class CreateSampleTypeGui extends Executor<CreateSampleType, SampleType> +public class CreateSampleTypeGui implements Command<SampleType> { + @Inject + private Pages pages; + + private SampleType type; + + public CreateSampleTypeGui(SampleType type) + { + this.type = type; + } @Override - public SampleType run(CreateSampleType request) + public SampleType execute() { - SampleType sampleType = request.getType(); - AddSampleTypeDialog dialog = goTo(new AddSampleTypeLocation()); - dialog.fillWith(sampleType); + AddSampleTypeDialog dialog = pages.goTo(new AddSampleTypeLocation()); + dialog.fillWith(type); dialog.save(); - return sampleType; + return type; } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateScriptGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateScriptGui.java index c88fe6e0a36..4a91d4bb684 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateScriptGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateScriptGui.java @@ -16,23 +16,33 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.RegisterScriptLocation; import ch.systemsx.cisd.openbis.uitest.page.RegisterScript; -import ch.systemsx.cisd.openbis.uitest.request.CreateScript; import ch.systemsx.cisd.openbis.uitest.type.Script; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class CreateScriptGui extends Executor<CreateScript, Script> +public class CreateScriptGui implements Command<Script> { + @Inject + private Pages pages; + + private Script script; + + public CreateScriptGui(Script script) + { + this.script = script; + } + @Override - public Script run(CreateScript request) + public Script execute() { - Script script = request.getScript(); - RegisterScript register = goTo(new RegisterScriptLocation()); + RegisterScript register = pages.goTo(new RegisterScriptLocation()); register.fillWith(script); register.save(); return script; diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateSpaceGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateSpaceGui.java index 5870d711a9c..1596b473127 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateSpaceGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateSpaceGui.java @@ -16,25 +16,35 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.AddSpaceDialogLocation; import ch.systemsx.cisd.openbis.uitest.page.AddSpaceDialog; -import ch.systemsx.cisd.openbis.uitest.request.CreateSpace; import ch.systemsx.cisd.openbis.uitest.type.Space; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class CreateSpaceGui extends Executor<CreateSpace, Space> +public class CreateSpaceGui implements Command<Void> { + @Inject + private Pages pages; + + private Space space; + + public CreateSpaceGui(Space space) + { + this.space = space; + } + @Override - public Space run(CreateSpace function) + public Void execute() { - Space space = function.getSpace(); - AddSpaceDialog dialog = goTo(new AddSpaceDialogLocation()); + AddSpaceDialog dialog = pages.goTo(new AddSpaceDialogLocation()); dialog.fillWith(space); dialog.save(); - return space; + return null; } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateVocabularyGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateVocabularyGui.java index c10c4240320..09da22b1308 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateVocabularyGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/CreateVocabularyGui.java @@ -16,26 +16,34 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.AddVocabularyLocation; import ch.systemsx.cisd.openbis.uitest.page.AddVocabularyDialog; -import ch.systemsx.cisd.openbis.uitest.request.CreateVocabulary; import ch.systemsx.cisd.openbis.uitest.type.Vocabulary; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class CreateVocabularyGui extends Executor<CreateVocabulary, Vocabulary> +public class CreateVocabularyGui implements Command<Vocabulary> { + @Inject + private Pages pages; + + private Vocabulary vocabulary; + + public CreateVocabularyGui(Vocabulary vocabulary) + { + this.vocabulary = vocabulary; + } @Override - public Vocabulary run(CreateVocabulary request) + public Vocabulary execute() { - Vocabulary vocabulary = request.getVocabulary(); - AddVocabularyDialog dialog = goTo(new AddVocabularyLocation()); + AddVocabularyDialog dialog = pages.goTo(new AddVocabularyLocation()); dialog.fillWith(vocabulary); dialog.save(); return vocabulary; } - } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteExperimentTypeGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteExperimentTypeGui.java index 64fdaf30713..2d3d54e4c06 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteExperimentTypeGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteExperimentTypeGui.java @@ -16,23 +16,34 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.page.Browsable; import ch.systemsx.cisd.openbis.uitest.page.Browser; -import ch.systemsx.cisd.openbis.uitest.request.DeleteExperimentType; import ch.systemsx.cisd.openbis.uitest.type.BrowsableWrapper; +import ch.systemsx.cisd.openbis.uitest.type.ExperimentType; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class DeleteExperimentTypeGui extends Executor<DeleteExperimentType, Void> +public class DeleteExperimentTypeGui implements Command<Void> { + @Inject + private Pages pages; + + private ExperimentType type; + + public DeleteExperimentTypeGui(ExperimentType type) + { + this.type = type; + } @Override - public Void run(DeleteExperimentType request) + public Void execute() { - Browsable browsable = new BrowsableWrapper(request.getType()); - Browser browser = goTo(browsable.getBrowserLocation()); + Browsable browsable = new BrowsableWrapper(type); + Browser browser = pages.goTo(browsable.getBrowserLocation()); browser.delete(browsable); return null; } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteExperimentsOfProjectGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteExperimentsOfProjectGui.java index fc35c01ec93..288caf7e555 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteExperimentsOfProjectGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteExperimentsOfProjectGui.java @@ -16,23 +16,34 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.ExperimentBrowserLocation; import ch.systemsx.cisd.openbis.uitest.page.ExperimentBrowser; -import ch.systemsx.cisd.openbis.uitest.request.DeleteExperimentsOfProject; +import ch.systemsx.cisd.openbis.uitest.type.Project; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class DeleteExperimentsOfProjectGui extends - Executor<DeleteExperimentsOfProject, Void> +public class DeleteExperimentsOfProjectGui implements Command<Void> { + @Inject + private Pages pages; + + private Project project; + + public DeleteExperimentsOfProjectGui(Project project) + { + this.project = project; + } + @Override - public Void run(DeleteExperimentsOfProject request) + public Void execute() { - ExperimentBrowser browser = goTo(new ExperimentBrowserLocation()); - if (browser.selectProject(request.getProject())) + ExperimentBrowser browser = pages.goTo(new ExperimentBrowserLocation()); + if (browser.selectProject(project)) { browser.deleteAll(); } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteProjectGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteProjectGui.java index fe80df0114f..b5170ef452f 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteProjectGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteProjectGui.java @@ -16,23 +16,35 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.page.Browsable; import ch.systemsx.cisd.openbis.uitest.page.Browser; -import ch.systemsx.cisd.openbis.uitest.request.DeleteProject; import ch.systemsx.cisd.openbis.uitest.type.BrowsableWrapper; +import ch.systemsx.cisd.openbis.uitest.type.Project; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class DeleteProjectGui extends Executor<DeleteProject, Void> +public class DeleteProjectGui implements Command<Void> { + @Inject + private Pages pages; + + private Project project; + + public DeleteProjectGui(Project project) + { + this.project = project; + } + @Override - public Void run(DeleteProject request) + public Void execute() { - Browsable browsable = new BrowsableWrapper(request.getProject()); - Browser browser = goTo(browsable.getBrowserLocation()); + Browsable browsable = new BrowsableWrapper(project); + Browser browser = pages.goTo(browsable.getBrowserLocation()); browser.delete(browsable); return null; } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeletePropertyTypeGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeletePropertyTypeGui.java index 2a421e9fea3..bfd038347f9 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeletePropertyTypeGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeletePropertyTypeGui.java @@ -16,23 +16,34 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.page.Browsable; import ch.systemsx.cisd.openbis.uitest.page.Browser; -import ch.systemsx.cisd.openbis.uitest.request.DeletePropertyType; import ch.systemsx.cisd.openbis.uitest.type.BrowsableWrapper; +import ch.systemsx.cisd.openbis.uitest.type.PropertyType; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class DeletePropertyTypeGui extends Executor<DeletePropertyType, Void> +public class DeletePropertyTypeGui implements Command<Void> { + @Inject + private Pages pages; + + private PropertyType type; + + public DeletePropertyTypeGui(PropertyType type) + { + this.type = type; + } @Override - public Void run(DeletePropertyType request) + public Void execute() { - Browsable browsable = new BrowsableWrapper(request.getType()); - Browser browser = goTo(browsable.getBrowserLocation()); + Browsable browsable = new BrowsableWrapper(type); + Browser browser = pages.goTo(browsable.getBrowserLocation()); browser.delete(browsable); return null; } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteSampleTypeGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteSampleTypeGui.java index 771a091f10e..744bd3c7e54 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteSampleTypeGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteSampleTypeGui.java @@ -16,23 +16,34 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.page.Browsable; import ch.systemsx.cisd.openbis.uitest.page.Browser; -import ch.systemsx.cisd.openbis.uitest.request.DeleteSampleType; import ch.systemsx.cisd.openbis.uitest.type.BrowsableWrapper; +import ch.systemsx.cisd.openbis.uitest.type.SampleType; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class DeleteSampleTypeGui extends Executor<DeleteSampleType, Void> +public class DeleteSampleTypeGui implements Command<Void> { + @Inject + private Pages pages; + + private SampleType type; + + public DeleteSampleTypeGui(SampleType type) + { + this.type = type; + } @Override - public Void run(DeleteSampleType request) + public Void execute() { - Browsable browsable = new BrowsableWrapper(request.getType()); - Browser browser = goTo(browsable.getBrowserLocation()); + Browsable browsable = new BrowsableWrapper(type); + Browser browser = pages.goTo(browsable.getBrowserLocation()); browser.delete(browsable); return null; } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteSpaceGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteSpaceGui.java index 39a7117b0ca..abbe981f2ad 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteSpaceGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteSpaceGui.java @@ -16,23 +16,34 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.page.Browsable; import ch.systemsx.cisd.openbis.uitest.page.Browser; -import ch.systemsx.cisd.openbis.uitest.request.DeleteSpace; import ch.systemsx.cisd.openbis.uitest.type.BrowsableWrapper; +import ch.systemsx.cisd.openbis.uitest.type.Space; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class DeleteSpaceGui extends Executor<DeleteSpace, Void> +public class DeleteSpaceGui implements Command<Void> { + @Inject + private Pages pages; + + private Space space; + + public DeleteSpaceGui(Space space) + { + this.space = space; + } @Override - public Void run(DeleteSpace request) + public Void execute() { - Browsable browsable = new BrowsableWrapper(request.getSpace()); - Browser browser = goTo(browsable.getBrowserLocation()); + Browsable browsable = new BrowsableWrapper(space); + Browser browser = pages.goTo(browsable.getBrowserLocation()); browser.delete(browsable); return null; } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteVocabularyGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteVocabularyGui.java index 4d6b32e5589..a4e80a73d10 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteVocabularyGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/DeleteVocabularyGui.java @@ -16,23 +16,34 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.page.Browsable; import ch.systemsx.cisd.openbis.uitest.page.Browser; -import ch.systemsx.cisd.openbis.uitest.request.DeleteVocabulary; import ch.systemsx.cisd.openbis.uitest.type.BrowsableWrapper; +import ch.systemsx.cisd.openbis.uitest.type.Vocabulary; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class DeleteVocabularyGui extends Executor<DeleteVocabulary, Void> +public class DeleteVocabularyGui implements Command<Void> { + @Inject + private Pages pages; + + private Vocabulary vocabulary; + + public DeleteVocabularyGui(Vocabulary vocabulary) + { + this.vocabulary = vocabulary; + } @Override - public Void run(DeleteVocabulary request) + public Void execute() { - Browsable browsable = new BrowsableWrapper(request.getVocabulary()); - Browser browser = goTo(browsable.getBrowserLocation()); + Browsable browsable = new BrowsableWrapper(vocabulary); + Browser browser = pages.goTo(browsable.getBrowserLocation()); browser.delete(browsable); return null; } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/EmptyTrashGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/EmptyTrashGui.java index 10fc74073fc..4444c538ed1 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/EmptyTrashGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/EmptyTrashGui.java @@ -16,19 +16,23 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.TrashLocation; -import ch.systemsx.cisd.openbis.uitest.request.EmptyTrash; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class EmptyTrashGui extends Executor<EmptyTrash, Void> +public class EmptyTrashGui implements Command<Void> { + @Inject + private Pages pages; + @Override - public Void run(EmptyTrash request) + public Void execute() { - goTo(new TrashLocation()).empty(); + pages.goTo(new TrashLocation()).empty(); return null; } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/LoginGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/LoginGui.java index 5789c99579b..b9705e81f6d 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/LoginGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/LoginGui.java @@ -16,19 +16,34 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.page.LoginPage; -import ch.systemsx.cisd.openbis.uitest.request.Login; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class LoginGui extends Executor<Login, Void> +public class LoginGui implements Command<Void> { + + @Inject + private Pages pages; + + private String user; + + private String password; + + public LoginGui(String user, String password) + { + this.user = user; + this.password = password; + } + @Override - public Void run(Login request) + public Void execute() { - load(LoginPage.class).loginAs(request.getUser(), request.getPassword()); + pages.load(LoginPage.class).loginAs(user, password); return null; } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/LogoutGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/LogoutGui.java index ff4abc5f84f..3abe9609b12 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/LogoutGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/LogoutGui.java @@ -16,25 +16,27 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.menu.TopBar; import ch.systemsx.cisd.openbis.uitest.menu.UserMenu; import ch.systemsx.cisd.openbis.uitest.page.LoginPage; -import ch.systemsx.cisd.openbis.uitest.request.Logout; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class LogoutGui extends Executor<Logout, Void> +public class LogoutGui implements Command<Void> { + @Inject + private Pages pages; @Override - public Void run(Logout request) + public Void execute() { - load(TopBar.class).user(); - load(UserMenu.class).logout(); - load(LoginPage.class); + pages.load(TopBar.class).user(); + pages.load(UserMenu.class).logout(); + pages.load(LoginPage.class); return null; } - } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/UpdateSampleTypeGui.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/UpdateSampleTypeGui.java index 239257cd850..3fa87e99e9c 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/UpdateSampleTypeGui.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/gui/UpdateSampleTypeGui.java @@ -16,34 +16,42 @@ package ch.systemsx.cisd.openbis.uitest.gui; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.layout.SampleTypeBrowserLocation; import ch.systemsx.cisd.openbis.uitest.page.Browsable; import ch.systemsx.cisd.openbis.uitest.page.EditSampleTypeDialog; import ch.systemsx.cisd.openbis.uitest.page.SampleTypeBrowser; -import ch.systemsx.cisd.openbis.uitest.request.UpdateSampleType; import ch.systemsx.cisd.openbis.uitest.type.BrowsableWrapper; import ch.systemsx.cisd.openbis.uitest.type.SampleType; +import ch.systemsx.cisd.openbis.uitest.webdriver.Pages; /** * @author anttil */ -public class UpdateSampleTypeGui extends Executor<UpdateSampleType, Void> +public class UpdateSampleTypeGui implements Command<Void> { + private SampleType type; + + @Inject + private Pages pages; + + public UpdateSampleTypeGui(SampleType type) + { + this.type = type; + } @Override - public Void run(UpdateSampleType request) + public Void execute() { - SampleType sampleType = request.getType(); - Browsable b = new BrowsableWrapper(sampleType); - SampleTypeBrowser browser = goTo(new SampleTypeBrowserLocation()); + Browsable b = new BrowsableWrapper(type); + SampleTypeBrowser browser = pages.goTo(new SampleTypeBrowserLocation()); browser.select(b); browser.edit(); - EditSampleTypeDialog dialog = load(EditSampleTypeDialog.class); - dialog.fillWith(sampleType); + EditSampleTypeDialog dialog = pages.load(EditSampleTypeDialog.class); + dialog.fillWith(type); dialog.save(); browser.resetFilters(); return null; } - } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/AddPropertyType.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/AddPropertyType.java index 6523379a208..4587e91bf2e 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/AddPropertyType.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/AddPropertyType.java @@ -16,6 +16,9 @@ package ch.systemsx.cisd.openbis.uitest.page; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + import ch.systemsx.cisd.openbis.uitest.type.PropertyType; import ch.systemsx.cisd.openbis.uitest.type.PropertyTypeDataType; import ch.systemsx.cisd.openbis.uitest.webdriver.Lazy; @@ -47,6 +50,10 @@ public class AddPropertyType @Locate("openbis_property-type-registration_formsave-button") private Button save; + @Lazy + @Locate("openbis_property-type-registration_form_tab") + private WebElement infoBox; + public void fillWith(PropertyType propertyType) { code.write(propertyType.getCode()); @@ -62,6 +69,9 @@ public class AddPropertyType public void save() { + String propertyCode = code.getValue().toUpperCase(); save.click(); + infoBox.findElements(By.xpath(".//div/b[text()='" + propertyCode + "']")); + } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/AssignSamplePropertyType.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/AssignSamplePropertyType.java index 27069f6f744..dd0599558c4 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/AssignSamplePropertyType.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/AssignSamplePropertyType.java @@ -16,15 +16,18 @@ package ch.systemsx.cisd.openbis.uitest.page; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + import ch.systemsx.cisd.openbis.uitest.type.PropertyTypeAssignment; import ch.systemsx.cisd.openbis.uitest.webdriver.Lazy; import ch.systemsx.cisd.openbis.uitest.webdriver.Locate; import ch.systemsx.cisd.openbis.uitest.widget.Button; import ch.systemsx.cisd.openbis.uitest.widget.Checkbox; -import ch.systemsx.cisd.openbis.uitest.widget.Widget; import ch.systemsx.cisd.openbis.uitest.widget.DropDown; import ch.systemsx.cisd.openbis.uitest.widget.Dynamic; import ch.systemsx.cisd.openbis.uitest.widget.Fillable; +import ch.systemsx.cisd.openbis.uitest.widget.Widget; public class AssignSamplePropertyType { @@ -45,6 +48,10 @@ public class AssignSamplePropertyType @Locate("openbis_property-type-assignment_SAMPLEsave-button") private Button save; + @Lazy + @Locate("openbis_property-type-assignment_SAMPLE_tab") + private WebElement infoBox; + public void fillWith(PropertyTypeAssignment assignment) { propertyType.select(assignment.getPropertyType().getLabel()); @@ -61,6 +68,8 @@ public class AssignSamplePropertyType public void save() { + String sampleTypeCode = sampleType.getValue(); this.save.click(); + infoBox.findElements(By.xpath(".//div[contains(text(), '" + sampleTypeCode + "')]")); } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/RegisterExperiment.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/RegisterExperiment.java index fc8b780a170..8ac961c935d 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/RegisterExperiment.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/RegisterExperiment.java @@ -18,6 +18,9 @@ package ch.systemsx.cisd.openbis.uitest.page; import java.util.concurrent.TimeUnit; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + import ch.systemsx.cisd.openbis.uitest.dsl.SeleniumTest; import ch.systemsx.cisd.openbis.uitest.type.Experiment; import ch.systemsx.cisd.openbis.uitest.type.ExperimentType; @@ -56,6 +59,10 @@ public class RegisterExperiment @Locate("confirmation_dialog") private DeletionConfirmationBox dialog; + @Lazy + @Locate("openbis_experiment-registration_tab") + private WebElement infoBox; + public void fillWith(Experiment experiment) { code.write(experiment.getCode()); @@ -89,7 +96,9 @@ public class RegisterExperiment public void save() { + String experimentCode = code.getValue().toUpperCase(); this.saveButton.click(); + infoBox.findElements(By.xpath(".//div/b[contains(text(), '" + experimentCode + "')]")); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/RegisterProject.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/RegisterProject.java index 88a8aa05fdd..d88759f8deb 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/RegisterProject.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/RegisterProject.java @@ -16,6 +16,9 @@ package ch.systemsx.cisd.openbis.uitest.page; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + import ch.systemsx.cisd.openbis.uitest.type.Project; import ch.systemsx.cisd.openbis.uitest.webdriver.Lazy; import ch.systemsx.cisd.openbis.uitest.webdriver.Locate; @@ -36,6 +39,10 @@ public class RegisterProject @Locate("openbis_project-register_formsave-button") private Button save; + @Lazy + @Locate("openbis_project-register_form_tab") + private WebElement infoBox; + public void fillWith(Project project) { code.write(project.getCode()); @@ -44,7 +51,9 @@ public class RegisterProject public void save() { + String projectCode = code.getValue().toUpperCase(); save.click(); + infoBox.findElements(By.xpath(".//div/b[contains(text(), '" + projectCode + "')]")); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/RegisterSample.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/RegisterSample.java index 2117f97ffaa..5ca4ebba483 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/RegisterSample.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/RegisterSample.java @@ -21,6 +21,9 @@ import java.util.HashSet; import java.util.Map; import java.util.concurrent.TimeUnit; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + import ch.systemsx.cisd.openbis.uitest.dsl.SeleniumTest; import ch.systemsx.cisd.openbis.uitest.type.PropertyType; import ch.systemsx.cisd.openbis.uitest.type.Sample; @@ -64,6 +67,10 @@ public class RegisterSample @Locate("confirmation_dialog") private DeletionConfirmationBox dialog; + @Lazy + @Locate("openbis_sample-registration_tab") + private WebElement infoBox; + public void fillWith(Sample sample) { code.write(sample.getCode()); @@ -102,7 +109,9 @@ public class RegisterSample public void save() { + String sampleCode = code.getValue(); save.click(); + infoBox.findElements(By.xpath(".//div/b[text()='" + sampleCode + "']")); } public Collection<String> getProperties() diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateDataSet.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateDataSet.java deleted file mode 100644 index b476e308f72..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateDataSet.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.DataSet; - -/** - * @author anttil - */ -public class CreateDataSet implements Request<DataSet> -{ - private final DataSet dataSet; - - public CreateDataSet(DataSet dataSet) - { - this.dataSet = dataSet; - } - - public DataSet getDataSet() - { - return dataSet; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateDataSetType.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateDataSetType.java deleted file mode 100644 index 7d03a6280e7..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateDataSetType.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.DataSetType; - -/** - * @author anttil - */ -public class CreateDataSetType implements Request<DataSetType> -{ - private final DataSetType type; - - public CreateDataSetType(DataSetType type) - { - this.type = type; - } - - public DataSetType getType() - { - return type; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateExperiment.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateExperiment.java deleted file mode 100644 index bec7c0e1733..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateExperiment.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.Experiment; - -/** - * @author anttil - */ -public class CreateExperiment implements Request<Experiment> -{ - private final Experiment experiment; - - public CreateExperiment(Experiment experiment) - { - this.experiment = experiment; - } - - public Experiment getExperiment() - { - return experiment; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateExperimentType.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateExperimentType.java deleted file mode 100644 index 511785e4f82..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateExperimentType.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.ExperimentType; - -/** - * @author anttil - */ -public class CreateExperimentType implements Request<ExperimentType> -{ - private final ExperimentType type; - - public CreateExperimentType(ExperimentType type) - { - this.type = type; - } - - public ExperimentType getType() - { - return type; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateMetaProject.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateMetaProject.java deleted file mode 100644 index cacc2a82a89..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateMetaProject.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.MetaProject; - -/** - * @author anttil - */ -public class CreateMetaProject implements Request<MetaProject> -{ - private MetaProject metaProject; - - public CreateMetaProject(MetaProject metaProject) - { - this.metaProject = metaProject; - } - - public MetaProject getMetaProject() - { - return metaProject; - } - -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreatePropertyType.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreatePropertyType.java deleted file mode 100644 index 827bf26e260..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreatePropertyType.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.PropertyType; - -/** - * @author anttil - */ -public class CreatePropertyType implements Request<PropertyType> -{ - private final PropertyType type; - - public CreatePropertyType(PropertyType type) - { - this.type = type; - } - - public PropertyType getType() - { - return type; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreatePropertyTypeAssignment.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreatePropertyTypeAssignment.java deleted file mode 100644 index 98c49793340..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreatePropertyTypeAssignment.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.PropertyTypeAssignment; - -/** - * @author anttil - */ -public class CreatePropertyTypeAssignment implements Request<PropertyTypeAssignment> -{ - private final PropertyTypeAssignment assignment; - - public CreatePropertyTypeAssignment(PropertyTypeAssignment assignment) - { - this.assignment = assignment; - } - - public PropertyTypeAssignment getAssignment() - { - return assignment; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateSample.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateSample.java deleted file mode 100644 index 3562257e02c..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateSample.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.Sample; - -/** - * @author anttil - */ -public class CreateSample implements Request<Sample> -{ - private final Sample sample; - - public CreateSample(Sample sample) - { - this.sample = sample; - } - - public Sample getSample() - { - return sample; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateSampleType.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateSampleType.java deleted file mode 100644 index ae23eea65f1..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateSampleType.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.SampleType; - -/** - * @author anttil - */ -public class CreateSampleType implements Request<SampleType> -{ - private final SampleType type; - - public CreateSampleType(SampleType type) - { - this.type = type; - } - - public SampleType getType() - { - return type; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateScript.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateScript.java deleted file mode 100644 index cf2812495a2..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateScript.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.Script; - -/** - * @author anttil - */ -public class CreateScript implements Request<Script> -{ - private final Script script; - - public CreateScript(Script script) - { - this.script = script; - } - - public Script getScript() - { - return script; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateSpace.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateSpace.java deleted file mode 100644 index e5bc9db7307..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateSpace.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.Space; - -/** - * @author anttil - */ -public class CreateSpace implements Request<Space> -{ - private Space space; - - public CreateSpace(Space space) - { - this.space = space; - } - - public Space getSpace() - { - return space; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateUser.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateUser.java deleted file mode 100644 index de08057e274..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateUser.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.User; - -/** - * @author anttil - */ -public class CreateUser implements Request<User> -{ - private final User user; - - public CreateUser(User user) - { - this.user = user; - } - - public User getUser() - { - return user; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateVocabulary.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateVocabulary.java deleted file mode 100644 index 3f339953458..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateVocabulary.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.Vocabulary; - -/** - * @author anttil - */ -public class CreateVocabulary implements Request<Vocabulary> -{ - private final Vocabulary vocabulary; - - public CreateVocabulary(Vocabulary vocabulary) - { - this.vocabulary = vocabulary; - } - - public Vocabulary getVocabulary() - { - return vocabulary; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteExperimentType.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteExperimentType.java deleted file mode 100644 index 18933f1f208..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteExperimentType.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.ExperimentType; - -/** - * @author anttil - */ -public class DeleteExperimentType implements Request<Void> -{ - private final ExperimentType type; - - public DeleteExperimentType(ExperimentType type) - { - this.type = type; - } - - public ExperimentType getType() - { - return type; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteExperimentsOfProject.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteExperimentsOfProject.java deleted file mode 100644 index 9c344f980a2..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteExperimentsOfProject.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.Project; - -/** - * @author anttil - */ -public class DeleteExperimentsOfProject implements Request<Void> -{ - private final Project project; - - public DeleteExperimentsOfProject(Project project) - { - this.project = project; - } - - public Project getProject() - { - return project; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteProject.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteProject.java deleted file mode 100644 index 845389a5602..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteProject.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.Project; - -/** - * @author anttil - */ -public class DeleteProject implements Request<Void> -{ - private final Project project; - - public DeleteProject(Project project) - { - this.project = project; - } - - public Project getProject() - { - return project; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeletePropertyType.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeletePropertyType.java deleted file mode 100644 index 67907b41f52..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeletePropertyType.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.PropertyType; - -/** - * @author anttil - */ -public class DeletePropertyType implements Request<Void> -{ - private final PropertyType type; - - public DeletePropertyType(PropertyType type) - { - this.type = type; - } - - public PropertyType getType() - { - return type; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteSampleType.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteSampleType.java deleted file mode 100644 index 42941e731d0..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteSampleType.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.SampleType; - -/** - * @author anttil - */ -public class DeleteSampleType implements Request<Void> -{ - private final SampleType type; - - public DeleteSampleType(SampleType type) - { - this.type = type; - } - - public SampleType getType() - { - return type; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteSpace.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteSpace.java deleted file mode 100644 index 33ee7a00a0b..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteSpace.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.Space; - -/** - * @author anttil - */ -public class DeleteSpace implements Request<Void> -{ - private final Space space; - - public DeleteSpace(Space space) - { - this.space = space; - } - - public Space getSpace() - { - return space; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteVocabulary.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteVocabulary.java deleted file mode 100644 index b498e40a757..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/DeleteVocabulary.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.Vocabulary; - -/** - * @author anttil - */ -public class DeleteVocabulary implements Request<Void> -{ - private final Vocabulary vocabulary; - - public DeleteVocabulary(Vocabulary vocabulary) - { - this.vocabulary = vocabulary; - } - - public Vocabulary getVocabulary() - { - return vocabulary; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListDataSetsOfSample.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListDataSetsOfSample.java deleted file mode 100644 index ef88a647fca..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListDataSetsOfSample.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import java.util.List; - -import ch.systemsx.cisd.openbis.uitest.type.DataSet; -import ch.systemsx.cisd.openbis.uitest.type.Sample; - -/** - * @author anttil - */ -public class ListDataSetsOfSample implements Request<List<DataSet>> -{ - - private Sample sample; - - public ListDataSetsOfSample(Sample sample) - { - this.sample = sample; - } - - public Sample getSample() - { - return sample; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListExperiments.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListExperiments.java deleted file mode 100644 index ba480f5bd62..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListExperiments.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; - -import ch.systemsx.cisd.openbis.uitest.rmi.Identifiers; -import ch.systemsx.cisd.openbis.uitest.type.Experiment; - -/** - * @author anttil - */ -public class ListExperiments implements Request<List<Experiment>> -{ - - private Collection<String> experimentIds; - - public ListExperiments(Experiment... experiments) - { - experimentIds = new HashSet<String>(); - for (Experiment e : experiments) - { - experimentIds.add(Identifiers.get(e).toString()); - } - } - - public ListExperiments(String... experimentIds) - { - this.experimentIds = Arrays.asList(experimentIds); - } - - public Collection<String> getExperimentIds() - { - return experimentIds; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListSamplesOfExperiment.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListSamplesOfExperiment.java deleted file mode 100644 index bf448920bea..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/ListSamplesOfExperiment.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import java.util.List; - -import ch.systemsx.cisd.openbis.uitest.type.Experiment; -import ch.systemsx.cisd.openbis.uitest.type.Sample; - -/** - * @author anttil - */ -public class ListSamplesOfExperiment implements Request<List<Sample>> -{ - - private final Experiment experiment; - - public ListSamplesOfExperiment(Experiment experiment) - { - this.experiment = experiment; - } - - public Experiment getExperiment() - { - return this.experiment; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/Logout.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/Logout.java deleted file mode 100644 index 2d17366c02b..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/Logout.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -/** - * @author anttil - */ -public class Logout implements Request<Void> -{ -} \ No newline at end of file diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/SearchForDataSets.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/SearchForDataSets.java deleted file mode 100644 index e5c2c14b1d0..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/SearchForDataSets.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import java.util.List; - -import ch.systemsx.cisd.openbis.uitest.type.DataSet; - -/** - * @author anttil - */ -public class SearchForDataSets implements Request<List<DataSet>> -{ - - private final String code; - - public SearchForDataSets(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/UpdateSampleType.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/UpdateSampleType.java deleted file mode 100644 index e6cde583577..00000000000 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/UpdateSampleType.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.SampleType; - -/** - * @author anttil - */ -public class UpdateSampleType implements Request<Void> -{ - private final SampleType type; - - public UpdateSampleType(SampleType type) - { - this.type = type; - } - - public SampleType getType() - { - return type; - } -} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/AddEntitiesToMetaProjectRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/AddEntitiesToMetaProjectRmi.java index e303420d865..675ec8b3f81 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/AddEntitiesToMetaProjectRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/AddEntitiesToMetaProjectRmi.java @@ -16,30 +16,66 @@ package ch.systemsx.cisd.openbis.uitest.rmi; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; + +import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationChangingService; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.MetaprojectAssignmentsIds; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.id.dataset.DataSetCodeId; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.id.experiment.ExperimentIdentifierId; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.id.material.MaterialCodeAndTypeCodeId; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.id.metaproject.MetaprojectIdentifierId; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.id.sample.SampleIdentifierId; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.AddEntitiesToMetaProject; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.type.DataSet; import ch.systemsx.cisd.openbis.uitest.type.Entity; import ch.systemsx.cisd.openbis.uitest.type.Experiment; +import ch.systemsx.cisd.openbis.uitest.type.Material; +import ch.systemsx.cisd.openbis.uitest.type.MetaProject; import ch.systemsx.cisd.openbis.uitest.type.Sample; +import ch.systemsx.cisd.openbis.uitest.type.User; /** * @author anttil */ -public class AddEntitiesToMetaProjectRmi extends Executor<AddEntitiesToMetaProject, Void> +public class AddEntitiesToMetaProjectRmi implements Command<Void> { + @Inject + private User user; + + @Inject + private String session; + + @Inject + private IGeneralInformationChangingService openbis; + + private MetaProject metaProject; + + private Collection<Entity> entities; + + public AddEntitiesToMetaProjectRmi(MetaProject metaProject, Entity first, Entity... rest) + { + this.metaProject = metaProject; + this.entities = new HashSet<Entity>(); + this.entities.add(first); + this.entities.addAll(Arrays.asList(rest)); + } + + public AddEntitiesToMetaProjectRmi(MetaProject metaProject, Collection<Entity> entities) + { + this.metaProject = metaProject; + this.entities = entities; + } + @Override - public Void run(AddEntitiesToMetaProject request) + public Void execute() { MetaprojectAssignmentsIds ids = new MetaprojectAssignmentsIds(); - for (Entity entity : request.getEntities()) + for (Entity entity : entities) { if (entity instanceof Sample) { @@ -51,16 +87,20 @@ public class AddEntitiesToMetaProjectRmi extends Executor<AddEntitiesToMetaProje } else if (entity instanceof DataSet) { ids.addDataSet(new DataSetCodeId(((DataSet) entity).getCode())); + } else if (entity instanceof Material) + { + Material material = (Material) entity; + ids.addMaterial(new MaterialCodeAndTypeCodeId(material.getCode(), material + .getType().getCode())); } else { - throw new UnsupportedOperationException("not implemented yet for " - + entity.getClass()); + throw new IllegalArgumentException(entity.getClass().getCanonicalName()); } } - generalInformationChangingService.addToMetaproject(session, new MetaprojectIdentifierId( - "/selenium/" - + request.getMetaProject().getName()), ids); + openbis.addToMetaproject(session, + new MetaprojectIdentifierId("/" + user.getName() + "/" + metaProject.getName()), + ids); return null; } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateDataSetRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateDataSetRmi.java index ddcc6b11971..6407f180431 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateDataSetRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateDataSetRmi.java @@ -18,8 +18,9 @@ package ch.systemsx.cisd.openbis.uitest.rmi; import java.util.Collection; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.CreateDataSet; +import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.type.DataSet; import ch.systemsx.cisd.openbis.uitest.type.DataSetType; import ch.systemsx.cisd.openbis.uitest.type.Experiment; @@ -29,12 +30,24 @@ import ch.systemsx.cisd.openbis.uitest.type.Sample; /** * @author anttil */ -public class CreateDataSetRmi extends Executor<CreateDataSet, DataSet> +public class CreateDataSetRmi implements Command<DataSet> { + @Inject + private String session; + + @Inject + private IDssServiceRpcGeneric dss; + + private final DataSet dataSet; + + public CreateDataSetRmi(DataSet dataSet) + { + this.dataSet = dataSet; + } + @Override - public DataSet run(final CreateDataSet request) + public DataSet execute() { - DataSet dataSet = request.getDataSet(); DataSetCreator creator = new DataSetCreator("data set content"); final String code = dss.putDataSet(session, creator.getMetadata(dataSet), creator.getData()); @@ -51,25 +64,25 @@ public class CreateDataSetRmi extends Executor<CreateDataSet, DataSet> @Override public DataSetType getType() { - return request.getDataSet().getType(); + return dataSet.getType(); } @Override public Sample getSample() { - return request.getDataSet().getSample(); + return dataSet.getSample(); } @Override public Experiment getExperiment() { - return request.getDataSet().getExperiment(); + return dataSet.getExperiment(); } @Override public Collection<MetaProject> getMetaProjects() { - return request.getDataSet().getMetaProjects(); + return dataSet.getMetaProjects(); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateDataSetTypeRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateDataSetTypeRmi.java index 2a55f81590e..0ec3d9addf3 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateDataSetTypeRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateDataSetTypeRmi.java @@ -16,30 +16,42 @@ package ch.systemsx.cisd.openbis.uitest.rmi; +import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetKind; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.CreateDataSetType; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.type.DataSetType; /** * @author anttil */ -public class CreateDataSetTypeRmi extends Executor<CreateDataSetType, DataSetType> +public class CreateDataSetTypeRmi implements Command<DataSetType> { + @Inject + private String session; + + @Inject + private ICommonServer commonServer; + + private DataSetType type; + + public CreateDataSetTypeRmi(DataSetType type) + { + this.type = type; + } @Override - public DataSetType run(CreateDataSetType request) + public DataSetType execute() { - DataSetType type = request.getType(); commonServer.registerDataSetType(session, convert(type)); return type; } - private ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType convert(DataSetType type) + private ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType convert(DataSetType dataSetType) { ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType t = new ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType(); - t.setCode(type.getCode()); + t.setCode(dataSetType.getCode()); t.setDataSetKind(DataSetKind.PHYSICAL); return t; } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateExperimentRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateExperimentRmi.java index a7ca3b9adc1..046d1e5b86a 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateExperimentRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateExperimentRmi.java @@ -21,39 +21,52 @@ import java.util.ArrayList; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.CreateExperiment; +import ch.systemsx.cisd.openbis.plugin.generic.shared.IGenericServer; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.type.Experiment; import ch.systemsx.cisd.openbis.uitest.type.Sample; /** * @author anttil */ -public class CreateExperimentRmi extends Executor<CreateExperiment, Experiment> +public class CreateExperimentRmi implements Command<Experiment> { + @Inject + private String session; + + @Inject + private IGenericServer genericServer; + + private Experiment experiment; + + public CreateExperimentRmi(Experiment experiment) + { + this.experiment = experiment; + } + @Override - public Experiment run(CreateExperiment request) + public Experiment execute() { - Experiment experiment = request.getExperiment(); genericServer.registerExperiment(session, convert(experiment), new ArrayList<NewAttachment>()); return experiment; } - private NewExperiment convert(Experiment experiment) + private NewExperiment convert(Experiment exp) { - String experimentId = Identifiers.get(experiment).toString(); - NewExperiment data = new NewExperiment(experimentId, experiment.getType().getCode()); + String experimentId = Identifiers.get(exp).toString(); + NewExperiment data = new NewExperiment(experimentId, exp.getType().getCode()); data.setAttachments(new ArrayList<NewAttachment>()); data.setGenerateCodes(false); data.setNewSamples(null); data.setProperties(new IEntityProperty[0]); data.setRegisterSamples(false); - String[] sampleIds = new String[experiment.getSamples().size()]; + String[] sampleIds = new String[exp.getSamples().size()]; int i = 0; - for (Sample sample : experiment.getSamples()) + for (Sample sample : exp.getSamples()) { sampleIds[i] = sample.getCode(); i++; diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateExperimentTypeRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateExperimentTypeRmi.java index 6708d079112..732942a2bb8 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateExperimentTypeRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateExperimentTypeRmi.java @@ -18,26 +18,39 @@ package ch.systemsx.cisd.openbis.uitest.rmi; import java.util.ArrayList; +import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentTypePropertyType; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.CreateExperimentType; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.type.ExperimentType; /** * @author anttil */ -public class CreateExperimentTypeRmi extends Executor<CreateExperimentType, ExperimentType> +public class CreateExperimentTypeRmi implements Command<ExperimentType> { + @Inject + private String session; + + @Inject + private ICommonServer commonServer; + + private ExperimentType type; + + public CreateExperimentTypeRmi(ExperimentType type) + { + this.type = type; + } @Override - public ExperimentType run(CreateExperimentType request) + public ExperimentType execute() { - ExperimentType type = request.getType(); commonServer.registerExperimentType(session, convert(type)); return type; } private ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType convert( + @SuppressWarnings("hiding") ExperimentType type) { ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType experimentType = diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateMaterialRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateMaterialRmi.java new file mode 100644 index 00000000000..52faa5221a0 --- /dev/null +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateMaterialRmi.java @@ -0,0 +1,75 @@ +/* + * Copyright 2012 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.uitest.rmi; + +import java.util.ArrayList; +import java.util.List; + +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterial; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterialsWithTypes; +import ch.systemsx.cisd.openbis.plugin.generic.shared.IGenericServer; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; +import ch.systemsx.cisd.openbis.uitest.type.Material; + +/** + * @author anttil + */ +public class CreateMaterialRmi implements Command<Material> +{ + @Inject + private String session; + + @Inject + private IGenericServer genericServer; + + private Material material; + + public CreateMaterialRmi(Material material) + { + this.material = material; + } + + @Override + public Material execute() + { + List<NewMaterialsWithTypes> newMaterials = new ArrayList<NewMaterialsWithTypes>(); + + NewMaterialsWithTypes newMaterial = new NewMaterialsWithTypes(); + newMaterial.setAllowUpdateIfExist(false); + + MaterialType type = new MaterialType(); + type.setCode(material.getType().getCode()); + + newMaterial.setEntityType(type); + + NewMaterial what = new NewMaterial(); + what.setCode(material.getCode()); + what.setProperties(new IEntityProperty[0]); + List<NewMaterial> list = new ArrayList<NewMaterial>(); + list.add(what); + newMaterial.setNewEntities(list); + + newMaterials.add(newMaterial); + + genericServer.registerMaterials(session, newMaterials); + + return material; + } +} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateMaterialTypeRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateMaterialTypeRmi.java new file mode 100644 index 00000000000..538863b84fb --- /dev/null +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateMaterialTypeRmi.java @@ -0,0 +1,57 @@ +/* + * Copyright 2012 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.uitest.rmi; + +import java.util.ArrayList; + +import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialTypePropertyType; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; +import ch.systemsx.cisd.openbis.uitest.type.MaterialType; + +/** + * @author anttil + */ +public class CreateMaterialTypeRmi implements Command<MaterialType> +{ + + @Inject + private String session; + + @Inject + private ICommonServer commonServer; + + private MaterialType type; + + public CreateMaterialTypeRmi(MaterialType type) + { + this.type = type; + } + + @Override + public MaterialType execute() + { + ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType materialType = + new ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType(); + materialType.setCode(type.getCode()); + materialType.setDescription(""); + materialType.setMaterialTypePropertyTypes(new ArrayList<MaterialTypePropertyType>()); + commonServer.registerMaterialType(session, materialType); + return type; + } +} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateMetaProjectRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateMetaProjectRmi.java index f61c34e1cb5..90cb1744e35 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateMetaProjectRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateMetaProjectRmi.java @@ -16,21 +16,35 @@ package ch.systemsx.cisd.openbis.uitest.rmi; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.CreateMetaProject; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationChangingService; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.type.MetaProject; /** * @author anttil */ -public class CreateMetaProjectRmi extends Executor<CreateMetaProject, MetaProject> +public class CreateMetaProjectRmi implements Command<MetaProject> { + @Inject + private String session; + + @Inject + private IGeneralInformationChangingService generalInformationChangingService; + + private MetaProject metaProject; + + public CreateMetaProjectRmi(MetaProject metaProject) + { + this.metaProject = metaProject; + } + @Override - public MetaProject run(CreateMetaProject request) + public MetaProject execute() { - MetaProject metaProject = request.getMetaProject(); - generalInformationChangingService.createMetaproject(session, metaProject.getName(), metaProject.getDescription()); + generalInformationChangingService.createMetaproject(session, metaProject.getName(), + metaProject.getDescription()); return metaProject; } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateProjectRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateProjectRmi.java index 8a6052e2d95..9045a14abf9 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateProjectRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateProjectRmi.java @@ -18,24 +18,35 @@ package ch.systemsx.cisd.openbis.uitest.rmi; import java.util.ArrayList; +import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.CreateProject; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.type.Project; /** * @author anttil */ -public class CreateProjectRmi extends Executor<CreateProject, Project> +public class CreateProjectRmi implements Command<Project> { + @Inject + private String session; + + @Inject + private ICommonServer commonServer; + + private Project project; + + public CreateProjectRmi(Project project) + { + this.project = project; + } @Override - public Project run(CreateProject request) + public Project execute() { - Project project = request.getProject(); commonServer.registerProject(session, Identifiers.get(project), project.getDescription(), "system", new ArrayList<NewAttachment>()); return project; } - } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateSampleRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateSampleRmi.java index 39ff35031f7..211c44402df 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateSampleRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateSampleRmi.java @@ -21,40 +21,52 @@ import java.util.ArrayList; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.CreateSample; +import ch.systemsx.cisd.openbis.plugin.generic.shared.IGenericServer; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.type.Sample; import ch.systemsx.cisd.openbis.uitest.type.SampleType; /** * @author anttil */ -public class CreateSampleRmi extends Executor<CreateSample, Sample> +public class CreateSampleRmi implements Command<Sample> { + @Inject + private String session; + + @Inject + private IGenericServer genericServer; + + private Sample sample; + + public CreateSampleRmi(Sample sample) + { + this.sample = sample; + } @Override - public Sample run(CreateSample request) + public Sample execute() { - Sample sample = request.getSample(); genericServer.registerSample(session, convert(sample), new ArrayList<NewAttachment>()); return sample; } - private NewSample convert(Sample sample) + private NewSample convert(Sample s) { NewSample data = new NewSample(); - data.setIdentifier(Identifiers.get(sample).toString()); + data.setIdentifier(Identifiers.get(s).toString()); data.setAttachments(new ArrayList<NewAttachment>()); data.setContainerIdentifier(null); - if (sample.getExperiment() != null) + if (s.getExperiment() != null) { - data.setExperimentIdentifier(Identifiers.get(sample.getExperiment()).toString()); + data.setExperimentIdentifier(Identifiers.get(s.getExperiment()).toString()); } - String[] parentIds = new String[sample.getParents().size()]; + String[] parentIds = new String[s.getParents().size()]; int i = 0; - for (Sample parent : sample.getParents()) + for (Sample parent : s.getParents()) { parentIds[i] = Identifiers.get(parent).toString(); i++; @@ -62,7 +74,7 @@ public class CreateSampleRmi extends Executor<CreateSample, Sample> data.setParentsOrNull(parentIds); data.setProperties(new IEntityProperty[0]); - data.setSampleType(convert(sample.getType())); + data.setSampleType(convert(s.getType())); return data; } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateSampleTypeRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateSampleTypeRmi.java index 8823a8b4a39..1f5653e4804 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateSampleTypeRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateSampleTypeRmi.java @@ -18,36 +18,48 @@ package ch.systemsx.cisd.openbis.uitest.rmi; import java.util.ArrayList; +import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleTypePropertyType; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.CreateSampleType; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.type.SampleType; /** * @author anttil */ -public class CreateSampleTypeRmi extends Executor<CreateSampleType, SampleType> +public class CreateSampleTypeRmi implements Command<SampleType> { + @Inject + private String session; + + @Inject + private ICommonServer commonServer; + + private SampleType type; + + public CreateSampleTypeRmi(SampleType type) + { + this.type = type; + } @Override - public SampleType run(CreateSampleType request) + public SampleType execute() { - SampleType sampleType = request.getType(); - commonServer.registerSampleType(session, convert(sampleType)); - return sampleType; + commonServer.registerSampleType(session, convert(type)); + return type; } - private ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType convert(SampleType type) + private ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType convert(SampleType sampleType) { ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType result = new ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType(); - result.setCode(type.getCode()); + result.setCode(sampleType.getCode()); result.setContainerHierarchyDepth(0); - result.setDescription(type.getDescription()); - result.setGeneratedCodePrefix(type.getGeneratedCodePrefix()); - result.setListable(type.isListable()); + result.setDescription(sampleType.getDescription()); + result.setGeneratedCodePrefix(sampleType.getGeneratedCodePrefix()); + result.setListable(sampleType.isListable()); result.setGeneratedFromHierarchyDepth(0); result.setSampleTypePropertyTypes(new ArrayList<SampleTypePropertyType>()); diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateSpaceRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateSpaceRmi.java index 4c816a674c3..f23d5c2d8bd 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateSpaceRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateSpaceRmi.java @@ -16,20 +16,33 @@ package ch.systemsx.cisd.openbis.uitest.rmi; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.CreateSpace; +import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.type.Space; /** * @author anttil */ -public class CreateSpaceRmi extends Executor<CreateSpace, Space> +public class CreateSpaceRmi implements Command<Space> { + private final Space space; + + @Inject + private ICommonServer commonServer; + + @Inject + private String session; + + public CreateSpaceRmi(Space space) + { + this.space = space; + } + @Override - public Space run(CreateSpace request) + public Space execute() { - Space space = request.getSpace(); commonServer.registerSpace(session, space.getCode(), space.getDescription()); return space; } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateUserRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateUserRmi.java index 7bd269f93fe..488bf76c0d7 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateUserRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/CreateUserRmi.java @@ -16,22 +16,35 @@ package ch.systemsx.cisd.openbis.uitest.rmi; +import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Grantee; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy.RoleCode; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.CreateUser; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.type.User; /** * @author anttil */ -public class CreateUserRmi extends Executor<CreateUser, User> +public class CreateUserRmi implements Command<User> { + @Inject + private String session; + + @Inject + private ICommonServer commonServer; + + private User user; + + public CreateUserRmi(User user) + { + this.user = user; + } + @Override - public User run(CreateUser request) + public User execute() { - User user = request.getUser(); String userName = user.getName(); commonServer.registerPerson(session, userName); commonServer.registerInstanceRole(session, RoleCode.ADMIN, Grantee.createPerson(userName)); diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListDataSetsOfSampleRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListDataSetsOfSampleRmi.java index 1f9de05412c..172c0733f28 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListDataSetsOfSampleRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListDataSetsOfSampleRmi.java @@ -18,13 +18,17 @@ package ch.systemsx.cisd.openbis.uitest.rmi; import java.util.ArrayList; import java.util.Arrays; +import java.util.EnumSet; import java.util.List; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.EntityRegistrationDetails; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.EntityRegistrationDetails.EntityRegistrationDetailsInitializer; -import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample.SampleInitializer; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.ListDataSetsOfSample; +import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SampleFetchOption; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClause; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClauseAttribute; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.rmi.eager.DataSetRmi; import ch.systemsx.cisd.openbis.uitest.type.DataSet; import ch.systemsx.cisd.openbis.uitest.type.Sample; @@ -32,34 +36,40 @@ import ch.systemsx.cisd.openbis.uitest.type.Sample; /** * @author anttil */ -public class ListDataSetsOfSampleRmi extends Executor<ListDataSetsOfSample, List<DataSet>> +public class ListDataSetsOfSampleRmi implements Command<List<DataSet>> { + @Inject + private String session; - @Override - public List<DataSet> run(ListDataSetsOfSample request) - { - Sample s = request.getSample(); + @Inject + private IGeneralInformationService generalInformationService; + + @Inject + private ICommonServer commonServer; + + private Sample sample; - SampleInitializer init = new SampleInitializer(); - init.setId(1L); - init.setPermId("aef"); - init.setCode(s.getCode()); - init.setSpaceCode(s.getSpace().getCode()); - init.setSampleTypeCode(s.getType().getCode()); - init.setIdentifier(Identifiers.get(s).toString()); - init.setSampleTypeId(1L); - init.setRegistrationDetails(new EntityRegistrationDetails( - new EntityRegistrationDetailsInitializer())); + public ListDataSetsOfSampleRmi(Sample sample) + { + this.sample = sample; + } - ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample sample = - new ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample(init); + @Override + public List<DataSet> execute() + { + SearchCriteria criteria = new SearchCriteria(); + criteria.addMatchClause( + MatchClause.createAttributeMatch(MatchClauseAttribute.CODE, sample.getCode())); + List<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample> searchResult = + generalInformationService.searchForSamples( + session, criteria, EnumSet.allOf(SampleFetchOption.class)); List<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet> dataSets = generalInformationService .listDataSets( session, Arrays.asList(new ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample[] - { sample })); + { searchResult.get(0) })); List<DataSet> result = new ArrayList<DataSet>(); for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet dataSet : dataSets) diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListExperimentsRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListExperimentsRmi.java index b1980d78e5e..04ae8d583a8 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListExperimentsRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListExperimentsRmi.java @@ -17,25 +17,45 @@ package ch.systemsx.cisd.openbis.uitest.rmi; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.ListExperiments; +import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.rmi.eager.ExperimentRmi; import ch.systemsx.cisd.openbis.uitest.type.Experiment; /** * @author anttil */ -public class ListExperimentsRmi extends Executor<ListExperiments, List<Experiment>> +public class ListExperimentsRmi implements Command<List<Experiment>> { + @Inject + private String session; + + @Inject + private IGeneralInformationService generalInformationService; + + @Inject + private ICommonServer commonServer; + + private List<String> ids; + + public ListExperimentsRmi(String firstId, String... rest) + { + this.ids = new ArrayList<String>(); + this.ids.add(firstId); + this.ids.addAll(Arrays.asList(rest)); + } + @Override - public List<Experiment> run(ListExperiments request) + public List<Experiment> execute() { - List<String> experimentIds = new ArrayList<String>(request.getExperimentIds()); List<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Experiment> experiments = - generalInformationService.listExperiments(session, experimentIds); + generalInformationService.listExperiments(session, ids); List<Experiment> result = new ArrayList<Experiment>(); for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Experiment e : experiments) diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListMetaProjectsRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListMetaProjectsRmi.java index 0ce49e85cfe..c2b2f321de9 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListMetaProjectsRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListMetaProjectsRmi.java @@ -18,20 +18,27 @@ package ch.systemsx.cisd.openbis.uitest.rmi; import java.util.List; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Metaproject; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.help.Lambda; -import ch.systemsx.cisd.openbis.uitest.request.ListMetaProjects; import ch.systemsx.cisd.openbis.uitest.rmi.eager.MetaProjectRmi; import ch.systemsx.cisd.openbis.uitest.type.MetaProject; /** * @author anttil */ -public class ListMetaProjectsRmi extends Executor<ListMetaProjects, List<MetaProject>> +public class ListMetaProjectsRmi implements Command<List<MetaProject>> { + @Inject + private String session; + + @Inject + private IGeneralInformationService generalInformationService; + @Override - public List<MetaProject> run(ListMetaProjects request) + public List<MetaProject> execute() { return Lambda.foreach( generalInformationService.listMetaprojects(session), diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListSamplesOfExperimentRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListSamplesOfExperimentRmi.java index d4e90948219..b1ae91ac0b3 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListSamplesOfExperimentRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/ListSamplesOfExperimentRmi.java @@ -18,24 +18,42 @@ package ch.systemsx.cisd.openbis.uitest.rmi; import java.util.List; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.help.Lambda; -import ch.systemsx.cisd.openbis.uitest.request.ListSamplesOfExperiment; import ch.systemsx.cisd.openbis.uitest.rmi.eager.SampleRmi; +import ch.systemsx.cisd.openbis.uitest.type.Experiment; import ch.systemsx.cisd.openbis.uitest.type.Sample; /** * @author anttil */ -public class ListSamplesOfExperimentRmi extends Executor<ListSamplesOfExperiment, List<Sample>> +public class ListSamplesOfExperimentRmi implements Command<List<Sample>> { + @Inject + private String session; + + @Inject + private IGeneralInformationService generalInformationService; + + @Inject + private ICommonServer commonServer; + + private Experiment experiment; + + public ListSamplesOfExperimentRmi(Experiment experiment) + { + this.experiment = experiment; + } @Override - public List<Sample> run(ListSamplesOfExperiment request) + public List<Sample> execute() { return Lambda.foreach( generalInformationService.listSamplesForExperiment( - session, Identifiers.get(request.getExperiment()).toString()), + session, Identifiers.get(experiment).toString()), new Lambda<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample, Sample>() { @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/SearchForDataSetsRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/SearchForDataSetsRmi.java index e568d1edc68..f0d81e89227 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/SearchForDataSetsRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/SearchForDataSetsRmi.java @@ -19,26 +19,44 @@ package ch.systemsx.cisd.openbis.uitest.rmi; import java.util.ArrayList; import java.util.List; +import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClause; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClauseAttribute; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; -import ch.systemsx.cisd.openbis.uitest.request.SearchForDataSets; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.rmi.eager.DataSetRmi; import ch.systemsx.cisd.openbis.uitest.type.DataSet; /** * @author anttil */ -public class SearchForDataSetsRmi extends Executor<SearchForDataSets, List<DataSet>> +public class SearchForDataSetsRmi implements Command<List<DataSet>> { + @Inject + private String session; + + @Inject + private IGeneralInformationService generalInformationService; + + @Inject + private ICommonServer commonServer; + + private String code; + + public SearchForDataSetsRmi(String code) + { + this.code = code; + } + @Override - public List<DataSet> run(SearchForDataSets request) + public List<DataSet> execute() { SearchCriteria criteria = new SearchCriteria(); criteria.addMatchClause( - MatchClause.createAttributeMatch(MatchClauseAttribute.CODE, request.getCode())); + MatchClause.createAttributeMatch(MatchClauseAttribute.CODE, code)); List<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet> dataSets = generalInformationService.searchForDataSets(session, criteria); diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/SearchForSamplesRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/SearchForSamplesRmi.java index 2ffa383387b..ea70ded39cc 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/SearchForSamplesRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/SearchForSamplesRmi.java @@ -19,29 +19,45 @@ package ch.systemsx.cisd.openbis.uitest.rmi; import java.util.EnumSet; import java.util.List; +import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SampleFetchOption; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClause; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClauseAttribute; -import ch.systemsx.cisd.openbis.uitest.dsl.Executor; +import ch.systemsx.cisd.openbis.uitest.dsl.Command; +import ch.systemsx.cisd.openbis.uitest.dsl.Inject; import ch.systemsx.cisd.openbis.uitest.help.Lambda; -import ch.systemsx.cisd.openbis.uitest.request.SearchForSamples; import ch.systemsx.cisd.openbis.uitest.rmi.eager.SampleRmi; import ch.systemsx.cisd.openbis.uitest.type.Sample; /** * @author anttil */ -public class SearchForSamplesRmi extends Executor<SearchForSamples, List<Sample>> +public class SearchForSamplesRmi implements Command<List<Sample>> { + @Inject + private String session; - @Override - public List<Sample> run(SearchForSamples request) + @Inject + private IGeneralInformationService generalInformationService; + + @Inject + private ICommonServer commonServer; + + private String code; + + public SearchForSamplesRmi(String code) { + this.code = code; + } + @Override + public List<Sample> execute() + { SearchCriteria criteria = new SearchCriteria(); criteria.addMatchClause( - MatchClause.createAttributeMatch(MatchClauseAttribute.CODE, request.getCode())); + MatchClause.createAttributeMatch(MatchClauseAttribute.CODE, code)); return Lambda.foreach( generalInformationService.searchForSamples( diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/eager/DataSetRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/eager/DataSetRmi.java index e39991a53d6..7fef2d8cecf 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/eager/DataSetRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/eager/DataSetRmi.java @@ -17,8 +17,10 @@ package ch.systemsx.cisd.openbis.uitest.rmi.eager; import java.util.Collection; +import java.util.HashSet; import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Metaproject; import ch.systemsx.cisd.openbis.uitest.type.DataSet; import ch.systemsx.cisd.openbis.uitest.type.DataSetType; import ch.systemsx.cisd.openbis.uitest.type.Experiment; @@ -50,15 +52,12 @@ public class DataSetRmi extends DataSet @Override public Collection<MetaProject> getMetaProjects() { - /* Collection<MetaProject> metaProjects = new HashSet<MetaProject>(); for (Metaproject m : dataSet.getMetaprojects()) { metaProjects.add(new MetaProjectRmi(m)); } return metaProjects; - */ - return null; } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/eager/ExperimentRmi.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/eager/ExperimentRmi.java index 1eaade00e32..ab8eefb7674 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/eager/ExperimentRmi.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/rmi/eager/ExperimentRmi.java @@ -17,8 +17,10 @@ package ch.systemsx.cisd.openbis.uitest.rmi.eager; import java.util.Collection; +import java.util.HashSet; import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Metaproject; import ch.systemsx.cisd.openbis.uitest.type.Experiment; import ch.systemsx.cisd.openbis.uitest.type.ExperimentType; import ch.systemsx.cisd.openbis.uitest.type.MetaProject; @@ -48,15 +50,12 @@ public class ExperimentRmi extends Experiment @Override public Collection<MetaProject> getMetaProjects() { - /* - Collection<MetaProject> metaProjects = new HashSet<MetaProject>(); - for (Metaproject m : experiment.getMetaprojects()) - { - metaProjects.add(new MetaProjectRmi(m)); - } - return metaProjects; - */ - return null; + Collection<MetaProject> metaProjects = new HashSet<MetaProject>(); + for (Metaproject m : experiment.getMetaprojects()) + { + metaProjects.add(new MetaProjectRmi(m)); + } + return metaProjects; } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/DataSetsContainMetaProjectInformation.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/DataSetsContainMetaProjectInformation.java index 3271d6fa4e0..85b573a6c7f 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/DataSetsContainMetaProjectInformation.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/DataSetsContainMetaProjectInformation.java @@ -38,20 +38,20 @@ public class DataSetsContainMetaProjectInformation extends MetaProjectSuite Sample sample = create(aSample().in(experiment)); DataSet dataSet = create(aDataSet().in(sample)); MetaProject metaProject = create(aMetaProject()); - addTo(metaProject, dataSet); + tagWith(metaProject, dataSet); DataSet searchResult = searchDataSet(dataSet); assertThat(metaProjectsOf(searchResult), containExactly(metaProject)); } - @Test(enabled = false) + @Test public void listedDataSetContainsMetaProjectInformation() throws Exception { Experiment experiment = create(anExperiment()); Sample sample = create(aSample().in(experiment)); DataSet dataSet = create(aDataSet().in(sample)); MetaProject metaProject = create(aMetaProject()); - addTo(metaProject, dataSet); + tagWith(metaProject, dataSet); DataSet listResult = listDataSet(dataSet); assertThat(metaProjectsOf(listResult), containExactly(metaProject)); diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/ExperimentsContainMetaProjectInformation.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/ExperimentsContainMetaProjectInformation.java index aabc6d98ceb..e3e2dc75d66 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/ExperimentsContainMetaProjectInformation.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/ExperimentsContainMetaProjectInformation.java @@ -29,12 +29,12 @@ import ch.systemsx.cisd.openbis.uitest.type.MetaProject; public class ExperimentsContainMetaProjectInformation extends MetaProjectSuite { - @Test(enabled = false) + @Test public void listedExperimentContainsMetaProjectInformation() throws Exception { Experiment experiment = create(anExperiment()); MetaProject metaProject = create(aMetaProject()); - addTo(metaProject, experiment); + tagWith(metaProject, experiment); Experiment listResult = listExperiment(experiment); assertThat(metaProjectsOf(listResult), containExactly(metaProject)); diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/AddEntitiesToMetaProject.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/MaterialsContainMetaProjectInformation.java similarity index 53% rename from ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/AddEntitiesToMetaProject.java rename to ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/MaterialsContainMetaProjectInformation.java index 9949bbeeccc..e35a6eeba12 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/AddEntitiesToMetaProject.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/MaterialsContainMetaProjectInformation.java @@ -14,36 +14,30 @@ * limitations under the License. */ -package ch.systemsx.cisd.openbis.uitest.request; +package ch.systemsx.cisd.openbis.uitest.suite.metaproject; -import java.util.Collection; +import org.testng.annotations.Test; -import ch.systemsx.cisd.openbis.uitest.type.Entity; +import ch.systemsx.cisd.openbis.uitest.type.Material; import ch.systemsx.cisd.openbis.uitest.type.MetaProject; /** * @author anttil */ -public class AddEntitiesToMetaProject implements Request<Void> +public class MaterialsContainMetaProjectInformation extends MetaProjectSuite { - private MetaProject metaProject; - - private Collection<Entity> entities; - - public AddEntitiesToMetaProject(MetaProject metaProject, Collection<Entity> entities) + @Test + public void listedMaterialContainsMetaProjectInformation() throws Exception { - this.metaProject = metaProject; - this.entities = entities; + Material material = create(aMaterial()); + MetaProject metaProject = create(aMetaProject()); + tagWith(metaProject, material); + + /* + Experiment listResult = listExperiment(experiment); + assertThat(metaProjectsOf(listResult), containExactly(metaProject)); + */ } - public MetaProject getMetaProject() - { - return metaProject; - } - - public Collection<Entity> getEntities() - { - return entities; - } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/MetaProjectCreation.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/MetaProjectCreation.java index 5885dd20738..4748e0c8934 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/MetaProjectCreation.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/MetaProjectCreation.java @@ -63,9 +63,11 @@ public class MetaProjectCreation extends MetaProjectSuite { create(aMetaProject().withName("UPPERCASElowercase")); - MetaProject metaProject = assume(aMetaProject().withName("UPPERCASElowercase")); + MetaProject existing = assume(aMetaProject().withName("UPPERCASElowercase")); + MetaProject nonExisting = assume(aMetaProject().withName("uppercaselowercase")); - assertThat(listOfAllMetaProjects(), contains(metaProject)); + assertThat(listOfAllMetaProjects(), contains(existing)); + assertThat(listOfAllMetaProjects(), doesNotContain(nonExisting)); } @Test(expectedExceptions = diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/SamplesContainMetaProjectInformation.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/SamplesContainMetaProjectInformation.java index 55a43d80549..3496d141c4f 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/SamplesContainMetaProjectInformation.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/suite/metaproject/SamplesContainMetaProjectInformation.java @@ -35,7 +35,7 @@ public class SamplesContainMetaProjectInformation extends MetaProjectSuite { Sample sample = create(aSample()); MetaProject metaProject = create(aMetaProject()); - addTo(metaProject, sample); + tagWith(metaProject, sample); Sample searchResult = searchSample(sample); assertThat(metaProjectsOf(searchResult), containExactly(metaProject)); @@ -47,7 +47,7 @@ public class SamplesContainMetaProjectInformation extends MetaProjectSuite Experiment experiment = create(anExperiment()); Sample sample = create(aSample().in(experiment)); MetaProject metaProject = create(aMetaProject()); - addTo(metaProject, sample); + tagWith(metaProject, sample); Sample result = listSample(sample); assertThat(metaProjectsOf(result), containExactly(metaProject)); diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateProject.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Material.java similarity index 52% rename from ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateProject.java rename to ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Material.java index 33dac4d67e1..682e75d741d 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/CreateProject.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Material.java @@ -14,25 +14,36 @@ * limitations under the License. */ -package ch.systemsx.cisd.openbis.uitest.request; - -import ch.systemsx.cisd.openbis.uitest.type.Project; +package ch.systemsx.cisd.openbis.uitest.type; /** * @author anttil */ -public class CreateProject implements Request<Project> +public abstract class Material implements Entity { + public abstract String getCode(); + + public abstract MaterialType getType(); - private final Project project; + @Override + public final boolean equals(Object o) + { + if (o instanceof Material) + { + return ((Material) o).getCode().equalsIgnoreCase(getCode()); + } + return false; + } - public CreateProject(Project project) + @Override + public final int hashCode() { - this.project = project; + return getCode().toUpperCase().hashCode(); } - public Project getProject() + @Override + public String toString() { - return project; + return this.getClass().getSimpleName() + " " + this.getCode(); } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/Login.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/MaterialType.java similarity index 55% rename from ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/Login.java rename to ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/MaterialType.java index e2166632f8c..eccf4dceaf1 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/request/Login.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/MaterialType.java @@ -14,30 +14,35 @@ * limitations under the License. */ -package ch.systemsx.cisd.openbis.uitest.request; +package ch.systemsx.cisd.openbis.uitest.type; /** * @author anttil */ -public class Login implements Request<Void> +public abstract class MaterialType { - private final String user; - private final String password; + public abstract String getCode(); - public Login(String user, String password) + @Override + public final boolean equals(Object o) { - this.user = user; - this.password = password; + if (o instanceof MaterialType) + { + return ((MaterialType) o).getCode().equalsIgnoreCase(getCode()); + } + return false; } - public String getUser() + @Override + public final int hashCode() { - return user; + return getCode().toUpperCase().hashCode(); } - public String getPassword() + @Override + public String toString() { - return password; + return this.getClass().getSimpleName() + " " + this.getCode(); } } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/DropDown.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/DropDown.java index fa5bb7b0861..517a420383e 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/DropDown.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/DropDown.java @@ -62,6 +62,11 @@ public class DropDown implements Widget, Fillable throw new IllegalArgumentException("Selection " + text + " not found, got " + found); } + public String getValue() + { + return textField.getValue(); + } + public List<String> getChoices() { List<String> choices = new ArrayList<String>(); -- GitLab