Package test.app

Source Code of test.app.IntrospectionTest

/*
* FeedTest.java
* JUnit based test
*
* Created on April 16, 2007, 9:56 AM
*/

package test.app;

import java.io.File;
import java.util.logging.Logger;
import junit.framework.*;
import org.atomojo.app.client.EntryCollection;
import org.atomojo.app.client.IntrospectionClient;
import org.restlet.data.Reference;
import test.util.Slot;
import test.util.TestConfig;

/**
*
* @author alex
*/
public class IntrospectionTest extends TestCase
{
  
   static Logger LOG = Logger.getLogger(IntrospectionTest.class.getName());
  
   TestConfig config;
  
   public IntrospectionTest(String testName)
   {
      super(testName);
   }

   protected void setUp() throws Exception
   {
   }

   protected void tearDown() throws Exception
   {
   }
  
   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();
   }

}
TOP

Related Classes of test.app.IntrospectionTest

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.