From 0a9b38c8be68be2c94873c987eef0f907778fed2 Mon Sep 17 00:00:00 2001
From: cramakri <cramakri>
Date: Tue, 12 Apr 2011 09:49:37 +0000
Subject: [PATCH] LMS-2132 Validate before uploading in the command line client
 as well.

SVN: 20826
---
 .../dss/client/api/cli/CommandPutTest.java    | 36 ++++++++++++-------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandPutTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandPutTest.java
index fdf7e4514e8..81c37bd44f9 100644
--- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandPutTest.java
+++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandPutTest.java
@@ -17,7 +17,9 @@
 package ch.systemsx.cisd.openbis.dss.client.api.cli;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 
 import org.hamcrest.BaseMatcher;
 import org.hamcrest.Description;
@@ -35,6 +37,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO;
 import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDTO;
 import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDTO.DataSetOwner;
 import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDTO.DataSetOwnerType;
+import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.validation.ValidationError;
 
 /**
  * @author Franz-Josef Elmer
@@ -88,21 +91,28 @@ public class CommandPutTest extends AbstractFileSystemTestCase
                     final NewDataSetDTO newDataSetDTO =
                             new NewDataSetDTO("MY_TYPE", owner, dataSetExample.getName(), Arrays
                                     .asList(info));
-                    one(dssComponent).putDataSet(with(new BaseMatcher<NewDataSetDTO>()
-                        {
-
-                            public boolean matches(Object item)
-                            {
-                                assertEquals(newDataSetDTO.toString(), item.toString());
-                                return true;
-                            }
-
-                            public void describeTo(Description description)
-                            {
-                            }
-                        }), with(equal(dataSetExample)));
+                    BaseMatcher<NewDataSetDTO> newDataSetDtoMatcher =
+                            new BaseMatcher<NewDataSetDTO>()
+                                {
+
+                                    public boolean matches(Object item)
+                                    {
+                                        assertEquals(newDataSetDTO.toString(), item.toString());
+                                        return true;
+                                    }
+
+                                    public void describeTo(Description description)
+                                    {
+                                    }
+                                };
+                    one(dssComponent).putDataSet(with(newDataSetDtoMatcher),
+                            with(equal(dataSetExample)));
                     will(returnValue(dataSet));
 
+                    one(dssComponent).validateDataSet(with(newDataSetDtoMatcher),
+                            with(equal(dataSetExample)));
+                    will(returnValue(new ArrayList<ValidationError>()));
+
                     one(dataSet).getCode();
                     will(returnValue("ds1"));
 
-- 
GitLab