Package org.globus.workspace.client_core

Examples of org.globus.workspace.client_core.ParameterProblem


public class CloudManagerTest extends FileCleanupTestFixture {


    @Test
    public void testBadConfDir() throws Exception {
        ParameterProblem expected = null;

        CloudManager manager;
        try {
            manager = new CloudManager(
                this.getTempDir()+ File.separator+"notarealdir");
View Full Code Here


        Cloud cloud2 = manager.getCloudByName(cloudName2);
        assertNotNull(cloud2);
        assertEquals(cloudName2, cloud2.getName());

        ParameterProblem expected = null;
        try {
            manager.getCloudByName("notarealcloud");
        } catch (ParameterProblem e) {
            expected = e;
        }
View Full Code Here

        final CommandLine line;

        try {
            line = parser.parse(options, args);
        } catch (ParseException e) {
            throw new ParameterProblem("Problem parsing parameters", e);
        }

        // first, parse out actions

        if (line.hasOption(Opts.RUN_OPT_STRING)) {
            this.actions.add(Action.RUN);
        }
        if (line.hasOption(Opts.HELP_OPT_STRING)) {
            this.actions.add(Action.HELP);

            // don't bother further parsing if help is specified
            return;
        }

        // look for propfile option next and load it up
        if (line.hasOption(Opts.PROPFILE_OPT_STRING)) {
            this.propertiesPath =
                    line.getOptionValue(Opts.PROPFILE_OPT_STRING);
            try {
                this.intakePropertiesFile(this.propertiesPath);
            } catch (IOException e) {
                throw new ParameterProblem("Failed to load properties file '"+
                    this.propertiesPath+"'", e);
        }
        }

        // now everything else. Note that these params may override
View Full Code Here

    }

    private void intakePropertiesFile(String propPath) throws ParameterProblem, IOException {
        final File f = new File(propPath);
        if (!CloudClientUtil.fileExistsAndReadable(f)) {
            throw new ParameterProblem(
                    "Properties file specified but file does not exist or " +
                            "is not readable: '" + this.propertiesPath + "'");
        }

        this.print.dbg("Loading supplied properties file: '" +
View Full Code Here

        final String coresStr = props.getProperty(Props.KEY_CORES_REQ);
        if (coresStr != null) {
            this.cores = Integer.parseInt(coresStr);
            if (this.cores < 1) {
                throw new ParameterProblem("Invalid core # requested in the " +
                        "properties of cloud '"+this.name+"'");
            }
        }

        final String pollStr =
View Full Code Here

    private String getRequiredProp(Properties props, String name)
        throws ParameterProblem {
        String val = props.getProperty(name);
        if (val == null) {
            throw new ParameterProblem("Required parameter '"+name+
                "' is missing from the properties of cloud '"+this.name+"'");
        }
        return val;
    }
View Full Code Here

        }

        this.configDirectory = new File(configDirPath);

        if (!this.configDirectory.isDirectory()) {
            throw new ParameterProblem("specified cloud configuration "+
                "path must be a directory.");
        }

        this.clouds = new ArrayList<Cloud>();
View Full Code Here

        if (defaultProps == null) {
            try {
                loadDefaultProperties();
            } catch (IOException e) {
                throw new ParameterProblem("failed to load default properties", e);
            }
        }

        Cloud cloud;
        try {
            cloud = loadFromProps(name);
        } catch (IOException e) {
            throw new ParameterProblem("Error reading configuration file for "+
                "cloud '"+name+"'",e);
        }

        this.clouds.add(cloud);
        return cloud;
View Full Code Here

    private Cloud loadFromProps(String name) throws ParameterProblem, IOException {

        File f = new File(configDirectory, name+FILE_SUFFIX);

        if (!f.exists()) {
            throw new ParameterProblem("Could not find configuration for "+
                "cloud '"+name+"'. Path: "+f.getAbsolutePath());
        }

        Properties props = new Properties(defaultProps);
        InputStream is = null;
View Full Code Here

        PrintOpts prOpts = new PrintOpts(CloudClient.getOptInPrCodes());

        final Print print = new Print(prOpts, System.out, System.err, debug);
        CloudMetaClient client = new CloudMetaClient(print);

        ParameterProblem parameterProblem = null;
        ExitNow exitNow = null;
        Throwable anyError = null;
        try {
            mainImpl(client, argv);
        } catch (ParameterProblem e) {
View Full Code Here

TOP

Related Classes of org.globus.workspace.client_core.ParameterProblem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.