Package org.apache.commons.chain.impl

Examples of org.apache.commons.chain.impl.ContextBase


            logger.setLevel(Level.WARN);

            String uri = command.getOptionValue("cli");
            Repository repository = JcrUtils.getRepository(uri);

            Context context = new ContextBase();
            CommandHelper.setRepository(context, repository, uri);
            try {
                Session session = repository.login();
                CommandHelper.setSession(context, session);
                CommandHelper.setCurrentNode(context, session.getRootNode());


    protected void tearDown() {
    }

    public void testSame() throws Exception {
        WrappingLookupCommand command = new WrappingLookupCommand();
        Context testContext = new ContextBase();

        Context wrapped = command.getContext(testContext);

        assertNotNull(wrapped);
        assertSame(testContext, wrapped);

    /**
     * Instantiate ActionContextBase, wrapping a default ContextBase
     * instance.
     */
    public ActionContextBase() {
        this(new ContextBase());
    }

    /**
     * Constructor
     */
    JcrClient() {
        super();
        ctx = new ContextBase();
        initOptions();
        initContext();
    }

   
   
    public void runChain( String chainName ) {
     
      // initialize context for the chain
      ctxBase = new ContextBase();
     
      try {
        createChain( chainName ).execute ( ctxBase );
      }
      catch ( Exception ex) {

     */
    public void setUp() {
        catalog = new CatalogBase();
        CatalogFactoryBase.getInstance().setCatalog(catalog);
        command = new LookupCommand();       
        context = new ContextBase();
    }

     */
    public void setUp() {
        catalog = new CatalogBase();
        CatalogFactoryBase.getInstance().setCatalog(catalog);
        command = new DispatchLookupCommand();       
        context = new ContextBase();
    }

    public void testMethodDispatch() throws Exception {
        TestCommand test = new TestCommand();

        test.setMethod("testMethod");
        Context context = new ContextBase();
        assertNull(context.get("foo"));
        boolean result = test.execute(context);
        assertTrue(result);
        assertNotNull(context.get("foo"));
        assertEquals("foo", context.get("foo"));


    }

    public void testMethodKeyDispatch() throws Exception {
        TestCommand test = new TestCommand();

        test.setMethodKey("foo");
        Context context = new ContextBase();
        context.put("foo", "testMethodKey");
        assertNull(context.get("bar"));
        boolean result = test.execute(context);
        assertFalse(result);
        assertNotNull(context.get("bar"));
        assertEquals("bar", context.get("bar"));


    }

    public void testAlternateContext() throws Exception {
        TestAlternateContextCommand test = new TestAlternateContextCommand();

        test.setMethod("foo");
        Context context = new ContextBase();
        assertNull(context.get("elephant"));
        boolean result = test.execute(context);
        assertTrue(result);
        assertNotNull(context.get("elephant"));
        assertEquals("elephant", context.get("elephant"));


    }

TOP

Related Classes of org.apache.commons.chain.impl.ContextBase

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.