Examples of TestConfig


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

   
    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

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

    }
   
    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

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

* @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

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

        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

Examples of test.util.TestConfig

   protected void setUp() throws Exception
   {
      File dir = TestConfig.getTestDir("users");
      dir.delete();
     
      config = new TestConfig("users","localhost","localhost",8080);
      config.startServer();
      adminUserLoc = new Reference(config.getServerLocation().toString()+"admin/users/");
      adminUserLoc = adminUserLoc.normalize();
   }
View Full Code Here

Examples of test.util.TestConfig

   public void testBasics()
      throws Exception
   {
      File dir = TestConfig.getTestDir("test.app.introspection.basics");
      dir.delete();
      TestConfig config = new TestConfig("test.app.introspection.basics","localhost","localhost",8080);
      // Make sure we start clean
      System.out.println("Using database directory: "+config.getDatabaseDirectory());
     
      config.startServer();
     
      Reference introLoc = new Reference(config.getServerLocation());
     
      IntrospectionClient client = new IntrospectionClient(LOG,introLoc);
      client.setIdentity("admin","admin");
     
      final Slot<Integer> workspaceCount = new Slot<Integer>(0);
      final Slot<Integer> collectionCount = new Slot<Integer>(0);
      client.introspect(new IntrospectionClient.ServiceListener() {
         public void onStartWorkspace(String title) {
            workspaceCount.set(workspaceCount.get().intValue()+1);
         }
         public void onCollection(EntryCollection collection) {
            collectionCount.set(collectionCount.get().intValue()+1);
         }
         public void onEndWorkspace() {
         }
      });
      assertTrue(workspaceCount.get().intValue()==1);
      assertTrue(collectionCount.get().intValue()==0);
     
      config.stopServer();
   }
View Full Code Here

Examples of test.util.TestConfig

      throws Exception
   {
      File dir = TestConfig.getTestDir("test.app.feed.basics");
      dir.delete();
     
      TestConfig config = new TestConfig("test.app.feed.basics","localhost","localhost",8080);
      // Make sure we start clean
      System.out.println("Using database directory: "+config.getDatabaseDirectory());
     
      config.startServer();
     
      Client client = new Client(new Context(),config.getServerLocation().getSchemeProtocol()) {
         public void handle(Request request,Response response) {
            request.setChallengeResponse(new ChallengeResponse(ChallengeScheme.HTTP_BASIC,"admin","admin"));
            super.handle(request,response);
         }
      };
     
      Reference rootFeed = new Reference(config.getServerLocation()+"R/");
     
      Response response;
      Form headers;
      String entryLocation;
      Reference entryRef;

      response = client.handle(makeHead(rootFeed));
      System.out.println("Status: "+response.getStatus());
      switch (response.getStatus().getCode()) {
         case 404:
         {
            System.out.println("Creating feed.");
            response = client.handle(makePost(rootFeed,new StringRepresentation("<feed xmlns='http://www.w3.org/2005/Atom'><title>Root</title></feed>",MediaType.APPLICATION_ATOM)));
            System.out.println("Status: "+response.getStatus());
            response.getEntity().release();
            assertTrue(response.getStatus().isSuccess());
            break;
         }
         default:
            assertTrue(response.getStatus().isSuccess());
      }
     
      response = client.handle(makePost(rootFeed,new StringRepresentation("<entry xmlns='http://www.w3.org/2005/Atom'><title>Entry 1</title></entry>",MediaType.APPLICATION_ATOM)));
      System.out.println("Status: "+response.getStatus());
      assertTrue(response.getStatus().isSuccess());
      headers = (Form)response.getAttributes().get("org.restlet.http.headers");
      entryLocation = headers.getValues("Location");
      System.out.println("Entry: "+entryLocation);
      //System.out.println("Entry: "+response.getEntity().getText());
      response.getEntity().release();
     
      entryRef = new Reference(entryLocation);
      response = client.handle(makeGet(entryRef));
      System.out.println("Status: "+response.getStatus());
      response.getEntity().release();
      assertTrue(response.getStatus().isSuccess());
     
      response = client.handle(makePost(rootFeed,new StringRepresentation("<entry xmlns='http://www.w3.org/2005/Atom'><title>Entry 2</title></entry>",MediaType.APPLICATION_ATOM)));
      System.out.println("Status: "+response.getStatus());
      response.getEntity().release();
      assertTrue(response.getStatus().isSuccess());
      entryLocation = headers.getValues("Location");
      System.out.println("Entry: "+entryLocation);
      response.getEntity().release();
     
      entryRef = new Reference(entryLocation);
      response = client.handle(makeGet(entryRef));
      System.out.println("Status: "+response.getStatus());
      assertTrue(response.getStatus().isSuccess());
      response.getEntity().release();
     
      response = client.handle(makePut(rootFeed,new StringRepresentation("<feed xmlns='http://www.w3.org/2005/Atom'><title>Root</title><category term='test'/><category term='bingo'/></feed>",MediaType.APPLICATION_ATOM)));
      System.out.println("Status: "+response.getStatus());
      assertTrue(response.getStatus().isSuccess());
      response.getEntity().release();
     
      config.stopServer();
   }
View Full Code Here

Examples of test.util.TestConfig

   }
  
   public void testStress()
      throws Exception
   {
      config = new TestConfig("test.app.stress","localhost","localhost",8080);
      File dir = TestConfig.getTestDir("test.app.stress");
      TestConfig.deltree(dir);

      Logger log = Logger.getLogger(EntryTest.class.getName());
      // Make sure we start clean
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.