Skip to content
Snippets Groups Projects
Commit 9dd70977 authored by cramakri's avatar cramakri
Browse files

LMS-1503 Work on the put method.

SVN: 16179
parent 1c2229e5
No related branches found
No related tags found
No related merge requests found
Showing
with 340 additions and 88 deletions
...@@ -48,7 +48,7 @@ abstract class AbstractCommand implements ICommand ...@@ -48,7 +48,7 @@ abstract class AbstractCommand implements ICommand
out.println(getUsagePrefixString() + " [options] <data set code> <path>"); out.println(getUsagePrefixString() + " [options] <data set code> <path>");
parser.printUsage(out); parser.printUsage(out);
out.println(" Example : " + getCommandCallString() + " " out.println(" Example : " + getCommandCallString() + " "
+ parser.printExample(ExampleMode.ALL)); + parser.printExample(ExampleMode.ALL) + " <data set code> <path>");
} }
/** /**
...@@ -82,15 +82,15 @@ abstract class AbstractCommand implements ICommand ...@@ -82,15 +82,15 @@ abstract class AbstractCommand implements ICommand
protected IDssComponent login(GlobalArguments arguments) protected IDssComponent login(GlobalArguments arguments)
{ {
IDssComponent component = IDssComponent component =
DssComponentFactory.tryCreate(arguments.getUsername(), arguments.getPassword(), arguments DssComponentFactory.tryCreate(arguments.getUsername(), arguments.getPassword(),
.getServerBaseUrl()); arguments.getServerBaseUrl());
return component; return component;
} }
/** /**
* Retuns a proxy to the DSS object referenced by the arguments. * Retuns a proxy to the DSS object referenced by the arguments.
*/ */
protected IDataSetDss getDataSet(IDssComponent component, GlobalArguments arguments) protected IDataSetDss getDataSet(IDssComponent component, DataSetArguments arguments)
{ {
return component.getDataSet(arguments.getDataSetCode()); return component.getDataSet(arguments.getDataSetCode());
} }
......
...@@ -26,7 +26,7 @@ class CommandFactory ...@@ -26,7 +26,7 @@ class CommandFactory
{ {
private static enum Command private static enum Command
{ {
LS, GET, HELP LS, GET, HELP, PUT
} }
/** /**
...@@ -58,6 +58,9 @@ class CommandFactory ...@@ -58,6 +58,9 @@ class CommandFactory
case HELP: case HELP:
result = new CommandHelp(this); result = new CommandHelp(this);
break; break;
case PUT:
result = new CommandPut();
break;
default: default:
result = null; result = null;
break; break;
...@@ -69,7 +72,7 @@ class CommandFactory ...@@ -69,7 +72,7 @@ class CommandFactory
List<String> getKnownCommands() List<String> getKnownCommands()
{ {
String[] commands = String[] commands =
{ "ls", "get" }; { "ls", "get", "put" };
return Arrays.asList(commands); return Arrays.asList(commands);
} }
} }
...@@ -39,7 +39,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO; ...@@ -39,7 +39,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO;
*/ */
class CommandGet extends AbstractCommand class CommandGet extends AbstractCommand
{ {
private static class CommandGetArguments extends GlobalArguments private static class CommandGetArguments extends DataSetArguments
{ {
@Option(name = "r", longName = "recursive", usage = "Recurse into directories") @Option(name = "r", longName = "recursive", usage = "Recurse into directories")
private boolean recursive = false; private boolean recursive = false;
......
...@@ -74,7 +74,7 @@ class CommandHelp extends AbstractCommand ...@@ -74,7 +74,7 @@ class CommandHelp extends AbstractCommand
@Override @Override
public void printUsage(PrintStream out) public void printUsage(PrintStream out)
{ {
out.println("usage: " + getProgramCallString() + " COMMAND [options...] DATA_SET_CODE"); out.println("usage: " + getProgramCallString() + " COMMAND [options...] <command arguments>");
List<String> commands = commandFactory.getKnownCommands(); List<String> commands = commandFactory.getKnownCommands();
out.println("\nCommands:"); out.println("\nCommands:");
for (String cmd : commands) for (String cmd : commands)
......
...@@ -31,7 +31,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO; ...@@ -31,7 +31,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO;
*/ */
class CommandLs extends AbstractCommand class CommandLs extends AbstractCommand
{ {
private static class CommandLsArguments extends GlobalArguments private static class CommandLsArguments extends DataSetArguments
{ {
@Option(name = "r", longName = "recursive", usage = "Recurse into directories") @Option(name = "r", longName = "recursive", usage = "Recurse into directories")
private boolean recursive = false; private boolean recursive = false;
......
/*
* 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.openbis.dss.client.api.cli;
import java.io.InputStream;
import java.io.PrintStream;
import ch.systemsx.cisd.args4j.CmdLineParser;
import ch.systemsx.cisd.args4j.ExampleMode;
import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.openbis.dss.client.api.v1.IDssComponent;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDssDTO;
/**
* Command that lists files in the data set.
*
* @author Chandrasekhar Ramakrishnan
*/
class CommandPut extends AbstractCommand
{
private static class CommandPutArguments extends GlobalArguments
{
public String getStorageProcess()
{
return getArguments().get(0);
}
public String getFilePath()
{
return getArguments().get(1);
}
@Override
public boolean isComplete()
{
if (false == super.isComplete())
return false;
if (getArguments().size() < 2)
return false;
return true;
}
}
private static class CommandPutExecutor
{
private final CommandPutArguments arguments;
private final IDssServiceRpcGeneric dssService;
CommandPutExecutor(IDssServiceRpcGeneric dataSet, CommandPutArguments arguments)
{
this.arguments = arguments;
this.dssService = dataSet;
}
int execute()
{
NewDataSetDssDTO newDataSet = getNewDataSet();
dssService.putDataSet("", newDataSet);
return 0;
}
private NewDataSetDssDTO getNewDataSet()
{
String storageProcessName = arguments.getStorageProcess();
String filePath = arguments.getFilePath();
filePath.length();
InputStream fileInputStream = null;
return new NewDataSetDssDTO(storageProcessName, fileInputStream);
}
}
private final CommandPutArguments arguments;
CommandPut()
{
arguments = new CommandPutArguments();
parser = new CmdLineParser(arguments);
}
public int execute(String[] args) throws UserFailureException, EnvironmentFailureException
{
parser.parseArgument(args);
// Show help and exit
if (arguments.isHelp())
{
printUsage(System.out);
return 0;
}
// Show usage and exit
if (arguments.isComplete() == false)
{
printUsage(System.err);
return 1;
}
IDssComponent component = login(arguments);
IDssServiceRpcGeneric dssService = component.getDefaultDssService();
return new CommandPutExecutor(dssService, arguments).execute();
}
public String getName()
{
return "put";
}
/**
* Print usage information about the command.
*/
@Override
public void printUsage(PrintStream out)
{
out.println(getUsagePrefixString() + " [options] <storage process> <path>");
parser.printUsage(out);
out.println(" Example : " + getCommandCallString() + " "
+ parser.printExample(ExampleMode.ALL) + " <storage process> <path>");
}
}
/*
* 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.openbis.dss.client.api.cli;
import java.util.List;
/**
* Command line arguments for dss commands that refer to data sets. The format is:
* <p>
* <code>
* [options] DATA_SET_CODE [PATH]
* </code>
*
* @author Chandrasekhar Ramakrishnan
*/
class DataSetArguments extends GlobalArguments
{
public String getDataSetCode()
{
List<String> args = getArguments();
if (args.size() < 1)
{
return "";
}
return args.get(0);
}
public String getRequestedPath()
{
List<String> args = getArguments();
String path;
if (args.size() < 2)
{
path = "/";
} else
{
path = args.get(1);
}
return path;
}
@Override
public boolean isComplete()
{
if (false == super.isComplete())
return false;
if (getDataSetCode().length() < 1)
{
return false;
}
return true;
}
}
...@@ -157,6 +157,7 @@ public class DssClient ...@@ -157,6 +157,7 @@ public class DssClient
} }
String commandName = args[0]; String commandName = args[0];
System.out.println("Command " + commandName);
ICommand command = commandFactory.tryCommandForName(commandName); ICommand command = commandFactory.tryCommandForName(commandName);
if (null == command) if (null == command)
{ {
......
...@@ -88,30 +88,6 @@ class GlobalArguments ...@@ -88,30 +88,6 @@ class GlobalArguments
this.serverBaseUrl = serverBaseUrl; this.serverBaseUrl = serverBaseUrl;
} }
public String getDataSetCode()
{
List<String> args = getArguments();
if (args.size() < 1)
{
return "";
}
return args.get(0);
}
public String getRequestedPath()
{
List<String> args = getArguments();
String path;
if (args.size() < 2)
{
path = "/";
} else
{
path = args.get(1);
}
return path;
}
public List<String> getArguments() public List<String> getArguments()
{ {
return arguments; return arguments;
...@@ -141,12 +117,7 @@ class GlobalArguments ...@@ -141,12 +117,7 @@ class GlobalArguments
{ {
return false; return false;
} }
if (getDataSetCode().length() < 1)
{
return false;
}
return true; return true;
} }
} }
...@@ -18,6 +18,7 @@ package ch.systemsx.cisd.openbis.dss.client.api.v1; ...@@ -18,6 +18,7 @@ package ch.systemsx.cisd.openbis.dss.client.api.v1;
import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
import ch.systemsx.cisd.common.exceptions.InvalidSessionException; import ch.systemsx.cisd.common.exceptions.InvalidSessionException;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric;
/** /**
* A component that manages a connection to openBIS and 1 or more data store servers. * A component that manages a connection to openBIS and 1 or more data store servers.
...@@ -63,6 +64,16 @@ public interface IDssComponent ...@@ -63,6 +64,16 @@ public interface IDssComponent
public IDataSetDss getDataSet(String code) throws IllegalStateException, public IDataSetDss getDataSet(String code) throws IllegalStateException,
EnvironmentFailureException; EnvironmentFailureException;
/**
* Get a proxy to the default DSS server for the openBIS AS.
*
* @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 IDssServiceRpcGeneric getDefaultDssService() throws IllegalStateException,
EnvironmentFailureException;
/** /**
* Logs the current user out. * Logs the current user out.
*/ */
......
...@@ -177,6 +177,12 @@ public class DssComponent implements IDssComponent ...@@ -177,6 +177,12 @@ public class DssComponent implements IDssComponent
state.login(user, password); state.login(user, password);
state = new AuthenticatedState(openBisService, dssServiceFactory, state.getSessionToken()); state = new AuthenticatedState(openBisService, dssServiceFactory, state.getSessionToken());
} }
public IDssServiceRpcGeneric getDefaultDssService() throws IllegalStateException,
EnvironmentFailureException
{
return state.getDefaultDssService();
}
} }
/** /**
...@@ -206,6 +212,11 @@ abstract class AbstractDssComponentState implements IDssComponent ...@@ -206,6 +212,11 @@ abstract class AbstractDssComponentState implements IDssComponent
throw new IllegalStateException("Please log in"); throw new IllegalStateException("Please log in");
} }
public IDssServiceRpcGeneric getDefaultDssService() throws IllegalStateException
{
throw new IllegalStateException("Please log in");
}
/** /**
* Authenticates the <code>user</code> with given <code>password</code>. * Authenticates the <code>user</code> with given <code>password</code>.
* *
...@@ -326,7 +337,13 @@ class AuthenticatedState extends AbstractDssComponentState ...@@ -326,7 +337,13 @@ class AuthenticatedState extends AbstractDssComponentState
IDssServiceRpcGeneric dssService = getDssServiceForUrl(url); IDssServiceRpcGeneric dssService = getDssServiceForUrl(url);
// Return a proxy to the data set // Return a proxy to the data set
return new DataSetDss(code, dssService, this); return new DataSetDss(code, dssService, this);
}
@Override
public IDssServiceRpcGeneric getDefaultDssService()
{
return null;
} }
/** /**
......
...@@ -26,9 +26,9 @@ import ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked; ...@@ -26,9 +26,9 @@ import ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked;
import ch.systemsx.cisd.openbis.dss.generic.server.AbstractDssServiceRpc; import ch.systemsx.cisd.openbis.dss.generic.server.AbstractDssServiceRpc;
import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileReferenceDTO; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileReferenceDssDTO;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDatasetDTO; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDssDTO;
/** /**
* Implementation of the generic RPC interface. * Implementation of the generic RPC interface.
...@@ -86,7 +86,7 @@ public class DssServiceRpcGeneric extends AbstractDssServiceRpc implements IDssS ...@@ -86,7 +86,7 @@ public class DssServiceRpcGeneric extends AbstractDssServiceRpc implements IDssS
} }
} }
public void putDataSet(String sessionToken, NewDatasetDTO newDataSet) public void putDataSet(String sessionToken, NewDataSetDssDTO newDataSet)
throws IOExceptionUnchecked, IllegalArgumentException throws IOExceptionUnchecked, IllegalArgumentException
{ {
...@@ -121,14 +121,14 @@ public class DssServiceRpcGeneric extends AbstractDssServiceRpc implements IDssS ...@@ -121,14 +121,14 @@ public class DssServiceRpcGeneric extends AbstractDssServiceRpc implements IDssS
factory.appendFileInfosForFile(requestedFile, list, isRecursive); factory.appendFileInfosForFile(requestedFile, list, isRecursive);
} }
public InputStream getFileForDataSet(String sessionToken, FileReferenceDTO fileOrFolder) public InputStream getFileForDataSet(String sessionToken, FileReferenceDssDTO fileOrFolder)
throws IOExceptionUnchecked, IllegalArgumentException throws IOExceptionUnchecked, IllegalArgumentException
{ {
return this.getFileForDataSet(sessionToken, fileOrFolder.getDataSetCode(), fileOrFolder return this.getFileForDataSet(sessionToken, fileOrFolder.getDataSetCode(), fileOrFolder
.getPath()); .getPath());
} }
public FileInfoDssDTO[] listFilesForDataSet(String sessionToken, FileReferenceDTO fileOrFolder) public FileInfoDssDTO[] listFilesForDataSet(String sessionToken, FileReferenceDssDTO fileOrFolder)
throws IOExceptionUnchecked, IllegalArgumentException throws IOExceptionUnchecked, IllegalArgumentException
{ {
return this.listFilesForDataSet(sessionToken, fileOrFolder.getDataSetCode(), fileOrFolder return this.listFilesForDataSet(sessionToken, fileOrFolder.getDataSetCode(), fileOrFolder
......
...@@ -23,7 +23,7 @@ import java.io.Serializable; ...@@ -23,7 +23,7 @@ import java.io.Serializable;
* *
* @author Chandrasekhar Ramakrishnan * @author Chandrasekhar Ramakrishnan
*/ */
public class FileReferenceDTO implements Serializable public class FileReferenceDssDTO implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -33,7 +33,7 @@ public class FileReferenceDTO implements Serializable ...@@ -33,7 +33,7 @@ public class FileReferenceDTO implements Serializable
private final boolean isRecursive; private final boolean isRecursive;
public FileReferenceDTO(String dataSetCode, String path, boolean isRecursive) public FileReferenceDssDTO(String dataSetCode, String path, boolean isRecursive)
{ {
this.dataSetCode = dataSetCode; this.dataSetCode = dataSetCode;
this.path = path; this.path = path;
......
...@@ -38,7 +38,7 @@ public interface IDssServiceRpcGeneric extends IRpcService ...@@ -38,7 +38,7 @@ public interface IDssServiceRpcGeneric extends IRpcService
* @throws IOExceptionUnchecked Thrown if an IOException occurs when listing the files * @throws IOExceptionUnchecked Thrown if an IOException occurs when listing the files
* @throws IllegalArgumentException Thrown if the dataSetCode or startPath are not valid * @throws IllegalArgumentException Thrown if the dataSetCode or startPath are not valid
*/ */
public FileInfoDssDTO[] listFilesForDataSet(String sessionToken, FileReferenceDTO fileOrFolder) public FileInfoDssDTO[] listFilesForDataSet(String sessionToken, FileReferenceDssDTO fileOrFolder)
throws IOExceptionUnchecked, IllegalArgumentException; throws IOExceptionUnchecked, IllegalArgumentException;
/** /**
...@@ -49,7 +49,7 @@ public interface IDssServiceRpcGeneric extends IRpcService ...@@ -49,7 +49,7 @@ public interface IDssServiceRpcGeneric extends IRpcService
* @throws IOExceptionUnchecked Thrown if an IOException occurs when listing the files * @throws IOExceptionUnchecked Thrown if an IOException occurs when listing the files
* @throws IllegalArgumentException Thrown if the dataSetCode or startPath are not valid * @throws IllegalArgumentException Thrown if the dataSetCode or startPath are not valid
*/ */
public InputStream getFileForDataSet(String sessionToken, FileReferenceDTO fileOrFolder) public InputStream getFileForDataSet(String sessionToken, FileReferenceDssDTO fileOrFolder)
throws IOExceptionUnchecked, IllegalArgumentException; throws IOExceptionUnchecked, IllegalArgumentException;
/** /**
...@@ -85,6 +85,6 @@ public interface IDssServiceRpcGeneric extends IRpcService ...@@ -85,6 +85,6 @@ public interface IDssServiceRpcGeneric extends IRpcService
* @throws IOExceptionUnchecked Thrown if an IOException occurs when listing the files * @throws IOExceptionUnchecked Thrown if an IOException occurs when listing the files
* @throws IllegalArgumentException Thrown if the dataSetCode or startPath are not valid * @throws IllegalArgumentException Thrown if the dataSetCode or startPath are not valid
*/ */
public void putDataSet(String sessionToken, NewDatasetDTO newDataset) public void putDataSet(String sessionToken, NewDataSetDssDTO newDataset)
throws IOExceptionUnchecked, IllegalArgumentException; throws IOExceptionUnchecked, IllegalArgumentException;
} }
...@@ -29,7 +29,7 @@ import ch.systemsx.cisd.common.io.ConcatenatedFileInputStream; ...@@ -29,7 +29,7 @@ import ch.systemsx.cisd.common.io.ConcatenatedFileInputStream;
* *
* @author Chandrasekhar Ramakrishnan * @author Chandrasekhar Ramakrishnan
*/ */
public class NewDatasetDTO implements Serializable public class NewDataSetDssDTO implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -44,7 +44,7 @@ public class NewDatasetDTO implements Serializable ...@@ -44,7 +44,7 @@ public class NewDatasetDTO implements Serializable
* @param inputStream An input stream on the file or folder to register. If a folder is to be * @param inputStream An input stream on the file or folder to register. If a folder is to be
* registered, the input stream must be a {@link ConcatenatedFileInputStream}. * registered, the input stream must be a {@link ConcatenatedFileInputStream}.
*/ */
public NewDatasetDTO(String storageProcessName, InputStream inputStream) public NewDataSetDssDTO(String storageProcessName, InputStream inputStream)
{ {
this.storageProcessName = storageProcessName; this.storageProcessName = storageProcessName;
this.inputStream = inputStream; this.inputStream = inputStream;
......
/*
* 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.openbis.dss.client.api.cli;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import ch.systemsx.cisd.args4j.CmdLineException;
import ch.systemsx.cisd.args4j.CmdLineParser;
/**
* @author Chandrasekhar Ramakrishnan
*/
public class DataSetArgumentsTest extends AssertJUnit
{
private DataSetArguments arguments;
private CmdLineParser parser;
@BeforeMethod
public void setUp()
{
arguments = new DataSetArguments();
parser = new CmdLineParser(arguments);
}
@Test
public void testParseBasicArguments()
{
String[] args =
{ "-u", "foo", "-p", "bar", "-s", "http://localhost:8888/openbis",
"20100318094819344-4" };
try
{
parser.parseArgument(args);
assertEquals("foo", arguments.getUsername());
assertEquals("bar", arguments.getPassword());
assertEquals("http://localhost:8888/openbis", arguments.getServerBaseUrl());
assertEquals("20100318094819344-4", arguments.getDataSetCode());
assertTrue(arguments.isComplete());
assertFalse(arguments.isHelp());
} catch (CmdLineException c)
{
fail("Should have parsed arguments");
}
}
@Test
public void testParseIncompleteArguments()
{
String[] args =
{ "-u", "foo", "-p", "bar", "-s", "http://localhost:8888/openbis" };
try
{
parser.parseArgument(args);
assertFalse(arguments.isComplete());
} catch (CmdLineException c)
{
fail("Should have parsed arguments");
}
}
}
...@@ -22,7 +22,6 @@ import org.testng.annotations.Test; ...@@ -22,7 +22,6 @@ import org.testng.annotations.Test;
import ch.systemsx.cisd.args4j.CmdLineException; import ch.systemsx.cisd.args4j.CmdLineException;
import ch.systemsx.cisd.args4j.CmdLineParser; import ch.systemsx.cisd.args4j.CmdLineParser;
import ch.systemsx.cisd.openbis.dss.client.api.cli.GlobalArguments;
/** /**
* @author Chandrasekhar Ramakrishnan * @author Chandrasekhar Ramakrishnan
...@@ -41,42 +40,6 @@ public class GlobalArgumentsTest extends AssertJUnit ...@@ -41,42 +40,6 @@ public class GlobalArgumentsTest extends AssertJUnit
parser = new CmdLineParser(arguments); parser = new CmdLineParser(arguments);
} }
@Test
public void testParseBasicArguments()
{
String[] args =
{ "-u", "foo", "-p", "bar", "-s", "http://localhost:8888/openbis",
"20100318094819344-4" };
try
{
parser.parseArgument(args);
assertEquals("foo", arguments.getUsername());
assertEquals("bar", arguments.getPassword());
assertEquals("http://localhost:8888/openbis", arguments.getServerBaseUrl());
assertEquals("20100318094819344-4", arguments.getDataSetCode());
assertTrue(arguments.isComplete());
assertFalse(arguments.isHelp());
} catch (CmdLineException c)
{
fail("Should have parsed arguments");
}
}
@Test
public void testParseIncompleteArguments()
{
String[] args =
{ "-u", "foo", "-p", "bar", "-s", "http://localhost:8888/openbis" };
try
{
parser.parseArgument(args);
assertFalse(arguments.isComplete());
} catch (CmdLineException c)
{
fail("Should have parsed arguments");
}
}
@Test @Test
public void testHelp() public void testHelp()
{ {
......
...@@ -36,7 +36,7 @@ import ch.systemsx.cisd.common.api.RpcServiceInterfaceDTO; ...@@ -36,7 +36,7 @@ import ch.systemsx.cisd.common.api.RpcServiceInterfaceDTO;
import ch.systemsx.cisd.common.api.RpcServiceInterfaceVersionDTO; import ch.systemsx.cisd.common.api.RpcServiceInterfaceVersionDTO;
import ch.systemsx.cisd.openbis.dss.client.api.v1.IDataSetDss; import ch.systemsx.cisd.openbis.dss.client.api.v1.IDataSetDss;
import ch.systemsx.cisd.openbis.dss.client.api.v1.impl.DssComponent; import ch.systemsx.cisd.openbis.dss.client.api.v1.impl.DssComponent;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssBuilder; import ch.systemsx.cisd.openbis.dss.generic.server.api.v1.FileInfoDssBuilder;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO;
import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric;
import ch.systemsx.cisd.openbis.generic.shared.IETLLIMSService; import ch.systemsx.cisd.openbis.generic.shared.IETLLIMSService;
......
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