Package org.apache.tools.ant.types

Examples of org.apache.tools.ant.types.Parameter


            assertEquals("The value attribute is required, and must "
                    + "be positive", be2.getMessage());
        }

        s = (SizeSelector)getInstance();
        Parameter param = new Parameter();
        param.setName("garbage in");
        param.setValue("garbage out");
        Parameter[] params = {param};
        s.setParameters(params);
        try {
            s.isSelected(basedir,filenames[0],files[0]);
            fail("SizeSelector did not check for valid parameter element");
        } catch (BuildException be3) {
            assertEquals("Invalid parameter garbage in", be3.getMessage());
        }

        s = (SizeSelector)getInstance();
        param = new Parameter();
        param.setName("value");
        param.setValue("garbage out");
        params[0] = param;
        s.setParameters(params);
        try {
            s.isSelected(basedir,filenames[0],files[0]);
            fail("SizeSelector accepted bad value as parameter");
        } catch (BuildException be4) {
            assertEquals("Invalid size setting garbage out",
                    be4.getMessage());
        }

        s = (SizeSelector)getInstance();
        Parameter param1 = new Parameter();
        Parameter param2 = new Parameter();
        param1.setName("value");
        param1.setValue("5");
        param2.setName("units");
        param2.setValue("garbage out");
        params = new Parameter[2];
        params[0] = param1;
        params[1] = param2;
        try {
            s.setParameters(params);
View Full Code Here


            s.setUnits(tibi);
            results = selectionString(s);
            assertEquals("TFFFFFFFFFFT", results);

            s = (SizeSelector)getInstance();
            Parameter param1 = new Parameter();
            Parameter param2 = new Parameter();
            Parameter param3 = new Parameter();
            param1.setName("value");
            param1.setValue("20");
            param2.setName("units");
            param2.setValue("Ki");
            param3.setName("when");
            param3.setValue("more");
            Parameter[] params = {param1,param2,param3};
            s.setParameters(params);
            results = selectionString(s);
            assertEquals("TFFFFFFTFFTT", results);
        }
View Full Code Here

        } catch (BuildException be1) {
            assertEquals("The name attribute is required", be1.getMessage());
        }

        s = (FilenameSelector)getInstance();
        Parameter param = new Parameter();
        param.setName("garbage in");
        param.setValue("garbage out");
        Parameter[] params = {param};
        s.setParameters(params);
        try {
            s.isSelected(basedir,filenames[0],files[0]);
            fail("FilenameSelector did not check for valid parameter element");
View Full Code Here

            s.setCasesensitive(false);
            results = selectionString(s);
            assertEquals("FFFTFFFTTFFF", results);

            s = (FilenameSelector)getInstance();
            Parameter param1 = new Parameter();
            param1.setName("name");
            param1.setValue("**/*.bz2");
            Parameter[] params = {param1};
            s.setParameters(params);
            results = selectionString(s);
            assertEquals("FFTFFFFFFTTF", results);

View Full Code Here

                        + " Cannot be parsed correctly. It should be in"
                        + " MM/DD/YYYY HH:MM AM_PM format.", be3.getMessage());
        }

        s = (DateSelector)getInstance();
        Parameter param = new Parameter();
        param.setName("garbage in");
        param.setValue("garbage out");
        Parameter[] params = new Parameter[1];
        params[0] = param;
        s.setParameters(params);
        try {
            s.isSelected(basedir,filenames[0],files[0]);
            fail("DateSelector did not check for valid parameter element");
        } catch (BuildException be4) {
            assertEquals("Invalid parameter garbage in", be4.getMessage());
        }

        s = (DateSelector)getInstance();
        param = new Parameter();
        param.setName("millis");
        param.setValue("garbage out");
        params[0] = param;
        s.setParameters(params);
        try {
            s.isSelected(basedir,filenames[0],files[0]);
            fail("DateSelector did not check for valid millis parameter");
        } catch (BuildException be5) {
            assertEquals("Invalid millisecond setting garbage out",
                    be5.getMessage());
        }

        s = (DateSelector)getInstance();
        param = new Parameter();
        param.setName("granularity");
        param.setValue("garbage out");
        params[0] = param;
        s.setParameters(params);
        try {
            s.isSelected(basedir,filenames[0],files[0]);
            fail("DateSelector did not check for valid granularity parameter");
View Full Code Here

                s.setWhen(after);
                results = selectionString(s);
                assertEquals("TFFTFTTTFFFT", results);

                s = (DateSelector)getInstance();
                Parameter param1 = new Parameter();
                Parameter param2 = new Parameter();
                param1.setName("datetime");
                param1.setValue("11/21/2001 4:56 AM");
                param2.setName("when");
                param2.setValue("after");
                Parameter[] params = {param1,param2};
                s.setParameters(params);
                results = selectionString(s);
                assertEquals("TFFTFTTTFFFT", results);
            }
View Full Code Here

        } catch (BuildException be1) {
            assertEquals("The text attribute is required", be1.getMessage());
        }

        s = (ContainsSelector)getInstance();
        Parameter param = new Parameter();
        param.setName("garbage in");
        param.setValue("garbage out");
        Parameter[] params = {param};
        s.setParameters(params);
        try {
            s.isSelected(basedir,filenames[0],files[0]);
            fail("ContainsSelector did not check for valid parameter element");
View Full Code Here

            assertEquals("The maximum depth is lower than the minimum.",
                    be2.getMessage());
        }

        s = (DepthSelector)getInstance();
        Parameter param = new Parameter();
        param.setName("garbage in");
        param.setValue("garbage out");
        Parameter[] params = new Parameter[1];
        params[0] = param;
        s.setParameters(params);
        try {
            s.isSelected(basedir,filenames[0],files[0]);
            fail("DepthSelector did not check for valid parameter element");
        } catch (BuildException be3) {
            assertEquals("Invalid parameter garbage in", be3.getMessage());
        }

        s = (DepthSelector)getInstance();
        param = new Parameter();
        param.setName("min");
        param.setValue("garbage out");
        params[0] = param;
        s.setParameters(params);
        try {
            s.isSelected(basedir,filenames[0],files[0]);
            fail("DepthSelector accepted bad minimum as parameter");
        } catch (BuildException be4) {
            assertEquals("Invalid minimum value garbage out",
                    be4.getMessage());
        }

        s = (DepthSelector)getInstance();
        param = new Parameter();
        param.setName("max");
        param.setValue("garbage out");
        params[0] = param;
        s.setParameters(params);
        try {
            s.isSelected(basedir,filenames[0],files[0]);
            fail("DepthSelector accepted bad maximum as parameter");
View Full Code Here

    // get environment variables (<envVar name="ENV_VAR_NO1" value="value1"/>) specified for the pear component
    Properties props = null;
    if (this.params.size() > 0) {
      props = new Properties();
      for (int i = 0; i < this.params.size(); i++) {
        Parameter param = (Parameter) this.params.get(i);
        props.setProperty(param.getName(), param.getValue());
      }
    }

    //call pear packager with the ANT defined information
    try {
View Full Code Here

        //
        // -----  Set the main attributes, pattern '*'  -----
        //
        for (Iterator itConfig = configParameter.iterator(); itConfig.hasNext();) {
            Parameter par = (Parameter) itConfig.next();
            if (par.getName().indexOf(".") > 0) {
                // this is a *.* parameter for later use
                specialParameter.add(par);
            } else {
                useParameter(par);
            }
        }
        configParameter = new Vector();

        //
        // -----  Instantiate the interfaces  -----
        //
        String className = null;
        String pkg = "org.apache.tools.ant.types.selectors.cacheselector";

        // the algorithm
        if (algorithm == null) {
            if ("hashvalue".equals(algoName.getValue())) {
                className = pkg + ".HashvalueAlgorithm";
            } else if ("digest".equals(algoName.getValue())) {
                className = pkg + ".DigestAlgorithm";
            }
            if (className != null) {
                try {
                    // load the specified Algorithm, save the reference and configure it
                    algorithm = (Algorithm) Class.forName(className).newInstance();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }

        // the cache
        if (cache == null) {
            if ("propertyfile".equals(cacheName.getValue())) {
                className = pkg + ".PropertiesfileCache";
            }
            if (className != null) {
                try {
                    // load the specified Cache, save the reference and configure it
                    cache = (Cache) Class.forName(className).newInstance();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }

        // the comparator
        if (comparator == null) {
            if ("equal".equals(compName.getValue())) {
                className = pkg + ".EqualComparator";
            } else if ("role".equals(compName.getValue())) {
                className = "java.text.RuleBasedCollator";
            }
            if (className != null) {
                try {
                    // load the specified Cache, save the reference and configure it
                    comparator = (Comparator) Class.forName(className).newInstance();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }

        //
        // -----  Set the special attributes, pattern '*.*'  -----
        //
        for (Iterator itSpecial = specialParameter.iterator(); itSpecial.hasNext();) {
            Parameter par = (Parameter) itSpecial.next();
            useParameter(par);
        }
        specialParameter = new Vector();
    }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.types.Parameter

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.