Skip to content
Snippets Groups Projects
Commit 0a9b38c8 authored by cramakri's avatar cramakri
Browse files

LMS-2132 Validate before uploading in the command line client as well.

SVN: 20826
parent d7a6b1cf
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,9 @@ ...@@ -17,7 +17,9 @@
package ch.systemsx.cisd.openbis.dss.client.api.cli; package ch.systemsx.cisd.openbis.dss.client.api.cli;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import org.hamcrest.BaseMatcher; import org.hamcrest.BaseMatcher;
import org.hamcrest.Description; import org.hamcrest.Description;
...@@ -35,6 +37,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO; ...@@ -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;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDTO.DataSetOwner; 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.NewDataSetDTO.DataSetOwnerType;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.validation.ValidationError;
/** /**
* @author Franz-Josef Elmer * @author Franz-Josef Elmer
...@@ -88,21 +91,28 @@ public class CommandPutTest extends AbstractFileSystemTestCase ...@@ -88,21 +91,28 @@ public class CommandPutTest extends AbstractFileSystemTestCase
final NewDataSetDTO newDataSetDTO = final NewDataSetDTO newDataSetDTO =
new NewDataSetDTO("MY_TYPE", owner, dataSetExample.getName(), Arrays new NewDataSetDTO("MY_TYPE", owner, dataSetExample.getName(), Arrays
.asList(info)); .asList(info));
one(dssComponent).putDataSet(with(new BaseMatcher<NewDataSetDTO>() BaseMatcher<NewDataSetDTO> newDataSetDtoMatcher =
{ new BaseMatcher<NewDataSetDTO>()
{
public boolean matches(Object item)
{ public boolean matches(Object item)
assertEquals(newDataSetDTO.toString(), item.toString()); {
return true; assertEquals(newDataSetDTO.toString(), item.toString());
} return true;
}
public void describeTo(Description description)
{ public void describeTo(Description description)
} {
}), with(equal(dataSetExample))); }
};
one(dssComponent).putDataSet(with(newDataSetDtoMatcher),
with(equal(dataSetExample)));
will(returnValue(dataSet)); will(returnValue(dataSet));
one(dssComponent).validateDataSet(with(newDataSetDtoMatcher),
with(equal(dataSetExample)));
will(returnValue(new ArrayList<ValidationError>()));
one(dataSet).getCode(); one(dataSet).getCode();
will(returnValue("ds1")); will(returnValue("ds1"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment