From 77c60d8a4da93a0acbbb083e4961f50b52ce2fc2 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Thu, 11 Dec 2008 14:33:39 +0000
Subject: [PATCH] LMS-663 Simple regression tests for server interfaces added.

SVN: 9306
---
 .../shared/ICommonServer.java.expected        | 182 ++++++++++++++++++
 .../openbis/generic/shared/INormalizer.java   |  27 +++
 .../generic/shared/RegressionTestCase.java    |  71 +++++++
 .../shared/ServerInterfaceRegressionTest.java |  34 ++++
 .../shared/IGenericServer.java.expected       |  89 +++++++++
 .../shared/ServerInterfaceRegressionTest.java |  35 ++++
 .../shared/IScreeningServer.java.expected     |  62 ++++++
 .../shared/ServerInterfaceRegressionTest.java |  35 ++++
 8 files changed, 535 insertions(+)
 create mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java.expected
 create mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/INormalizer.java
 create mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/RegressionTestCase.java
 create mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ServerInterfaceRegressionTest.java
 create mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServer.java.expected
 create mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/shared/ServerInterfaceRegressionTest.java
 create mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/IScreeningServer.java.expected
 create mode 100644 openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/ServerInterfaceRegressionTest.java

diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java.expected b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java.expected
new file mode 100644
index 00000000000..63fa550f349
--- /dev/null
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java.expected
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2008 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.generic.shared;
+
+import java.util.List;
+
+import org.springframework.transaction.annotation.Transactional;
+
+import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.AuthorizationGuard;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.ReturnValueFilter;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.RoleSet;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.RolesAllowed;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.GroupIdentifierPredicate;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.validator.GroupValidator;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.validator.MatchingEntityValidator;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.validator.ProjectValidator;
+import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentTypePE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataPE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.GroupPE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.ListSampleCriteriaDTO;
+import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.RoleAssignmentPE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.RoleCode;
+import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.SampleTypePE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.SearchHit;
+import ch.systemsx.cisd.openbis.generic.shared.dto.SearchableEntity;
+import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.DatabaseInstanceIdentifier;
+import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.GroupIdentifier;
+import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier;
+import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier;
+
+/**
+ * Definition of the client-server interface.
+ * 
+ * @author Franz-Josef Elmer
+ */
+public interface ICommonServer extends IServer
+{
+    /**
+     * Returns all groups which belong to the specified database instance.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.OBSERVER)
+    @ReturnValueFilter(validatorClass = GroupValidator.class)
+    public List<GroupPE> listGroups(String sessionToken, DatabaseInstanceIdentifier identifier);
+
+    /**
+     * Registers a new group with specified code and optional description and group leader ID.
+     */
+    @Transactional
+    @RolesAllowed(RoleSet.INSTANCE_ADMIN)
+    public void registerGroup(String sessionToken, String groupCode, String descriptionOrNull,
+            String groupLeaderOrNull);
+
+    /**
+     * Returns all persons from current instance.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.OBSERVER)
+    public List<PersonPE> listPersons(String sessionToken);
+
+    /**
+     * Returns all projects.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.OBSERVER)
+    @ReturnValueFilter(validatorClass = ProjectValidator.class)
+    public List<ProjectPE> listProjects(String sessionToken);
+
+    /**
+     * Registers a new person.
+     */
+    @Transactional
+    @RolesAllowed(RoleSet.INSTANCE_ADMIN)
+    public void registerPerson(String sessionToken, String userID);
+
+    /**
+     * Returns a list of all roles.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.GROUP_ADMIN)
+    public List<RoleAssignmentPE> listRoles(String sessionToken);
+
+    /**
+     * Registers a new group role.
+     */
+    @Transactional
+    @RolesAllowed(RoleSet.GROUP_ADMIN)
+    public void registerGroupRole(String sessionToken, RoleCode roleCode,
+            @AuthorizationGuard(guardClass = GroupIdentifierPredicate.class)
+            GroupIdentifier identifier, String person);
+
+    /**
+     * Registers a new instance role.
+     */
+    @Transactional
+    @RolesAllowed(RoleSet.INSTANCE_ADMIN)
+    public void registerInstanceRole(String sessionToken, RoleCode roleCode, String person);
+
+    /**
+     * Deletes role described by given role code, group identifier and user id.
+     */
+    @Transactional
+    @RolesAllowed(RoleSet.GROUP_ADMIN)
+    public void deleteGroupRole(String sessionToken, RoleCode roleCode,
+            @AuthorizationGuard(guardClass = GroupIdentifierPredicate.class)
+            GroupIdentifier groupIdentifier, String person);
+
+    /**
+     * Deletes role described by given role code and user id.
+     */
+    @Transactional
+    @RolesAllowed(RoleSet.INSTANCE_ADMIN)
+    public void deleteInstanceRole(String sessionToken, RoleCode roleCode, String person);
+
+    /**
+     * Lists sample types which are appropriate for listing.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.OBSERVER)
+    public List<SampleTypePE> listSampleTypes(String sessionToken);
+
+    /**
+     * Lists samples using given configuration.No properties are loaded.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.OBSERVER)
+    public List<SamplePE> listSamples(final String sessionToken,
+            final ListSampleCriteriaDTO criteria);
+
+    /**
+     * Lists experiments.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.OBSERVER)
+    public List<ExperimentPE> listExperiments(final String sessionToken,
+            ExperimentTypePE experimentType,
+            @AuthorizationGuard(guardClass = GroupIdentifierPredicate.class)
+            ProjectIdentifier project);
+
+    /**
+     * For given {@link SampleIdentifier} returns the corresponding list of {@link ExternalDataPE}.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.OBSERVER)
+    public List<ExternalDataPE> listExternalData(final String sessionToken,
+            final SampleIdentifier identifier);
+
+    /**
+     * Performs an <i>Hibernate Search</i> based on given parameters.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.OBSERVER)
+    @ReturnValueFilter(validatorClass = MatchingEntityValidator.class)
+    public List<SearchHit> listMatchingEntities(final String sessionToken,
+            final SearchableEntity[] searchableEntities, final String queryText);
+
+    /**
+     * List experiment types.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.OBSERVER)
+    public List<ExperimentTypePE> listExperimentTypes(String sessionToken);
+
+}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/INormalizer.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/INormalizer.java
new file mode 100644
index 00000000000..8da91428930
--- /dev/null
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/INormalizer.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2008 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.generic.shared;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public interface INormalizer
+{
+    public String normalize(String notNormalizedText);
+}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/RegressionTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/RegressionTestCase.java
new file mode 100644
index 00000000000..e90919398c9
--- /dev/null
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/RegressionTestCase.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2008 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.generic.shared;
+
+import java.io.File;
+
+import org.testng.AssertJUnit;
+
+import ch.systemsx.cisd.common.filesystem.FileUtilities;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public class RegressionTestCase extends AssertJUnit
+{
+    private static final File SOURCE_FOLDER = new File("source/java");
+    private static final File SOURCE_TEST_FOLDER = new File("sourceTest/java");
+    
+    private static final class DefaultNormalizer implements INormalizer
+    {
+        static final INormalizer INSTANCE = new DefaultNormalizer();
+        
+        public String normalize(String notNormalizedText)
+        {
+            return notNormalizedText;
+        }
+    }
+    
+    protected void assertNormalizedSourceFilesAreEqual(Class<?> clazz)
+    {
+        assertNormalizedSourceFilesAreEqual(clazz, SOURCE_TEST_FOLDER, SOURCE_FOLDER,
+                DefaultNormalizer.INSTANCE);
+    }
+    
+    protected void assertNormalizedSourceFilesAreEqual(Class<?> clazz, File rootFolderOfExpected,
+            File rootFolderOfActual)
+    {
+        assertNormalizedSourceFilesAreEqual(clazz, rootFolderOfExpected, rootFolderOfActual,
+                DefaultNormalizer.INSTANCE);
+    }
+    
+    protected void assertNormalizedSourceFilesAreEqual(Class<?> clazz, File rootFolderOfExpected,
+            File rootFolderOfActual, INormalizer normalizer)
+    {
+        String fileName = clazz.getName().replace('.', '/') + ".java";
+        String expectedContent = readContent(normalizer, rootFolderOfExpected, fileName + ".expected");
+        String actualContent = readContent(normalizer, rootFolderOfActual, fileName);
+        assertEquals(expectedContent, actualContent);
+    }
+    
+    private String readContent(INormalizer normalizer, File rootFolder, String fileName)
+    {
+        return normalizer.normalize(FileUtilities.loadToString(new File(rootFolder, fileName))); 
+    }
+}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ServerInterfaceRegressionTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ServerInterfaceRegressionTest.java
new file mode 100644
index 00000000000..9b82de47dde
--- /dev/null
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ServerInterfaceRegressionTest.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2008 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.generic.shared;
+
+import org.testng.annotations.Test;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public class ServerInterfaceRegressionTest extends RegressionTestCase
+{
+    
+    @Test
+    public void testICommonServer()
+    {
+        assertNormalizedSourceFilesAreEqual(ICommonServer.class);
+    }
+}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServer.java.expected b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServer.java.expected
new file mode 100644
index 00000000000..7f81456695e
--- /dev/null
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServer.java.expected
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2008 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.plugin.generic.shared;
+
+import java.util.List;
+
+import org.springframework.transaction.annotation.Transactional;
+
+import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.client.web.client.dto.NewSample;
+import ch.systemsx.cisd.openbis.generic.client.web.client.dto.SampleType;
+import ch.systemsx.cisd.openbis.generic.shared.IServer;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.AuthorizationGuard;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.RoleSet;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.RolesAllowed;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.GroupIdentifierPredicate;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.NewSamplePredicate;
+import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentPE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.SampleGenerationDTO;
+import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier;
+import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier;
+
+/**
+ * Definition of the client-server interface.
+ * 
+ * @author Franz-Josef Elmer
+ */
+public interface IGenericServer extends IServer
+{
+
+    /**
+     * For given {@link SampleIdentifier} returns the corresponding {@link SamplePE}.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.OBSERVER)
+    public SampleGenerationDTO getSampleInfo(final String sessionToken,
+            final SampleIdentifier identifier);
+
+    /**
+     * Registers a new sample.
+     */
+    @Transactional
+    @RolesAllowed(RoleSet.USER)
+    public void registerSample(final String sessionToken,
+            @AuthorizationGuard(guardClass = NewSamplePredicate.class)
+            final NewSample newSample);
+
+    /**
+     * For given {@link ExperimentIdentifier} returns the corresponding {@link ExperimentPE}.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.OBSERVER)
+    public ExperimentPE getExperimentInfo(String sessionToken, ExperimentIdentifier identifier);
+
+    /**
+     * Returns attachment described by given experiment identifier, filename and version.
+     */
+    @Transactional
+    @RolesAllowed(RoleSet.OBSERVER)
+    public AttachmentPE getExperimentFileAttachment(String sessionToken,
+            @AuthorizationGuard(guardClass = GroupIdentifierPredicate.class)
+            ExperimentIdentifier experimentIdentifier, String filename, int version)
+            throws UserFailureException;
+
+    /**
+     * Registers samples in batch.
+     */
+    @Transactional
+    @RolesAllowed(RoleSet.USER)
+    public void registerSamples(final String sessionToken, SampleType sampleType,
+            @AuthorizationGuard(guardClass = NewSamplePredicate.class)
+            final List<NewSample> newSamples) throws UserFailureException;
+}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/shared/ServerInterfaceRegressionTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/shared/ServerInterfaceRegressionTest.java
new file mode 100644
index 00000000000..dcd25f84544
--- /dev/null
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/shared/ServerInterfaceRegressionTest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 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.plugin.generic.shared;
+
+import org.testng.annotations.Test;
+
+import ch.systemsx.cisd.openbis.generic.shared.RegressionTestCase;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public class ServerInterfaceRegressionTest extends RegressionTestCase
+{
+    @Test
+    public void testIGenericServer()
+    {
+        assertNormalizedSourceFilesAreEqual(IGenericServer.class);
+    }
+}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/IScreeningServer.java.expected b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/IScreeningServer.java.expected
new file mode 100644
index 00000000000..d55fb9f9a7f
--- /dev/null
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/IScreeningServer.java.expected
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2008 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.plugin.screening.shared;
+
+import org.springframework.transaction.annotation.Transactional;
+
+import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.client.web.client.dto.NewSample;
+import ch.systemsx.cisd.openbis.generic.shared.IServer;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.AuthorizationGuard;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.RoleSet;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.RolesAllowed;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.SampleOwnerIdentifierPredicate;
+import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.NewSamplePredicate;
+import ch.systemsx.cisd.openbis.generic.shared.dto.SampleGenerationDTO;
+import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier;
+
+/**
+ * The <i>screening</i> server.
+ * 
+ * @author Christian Ribeaud
+ */
+public interface IScreeningServer extends IServer
+{
+
+    /**
+     * For given <var>sampleIdentifier</var> returns the {@link SamplePE} and its children.
+     * 
+     * @return never <code>null</code>.
+     * @throws UserFailureException if given <var>sessionToken</var> is invalid or whether sample
+     *             uniquely identified by given <var>sampleIdentifier</var> does not exist.
+     */
+    @Transactional(readOnly = true)
+    @RolesAllowed(RoleSet.OBSERVER)
+    SampleGenerationDTO getSampleInfo(final String sessionToken,
+            @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class)
+            final SampleIdentifier sampleIdentifier) throws UserFailureException;
+
+    /**
+     * Registers a new sample.
+     */
+    @Transactional
+    @RolesAllowed(RoleSet.USER)
+    public void registerSample(final String sessionToken,
+            @AuthorizationGuard(guardClass = NewSamplePredicate.class)
+            final NewSample newSample);
+}
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/ServerInterfaceRegressionTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/ServerInterfaceRegressionTest.java
new file mode 100644
index 00000000000..354ba4d0e7a
--- /dev/null
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/ServerInterfaceRegressionTest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 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.plugin.screening.shared;
+
+import org.testng.annotations.Test;
+
+import ch.systemsx.cisd.openbis.generic.shared.RegressionTestCase;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public class ServerInterfaceRegressionTest extends RegressionTestCase
+{
+    @Test
+    public void testIGenericServer()
+    {
+        assertNormalizedSourceFilesAreEqual(IScreeningServer.class);
+    }
+}
-- 
GitLab