From 45a004a1dd3c54c20357170d81719628750f7ec2 Mon Sep 17 00:00:00 2001
From: cramakri <cramakri>
Date: Mon, 11 Oct 2010 14:31:40 +0000
Subject: [PATCH] LMS-1811 Implemented generate sample code service, refactored
 stuff.

SVN: 18246
---
 ...tCommand.java => AbstractCinaCommand.java} |  60 +---
 .../client/util/cli/AbstractExecutor.java     |   4 +-
 .../client/util/cli/CinaCommandFactory.java   |  10 +-
 .../util/cli/CommandGenerateSampleCode.java   |  99 +++++
 .../client/util/cli/CommandSampleLister.java  |  12 +-
 .../cina/client/util/v1/ICinaUtilities.java   |  14 +-
 .../util/v1/impl/CinaUtilitiesFacade.java     |  58 ++-
 .../dss/info/CinaDataSetInfoExtractor.java    | 176 ---------
 .../cisd/cina/dss/info/CinaTypeExtractor.java | 118 ------
 .../info/EntityRegistrationSuccessEmail.java  | 289 ---------------
 .../cisd/cina/dss/info/EntityTypes.java       |  63 ----
 ...imentRegistrationInformationExtractor.java | 177 ---------
 .../cisd/cina/dss/info/FolderOracle.java      | 233 ------------
 ...ampleRegistrationInformationExtractor.java | 182 ----------
 .../util/cli/CinaCommandFactoryTest.java      |   2 +-
 .../client/util/cli/CommandFactoryTest.java   |   6 +-
 .../cli/CommandGenerateSampleCodeTest.java    | 129 +++++++
 ...Test.java => CommandSampleListerTest.java} |  19 +-
 .../util/v1/impl/CinaUtilitiesFacadeTest.java |  55 ++-
 .../cina/dss/MockDefaultStorageProcessor.java |  58 ---
 .../cisd/cina/dss/StorageProcessorTest.java   | 139 --------
 .../info/CinaDataSetInfoExtractorTest.java    | 133 -------
 .../info/ExperimentMetadataExtractorTest.java | 237 ------------
 .../cisd/cina/dss/info/FolderOracleTest.java  |  88 -----
 .../dss/info/SampleMetadataExtractorTest.java | 337 ------------------
 .../ambiguous-data-folder/dataset.properties  |   3 -
 .../ambiguous-data-folder/sample.properties   |   3 -
 .../dataset-data-folder/dataset.properties    |   3 -
 .../dss/info/dataset-data-folder/metadata.xml |  63 ----
 .../dss/info/empty-data-folder/.gitignore     |   0
 .../experiment.properties                     |   3 -
 .../info/sample-data-folder/sample.properties |   3 -
 32 files changed, 380 insertions(+), 2396 deletions(-)
 rename rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/{AbstractCommand.java => AbstractCinaCommand.java} (53%)
 create mode 100644 rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/CommandGenerateSampleCode.java
 delete mode 100644 rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/CinaDataSetInfoExtractor.java
 delete mode 100644 rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/CinaTypeExtractor.java
 delete mode 100644 rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/EntityRegistrationSuccessEmail.java
 delete mode 100644 rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/EntityTypes.java
 delete mode 100644 rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/ExperimentRegistrationInformationExtractor.java
 delete mode 100644 rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/FolderOracle.java
 delete mode 100644 rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/SampleRegistrationInformationExtractor.java
 create mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CommandGenerateSampleCodeTest.java
 rename rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/{SampleListerCommandTest.java => CommandSampleListerTest.java} (92%)
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/MockDefaultStorageProcessor.java
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/StorageProcessorTest.java
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/CinaDataSetInfoExtractorTest.java
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/ExperimentMetadataExtractorTest.java
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/FolderOracleTest.java
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/SampleMetadataExtractorTest.java
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/ambiguous-data-folder/dataset.properties
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/ambiguous-data-folder/sample.properties
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/dataset-data-folder/dataset.properties
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/dataset-data-folder/metadata.xml
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/empty-data-folder/.gitignore
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/experiment-data-folder/experiment.properties
 delete mode 100644 rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/sample-data-folder/sample.properties

diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/AbstractCommand.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/AbstractCinaCommand.java
similarity index 53%
rename from rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/AbstractCommand.java
rename to rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/AbstractCinaCommand.java
index 88540021853..b583ec0ccd7 100644
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/AbstractCommand.java
+++ b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/AbstractCinaCommand.java
@@ -16,14 +16,10 @@
 
 package ch.systemsx.cisd.cina.client.util.cli;
 
-import java.io.PrintStream;
-
-import ch.systemsx.cisd.args4j.CmdLineParser;
-import ch.systemsx.cisd.args4j.ExampleMode;
 import ch.systemsx.cisd.cina.client.util.v1.CinaUtilitiesFacadeFactory;
 import ch.systemsx.cisd.cina.client.util.v1.ICinaUtilities;
+import ch.systemsx.cisd.openbis.dss.client.api.cli.AbstractCommand;
 import ch.systemsx.cisd.openbis.dss.client.api.cli.GlobalArguments;
-import ch.systemsx.cisd.openbis.dss.client.api.cli.ICommand;
 
 /**
  * Superclass for cina command-line client commands.
@@ -36,54 +32,20 @@ import ch.systemsx.cisd.openbis.dss.client.api.cli.ICommand;
  * 
  * @author Chandrasekhar Ramakrishnan
  */
-abstract class AbstractCommand<T extends GlobalArguments> implements ICommand
+abstract class AbstractCinaCommand<T extends GlobalArguments> extends AbstractCommand<T>
 {
-    // The parser for command-line arguments; set by subclasses in the constructor.
-    protected final CmdLineParser parser;
-
-    // The object that describes and receives the value of the arguments
-    protected final T arguments;
-
-    protected AbstractCommand(T arguments)
-    {
-        this.parser = new CmdLineParser(arguments);
-        this.arguments = arguments;
-    }
-
-    /**
-     * Print usage information about the command.
-     */
-    public void printUsage(PrintStream out)
-    {
-        out.println(getUsagePrefixString() + " [options]");
-        parser.printUsage(out);
-        out.println("  Example : " + getCommandCallString() + " "
-                + parser.printExample(ExampleMode.ALL) + "");
-    }
-
-    /**
-     * How is this command invoked from the command line? This is the program call string + command
-     * name
-     */
-    protected String getCommandCallString()
-    {
-        return getProgramCallString() + " " + getName();
-    }
-
-    /**
-     * Used for displaying help.
-     */
-    protected String getUsagePrefixString()
+    protected AbstractCinaCommand(T arguments)
     {
-        return "usage: " + getCommandCallString();
+        super(arguments);
     }
 
     /**
      * How is this program invoked from the command line?
      */
+    @Override
     protected String getProgramCallString()
     {
-        return "cina_client.sh";
+        return CinaCommandFactory.PROGRAM_CALL_STRING;
     }
 
     /**
@@ -100,14 +62,4 @@ abstract class AbstractCommand<T extends GlobalArguments> implements ICommand
         }
         return component;
     }
-
-    CmdLineParser getParser()
-    {
-        return parser;
-    }
-
-    T getArguments()
-    {
-        return arguments;
-    }
 }
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/AbstractExecutor.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/AbstractExecutor.java
index 1453784a21e..b370baa3bbd 100644
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/AbstractExecutor.java
+++ b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/AbstractExecutor.java
@@ -29,9 +29,9 @@ abstract class AbstractExecutor<A extends GlobalArguments>
 
     private final CmdLineParser parser;
 
-    private final AbstractCommand<A> command;
+    private final AbstractCinaCommand<A> command;
 
-    AbstractExecutor(AbstractCommand<A> command)
+    AbstractExecutor(AbstractCinaCommand<A> command)
     {
         this.command = command;
         arguments = command.getArguments();
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/CinaCommandFactory.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/CinaCommandFactory.java
index 31fb6399b91..e3797d8e5fe 100644
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/CinaCommandFactory.java
+++ b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/CinaCommandFactory.java
@@ -32,13 +32,13 @@ public class CinaCommandFactory extends AbstractCommandFactory
 
     private static enum Command
     {
-        PREPS, GENID, HELP
+        LISTSAMPS, GENCODE, HELP
     }
 
     public List<String> getKnownCommands()
     {
         String[] commands =
-            { "preps", "genid" };
+            { "listsamps", "gencode" };
         return Arrays.asList(commands);
     }
 
@@ -67,11 +67,11 @@ public class CinaCommandFactory extends AbstractCommandFactory
         ICommand result;
         switch (command)
         {
-            case PREPS:
+            case LISTSAMPS:
                 result = new CommandSampleLister();
                 break;
-            case GENID:
-                result = new CommandSampleLister();
+            case GENCODE:
+                result = new CommandGenerateSampleCode();
                 break;
             case HELP:
                 result = new CommandHelp(this, PROGRAM_CALL_STRING);
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/CommandGenerateSampleCode.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/CommandGenerateSampleCode.java
new file mode 100644
index 00000000000..8c52d14992e
--- /dev/null
+++ b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/CommandGenerateSampleCode.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2010 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.cina.client.util.cli;
+
+import ch.systemsx.cisd.cina.client.util.v1.ICinaUtilities;
+import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
+import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.dss.client.api.cli.GlobalArguments;
+
+/**
+ * @author Chandrasekhar Ramakrishnan
+ */
+public class CommandGenerateSampleCode extends
+        AbstractCinaCommand<CommandGenerateSampleCode.CommandGenerateSampleCodeArguments>
+{
+    static class CommandGenerateSampleCodeArguments extends GlobalArguments
+    {
+        public String getSampleTypeCode()
+        {
+            return getArguments().get(0).toString().toUpperCase();
+        }
+
+        @Override
+        public boolean isComplete()
+        {
+            if (getArguments().size() < 1)
+            {
+                return false;
+            }
+            if (getSampleTypeCode().length() < 1)
+            {
+                return false;
+            }
+
+            if (false == super.isComplete())
+                return false;
+
+            return true;
+        }
+    }
+
+    private static class GenerateSampleIdExecutor extends
+            AbstractExecutor<CommandGenerateSampleCodeArguments>
+    {
+        /**
+         * @param command The parent command
+         */
+        GenerateSampleIdExecutor(CommandGenerateSampleCode command)
+        {
+            super(command);
+        }
+
+        @Override
+        protected int doExecute(ICinaUtilities component)
+        {
+            String sampleTypeCode = arguments.getSampleTypeCode();
+            String result = component.generateSampleCode(sampleTypeCode);
+            System.out.println(result);
+            return 0;
+        }
+
+    }
+
+    public CommandGenerateSampleCode()
+    {
+        super(new CommandGenerateSampleCodeArguments());
+    }
+
+    public int execute(String[] args) throws UserFailureException, EnvironmentFailureException
+    {
+        return new GenerateSampleIdExecutor(this).execute(args);
+    }
+
+    public String getName()
+    {
+        return "gencode";
+    }
+
+    @Override
+    protected String getRequiredArgumentsString()
+    {
+        return "<sample type code>";
+    }
+
+}
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/CommandSampleLister.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/CommandSampleLister.java
index 19df328ef04..55c661f33d3 100644
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/CommandSampleLister.java
+++ b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/cli/CommandSampleLister.java
@@ -31,7 +31,7 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchCl
 /**
  * @author Chandrasekhar Ramakrishnan
  */
-public class CommandSampleLister extends AbstractCommand<GlobalArguments>
+public class CommandSampleLister extends AbstractCinaCommand<GlobalArguments>
 {
     private static class SampleListerExecutor extends AbstractExecutor<GlobalArguments>
     {
@@ -42,7 +42,7 @@ public class CommandSampleLister extends AbstractCommand<GlobalArguments>
         {
             super(command);
         }
-        
+
         @Override
         protected int doExecute(ICinaUtilities component)
         {
@@ -71,6 +71,12 @@ public class CommandSampleLister extends AbstractCommand<GlobalArguments>
 
     public String getName()
     {
-        return "list-samples";
+        return "listsamps";
+    }
+
+    @Override
+    protected String getRequiredArgumentsString()
+    {
+        return "";
     }
 }
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/v1/ICinaUtilities.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/v1/ICinaUtilities.java
index d600880d14b..40d819a9850 100644
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/v1/ICinaUtilities.java
+++ b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/v1/ICinaUtilities.java
@@ -46,7 +46,19 @@ public interface ICinaUtilities
      * @throws EnvironmentFailureException Thrown in cases where it is not possible to connect to
      *             the server.
      */
-    public List<Sample> searchForSamples(SearchCriteria searchCriteria) throws IllegalStateException,
+    public List<Sample> searchForSamples(SearchCriteria searchCriteria)
+            throws IllegalStateException, EnvironmentFailureException;
+
+    /**
+     * Return a generated sample code for the provided sample type.
+     * 
+     * @param sampleTypeCode The sample type of the sample the generated identifier will belong to.
+     * @return A sample code for the provided sample type.
+     * @throws IllegalStateException Thrown if the user has not yet been authenticated.
+     * @throws EnvironmentFailureException Thrown in cases where it is not possible to connect to
+     *             the server.
+     */
+    public String generateSampleCode(String sampleTypeCode) throws IllegalStateException,
             EnvironmentFailureException;
 
     /**
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/v1/impl/CinaUtilitiesFacade.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/v1/impl/CinaUtilitiesFacade.java
index 1d5ccdb9ddb..a1d20e15410 100644
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/v1/impl/CinaUtilitiesFacade.java
+++ b/rtd_cina/source/java/ch/systemsx/cisd/cina/client/util/v1/impl/CinaUtilitiesFacade.java
@@ -24,9 +24,13 @@ import ch.systemsx.cisd.cina.client.util.v1.ICinaUtilities;
 import ch.systemsx.cisd.common.api.client.ServiceFinder;
 import ch.systemsx.cisd.common.exceptions.AuthorizationFailureException;
 import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
+import ch.systemsx.cisd.openbis.generic.shared.IETLLIMSService;
+import ch.systemsx.cisd.openbis.generic.shared.OpenBisServiceFactory;
+import ch.systemsx.cisd.openbis.generic.shared.ResourceNames;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType;
 
 /**
  * @author Chandrasekhar Ramakrishnan
@@ -34,7 +38,7 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria;
 public class CinaUtilitiesFacade implements ICinaUtilities
 {
     /**
-     * Public factory method for creating a DssComponent with a username and password.
+     * Public factory method for creating a CinaUtilitiesFacade with a username and password.
      * 
      * @param user The user name
      * @param password The user's password
@@ -77,9 +81,17 @@ public class CinaUtilitiesFacade implements ICinaUtilities
         return service;
     }
 
+    private static IETLLIMSService createOpenBisService(String openBISURL)
+    {
+        return new OpenBisServiceFactory(openBISURL, ResourceNames.ETL_SERVICE_URL).createService();
+    }
+
     /** The interface for accessing the remote services. */
     private final IGeneralInformationService generalInformationService;
 
+    /** The LIMS service. */
+    private final IETLLIMSService openbisService;
+
     /** The current state of the facade */
     private AbstractCinaFacadeState state;
 
@@ -95,7 +107,8 @@ public class CinaUtilitiesFacade implements ICinaUtilities
      */
     private CinaUtilitiesFacade(String openBISURL, String sessionTokenOrNull)
     {
-        this(createGeneralInformationService(openBISURL), sessionTokenOrNull);
+        this(createGeneralInformationService(openBISURL), createOpenBisService(openBISURL),
+                sessionTokenOrNull);
     }
 
     /**
@@ -103,20 +116,24 @@ public class CinaUtilitiesFacade implements ICinaUtilities
      * 
      * @param generalInformationService A proxy to the openBIS application server's general
      *            information service
+     * @param openbisService A proxy to the openBIS application server's ETLLIMS Service
      * @param sessionTokenOrNull A session token, if the user has already logged in, or null
      *            otherwise.
      */
     protected CinaUtilitiesFacade(IGeneralInformationService generalInformationService,
-            String sessionTokenOrNull)
+            IETLLIMSService openbisService, String sessionTokenOrNull)
 
     {
         this.generalInformationService = generalInformationService;
+        this.openbisService = openbisService;
         if (sessionTokenOrNull == null)
         {
             this.state = new UnauthenticatedState(generalInformationService);
         } else
         {
-            this.state = new AuthenticatedState(generalInformationService, sessionTokenOrNull);
+            this.state =
+                    new AuthenticatedState(generalInformationService, openbisService,
+                            sessionTokenOrNull);
         }
     }
 
@@ -132,7 +149,9 @@ public class CinaUtilitiesFacade implements ICinaUtilities
     {
         // login and transition to the authenticated state
         state.login(user, password);
-        state = new AuthenticatedState(generalInformationService, state.getSessionToken());
+        state =
+                new AuthenticatedState(generalInformationService, openbisService,
+                        state.getSessionToken());
     }
 
     public void logout()
@@ -152,6 +171,12 @@ public class CinaUtilitiesFacade implements ICinaUtilities
     {
         return state.searchForSamples(searchCriteria);
     }
+
+    public String generateSampleCode(String sampleTypeCode) throws IllegalStateException,
+            EnvironmentFailureException
+    {
+        return state.generateSampleCode(sampleTypeCode);
+    }
 }
 
 /**
@@ -182,6 +207,12 @@ abstract class AbstractCinaFacadeState implements ICinaUtilities
         throw new IllegalStateException("Please log in");
     }
 
+    public String generateSampleCode(String sampleTypeCode) throws IllegalStateException,
+            EnvironmentFailureException
+    {
+        throw new IllegalStateException("Please log in");
+    }
+
     /**
      * Authenticates the <code>user</code> with given <code>password</code>.
      * 
@@ -252,13 +283,17 @@ class AuthenticatedState extends AbstractCinaFacadeState
 {
     private final String sessionToken;
 
+    private final IETLLIMSService openbisService;
+
     /**
      * @param service
      */
-    AuthenticatedState(IGeneralInformationService service, String sessionToken)
+    AuthenticatedState(IGeneralInformationService service, IETLLIMSService openbisService,
+            String sessionToken)
     {
         super(service);
         this.sessionToken = sessionToken;
+        this.openbisService = openbisService;
     }
 
     @Override
@@ -291,4 +326,15 @@ class AuthenticatedState extends AbstractCinaFacadeState
     {
         return sessionToken;
     }
+
+    @Override
+    public String generateSampleCode(String sampleTypeCode) throws IllegalStateException,
+            EnvironmentFailureException
+    {
+        SampleType replicaSampleType = openbisService.getSampleType(sessionToken, sampleTypeCode);
+        long sampleCodeSuffix = openbisService.drawANewUniqueID(sessionToken);
+        String sampleCode =
+                String.format("%s%d", replicaSampleType.getGeneratedCodePrefix(), sampleCodeSuffix);
+        return sampleCode;
+    }
 }
\ No newline at end of file
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/CinaDataSetInfoExtractor.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/CinaDataSetInfoExtractor.java
deleted file mode 100644
index f934c9ee9f3..00000000000
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/CinaDataSetInfoExtractor.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss.info;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Properties;
-import java.util.Map.Entry;
-
-import ch.systemsx.cisd.cina.dss.info.FolderOracle.FolderMetadata;
-import ch.systemsx.cisd.cina.dss.info.FolderOracle.FolderType;
-import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
-import ch.systemsx.cisd.common.exceptions.UserFailureException;
-import ch.systemsx.cisd.etlserver.IDataSetInfoExtractor;
-import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
-import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation;
-
-/**
- * TODO 2010-08-16, CR, This class is no longer used. It can be deleted.
- * <p>
- * CINA uses the data store server to register experiments and samples in addition to data sets. The
- * CinaBundleDataSetInfoExtractor follows the conventions agreed to by the CINA project to determine
- * if the file represents an experiment, sample, or data set and takes according action.
- * <p>
- * In the case of data representing experiments and samples, the extractor may need to register the
- * experiment/sample with openBIS before continuing to process the data set.
- * 
- * @author Chandrasekhar Ramakrishnan
- */
-public class CinaDataSetInfoExtractor implements IDataSetInfoExtractor
-{
-    // Keys used in the metadata file
-    static final String DESCRIPTION_KEY = "DESCRIPTION";
-
-    public CinaDataSetInfoExtractor(final Properties properties)
-    {
-
-    }
-
-    public DataSetInformation getDataSetInformation(File incomingDataSetFile,
-            IEncapsulatedOpenBISService openbisService) throws UserFailureException,
-            EnvironmentFailureException
-    {
-        final DataSetInformation dataSetInformation = new DataSetInformation();
-
-        final FolderOracle folderOracle = new FolderOracle();
-        FolderMetadata metadata = folderOracle.getFolderMetadataForFolder(incomingDataSetFile);
-        FolderType folderType = metadata.getType();
-
-        switch (folderType)
-        {
-            case DATA_SET:
-                processDataSetFolder(metadata, dataSetInformation, openbisService);
-                break;
-            case EXPERIMENT:
-                processExperimentFolder(metadata, dataSetInformation, openbisService);
-                break;
-            case SAMPLE:
-                processSampleFolder(metadata, dataSetInformation, openbisService);
-                break;
-            case UNKNOWN:
-                // Ignore it
-                break;
-        }
-
-        return dataSetInformation;
-    }
-
-    /**
-     * See if the incoming data set folder is contains an experiment and, if so, register the
-     * experiment.
-     */
-    private void processExperimentFolder(final FolderMetadata folderMetadata,
-            final DataSetInformation dataSetInformation, IEncapsulatedOpenBISService openbisService)
-    {
-        final File markerFile = folderMetadata.tryGetMarkerFile();
-        try
-        {
-            HashMap<String, String> metadata = new HashMap<String, String>();
-            metadata = appendMarkerFileToMap(markerFile, metadata);
-            ExperimentRegistrationInformationExtractor extractor =
-                    new ExperimentRegistrationInformationExtractor(dataSetInformation, metadata,
-                            getEntityCodeSuffix(), openbisService);
-            extractor.processMetadataAndFillDataSetInformation();
-        } catch (IOException ex)
-        {
-            UserFailureException userFailure =
-                    new UserFailureException("Could not register experiment", ex);
-            throw userFailure;
-        }
-    }
-
-    /**
-     * See if the incoming data set folder is contains a sample and, if so, register the sample.
-     */
-    private void processSampleFolder(final FolderMetadata folderMetadata,
-            final DataSetInformation dataSetInformation, IEncapsulatedOpenBISService openbisService)
-    {
-        final File markerFile = folderMetadata.tryGetMarkerFile();
-        try
-        {
-            HashMap<String, String> metadata = new HashMap<String, String>();
-            metadata = appendMarkerFileToMap(markerFile, metadata);
-            SampleRegistrationInformationExtractor extractor =
-                    new SampleRegistrationInformationExtractor(dataSetInformation, metadata,
-                            getEntityCodeSuffix(), openbisService);
-            extractor.processMetadataAndFillDataSetInformation();
-        } catch (IOException ex)
-        {
-            UserFailureException userFailure =
-                    new UserFailureException("Could not register sample", ex);
-            throw userFailure;
-        }
-    }
-
-    /**
-     * See if the incoming data set folder is contains a data set and, if so, register the data set.
-     */
-    private void processDataSetFolder(final FolderMetadata folderMetadata,
-            final DataSetInformation dataSetInformation, IEncapsulatedOpenBISService openbisService)
-    {
-    }
-
-    /**
-     * Create a suffix for the entity code.
-     */
-    private String getEntityCodeSuffix()
-    {
-        Calendar now = GregorianCalendar.getInstance();
-        StringBuffer sb = new StringBuffer();
-        sb.append(now.get(Calendar.YEAR));
-        sb.append(String.format("%02d", now.get(Calendar.MONTH) + 1));
-        sb.append(String.format("%02d", now.get(Calendar.DAY_OF_MONTH)));
-        sb.append("-");
-        sb.append(now.get(Calendar.HOUR_OF_DAY));
-        sb.append(now.get(Calendar.MINUTE));
-        sb.append("-");
-        sb.append(now.get(Calendar.MILLISECOND));
-        return sb.toString();
-    }
-
-    /**
-     * Parse the marker file and append it to hashmap.
-     */
-    private HashMap<String, String> appendMarkerFileToMap(File markerFile,
-            HashMap<String, String> map) throws IOException, FileNotFoundException
-    {
-        Properties properties = new Properties();
-        properties.load(new FileInputStream(markerFile));
-
-        for (Entry<Object, Object> entry : properties.entrySet())
-        {
-            map.put((String) entry.getKey(), (String) entry.getValue());
-        }
-        return map;
-    }
-}
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/CinaTypeExtractor.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/CinaTypeExtractor.java
deleted file mode 100644
index f401a28f6a7..00000000000
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/CinaTypeExtractor.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss.info;
-
-import java.io.File;
-import java.util.Properties;
-
-import ch.systemsx.cisd.cina.dss.info.FolderOracle.FolderType;
-import ch.systemsx.cisd.etlserver.ITypeExtractor;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.FileFormatType;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.LocatorType;
-
-/**
- * TODO 2010-08-16, CR, This class is no longer used. It can be deleted.
- * <p>
- * The extractor expects that certain things have been set up in the database. In particular:
- * <ul>
- * <li>A data set type with code CINA_EXP_PREP &mdash; this is the data set for preparation
- * information for an experiment</li>
- * <li>A data set type with code CINA_SAMPLE_PREP &mdash; this is the data set for preparation
- * information for a sample</li>
- * </ul>
- * 
- * @author Chandrasekhar Ramakrishnan
- */
-public class CinaTypeExtractor implements ITypeExtractor
-{
-
-    private final String EXPERIMENT_METADATA_DATASET_TYPE = "CINA_EXP_PREP";
-
-    private final String SAMPLE_METADATA_DATASET_TYPE = "CINA_SAMPLE_PREP";
-
-    private final String UNKNOWN_METADATA_DATASET_TYPE = "UNKNOWN";
-
-    public CinaTypeExtractor(final Properties properties)
-    {
-
-    }
-
-    public DataSetType getDataSetType(File incomingDataSetPath)
-    {
-        FolderOracle folderOracle = new FolderOracle();
-        FolderType folderType = folderOracle.getTypeForFolder(incomingDataSetPath);
-        DataSetType datasetType = null;
-        switch (folderType)
-        {
-            case DATA_SET:
-                datasetType = new DataSetType(UNKNOWN_METADATA_DATASET_TYPE);
-                break;
-            case EXPERIMENT:
-                datasetType = new DataSetType(EXPERIMENT_METADATA_DATASET_TYPE);
-                break;
-            case SAMPLE:
-                datasetType = new DataSetType(SAMPLE_METADATA_DATASET_TYPE);
-                break;
-            case UNKNOWN:
-                datasetType = new DataSetType(UNKNOWN_METADATA_DATASET_TYPE);
-                break;
-
-        }
-        return datasetType;
-    }
-
-    public FileFormatType getFileFormatType(File incomingDataSetPath)
-    {
-        return new FileFormatType("PROPRIETARY");
-    }
-
-    public LocatorType getLocatorType(File incomingDataSetPath)
-    {
-        return new LocatorType("RELATIVE_LOCATION");
-    }
-
-    public String getProcessorType(File incomingDataSetPath)
-    {
-        return null;
-    }
-
-    public boolean isMeasuredData(File incomingDataSetPath)
-    {
-        FolderOracle folderOracle = new FolderOracle();
-        FolderType folderType = folderOracle.getTypeForFolder(incomingDataSetPath);
-        boolean isMeasuredData = false;
-        switch (folderType)
-        {
-            case DATA_SET:
-                isMeasuredData = true;
-                break;
-            case EXPERIMENT:
-                isMeasuredData = false;
-                break;
-            case SAMPLE:
-                isMeasuredData = false;
-                break;
-            case UNKNOWN:
-                isMeasuredData = false;
-                break;
-
-        }
-        return isMeasuredData;
-    }
-
-}
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/EntityRegistrationSuccessEmail.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/EntityRegistrationSuccessEmail.java
deleted file mode 100644
index 795f105a013..00000000000
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/EntityRegistrationSuccessEmail.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss.info;
-
-import java.io.File;
-
-import javax.activation.DataHandler;
-
-import ch.systemsx.cisd.cina.dss.info.FolderOracle.FolderType;
-import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation;
-
-/**
- * TODO 2010-08-16, CR, This class is no longer used. It can be deleted.
- * 
- * Create the subject and content for an email that is sent when an experiment or sample is
- * registered.
- * 
- * @author Chandrasekhar Ramakrishnan
- */
-class EntityRegistrationSuccessEmail
-{
-    private static final String MARKER_FILE_MIME_TYPE = "application/octet-stream";
-
-    private final DataSetInformation dataSetInformation;
-
-    private final EntityEmailDetails entityEmailDetails;
-
-    private static final String EMAIL_SUBJECT_PREFIX = "[CINA]";
-
-    private static final String SAMPLE_CODE_PREFIX = "S";
-
-    public EntityRegistrationSuccessEmail(DataSetInformation dataSetInformation,
-            File incomingDataSetDirectory)
-    {
-        this.dataSetInformation = dataSetInformation;
-
-        FolderType folderType = new FolderOracle().getTypeForFolder(incomingDataSetDirectory);
-        switch (folderType)
-        {
-            case DATA_SET:
-                entityEmailDetails = new DatasetEmailDetails();
-                break;
-            case EXPERIMENT:
-                entityEmailDetails = new ExperimentEmailDetails();
-                break;
-            case SAMPLE:
-                entityEmailDetails = new SampleEmailDetails();
-                break;
-            case UNKNOWN:
-                entityEmailDetails = new UnknownEmailDetails();
-                break;
-            default:
-                entityEmailDetails = new UnknownEmailDetails();
-                break;
-        }
-    }
-
-    /**
-     * Return true if the incoming data set requires that an email be sent on registration.
-     */
-    public boolean shouldSendEmail()
-    {
-        return entityEmailDetails.shouldSendEmail();
-    }
-
-    /**
-     * Return the subject of the email
-     */
-    public String getSubject()
-    {
-        StringBuffer subject = new StringBuffer();
-        subject.append(EMAIL_SUBJECT_PREFIX);
-        subject.append(" Registered ");
-        entityEmailDetails.appendEntityName(subject);
-        subject.append(" ");
-        entityEmailDetails.appendSubjectDetails(subject);
-        return subject.toString();
-    }
-
-    /**
-     * Return the body of the email for a text-only (no attachments) email. Used if the mail client
-     * does no support sending attachments.
-     */
-    public String getContentTextOnly()
-    {
-        StringBuffer content = new StringBuffer();
-        entityEmailDetails.appendEntityName(content);
-        content.append(" was successfully registered. Use the following metadata file to register");
-        entityEmailDetails.appendFollowOnEntityName(content);
-        content.append(":\n");
-        content.append("------");
-        entityEmailDetails.appendMarkerFileName(content);
-        content.append("------");
-        content.append("\n");
-        entityEmailDetails.appendMarkerFileContent(content);
-
-        return content.toString();
-    }
-
-    /**
-     * Return the body of the email for a MIME email. In a MIME email, the marker file is sent as a
-     * file attachment, not part of the text body of the email.
-     */
-    public String getContentMimeText()
-    {
-        StringBuffer content = new StringBuffer();
-        entityEmailDetails.appendEntityName(content);
-        content.append(" was successfully registered. Use the attached metadata file to register ");
-        entityEmailDetails.appendFollowOnEntityName(content);
-
-        return content.toString();
-    }
-
-    /**
-     * Return the file name of the MIME file attachment.
-     */
-    public String getContentMimeAttachmentFileName()
-    {
-        StringBuffer content = new StringBuffer();
-        entityEmailDetails.appendMarkerFileName(content);
-
-        return content.toString();
-    }
-
-    public DataHandler getContentMimeAttachmentContent()
-    {
-        StringBuffer content = new StringBuffer();
-        entityEmailDetails.appendMarkerFileContent(content);
-        DataHandler attachment = new DataHandler(content.toString(), MARKER_FILE_MIME_TYPE);
-
-        return attachment;
-    }
-
-    private abstract class EntityEmailDetails
-    {
-        boolean shouldSendEmail()
-        {
-            return false;
-        }
-
-        abstract void appendEntityName(StringBuffer sb);
-
-        void appendFollowOnEntityName(StringBuffer sb)
-        {
-        }
-
-        void appendSubjectDetails(StringBuffer subject)
-        {
-        }
-
-        void appendMarkerFileName(StringBuffer sb)
-        {
-        }
-
-        void appendMarkerFileContent(StringBuffer sb)
-        {
-
-        }
-    }
-
-    private class ExperimentEmailDetails extends EntityEmailDetails
-    {
-        @Override
-        boolean shouldSendEmail()
-        {
-            return true;
-        }
-
-        @Override
-        void appendEntityName(StringBuffer sb)
-        {
-            sb.append("Experiment");
-        }
-
-        @Override
-        void appendFollowOnEntityName(StringBuffer sb)
-        {
-            sb.append("Samples");
-        }
-
-        @Override
-        void appendSubjectDetails(StringBuffer subject)
-        {
-            subject.append(dataSetInformation.getExperimentIdentifier());
-        }
-
-        @Override
-        void appendMarkerFileContent(StringBuffer sb)
-        {
-            sb.append(SampleRegistrationInformationExtractor.EXPERIMENT_IDENTIFIER_KEY);
-            sb.append("=");
-            sb.append(dataSetInformation.getExperimentIdentifier());
-            sb.append("\n");
-
-            sb.append(SampleRegistrationInformationExtractor.EXPERIMENT_OWNER_EMAIL_KEY);
-            sb.append("=");
-            sb.append(dataSetInformation.tryGetUploadingUserEmail());
-            sb.append("\n");
-
-            sb.append(SampleRegistrationInformationExtractor.SAMPLE_CODE_PREFIX_KEY);
-            sb.append("=");
-            sb.append(SAMPLE_CODE_PREFIX);
-            sb.append("\n");
-        }
-
-        @Override
-        void appendMarkerFileName(StringBuffer sb)
-        {
-            sb.append(FolderOracle.SAMPLE_MARKER_FILENAME);
-
-        }
-    }
-
-    private class SampleEmailDetails extends EntityEmailDetails
-    {
-        @Override
-        boolean shouldSendEmail()
-        {
-            return true;
-        }
-
-        @Override
-        void appendEntityName(StringBuffer sb)
-        {
-            sb.append("Sample");
-        }
-
-        @Override
-        void appendFollowOnEntityName(StringBuffer sb)
-        {
-            sb.append("Data Sets");
-        }
-
-        @Override
-        void appendSubjectDetails(StringBuffer subject)
-        {
-            subject.append(dataSetInformation.getSampleIdentifier());
-        }
-
-        @Override
-        void appendMarkerFileContent(StringBuffer sb)
-        {
-        }
-
-        @Override
-        void appendMarkerFileName(StringBuffer sb)
-        {
-            sb.append(FolderOracle.DATA_SET_MARKER_FILENAME);
-        }
-    }
-
-    private class DatasetEmailDetails extends EntityEmailDetails
-    {
-        @Override
-        void appendEntityName(StringBuffer sb)
-        {
-            sb.append("Data Set");
-        }
-
-        @Override
-        void appendSubjectDetails(StringBuffer subject)
-        {
-            subject.append(dataSetInformation.getDataSetCode());
-        }
-    }
-
-    private class UnknownEmailDetails extends EntityEmailDetails
-    {
-        @Override
-        void appendEntityName(StringBuffer sb)
-        {
-            sb.append("Unknown");
-        }
-    }
-}
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/EntityTypes.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/EntityTypes.java
deleted file mode 100644
index dd5bad9df16..00000000000
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/EntityTypes.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss.info;
-
-/**
- * TODO 2010-08-16, CR, This class is no longer used. It can be deleted.
- * <p>
- * A registry for the different entity types CINA uses
- * 
- * @author Chandrasekhar Ramakrishnan
- */
-public class EntityTypes
-{
-    /**
-     * CINA carries out the following kinds of experiment: electron microscopy, light microscopy,
-     * mass spectrometry, tomography, and a non-specific CINA experiment type.
-     * 
-     * @author Chandrasekhar Ramakrishnan
-     */
-    public static enum ExperimentTypes
-    {
-        ELECTRON_MICROSCOPY, LIGHT_MICROSCOPY, MASS_SPEC, TOMOGRAPHY, CINA_EXP_TYPE
-    }
-
-    /**
-     * CINA utilizes the following sample types: original experimental sample, samples that result
-     * from biochemical manipulation of the original, grid peperation, and non-specific CINA sample
-     * type.
-     * 
-     * @author Chandrasekhar Ramakrishnan
-     */
-    public static enum SampleTypes
-    {
-        ORIGINAL, BIOCHEMISTRY, GRID_PREP, CINA_SAMPLE_TYPE
-    }
-
-    /**
-     * Results and by products of experiments in CINA are data sets types: electron microscope
-     * images, light microscope images, mass spectrograms, tomograms, ยต-fluidics parameters, lab
-     * notebooks, and a non-specific data set type.
-     * 
-     * @author Chandrasekhar Ramakrishnan
-     */
-    public static enum DataSetTypes
-    {
-        EM_IMAGE, LM_IMAGE, MASS_SPECTROGRAM, TOMOGRAM, U_FLUIDICS_PARAMETERS, LAB_NOTEBOOK,
-        UNKNOWN
-    }
-}
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/ExperimentRegistrationInformationExtractor.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/ExperimentRegistrationInformationExtractor.java
deleted file mode 100644
index 729debfb550..00000000000
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/ExperimentRegistrationInformationExtractor.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss.info;
-
-import java.util.Map;
-
-import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
-import ch.systemsx.cisd.common.exceptions.UserFailureException;
-import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
-import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifierFactory;
-
-/**
- * Package-visible helper class to extract information from the XML metadata file and register a new
- * experiment using this data.
- * 
- * @author Chandrasekhar Ramakrishnan
- */
-class ExperimentRegistrationInformationExtractor
-{
-    // Keys expected in metadata properties file
-    public static final String PROJECT_IDENTIFIER_KEY = "project.identifier";
-
-    public static final String EXPERIMENT_CODE_KEY = "experiment.code-prefix";
-
-    public static final String EXPERIMENT_OWNER_EMAIL_KEY = "experiment.owner-email";
-
-    // Instance state
-    private final DataSetInformation dataSetInformation;
-
-    private final Map<String, String> experimentMetadata;
-
-    private final String experimentCodeSuffix;
-
-    private final IEncapsulatedOpenBISService openbisService;
-
-    // Internal state used during extraction
-    private ProjectIdentifier projectIdentifier;
-
-    private String experimentCodePrefix;
-
-    private String emailAddress;
-
-    ExperimentRegistrationInformationExtractor(DataSetInformation dataSetInformation,
-            Map<String, String> experimentMetadata, String experimentCodeSuffix,
-            IEncapsulatedOpenBISService openbisService)
-    {
-        this.dataSetInformation = dataSetInformation;
-        this.experimentMetadata = experimentMetadata;
-        this.experimentCodeSuffix = experimentCodeSuffix;
-        this.openbisService = openbisService;
-    }
-
-    /**
-     * Takes the project code, experiment code, and email address from the properties file and
-     * creates a new experiment.
-     * <p>
-     * This method is package-visible for testing purposes.
-     */
-    void processMetadataAndFillDataSetInformation() throws UserFailureException
-    {
-        extractMetadata();
-
-        // Set the email address as early as possible because it will be used later to notify the
-        // user.
-        dataSetInformation.setUploadingUserEmail(emailAddress);
-
-        // Check that that the required data was specified in the properties file.
-        verifyRequiredMetadataDataHasBeenProvided();
-
-        ExperimentIdentifier experimentId = this.createExperiment();
-        dataSetInformation.setExperimentIdentifier(experimentId);
-    }
-
-    private void extractMetadata()
-    {
-        String projectIdString = experimentMetadata.get(PROJECT_IDENTIFIER_KEY);
-        if (projectIdString != null)
-        {
-            projectIdentifier = new ProjectIdentifierFactory(projectIdString).createIdentifier();
-        }
-        experimentCodePrefix = experimentMetadata.get(EXPERIMENT_CODE_KEY);
-        emailAddress = experimentMetadata.get(EXPERIMENT_OWNER_EMAIL_KEY);
-    }
-
-    /**
-     * Create a new experiment. If an experiment already exists, raise an error.
-     */
-    private ExperimentIdentifier createExperiment() throws EnvironmentFailureException
-    {
-        ExperimentIdentifier experimentIdentifier =
-                new ExperimentIdentifier(projectIdentifier, experimentCodePrefix + "-"
-                        + experimentCodeSuffix);
-
-        // Check that the identifier is unique
-        Experiment experiment = openbisService.tryToGetExperiment(experimentIdentifier);
-        if (experiment != null)
-        {
-            throw new EnvironmentFailureException(
-                    "The generated experiment identifer, which must be unique, is already in the database. This should not happen: Please contact the administrator.");
-        }
-
-        openbisService.registerExperiment(new NewExperiment(experimentIdentifier.toString(),
-                EntityTypes.ExperimentTypes.CINA_EXP_TYPE.toString()));
-
-        return experimentIdentifier;
-    }
-
-    /**
-     * Ensure the required user-provided data has been specified. Throws an exception if this is not
-     * the case.
-     */
-    private void verifyRequiredMetadataDataHasBeenProvided() throws UserFailureException
-    {
-        if (null == projectIdentifier)
-        {
-            throw new UserFailureException(
-                    "A project identifier must be specified to register an experiment.");
-        }
-
-        if (null == experimentCodePrefix)
-        {
-            throw new UserFailureException(
-                    "An experiment code prefix must be specified to register an experiment.");
-        }
-
-        if (null == emailAddress)
-        {
-            throw new UserFailureException(
-                    "An email address must be specified to register an experiment.");
-        }
-    }
-    /**
-     * Automatically generates the code.
-     */
-    // Need to use something like this.
-    // public void generateCode()
-    // {
-    // viewContext.getCommonService().generateCode(codePrefix,
-    // new GenerateCodeCallback(viewContext));
-    // }
-    //
-    // private final class GenerateCodeCallback extends AbstractAsyncCallback<String>
-    // {
-    //
-    // GenerateCodeCallback(final IViewContext<?> viewContext)
-    // {
-    // super(viewContext);
-    // }
-    //
-    // @Override
-    // protected final void process(final String result)
-    // {
-    // setValue(result);
-    // }
-    //
-    // }
-
-}
\ No newline at end of file
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/FolderOracle.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/FolderOracle.java
deleted file mode 100644
index 2b3901776b9..00000000000
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/FolderOracle.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss.info;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
-import ch.systemsx.cisd.common.exceptions.UserFailureException;
-
-/**
- * The Folder Oracle knows the naming conventions for the different types of data provided by CINA
- * and can tell clients which of the types this data actually is.
- * <p>
- * Instances of this class are designed to be used within a single thread.
- * 
- * @author Chandrasekhar Ramakrishnan
- */
-class FolderOracle
-{
-    /**
-     * The different kinds of metadata known to the oracle.
-     * 
-     * @author Chandrasekhar Ramakrishnan
-     */
-    static enum FolderType
-    {
-        EXPERIMENT, SAMPLE, DATA_SET, UNKNOWN;
-    }
-
-    /**
-     * A little helper class for storing the location and type of the sidecar files for a folder. If
-     * the type is UNKNOWN, the files will be null. If the type is known, the marker file will be
-     * non-null. The metadata file might still be null.
-     * 
-     * @author Chandrasekhar Ramakrishnan
-     */
-    static class FolderMetadata
-    {
-        private final FolderType type;
-
-        private final File markerFileOrNull;
-
-        private final File metadataXMLFileOrNull;
-
-        FolderMetadata(FolderType type, File markerFile, File metadataXMLFile)
-        {
-            this.type = type;
-            this.markerFileOrNull = markerFile;
-            this.metadataXMLFileOrNull = metadataXMLFile;
-        }
-
-        /**
-         * The type of the folder.
-         */
-        FolderType getType()
-        {
-            return type;
-        }
-
-        /**
-         * The marker file for this folder -- this is a properties file.
-         */
-        File tryGetMarkerFile()
-        {
-            return markerFileOrNull;
-        }
-
-        /**
-         * The metadata file for this folder -- this is an XML file.
-         */
-        File tryGetMetadataXMLFile()
-        {
-            return metadataXMLFileOrNull;
-        }
-    }
-
-    // The known conventions for naming metadata files. If a new metadata file is created, cases
-    // should be added to getFilenameFilter() and getFolderMetadataForFile() as well.
-    static String EXPERIMENT_MARKER_FILENAME = "experiment.properties";
-
-    static String SAMPLE_MARKER_FILENAME = "sample.properties";
-
-    static String DATA_SET_MARKER_FILENAME = "dataset.properties";
-
-    static String METADATA_XML_FILENAME = "metadata.xml";
-
-    FolderOracle()
-    {
-
-    }
-
-    /**
-     * Scan the folder and return the metadata file for the folder along with its associated type.
-     * <p>
-     * Returns type UNKNOWN if the folder cannot be identified and throws an error if the
-     * identification is ambiguous.
-     */
-    FolderMetadata getFolderMetadataForFolder(File incomingDataSetFolder)
-            throws UserFailureException
-    {
-        // Don't know what to do with this file
-        if (!incomingDataSetFolder.isDirectory())
-        {
-            return new FolderMetadata(FolderType.UNKNOWN, null, null);
-        }
-
-        File[] metadata = incomingDataSetFolder.listFiles(getMarkerFilenameFilter());
-
-        // Didn't find any metadata
-        if (metadata.length < 1)
-        {
-            return new FolderMetadata(FolderType.UNKNOWN, null, null);
-        }
-
-        // Found too much metadata
-        if (metadata.length > 1)
-        {
-            StringBuffer errorDescription = new StringBuffer();
-            errorDescription.append("Folder (" + incomingDataSetFolder
-                    + ") contains multiple description files: ");
-            for (File file : metadata)
-            {
-                errorDescription.append("\n\t");
-                errorDescription.append(file);
-            }
-            throw new UserFailureException(errorDescription.toString());
-        }
-
-        return getFolderMetadataForFile(metadata[0]);
-    }
-
-    /**
-     * Returns the type of data stored in the folder
-     */
-    FolderType getTypeForFolder(File incomingDataSetFolder) throws UserFailureException
-    {
-        FolderMetadata metadata = getFolderMetadataForFolder(incomingDataSetFolder);
-        return metadata.getType();
-    }
-
-    /**
-     * After it has been determined that the folder contains metadata for some known type, this
-     * method can be invoked to return a folder metadata object.
-     */
-    private FolderMetadata getFolderMetadataForFile(File metadataFile)
-    {
-        String filename = metadataFile.getName();
-        File parentDir = metadataFile.getParentFile();
-        File metadataXMLFileOrNull = null;
-        if (parentDir != null)
-        {
-
-            File[] metadataXMLFiles = parentDir.listFiles(getMetadataXMLFilenameFilter());
-            if (metadataXMLFiles.length > 0)
-            {
-                metadataXMLFileOrNull = metadataXMLFiles[0];
-            }
-        }
-
-        if (EXPERIMENT_MARKER_FILENAME.equals(filename))
-        {
-            return new FolderMetadata(FolderType.EXPERIMENT, metadataFile, metadataXMLFileOrNull);
-        }
-
-        if (SAMPLE_MARKER_FILENAME.equals(filename))
-        {
-            return new FolderMetadata(FolderType.SAMPLE, metadataFile, metadataXMLFileOrNull);
-        }
-
-        if (DATA_SET_MARKER_FILENAME.equals(filename))
-        {
-            return new FolderMetadata(FolderType.DATA_SET, metadataFile, metadataXMLFileOrNull);
-        }
-
-        throw new EnvironmentFailureException(
-                "A metadata file convention was added without modifing getFolderMetadataForFile()");
-    }
-
-    private FilenameFilter getMarkerFilenameFilter()
-    {
-        return new FilenameFilter()
-            {
-                public boolean accept(File dir, String name)
-                {
-                    if (EXPERIMENT_MARKER_FILENAME.equals(name))
-                    {
-                        return true;
-                    } else if (SAMPLE_MARKER_FILENAME.equals(name))
-                    {
-                        return true;
-                    } else if (DATA_SET_MARKER_FILENAME.equals(name))
-                    {
-                        return true;
-                    } else
-                    {
-                        return false;
-                    }
-                }
-            };
-    }
-
-    private FilenameFilter getMetadataXMLFilenameFilter()
-    {
-        return new FilenameFilter()
-            {
-                public boolean accept(File dir, String name)
-                {
-                    if (METADATA_XML_FILENAME.equals(name))
-                    {
-                        return true;
-                    } else
-                    {
-                        return false;
-                    }
-                }
-            };
-    }
-}
diff --git a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/SampleRegistrationInformationExtractor.java b/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/SampleRegistrationInformationExtractor.java
deleted file mode 100644
index 45b04ebc48a..00000000000
--- a/rtd_cina/source/java/ch/systemsx/cisd/cina/dss/info/SampleRegistrationInformationExtractor.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss.info;
-
-import java.util.Map;
-
-import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
-import ch.systemsx.cisd.common.exceptions.UserFailureException;
-import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
-import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifierFactory;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.GroupIdentifier;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier;
-
-/**
- * TODO 2010-08-16, CR, This class is no longer used. It can be deleted.
- * <p>
- * Package-visible helper class to extract information from the XML metadata file and register a new
- * sample using this data.
- * <p>
- * This class assumes that the sample type CINA_SAMPLE_TYPE has been registered.
- * 
- * @author Chandrasekhar Ramakrishnan
- */
-class SampleRegistrationInformationExtractor
-{
-    // Keys expected in metadata properties file
-
-    public static final String EXPERIMENT_IDENTIFIER_KEY = "experiment.identifier";
-
-    public static final String EXPERIMENT_OWNER_EMAIL_KEY =
-            ExperimentRegistrationInformationExtractor.EXPERIMENT_OWNER_EMAIL_KEY;
-
-    public static final String SAMPLE_CODE_PREFIX_KEY = "sample.code-prefix";
-
-    // Instance state
-    private final DataSetInformation dataSetInformation;
-
-    private final Map<String, String> sampleMetadata;
-
-    private final String sampleCodeSuffix;
-
-    private final IEncapsulatedOpenBISService openbisService;
-
-    private ExperimentIdentifier experimentIdentifier;
-
-    private String sampleCodePrefix;
-
-    private String emailAddress;
-
-    SampleRegistrationInformationExtractor(DataSetInformation dataSetInformation,
-            Map<String, String> sampleMetadata, String sampleCodeSuffix,
-            IEncapsulatedOpenBISService openbisService)
-    {
-        this.dataSetInformation = dataSetInformation;
-        this.sampleMetadata = sampleMetadata;
-        this.sampleCodeSuffix = sampleCodeSuffix;
-        this.openbisService = openbisService;
-    }
-
-    /**
-     * Takes the project code, experiment code, and email address from the properties file and
-     * creates a new experiment.
-     * <p>
-     * This method is package-visible for testing purposes.
-     */
-    void processMetadataAndFillDataSetInformation()
-    {
-        extractMetadata();
-
-        // Set the email address as early as possible because it will be used later to notify the
-        // user.
-        dataSetInformation.setUploadingUserEmail(emailAddress);
-
-        // Check that that the required data was specified in the properties file.
-        verifyRequiredMetadataDataHasBeenProvided();
-
-        SampleIdentifier sampleId = this.createSample();
-        dataSetInformation.setExperimentIdentifier(experimentIdentifier);
-        dataSetInformation.setSpaceCode(sampleId.getSpaceLevel().getSpaceCode());
-        dataSetInformation.setSampleCode(sampleId.getSampleCode());
-        dataSetInformation.setUploadingUserEmail(emailAddress);
-    }
-
-    private void extractMetadata()
-    {
-        String experimentIdString = sampleMetadata.get(EXPERIMENT_IDENTIFIER_KEY);
-        if (experimentIdString != null)
-            experimentIdentifier =
-                    new ExperimentIdentifierFactory(experimentIdString).createIdentifier();
-        sampleCodePrefix = sampleMetadata.get(SAMPLE_CODE_PREFIX_KEY);
-        emailAddress = sampleMetadata.get(EXPERIMENT_OWNER_EMAIL_KEY);
-    }
-
-    /**
-     * Create a new sample attached to the experiment identified by the identifier.
-     * <p>
-     * <ul>
-     * <li>If the experiment the sample is supposed to be attached to does not exist, raise an
-     * error.</li>
-     * <li>If a sample with the desired identifier already exists, raise an error.</li>
-     * </ul>
-     */
-    private SampleIdentifier createSample() throws UserFailureException,
-            EnvironmentFailureException
-    {
-        Experiment experiment = openbisService.tryToGetExperiment(experimentIdentifier);
-        if (null == experiment)
-        {
-            throw new UserFailureException(
-                    "The experiment with identifier ("
-                            + experimentIdentifier.toString()
-                            + ") does not exist. Please select an experiment to be the container for registered samples.");
-        }
-
-        SampleIdentifier sampleId =
-                new SampleIdentifier(new GroupIdentifier((String) null, experimentIdentifier
-                        .getSpaceCode()), sampleCodePrefix + "-" + sampleCodeSuffix);
-
-        NewSample sample = new NewSample();
-        SampleType sampleType = new SampleType();
-        sampleType.setCode(EntityTypes.SampleTypes.CINA_SAMPLE_TYPE.toString());
-        sample.setSampleType(sampleType);
-        sample.setExperimentIdentifier(experimentIdentifier.toString());
-        sample.setIdentifier(sampleId.toString());
-
-        Sample dbSample = openbisService.tryGetSampleWithExperiment(sampleId);
-        if (dbSample != null)
-        {
-            throw new EnvironmentFailureException(
-                    "The generated sample identifer, which must be unique, is already in the database. This should not happen: Please contact the administrator.");
-        }
-
-        openbisService.registerSample(sample, null);
-
-        return sampleId;
-    }
-
-    /**
-     * Ensure the required user-provided data has been specified. Throws an exception if this is not
-     * the case.
-     */
-    private void verifyRequiredMetadataDataHasBeenProvided() throws UserFailureException
-    {
-        if (null == experimentIdentifier)
-        {
-            throw new UserFailureException(
-                    "An experiment identifier must be specified to register an experiment.");
-        }
-
-        if (null == sampleCodePrefix)
-        {
-            throw new UserFailureException(
-                    "An sample code prefix must be specified to register an experiment.");
-        }
-
-        if (null == emailAddress)
-        {
-            throw new UserFailureException(
-                    "An email address must be specified to register an experiment.");
-        }
-    }
-}
\ No newline at end of file
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CinaCommandFactoryTest.java b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CinaCommandFactoryTest.java
index 35c16f7d2a9..5cfb0a4485e 100644
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CinaCommandFactoryTest.java
+++ b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CinaCommandFactoryTest.java
@@ -39,7 +39,7 @@ public class CinaCommandFactoryTest extends AssertJUnit
     public void testNameMapping()
     {
         ICommand cmd;
-        cmd = factory.tryCommandForName("preps");
+        cmd = factory.tryCommandForName("listsamps");
         assertEquals(CommandSampleLister.class, cmd.getClass());
 
         cmd = factory.tryCommandForName("genid");
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CommandFactoryTest.java b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CommandFactoryTest.java
index 38c2b8b9546..a9aeef38881 100644
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CommandFactoryTest.java
+++ b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CommandFactoryTest.java
@@ -49,7 +49,7 @@ public class CommandFactoryTest extends AssertJUnit
     public void testNameMapping()
     {
         ICommand cmd;
-        cmd = factory.tryCommandForName("preps");
+        cmd = factory.tryCommandForName("listsamps");
         assertEquals(CommandSampleLister.class, cmd.getClass());
 
         cmd = factory.tryCommandForName("genid");
@@ -72,8 +72,8 @@ public class CommandFactoryTest extends AssertJUnit
         cmd.printUsage(out);
         String helpText =
                 "usage: cina_client.sh COMMAND [options...] <command arguments>\n" + "\n"
-                        + "Commands:\n" + " preps\n" + " genid\n" + " ls\n" + " get\n" + " put\n"
-                        + "\n" + "Options:\n"
+                        + "Commands:\n" + " listsamps\n" + " genid\n" + " ls\n" + " get\n"
+                        + " put\n" + "\n" + "Options:\n"
                         + " [-p,--password] VAL        : User login password\n"
                         + " [-s,--server-base-url] VAL : URL for openBIS Server (required)\n"
                         + " [-u,--username] VAL        : User login name\n";
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CommandGenerateSampleCodeTest.java b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CommandGenerateSampleCodeTest.java
new file mode 100644
index 00000000000..7d47eb08ba7
--- /dev/null
+++ b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CommandGenerateSampleCodeTest.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2010 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.cina.client.util.cli;
+
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.testng.AssertJUnit;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import ch.systemsx.cisd.cina.client.util.v1.ICinaUtilities;
+import ch.systemsx.cisd.openbis.dss.client.api.cli.ICommand;
+import ch.systemsx.cisd.openbis.generic.shared.IETLLIMSService;
+import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType;
+
+/**
+ * @author Chandrasekhar Ramakrishnan
+ */
+public class CommandGenerateSampleCodeTest extends AssertJUnit
+{
+    private final class MockCommandGenerateSampleCode extends CommandGenerateSampleCode
+    {
+
+        @Override
+        protected ICinaUtilities login()
+        {
+            facade =
+                    ch.systemsx.cisd.cina.client.util.v1.impl.CinaUtilitiesFacadeTest.createFacade(
+                            service, openbisService, USER_ID, PASSWORD);
+            return facade;
+        }
+
+    }
+
+    private final static String USER_ID = "userid";
+
+    private final static String PASSWORD = "password";
+
+    private final static String SESSION_TOKEN = "sessionToken";
+
+    private Mockery context;
+
+    private ICinaUtilities facade;
+
+    private IGeneralInformationService service;
+
+    private IETLLIMSService openbisService;
+
+    @BeforeMethod
+    public void setUp()
+    {
+        context = new Mockery();
+        service = context.mock(IGeneralInformationService.class);
+        openbisService = context.mock(IETLLIMSService.class);
+    }
+
+    @AfterMethod
+    public void tearDown()
+    {
+        // To following line of code should also be called at the end of each test method.
+        // Otherwise one does not known which test failed.
+        context.assertIsSatisfied();
+    }
+
+    @Test
+    public void testCodePath()
+    {
+        final String sampleTypeCode = "SampleTypeCode";
+        final SampleType sampleType = new SampleType();
+        sampleType.setAutoGeneratedCode(true);
+        sampleType.setGeneratedCodePrefix("STC-");
+        context.checking(new Expectations()
+            {
+                {
+                    one(service).tryToAuthenticateForAllServices(USER_ID, PASSWORD);
+                    will(returnValue(SESSION_TOKEN));
+
+                    one(openbisService).getSampleType(SESSION_TOKEN, sampleTypeCode.toUpperCase());
+                    will(returnValue(sampleType));
+
+                    one(openbisService).drawANewUniqueID(SESSION_TOKEN);
+                    will(returnValue((long) 1));
+
+                    one(service).logout(SESSION_TOKEN);
+                }
+            });
+        ICommand command = new MockCommandGenerateSampleCode();
+
+        int exitCode = command.execute(new String[]
+            { "-s", "url", "-u", USER_ID, "-p", PASSWORD, sampleTypeCode });
+
+        assertEquals(0, exitCode);
+        context.assertIsSatisfied();
+    }
+
+    @Test
+    public void testMissingArguments()
+    {
+        context.checking(new Expectations()
+            {
+                {
+
+                }
+            });
+        ICommand command = new MockCommandGenerateSampleCode();
+
+        int exitCode = command.execute(new String[]
+            { "-s", "url", "-u", USER_ID, "-p", PASSWORD });
+
+        assertEquals(1, exitCode);
+        context.assertIsSatisfied();
+    }
+}
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/SampleListerCommandTest.java b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CommandSampleListerTest.java
similarity index 92%
rename from rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/SampleListerCommandTest.java
rename to rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CommandSampleListerTest.java
index c97bb090269..fd90d70bf03 100644
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/SampleListerCommandTest.java
+++ b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/cli/CommandSampleListerTest.java
@@ -30,6 +30,7 @@ import ch.systemsx.cisd.cina.client.util.v1.ICinaUtilities;
 import ch.systemsx.cisd.cina.shared.constants.CinaConstants;
 import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
 import ch.systemsx.cisd.openbis.dss.client.api.cli.ICommand;
+import ch.systemsx.cisd.openbis.generic.shared.IETLLIMSService;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria;
@@ -39,17 +40,18 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchCl
 /**
  * @author Chandrasekhar Ramakrishnan
  */
-public class SampleListerCommandTest extends AssertJUnit
+public class CommandSampleListerTest extends AssertJUnit
 {
     private final class MockCommandSampleLister extends CommandSampleLister
     {
-
         @Override
         protected ICinaUtilities login()
         {
+            facade =
+                    ch.systemsx.cisd.cina.client.util.v1.impl.CinaUtilitiesFacadeTest.createFacade(
+                            service, openbisService, USER_ID, PASSWORD);
             return facade;
         }
-
     }
 
     private final static String USER_ID = "userid";
@@ -64,11 +66,14 @@ public class SampleListerCommandTest extends AssertJUnit
 
     private IGeneralInformationService service;
 
+    private IETLLIMSService openbisService;
+
     @BeforeMethod
     public void setUp()
     {
         context = new Mockery();
         service = context.mock(IGeneralInformationService.class);
+        openbisService = context.mock(IETLLIMSService.class);
     }
 
     @AfterMethod
@@ -103,9 +108,7 @@ public class SampleListerCommandTest extends AssertJUnit
                     one(service).logout(SESSION_TOKEN);
                 }
             });
-        facade =
-                ch.systemsx.cisd.cina.client.util.v1.impl.CinaUtilitiesFacadeTest.createFacade(
-                        service, USER_ID, PASSWORD);
+
         ICommand command = new MockCommandSampleLister();
 
         int exitCode = command.execute(new String[]
@@ -135,9 +138,7 @@ public class SampleListerCommandTest extends AssertJUnit
                     one(service).logout(SESSION_TOKEN);
                 }
             });
-        facade =
-                ch.systemsx.cisd.cina.client.util.v1.impl.CinaUtilitiesFacadeTest.createFacade(
-                        service, USER_ID, PASSWORD);
+
         ICommand command = new MockCommandSampleLister();
 
         try
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/v1/impl/CinaUtilitiesFacadeTest.java b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/v1/impl/CinaUtilitiesFacadeTest.java
index cbdfb15401e..85548c9d7da 100644
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/v1/impl/CinaUtilitiesFacadeTest.java
+++ b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/client/util/v1/impl/CinaUtilitiesFacadeTest.java
@@ -26,9 +26,11 @@ import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import ch.systemsx.cisd.openbis.generic.shared.IETLLIMSService;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType;
 
 /**
  * @author Chandrasekhar Ramakrishnan
@@ -45,11 +47,14 @@ public class CinaUtilitiesFacadeTest extends AssertJUnit
 
     private IGeneralInformationService service;
 
+    private IETLLIMSService openbisService;
+
     @BeforeMethod
     public void setUp()
     {
         context = new Mockery();
         service = context.mock(IGeneralInformationService.class);
+        openbisService = context.mock(IETLLIMSService.class);
     }
 
     @AfterMethod
@@ -61,7 +66,7 @@ public class CinaUtilitiesFacadeTest extends AssertJUnit
     }
 
     @Test
-    public void test()
+    public void testSearchForSamples()
     {
         final SearchCriteria searchCriteria = new SearchCriteria();
         context.checking(new Expectations()
@@ -81,7 +86,8 @@ public class CinaUtilitiesFacadeTest extends AssertJUnit
                     one(service).logout(SESSION_TOKEN);
                 }
             });
-        CinaUtilitiesFacade facade = createFacade(service, USER_ID, PASSWORD);
+        CinaUtilitiesFacade facade = createFacade(service, openbisService);
+        facade.login(USER_ID, PASSWORD);
         assertEquals(facade.getSessionToken(), SESSION_TOKEN);
         List<Sample> result = facade.searchForSamples(searchCriteria);
         assertEquals(0, result.size());
@@ -89,13 +95,54 @@ public class CinaUtilitiesFacadeTest extends AssertJUnit
         context.assertIsSatisfied();
     }
 
+    @Test
+    public void testGenerateSampleCode()
+    {
+        final String sampleTypeCode = "SampleTypeCode";
+        final SampleType sampleType = new SampleType();
+        sampleType.setAutoGeneratedCode(true);
+        sampleType.setGeneratedCodePrefix("STC-");
+        context.checking(new Expectations()
+            {
+                {
+                    one(service).tryToAuthenticateForAllServices(USER_ID, PASSWORD);
+                    will(returnValue(SESSION_TOKEN));
+
+                    one(openbisService).getSampleType(SESSION_TOKEN, sampleTypeCode);
+                    will(returnValue(sampleType));
+
+                    one(openbisService).drawANewUniqueID(SESSION_TOKEN);
+                    will(returnValue((long) 1));
+
+                    one(service).logout(SESSION_TOKEN);
+                }
+            });
+        CinaUtilitiesFacade facade = createFacade(service, openbisService);
+        facade.login(USER_ID, PASSWORD);
+        assertEquals(facade.getSessionToken(), SESSION_TOKEN);
+        String result = facade.generateSampleCode(sampleTypeCode);
+        assertEquals("STC-1", result);
+        facade.logout();
+        context.assertIsSatisfied();
+    }
+
+    /**
+     * Utility method to create a CinaUtilitiesFacade object for testing.
+     */
+    public static CinaUtilitiesFacade createFacade(IGeneralInformationService service,
+            IETLLIMSService openbisService)
+    {
+        CinaUtilitiesFacade facade = new CinaUtilitiesFacade(service, openbisService, null);
+        return facade;
+    }
+
     /**
      * Utility method to create a CinaUtilitiesFacade object for testing.
      */
     public static CinaUtilitiesFacade createFacade(IGeneralInformationService service,
-            String userId, String password)
+            IETLLIMSService openbisService, String userId, String password)
     {
-        CinaUtilitiesFacade facade = new CinaUtilitiesFacade(service, null);
+        CinaUtilitiesFacade facade = new CinaUtilitiesFacade(service, openbisService, null);
         facade.login(userId, password);
         return facade;
     }
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/MockDefaultStorageProcessor.java b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/MockDefaultStorageProcessor.java
deleted file mode 100644
index 9308dbe7143..00000000000
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/MockDefaultStorageProcessor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss;
-
-import java.io.File;
-import java.util.Properties;
-
-import ch.systemsx.cisd.common.mail.IMailClient;
-import ch.systemsx.cisd.etlserver.AbstractStorageProcessor;
-import ch.systemsx.cisd.etlserver.ITypeExtractor;
-import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation;
-import ch.systemsx.cisd.openbis.generic.shared.dto.StorageFormat;
-
-public class MockDefaultStorageProcessor extends AbstractStorageProcessor
-{
-
-    public MockDefaultStorageProcessor(final Properties properties)
-    {
-        super(properties);
-    }
-
-    public StorageFormat getStorageFormat()
-    {
-        return StorageFormat.PROPRIETARY;
-    }
-
-    public UnstoreDataAction rollback(File incomingDataSetDirectory, File storedDataDirectory,
-            Throwable exception)
-    {
-        return null;
-    }
-
-    public File storeData(DataSetInformation dataSetInformation, ITypeExtractor typeExtractor,
-            IMailClient mailClient, File incomingDataSetDirectory, File rootDir)
-    {
-        return null;
-    }
-
-    public File tryGetProprietaryData(File storedDataDirectory)
-    {
-        return null;
-    }
-
-}
\ No newline at end of file
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/StorageProcessorTest.java b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/StorageProcessorTest.java
deleted file mode 100644
index 03b98caa4f0..00000000000
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/StorageProcessorTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import ch.systemsx.cisd.base.tests.AbstractFileSystemTestCase;
-import ch.systemsx.cisd.cina.dss.info.CinaDataSetInfoExtractor;
-import ch.systemsx.cisd.cina.dss.info.CinaTypeExtractor;
-import ch.systemsx.cisd.common.mail.IMailClient;
-import ch.systemsx.cisd.common.mail.MailClient;
-import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
-import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier;
-
-/**
- * @author Chandrasekhar Ramakrishnan
- */
-public class StorageProcessorTest extends AbstractFileSystemTestCase
-{
-    Mockery context;
-
-    IEncapsulatedOpenBISService openbisService;
-
-    CinaDataSetInfoExtractor extractor;
-
-    CinaTypeExtractor typeExtractor;
-
-    StorageProcessor storageProcessor;
-
-    IMailClient mailClient;
-
-    File rootDir;
-
-    File emailDir;
-
-    private void initializeDSSInfrastructure()
-    {
-        context = new Mockery();
-        openbisService = context.mock(IEncapsulatedOpenBISService.class);
-        extractor = new CinaDataSetInfoExtractor(new Properties());
-        typeExtractor = new CinaTypeExtractor(new Properties());
-        rootDir = new File("sourceTest/java/ch/systemsx/cisd/cina/dss/info/");
-    }
-
-    private void initializeMailClient()
-    {
-        String emailFolderPath = workingDirectory.getPath() + "/emails";
-        mailClient = new MailClient("sender", "file://" + emailFolderPath);
-        emailDir = new File(emailFolderPath);
-    }
-
-    private void initializeStorageProcessor()
-    {
-        final Properties props = new Properties();
-        props.setProperty("data-store-server-code", "DSS1");
-        // Don't use this
-        // props.setProperty("data-folder", "targets/playground/data") ;
-        props.setProperty("storeroot-dir", "store");
-        // workingDirectory
-        props.setProperty("mail.smtp.host", emailDir.getPath());
-        props.setProperty("mail.from", "datastore_server@localhost");
-        props.setProperty("processor", "ch.systemsx.cisd.cina.dss.MockDefaultStorageProcessor");
-        storageProcessor = new StorageProcessor(props);
-    }
-
-    @Override
-    @BeforeMethod
-    public void setUp() throws IOException
-    {
-        // Override setUp and call super first to make sure the working directory has been created
-        super.setUp();
-
-        // create openbis, extractor, other necessary infrastructure
-        initializeDSSInfrastructure();
-
-        initializeMailClient();
-
-        initializeStorageProcessor();
-    }
-
-    @AfterMethod
-    public void afterMethod()
-    {
-        // To following line of code should also be called at the end of each test method.
-        // Otherwise one do not known which test failed.
-        context.assertIsSatisfied();
-    }
-
-    @Test
-    public void testRegisterExperiment()
-    {
-        // set up the expectations
-        context.checking(new Expectations()
-            {
-                {
-                    one(openbisService).tryToGetExperiment(with(any(ExperimentIdentifier.class)));
-                    will(returnValue(null));
-                    one(openbisService).registerExperiment(with(any(NewExperiment.class)));
-                }
-            });
-
-        // "store" the data set
-        doStoreData(new File(
-                "sourceTest/java/ch/systemsx/cisd/cina/dss/info/experiment-data-folder"));
-    }
-
-    private void doStoreData(File datasetFolder)
-    {
-        DataSetInformation dataSetInformation =
-                extractor.getDataSetInformation(datasetFolder, openbisService);
-
-        storageProcessor.storeData(dataSetInformation, typeExtractor, mailClient, datasetFolder,
-                rootDir);
-    }
-}
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/CinaDataSetInfoExtractorTest.java b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/CinaDataSetInfoExtractorTest.java
deleted file mode 100644
index 047286c2edc..00000000000
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/CinaDataSetInfoExtractorTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss.info;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.testng.AssertJUnit;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import ch.systemsx.cisd.common.exceptions.UserFailureException;
-import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
-import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier;
-
-/**
- * @author Chandrasekhar Ramakrishnan
- */
-public class CinaDataSetInfoExtractorTest extends AssertJUnit
-{
-    Mockery context;
-
-    IEncapsulatedOpenBISService openbisService;
-
-    CinaDataSetInfoExtractor extractor;
-
-    @BeforeMethod
-    public void beforeMethod()
-    {
-        context = new Mockery();
-        openbisService = context.mock(IEncapsulatedOpenBISService.class);
-        extractor = new CinaDataSetInfoExtractor(new Properties());
-    }
-
-    @AfterMethod
-    public void afterMethod()
-    {
-        // To following line of code should also be called at the end of each test method.
-        // Otherwise one do not known which test failed.
-        context.assertIsSatisfied();
-    }
-
-    @Test
-    public void testRegisterExperiment()
-    {
-        context.checking(new Expectations()
-            {
-                {
-                    one(openbisService).tryToGetExperiment(with(any(ExperimentIdentifier.class)));
-                    will(returnValue(null));
-                    one(openbisService).registerExperiment(with(any(NewExperiment.class)));
-                }
-            });
-
-        File experimentFolder =
-                new File("sourceTest/java/ch/systemsx/cisd/cina/dss/info/experiment-data-folder");
-        DataSetInformation dataSetInformation =
-                extractor.getDataSetInformation(experimentFolder, openbisService);
-
-        assertTrue("no-one@nowhere.ch".equals(dataSetInformation.tryGetUploadingUserEmail()));
-    }
-
-    @Test
-    public void testRegisterSample()
-    {
-        final Experiment existingExperiment = new Experiment();
-        context.checking(new Expectations()
-            {
-                {
-                    one(openbisService).tryToGetExperiment(with(any(ExperimentIdentifier.class)));
-                    will(returnValue(existingExperiment));
-                    one(openbisService).tryGetSampleWithExperiment(
-                            with(any(SampleIdentifier.class)));
-                    will(returnValue(null));
-                    one(openbisService).registerSample(with(any(NewSample.class)),
-                            with(aNull(String.class)));
-                }
-            });
-
-        File sampleFolder =
-                new File("sourceTest/java/ch/systemsx/cisd/cina/dss/info/sample-data-folder");
-        DataSetInformation dataSetInformation =
-                extractor.getDataSetInformation(sampleFolder, openbisService);
-
-        assertTrue("no-one@nowhere.ch".equals(dataSetInformation.tryGetUploadingUserEmail()));
-    }
-
-    @Test
-    public void testRegisterAmbiguousFolder()
-    {
-        File ambiguousDataFolder =
-                new File("sourceTest/java/ch/systemsx/cisd/cina/dss/info/ambiguous-data-folder");
-
-        try
-        {
-            extractor.getDataSetInformation(ambiguousDataFolder, openbisService);
-            fail("An ambiguous data folder should result in a UserFailureException.");
-        } catch (UserFailureException ex)
-        {
-
-        }
-    }
-
-    @Test
-    public void testRegisterEmptyFolder()
-    {
-        File emptyDataFolder =
-                new File("sourceTest/java/ch/systemsx/cisd/cina/dss/info/empty-data-folder");
-        extractor.getDataSetInformation(emptyDataFolder, openbisService);
-    }
-}
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/ExperimentMetadataExtractorTest.java b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/ExperimentMetadataExtractorTest.java
deleted file mode 100644
index 94b1aaa2062..00000000000
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/ExperimentMetadataExtractorTest.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss.info;
-
-import java.util.HashMap;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.testng.AssertJUnit;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
-import ch.systemsx.cisd.common.exceptions.UserFailureException;
-import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
-import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifierFactory;
-
-/**
- * @author Chandrasekhar Ramakrishnan
- */
-public class ExperimentMetadataExtractorTest extends AssertJUnit
-{
-    Mockery context;
-
-    DataSetInformation dataSetInformation;
-
-    IEncapsulatedOpenBISService openbisService;
-
-    @BeforeMethod
-    public void beforeMethod()
-    {
-        dataSetInformation = new DataSetInformation();
-        context = new Mockery();
-        openbisService = context.mock(IEncapsulatedOpenBISService.class);
-    }
-
-    @AfterMethod
-    public void afterMethod()
-    {
-        // To following line of code should also be called at the end of each test method.
-        // Otherwise one do not known which test failed.
-        context.assertIsSatisfied();
-    }
-
-    /**
-     * Creates dummy metadata and invokes the ExperimentMetadataExtrator.
-     */
-    @Test
-    public void testSuccessfulExperimentRegistration()
-    {
-        final String projectIdString = "/CINA/CINA1";
-        final String experimentCodePrefix = "EXP";
-        final String experimentCodeSuffix = "SUFFIX";
-        final String ownerEmail = "no-one@nowhere.ch";
-
-        final HashMap<String, String> experimentMetadata = new HashMap<String, String>();
-        experimentMetadata.put("project.identifier", projectIdString);
-        experimentMetadata.put("experiment.code-prefix", experimentCodePrefix);
-        experimentMetadata.put("experiment.owner-email", ownerEmail);
-
-        final ProjectIdentifier projectIdentifier =
-                new ProjectIdentifierFactory(projectIdString).createIdentifier();
-
-        final ExperimentIdentifier identifier =
-                new ExperimentIdentifier(projectIdentifier, experimentCodePrefix + "-"
-                        + experimentCodeSuffix);
-        final NewExperiment newExperiment =
-                new NewExperiment(identifier.toString(), "CINA_EXP_TYPE");
-        context.checking(new Expectations()
-            {
-                {
-                    one(openbisService).tryToGetExperiment(identifier);
-                    will(returnValue(null));
-                    // TODO: This does not check the type of the new experiment -- it only tests
-                    // that the identifier of the new experiment is the one specified above.
-                    one(openbisService).registerExperiment(newExperiment);
-                }
-            });
-
-        ExperimentRegistrationInformationExtractor extractor =
-                new ExperimentRegistrationInformationExtractor(dataSetInformation, experimentMetadata,
-                        experimentCodeSuffix, openbisService);
-        extractor.processMetadataAndFillDataSetInformation();
-        assertEquals(ownerEmail, dataSetInformation.tryGetUploadingUserEmail());
-
-        context.assertIsSatisfied();
-    }
-
-    /**
-     * Tries to register an experiment that is already in the database (this should not happen in
-     * practice)
-     */
-    @Test
-    public void testDuplicateExperimentRegistration()
-    {
-        final String projectIdString = "/CINA/CINA1";
-        final String experimentCodePrefix = "EXP";
-        final String experimentCodeSuffix = "SUFFIX";
-        final String ownerEmail = "no-one@nowhere.ch";
-
-        final HashMap<String, String> experimentMetadata = new HashMap<String, String>();
-        experimentMetadata.put("project.identifier", projectIdString);
-        experimentMetadata.put("experiment.code-prefix", experimentCodePrefix);
-        experimentMetadata.put("experiment.owner-email", ownerEmail);
-
-        final ProjectIdentifier projectIdentifier =
-                new ProjectIdentifierFactory(projectIdString).createIdentifier();
-
-        final ExperimentIdentifier identifier =
-                new ExperimentIdentifier(projectIdentifier, experimentCodePrefix + "-"
-                        + experimentCodeSuffix);
-        final Experiment existingExperiment = new Experiment();
-        context.checking(new Expectations()
-            {
-                {
-                    one(openbisService).tryToGetExperiment(identifier);
-                    will(returnValue(existingExperiment));
-                }
-            });
-
-        ExperimentRegistrationInformationExtractor extractor =
-                new ExperimentRegistrationInformationExtractor(dataSetInformation, experimentMetadata,
-                        experimentCodeSuffix, openbisService);
-        try
-        {
-            extractor.processMetadataAndFillDataSetInformation();
-            fail("Registering a duplicate experiment should throw an exception.");
-        } catch (EnvironmentFailureException ex)
-        {
-            // this should happen
-        }
-        assertEquals(ownerEmail, dataSetInformation.tryGetUploadingUserEmail());
-
-        context.assertIsSatisfied();
-    }
-
-    /**
-     * Tries to register an experiment where required metadata is missing.
-     */
-    @Test
-    public void testRegisterExperimentWithMissingProjectCode()
-    {
-        final String experimentCode = "EXP";
-        final String experimentCodeSuffix = "SUFFIX";
-        final String ownerEmail = "no-one@nowhere.ch";
-
-        final HashMap<String, String> experimentMetadata = new HashMap<String, String>();
-        experimentMetadata.put("experiment.code", experimentCode);
-        experimentMetadata.put("experiment.owner-email", ownerEmail);
-
-        ExperimentRegistrationInformationExtractor extractor =
-                new ExperimentRegistrationInformationExtractor(dataSetInformation, experimentMetadata,
-                        experimentCodeSuffix, openbisService);
-        try
-        {
-            extractor.processMetadataAndFillDataSetInformation();
-            fail("Project code was not specified -- this should result in an exception");
-        } catch (UserFailureException ex)
-        {
-            // This should happen
-        }
-    }
-
-    /**
-     * Tries to register an experiment where required metadata is missing.
-     */
-    @Test
-    public void testRegisterExperimentWithMissingExperimentCodePrefix()
-    {
-        final String projectCode = "CINA1";
-        final String experimentCodeSuffix = "SUFFIX";
-        final String ownerEmail = "no-one@nowhere.ch";
-
-        final HashMap<String, String> experimentMetadata = new HashMap<String, String>();
-        experimentMetadata.put("project.code", projectCode);
-        experimentMetadata.put("experiment.owner-email", ownerEmail);
-
-        ExperimentRegistrationInformationExtractor extractor =
-                new ExperimentRegistrationInformationExtractor(dataSetInformation, experimentMetadata,
-                        experimentCodeSuffix, openbisService);
-        try
-        {
-            extractor.processMetadataAndFillDataSetInformation();
-            fail("Experiment code prefix was not specified -- this should result in an exception");
-        } catch (UserFailureException ex)
-        {
-            // This should happen
-        }
-    }
-
-    /**
-     * Tries to register an experiment where required metadata is missing.
-     */
-    @Test
-    public void testRegisterExperimentWithMissingEmailAddress()
-    {
-        final String projectCode = "CINA1";
-        final String experimentCode = "EXP";
-        final String experimentCodeSuffix = "SUFFIX";
-
-        final HashMap<String, String> experimentMetadata = new HashMap<String, String>();
-        experimentMetadata.put("project.code", projectCode);
-        experimentMetadata.put("experiment.code", experimentCode);
-
-        ExperimentRegistrationInformationExtractor extractor =
-                new ExperimentRegistrationInformationExtractor(dataSetInformation, experimentMetadata,
-                        experimentCodeSuffix, openbisService);
-        try
-        {
-            extractor.processMetadataAndFillDataSetInformation();
-            fail("Owner email address was not specified -- this should result in an exception");
-        } catch (UserFailureException ex)
-        {
-            // This should happen
-        }
-    }
-}
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/FolderOracleTest.java b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/FolderOracleTest.java
deleted file mode 100644
index 98638f0f596..00000000000
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/FolderOracleTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss.info;
-
-import java.io.File;
-
-import org.testng.AssertJUnit;
-import org.testng.annotations.Test;
-
-import ch.systemsx.cisd.cina.dss.info.FolderOracle.FolderMetadata;
-import ch.systemsx.cisd.cina.dss.info.FolderOracle.FolderType;
-import ch.systemsx.cisd.common.exceptions.UserFailureException;
-
-/**
- * @author Chandrasekhar Ramakrishnan
- */
-public class FolderOracleTest extends AssertJUnit
-{
-
-    @Test
-    public void testExperimentFolder()
-    {
-        FolderOracle folderOracle = new FolderOracle();
-        File experimentFolder =
-                new File("sourceTest/java/ch/systemsx/cisd/cina/dss/info/experiment-data-folder");
-        FolderMetadata metadata = folderOracle.getFolderMetadataForFolder(experimentFolder);
-        assertEquals(metadata.getType(), FolderType.EXPERIMENT);
-        assertEquals("experiment.properties", metadata.tryGetMarkerFile().getName());
-        // The folder doesn't have an XML metadata file
-        assertNull(metadata.tryGetMetadataXMLFile());
-    }
-
-    @Test
-    public void testSampleFolder()
-    {
-        FolderOracle folderOracle = new FolderOracle();
-        File sampleFolder =
-                new File("sourceTest/java/ch/systemsx/cisd/cina/dss/info/sample-data-folder");
-        FolderMetadata metadata = folderOracle.getFolderMetadataForFolder(sampleFolder);
-        assertEquals(metadata.getType(), FolderType.SAMPLE);
-        assertEquals("sample.properties", metadata.tryGetMarkerFile().getName());
-        // The folder doesn't have an XML metadata file
-        assertNull(metadata.tryGetMetadataXMLFile());
-    }
-
-    @Test
-    public void testDataSetFolder()
-    {
-        FolderOracle folderOracle = new FolderOracle();
-        File datasetFolder =
-                new File("sourceTest/java/ch/systemsx/cisd/cina/dss/info/dataset-data-folder");
-        FolderMetadata metadata = folderOracle.getFolderMetadataForFolder(datasetFolder);
-        assertEquals(metadata.getType(), FolderType.DATA_SET);
-        assertEquals("dataset.properties", metadata.tryGetMarkerFile().getName());
-        assertNotNull(metadata.tryGetMetadataXMLFile());
-        assertEquals("metadata.xml", metadata.tryGetMetadataXMLFile().getName());
-    }
-
-    @Test
-    public void testAmbiguousFolder()
-    {
-        FolderOracle folderOracle = new FolderOracle();
-        File ambiguousFolder =
-                new File("sourceTest/java/ch/systemsx/cisd/cina/dss/info/ambiguous-data-folder");
-        try
-        {
-            folderOracle.getFolderMetadataForFolder(ambiguousFolder);
-            fail("The method getMetadataForFolder should throw an error on folder ambiguous-data-folder.");
-        } catch (UserFailureException ex)
-        {
-            // This should happen
-        }
-    }
-}
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/SampleMetadataExtractorTest.java b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/SampleMetadataExtractorTest.java
deleted file mode 100644
index 6232930ac6b..00000000000
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/SampleMetadataExtractorTest.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * Copyright 2010 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.cina.dss.info;
-
-import java.util.HashMap;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.testng.AssertJUnit;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
-import ch.systemsx.cisd.common.exceptions.UserFailureException;
-import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
-import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifierFactory;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.GroupIdentifier;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier;
-import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleOwnerIdentifier;
-
-/**
- * @author Chandrasekhar Ramakrishnan
- */
-public class SampleMetadataExtractorTest extends AssertJUnit
-{
-    Mockery context;
-
-    DataSetInformation dataSetInformation;
-
-    IEncapsulatedOpenBISService openbisService;
-
-    @BeforeMethod
-    public void beforeMethod()
-    {
-        dataSetInformation = new DataSetInformation();
-        context = new Mockery();
-        openbisService = context.mock(IEncapsulatedOpenBISService.class);
-    }
-
-    @AfterMethod
-    public void afterMethod()
-    {
-        // To following line of code should also be called at the end of each test method.
-        // Otherwise one do not known which test failed.
-        context.assertIsSatisfied();
-    }
-
-    /**
-     * Creates dummy metadata and invokes the SampleMetadataExtrator.
-     */
-    @Test
-    public void testSuccessfulSampleRegistration()
-    {
-        final String experimentId = "/CINA/CINA1/EXP1";
-        final String sampleCodePrefix = "S";
-        final String sampleCodeSuffix = "SUFFIX";
-        final String ownerEmail = "no-one@nowhere.ch";
-
-        final HashMap<String, String> sampleMetadata = new HashMap<String, String>();
-        sampleMetadata.put("experiment.identifier", experimentId);
-        sampleMetadata.put("sample.code-prefix", sampleCodePrefix);
-        sampleMetadata.put("experiment.owner-email", ownerEmail);
-
-        final ExperimentIdentifier experimentIdentifier =
-                new ExperimentIdentifierFactory(experimentId).createIdentifier();
-        final Experiment experiment = new Experiment();
-        experiment.setIdentifier(experimentIdentifier.toString());
-
-        final SampleIdentifier sampleIdentifier =
-                new SampleIdentifier(new GroupIdentifier((String) null, "CINA"), sampleCodePrefix
-                        + "-" + sampleCodeSuffix);
-
-        final NewSample newSample = new NewSample();
-        SampleType sampleType = new SampleType();
-        sampleType.setCode("CINA_SAMPLE_TYPE");
-        newSample.setSampleType(sampleType);
-        newSample.setExperimentIdentifier(experimentId.toString());
-        newSample.setIdentifier(sampleIdentifier.toString());
-        context.checking(new Expectations()
-            {
-                {
-                    one(openbisService).tryToGetExperiment(experimentIdentifier);
-                    will(returnValue(experiment));
-                    one(openbisService).tryGetSampleWithExperiment(sampleIdentifier);
-                    will(returnValue(null));
-                    one(openbisService).registerSample(newSample, null);
-                }
-            });
-
-        SampleRegistrationInformationExtractor extractor =
-                new SampleRegistrationInformationExtractor(dataSetInformation, sampleMetadata, sampleCodeSuffix,
-                        openbisService);
-        extractor.processMetadataAndFillDataSetInformation();
-        assertEquals(ownerEmail, dataSetInformation.tryGetUploadingUserEmail());
-        assertEquals("/CINA/S-SUFFIX", dataSetInformation.getSampleIdentifier().toString());
-
-        context.assertIsSatisfied();
-    }
-
-    /**
-     * Tries to register a sample that is already in the database (this should not happen in
-     * practice)
-     */
-    @Test
-    public void testDuplicateSampleRegistration()
-    {
-        final String experimentId = "/CINA/CINA1/EXP1";
-        final String sampleCodePrefix = "S";
-        final String sampleCodeSuffix = "SUFFIX";
-        final String ownerEmail = "no-one@nowhere.ch";
-
-        final HashMap<String, String> sampleMetadata = new HashMap<String, String>();
-        sampleMetadata.put("experiment.identifier", experimentId);
-        sampleMetadata.put("sample.code-prefix", sampleCodePrefix);
-        sampleMetadata.put("experiment.owner-email", ownerEmail);
-
-        final ExperimentIdentifier experimentIdentifier =
-                new ExperimentIdentifierFactory(experimentId).createIdentifier();
-        final Experiment experiment = new Experiment();
-        experiment.setIdentifier(experimentIdentifier.toString());
-
-        final SampleIdentifier sampleIdentifier =
-                new SampleIdentifier(new GroupIdentifier((String) null, "CINA"), sampleCodePrefix
-                        + "-" + sampleCodeSuffix);
-
-        final Sample existingSample = new Sample();
-        context.checking(new Expectations()
-            {
-                {
-                    one(openbisService).tryToGetExperiment(experimentIdentifier);
-                    will(returnValue(experiment));
-                    one(openbisService).tryGetSampleWithExperiment(sampleIdentifier);
-                    will(returnValue(existingSample));
-                }
-            });
-
-        SampleRegistrationInformationExtractor extractor =
-                new SampleRegistrationInformationExtractor(dataSetInformation, sampleMetadata, sampleCodeSuffix,
-                        openbisService);
-
-        try
-        {
-            extractor.processMetadataAndFillDataSetInformation();
-            fail("Registering a duplicate sample should throw an exception.");
-        } catch (EnvironmentFailureException ex)
-        {
-            // this should happen
-        }
-        assertEquals(ownerEmail, dataSetInformation.tryGetUploadingUserEmail());
-
-        context.assertIsSatisfied();
-    }
-
-    /**
-     * Tries to register an sample where required metadata is missing.
-     */
-    @Test
-    public void testRegisterExperimentWithMissingExperimentIdentifier()
-    {
-        final String sampleCodePrefix = "S";
-        final String sampleCodeSuffix = "SUFFIX";
-        final String ownerEmail = "no-one@nowhere.ch";
-
-        final HashMap<String, String> sampleMetadata = new HashMap<String, String>();
-        sampleMetadata.put("sample.code-prefix", sampleCodePrefix);
-        sampleMetadata.put("experiment.owner-email", ownerEmail);
-
-        SampleRegistrationInformationExtractor extractor =
-                new SampleRegistrationInformationExtractor(dataSetInformation, sampleMetadata, sampleCodeSuffix,
-                        openbisService);
-        try
-        {
-            extractor.processMetadataAndFillDataSetInformation();
-            fail("Experiment identifier was not specified -- this should result in an exception");
-        } catch (UserFailureException ex)
-        {
-            // This should happen
-        }
-    }
-
-    /**
-     * Tries to register an sample where required metadata is missing.
-     */
-    @Test
-    public void testRegisterExperimentWithJunkExperimentIdentifier()
-    {
-        final String experimentId = "/CINA-adf-EXP1";
-        final String sampleCodePrefix = "S";
-        final String sampleCodeSuffix = "SUFFIX";
-        final String ownerEmail = "no-one@nowhere.ch";
-
-        final HashMap<String, String> sampleMetadata = new HashMap<String, String>();
-        sampleMetadata.put("experiment.identifier", experimentId);
-        sampleMetadata.put("sample.code-prefix", sampleCodePrefix);
-        sampleMetadata.put("experiment.owner-email", ownerEmail);
-
-        SampleRegistrationInformationExtractor extractor =
-                new SampleRegistrationInformationExtractor(dataSetInformation, sampleMetadata, sampleCodeSuffix,
-                        openbisService);
-        try
-        {
-            extractor.processMetadataAndFillDataSetInformation();
-            fail("Experiment identifier was not in the correct format -- this should result in an exception");
-        } catch (UserFailureException ex)
-        {
-            // This should happen
-        }
-    }
-
-    /**
-     * Tries to register an sample where required metadata is missing.
-     */
-    @Test
-    public void testRegisterExperimentWithInvalidExperimentIdentifier()
-    {
-        final String experimentId = "/CINA/CINA1/EXP482";
-        final String sampleCodePrefix = "S";
-        final String sampleCodeSuffix = "SUFFIX";
-        final String ownerEmail = "no-one@nowhere.ch";
-
-        final HashMap<String, String> sampleMetadata = new HashMap<String, String>();
-        sampleMetadata.put("experiment.identifier", experimentId);
-        sampleMetadata.put("sample.code-prefix", sampleCodePrefix);
-        sampleMetadata.put("experiment.owner-email", ownerEmail);
-
-        final ExperimentIdentifier experimentIdentifier =
-                new ExperimentIdentifierFactory(experimentId).createIdentifier();
-
-        final SampleIdentifier sampleIdentifier =
-                SampleIdentifier.createOwnedBy(new SampleOwnerIdentifier(experimentIdentifier),
-                        sampleCodePrefix + "-" + sampleCodeSuffix);
-
-        final NewSample newSample = new NewSample();
-        SampleType sampleType = new SampleType();
-        sampleType.setCode("CINA_SAMPLE_TYPE");
-        newSample.setSampleType(sampleType);
-        newSample.setExperimentIdentifier(experimentId.toString());
-        newSample.setIdentifier(sampleIdentifier.toString());
-        context.checking(new Expectations()
-            {
-                {
-                    one(openbisService).tryToGetExperiment(experimentIdentifier);
-                    will(returnValue(null));
-                }
-            });
-
-        SampleRegistrationInformationExtractor extractor =
-                new SampleRegistrationInformationExtractor(dataSetInformation, sampleMetadata, sampleCodeSuffix,
-                        openbisService);
-        try
-        {
-            extractor.processMetadataAndFillDataSetInformation();
-            fail("There is no experiment with the provided identifier -- this should result in an exception");
-        } catch (UserFailureException ex)
-        {
-            // This should happen
-        }
-        assertEquals(ownerEmail, dataSetInformation.tryGetUploadingUserEmail());
-
-        context.assertIsSatisfied();
-    }
-
-    /**
-     * Tries to register an sample where required metadata is missing.
-     */
-    @Test
-    public void testRegisterSampleWithMissingSampleCodePrefix()
-    {
-        final String experimentId = "/CINA/CINA1/EXP1";
-        final String sampleCodeSuffix = "SUFFIX";
-        final String ownerEmail = "no-one@nowhere.ch";
-
-        final HashMap<String, String> sampleMetadata = new HashMap<String, String>();
-        sampleMetadata.put("experiment.identifier", experimentId);
-        sampleMetadata.put("experiment.owner-email", ownerEmail);
-
-        SampleRegistrationInformationExtractor extractor =
-                new SampleRegistrationInformationExtractor(dataSetInformation, sampleMetadata, sampleCodeSuffix,
-                        openbisService);
-        try
-        {
-            extractor.processMetadataAndFillDataSetInformation();
-            fail("Sample code prefix was not specified -- this should result in an exception");
-        } catch (UserFailureException ex)
-        {
-            // This should happen
-        }
-    }
-
-    /**
-     * Tries to register an sample where required metadata is missing.
-     */
-    @Test
-    public void testRegisterSampleWithMissingEmailAddress()
-    {
-        final String experimentId = "/CINA/CINA1/EXP1";
-        final String sampleCodePrefix = "S";
-        final String sampleCodeSuffix = "SUFFIX";
-
-        final HashMap<String, String> sampleMetadata = new HashMap<String, String>();
-        sampleMetadata.put("experiment.identifier", experimentId);
-        sampleMetadata.put("sample.code-prefix", sampleCodePrefix);
-
-        SampleRegistrationInformationExtractor extractor =
-                new SampleRegistrationInformationExtractor(dataSetInformation, sampleMetadata, sampleCodeSuffix,
-                        openbisService);
-        try
-        {
-            extractor.processMetadataAndFillDataSetInformation();
-            fail("Owner email address was not specified -- this should result in an exception");
-        } catch (UserFailureException ex)
-        {
-            // This should happen
-        }
-    }
-}
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/ambiguous-data-folder/dataset.properties b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/ambiguous-data-folder/dataset.properties
deleted file mode 100644
index 124fde3eff7..00000000000
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/ambiguous-data-folder/dataset.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-project.code = CINA1
-experiment.code = EXP
-experiment.owner-email = no-one@nowhere.ch
\ No newline at end of file
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/ambiguous-data-folder/sample.properties b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/ambiguous-data-folder/sample.properties
deleted file mode 100644
index 124fde3eff7..00000000000
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/ambiguous-data-folder/sample.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-project.code = CINA1
-experiment.code = EXP
-experiment.owner-email = no-one@nowhere.ch
\ No newline at end of file
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/dataset-data-folder/dataset.properties b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/dataset-data-folder/dataset.properties
deleted file mode 100644
index 124fde3eff7..00000000000
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/dataset-data-folder/dataset.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-project.code = CINA1
-experiment.code = EXP
-experiment.owner-email = no-one@nowhere.ch
\ No newline at end of file
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/dataset-data-folder/metadata.xml b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/dataset-data-folder/metadata.xml
deleted file mode 100644
index e053af4a7e1..00000000000
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/dataset-data-folder/metadata.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" standalone="yes"?>
-<LVData xmlns="http://www.ni.com/LVData">
-	<Version>8.6.1</Version>
-	<Cluster>
-		<Name>GeneralDatabaseEnty</Name>
-		<NumElts>9</NumElts>
-		<DBL>
-			<Name>Experiment identifier</Name>
-			<Val>0.00000000000000</Val>
-		</DBL>
-		<String>
-			<Name>Operator</Name>
-			<Val>dedeed</Val>
-		</String>
-		<Timestamp>
-			<Name>Creation data</Name>
-			<Cluster>
-				<Name/>
-				<NumElts>4</NumElts>
-				<I32>
-					<Name/>
-					<Val>0</Val>
-				</I32>
-				<I32>
-					<Name/>
-					<Val>348413952</Val>
-				</I32>
-				<I32>
-					<Name/>
-					<Val>-946831183</Val>
-				</I32>
-				<I32>
-					<Name/>
-					<Val>0</Val>
-				</I32>
-			</Cluster>
-		</Timestamp>
-		<String>
-			<Name>Description</Name>
-			<Val>wqded ewdewdewd wedewdewd wedewdewd wedewdew &#xA7;</Val>
-		</String>
-		<DBL>
-			<Name>Sample identifier</Name>
-			<Val>0.00000000000000</Val>
-		</DBL>
-		<Boolean>
-			<Name>DBGetExpIndentifier</Name>
-			<Val>0</Val>
-		</Boolean>
-		<Boolean>
-			<Name>DBGetExpIndentifier 2</Name>
-			<Val>0</Val>
-		</Boolean>
-		<Path>
-			<Name>Bundle folder</Name>
-			<Val>C:\Documents and Settings\tbraun\My Documents\CINA_Data_Container</Val>
-		</Path>
-		<String>
-			<Name>Experiment name</Name>
-			<Val>Wednesday10</Val>
-		</String>
-	</Cluster>
-</LVData>
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/empty-data-folder/.gitignore b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/empty-data-folder/.gitignore
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/experiment-data-folder/experiment.properties b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/experiment-data-folder/experiment.properties
deleted file mode 100644
index f15a939bc1b..00000000000
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/experiment-data-folder/experiment.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-project.identifier = /CINA/CINA1
-experiment.code-prefix = EXP
-experiment.owner-email = no-one@nowhere.ch
\ No newline at end of file
diff --git a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/sample-data-folder/sample.properties b/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/sample-data-folder/sample.properties
deleted file mode 100644
index 80ba74bf10f..00000000000
--- a/rtd_cina/sourceTest/java/ch/systemsx/cisd/cina/dss/info/sample-data-folder/sample.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-experiment.identifier = /CINA/CINA1/EXP1
-experiment.owner-email = no-one@nowhere.ch
-sample.code-prefix = S
\ No newline at end of file
-- 
GitLab