Package org.vfny.geoserver.config.validation

Examples of org.vfny.geoserver.config.validation.TestConfig


*/
public class ValidationTest extends TestCase {

//  public static void main(String[] args) {
  public void test() {
    TestConfig testConfig = new TestConfig();
    PlugInConfig pluginConfig = new PlugInConfig();
    // the plugin to test the bean info for.
    //pluginConfig.setClassName(PolygonBoundaryCoveredByPolygonValidation.class.getName());
    pluginConfig.setClassName(GazetteerNameValidation.class.getName());
    testConfig.setPlugIn(pluginConfig);

    System.out.println(testConfig.toString());
    System.out.println("--------------------------------------");
    for (int i = 0; i < testConfig.getPropertyDescriptors().length; i++) {
     
      System.out.println(testConfig.getPropertyDescriptors()[i].getClass().getName());
      System.out.println(testConfig.getPropertyDescriptors()[i].getDisplayName());
      System.out.println(testConfig.getPropertyDescriptors()[i].getShortDescription());
     
      System.out.println(testConfig.getPropertyDescriptors()[i].attributeNames());
      System.out.println("--------------------------------------");
    }

    System.out.println("--------------------------------------");
    System.out.println("--------------------------------------");
    System.out.println("--------------------------------------");
   
   
    testConfig = new TestConfig();
    pluginConfig = new PlugInConfig();
    // the plugin to test the bean info for.
    //pluginConfig.setClassName(PolygonBoundaryCoveredByPolygonValidation.class.getName());
    pluginConfig.setClassName(GazetteerNameValidation.class.getName());
    testConfig.setPlugIn(pluginConfig);

    PropertyDescriptor [] pd = pluginConfig.getPropertyDescriptors();
   
    System.out.println(pluginConfig.toString());
    System.out.println("--------------------------------------");
View Full Code Here


*/
public class ValidationTest extends TestCase {

//  public static void main(String[] args) {
  public void test() {
    TestConfig testConfig = new TestConfig();
    PlugInConfig pluginConfig = new PlugInConfig();
    // the plugin to test the bean info for.
    //pluginConfig.setClassName(PolygonBoundaryCoveredByPolygonValidation.class.getName());
    pluginConfig.setClassName(GazetteerNameValidation.class.getName());
    testConfig.setPlugIn(pluginConfig);

    System.out.println(testConfig.toString());
    System.out.println("--------------------------------------");
    for (int i = 0; i < testConfig.getPropertyDescriptors().length; i++) {
     
      System.out.println(testConfig.getPropertyDescriptors()[i].getClass().getName());
      System.out.println(testConfig.getPropertyDescriptors()[i].getDisplayName());
      System.out.println(testConfig.getPropertyDescriptors()[i].getShortDescription());
     
      System.out.println(testConfig.getPropertyDescriptors()[i].attributeNames());
      System.out.println("--------------------------------------");
    }

    System.out.println("--------------------------------------");
    System.out.println("--------------------------------------");
    System.out.println("--------------------------------------");
   
   
    testConfig = new TestConfig();
    pluginConfig = new PlugInConfig();
    // the plugin to test the bean info for.
    //pluginConfig.setClassName(PolygonBoundaryCoveredByPolygonValidation.class.getName());
    pluginConfig.setClassName(GazetteerNameValidation.class.getName());
    testConfig.setPlugIn(pluginConfig);

    PropertyDescriptor [] pd = pluginConfig.getPropertyDescriptors();
   
    System.out.println(pluginConfig.toString());
    System.out.println("--------------------------------------");
View Full Code Here

        ServletContext context = this.getServlet().getServletContext();
        ValidationConfig validationConfig = (ValidationConfig) context.getAttribute(ValidationConfig.CONFIG_KEY);
        TestSuiteConfig suiteConfig = (TestSuiteConfig) request.getSession().getAttribute(TestSuiteConfig.CURRENTLY_SELECTED_KEY);
       
        if (edit.equals(buttonAction)) {
            TestConfig testConfig = (TestConfig) suiteConfig.getTests().get(selectedTest);
            request.getSession().setAttribute(TestConfig.CURRENTLY_SELECTED_KEY, testConfig);
           
            return mapping.findForward("validationTestEditor");           
        } else if (delete.equals(buttonAction)) {
           
View Full Code Here

        String newName = form.getNewName();
        String selectedPlugIn = form.getSelectedPlugIn();
       
        PlugInConfig plugIn = validationConfig.getPlugIn(selectedPlugIn);
       
        TestConfig testConfig = new TestConfig();
        testConfig.setName(newName);
        testConfig.setPlugIn(plugIn);
        testConfig.setArgs(new HashMap());
       
        TestSuiteConfig suiteConfig = (TestSuiteConfig) request.getSession().getAttribute(TestSuiteConfig.CURRENTLY_SELECTED_KEY);
        suiteConfig.addTest(testConfig);
        getApplicationState().notifyConfigChanged();
       
View Full Code Here

   
    public void reset(ActionMapping arg0, HttpServletRequest request) {
        super.reset(arg0, request);
        this.request = request;
       
        TestConfig testConfig = (TestConfig) request.getSession().getAttribute(TestConfig.CURRENTLY_SELECTED_KEY);
       
        name = testConfig.getName();
        description = testConfig.getDescription();
        plugInName = testConfig.getPlugIn().getName();
       
        attributeKeys = new ArrayList();
        attributeHelps = new ArrayList();
        attributeValues = new ArrayList();
        ArgumentConfig.loadPropertyLists(testConfig,request.getLocale(),attributeKeys,attributeHelps,attributeValues);
View Full Code Here

    }
   
    public ActionErrors validate(ActionMapping mapping,
            HttpServletRequest request) {
       
        final TestConfig victim = (TestConfig) request.getSession().getAttribute(TestConfig.CURRENTLY_SELECTED_KEY);
        // Only used to validate values!
       
        ActionErrors errors = new ActionErrors();
        for(int i=0; i<attributeKeys.size();i++){
            String key = (String) attributeKeys.get( i );
            String text = (String) attributeValues.get( i );
            PropertyDescriptor property = victim.getPropertyDescriptor(key);
           
            if( text == null || text.length() == 0){
                if( property.isPreferred() ){
                    errors.add( key, new ActionError( "validation.test.property.required", key ));
                }               
                else {
                    // assume null is ok
                }                               
            }
            else {
                try {
                    Object value = victim.createArg( key, text );
                    if( value == null && property.isPreferred() ){
                        errors.add( key, new ActionError( "validation.test.property.required", key ));                       
                    }                   
                }
                catch (Throwable t) {
View Full Code Here

* @version $Id: ValidationTest.java,v 1.1 2004/01/31 00:17:53 jive Exp $
*/
public class ValidationTest {

  public static void main(String[] args) {
    TestConfig testConfig = new TestConfig();
    PlugInConfig pluginConfig = new PlugInConfig();
    // the plugin to test the bean info for.
    //pluginConfig.setClassName(PolygonBoundaryCoveredByPolygonValidation.class.getName());
    pluginConfig.setClassName(GazetteerNameValidation.class.getName());
    testConfig.setPlugIn(pluginConfig);

    System.out.println(testConfig.toString());
    System.out.println("--------------------------------------");
    for (int i = 0; i < testConfig.getPropertyDescriptors().length; i++) {
     
      System.out.println(testConfig.getPropertyDescriptors()[i].getClass().getName());
      System.out.println(testConfig.getPropertyDescriptors()[i].getDisplayName());
      System.out.println(testConfig.getPropertyDescriptors()[i].getShortDescription());
     
      System.out.println(testConfig.getPropertyDescriptors()[i].attributeNames());
      System.out.println("--------------------------------------");
    }

    System.out.println("--------------------------------------");
    System.out.println("--------------------------------------");
    System.out.println("--------------------------------------");
   
   
    testConfig = new TestConfig();
    pluginConfig = new PlugInConfig();
    // the plugin to test the bean info for.
    //pluginConfig.setClassName(PolygonBoundaryCoveredByPolygonValidation.class.getName());
    pluginConfig.setClassName(GazetteerNameValidation.class.getName());
    testConfig.setPlugIn(pluginConfig);

    PropertyDescriptor [] pd = pluginConfig.getPropertyDescriptors();
   
    System.out.println(pluginConfig.toString());
    System.out.println("--------------------------------------");
View Full Code Here

        List attributeValues = form.getAttributeValues();
      
        ServletContext context = getServlet().getServletContext();
        ValidationConfig validationConfig = (ValidationConfig) context.getAttribute(ValidationConfig.CONFIG_KEY);
        TestSuiteConfig suiteConfig = (TestSuiteConfig) request.getSession().getAttribute(TestSuiteConfig.CURRENTLY_SELECTED_KEY);
        TestConfig testConfig = (TestConfig) request.getSession().getAttribute(TestConfig.CURRENTLY_SELECTED_KEY);
       
        //this allows renaming. If they change the test's name, we just remove it add a new one
        suiteConfig.removeTest(testConfig.getName());
       
        testConfig.setName(name);
        testConfig.setDescription(description);
       
        for (int i = 0; i < attributeKeys.size(); i++) {
            System.out.println((String) attributeKeys.get(i)+"="+ (String) attributeValues.get(i));
            System.out.println(testConfig.getArgs());
            String val = (String) attributeValues.get(i);
            if(val != null && val != "")
              testConfig.setArgStringValue((String) attributeKeys.get(i), val);
        }
      
        suiteConfig.addTest(testConfig);
        getApplicationState().notifyConfigChanged();
       
View Full Code Here

TOP

Related Classes of org.vfny.geoserver.config.validation.TestConfig

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.