Examples of MockContainer


Examples of org.apache.click.MockContainer

    /**
     * Test changes to the SessionMap.
     */
    public void testPuts() {
        MockContainer container = new MockContainer("web");
        container.start();
        HttpSession session = container.getRequest().getSession();
        SessionMap sm = new SessionMap(session);
      
        Assert.assertEquals(0, sm.size());
       
        sm.put("attrib1", "value1");
       
        Assert.assertEquals("value1", session.getAttribute("attrib1"));
       
        sm.put("attrib1", "value2");

        Assert.assertEquals("value2", session.getAttribute("attrib1"));

        Assert.assertEquals("value2", sm.remove("attrib1"));
       
        Assert.assertEquals(0, sm.size());
       
        sm.putAll(null);

        Assert.assertEquals(0, sm.size());

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("attrib2", "value2");
       
        sm.putAll(map);
        Assert.assertEquals(1, sm.size());

        sm.clear();
       
        Assert.assertEquals(0, sm.size());
       
        container.stop();
    }
View Full Code Here

Examples of org.apache.click.MockContainer

   
    /**
     * Test iteration over entrySet from velocity.
     */
    public void testPage() {
        MockContainer container = new MockContainer("web");
        container.start();
        HttpSession session = container.getRequest().getSession(true);
       
        session.setAttribute("attrib1", "value1");
       
        container.getRequest().setMethod("GET");

        container.testPage(SessionMapPage.class);
        Assert.assertTrue(container.getHtml().contains("attrib1=value1"));
       
        container.stop();
    }
View Full Code Here

Examples of org.apache.click.MockContainer

        pstr.println(" <control-set name='MyControlSet.xml'/>");
        pstr.println("</controls>");
        pstr.println("</click-app>");
        pstr.close();

        MockContainer container = new MockContainer(tmpdir.getAbsolutePath());
        container.start();

        container.stop();

        deleteDir(tmpdir);
    }
View Full Code Here

Examples of org.apache.click.MockContainer

        pstr.println("  <property name='type' value='app'/>");
        pstr.println(" </page-interceptor>");
        pstr.println("</click-app>");
        pstr.close();

        MockContainer container = new MockContainer(tmpdir.getAbsolutePath());
        container.start();

        ConfigService config = ClickUtils.getConfigService(container.getServletContext());

        List<PageInterceptor> list = config.getPageInterceptors();
        assertEquals(2, list.size());
        assertEquals("std", list.get(0).toString());
        assertEquals("app", list.get(1).toString());
        container.stop();

        deleteDir(tmpdir);
    }
View Full Code Here

Examples of org.apache.click.MockContainer

     * by multiple threads.
     */
    public void testClassAttributeRendering() {
        // PickList uses Velocity to render its template. In this test we start a
        // MockContainer which also configures Velocity
        MockContainer container = new MockContainer("web");
        container.start();

        // MockContext is created when a container tests a page. There
        // is no page to test so we manually create a MockContext
        // and reuse the Mock Servlet objects created in the container.
        MockContext.initContext(container.getServletConfig(),
            container.getRequest(), container.getResponse(), container.getClickServlet());

        PickList pickList = new PickList("pickList");

        pickList.addStyleClass("white");
        pickList.setAttribute("title", "test");

        String pickListStr = pickList.toString();

        // Perform checks within the first 100 characters
        pickListStr = pickListStr.substring(0, 100);

        // Check that class attribute was rendered
        assertEquals(1, StringUtils.countMatches(pickListStr, "class=\"white picklist\""));

        // Check that the title attribute was rendered
        assertEquals(1, StringUtils.countMatches(pickListStr, "title=\"test\""));

        // Check that class attribute was rendered once
        assertEquals(1, StringUtils.countMatches(pickListStr, "class="));
        container.stop();
    }
View Full Code Here

Examples of org.apache.click.MockContainer

public class TabbedFormTest extends TestCase {

    public void testGetHeadElements() {
        // TabbedForm uses Velocity to render its template. In this test we start a
        // MockContainer which also configures Velocity
        MockContainer container = new MockContainer("web");
        container.start();

        // MockContext is created when a container tests a page. There
        // is no page to test so we manually create a MockContext
        // and reuse the Mock Servlet objects created in the container.
        MockContext.initContext(container.getServletConfig(),
            container.getRequest(), container.getResponse(), container.getClickServlet());

        TabbedForm form = new TabbedForm("form");

        assertTrue(form.toString().indexOf("<form") > 0);
        assertTrue(form.getHeadElements().toString().indexOf("/control.js") > 0);
        assertTrue(form.getHeadElements().toString().indexOf("/control.css") > 0);
        assertTrue(form.getHeadElements().toString().indexOf("/extras-control.css") > 0);
       
        container.stop();
    }
View Full Code Here

Examples of org.jboss.ejb3.core.test.ejbthree1358.MockContainer

   private static MockContainer container;
  
   @BeforeClass
   public static void beforeClass() throws Exception
   {
      container = new MockContainer();
   }
View Full Code Here

Examples of org.jboss.ejb3.test.threadlocal.MockContainer

   }
  
   public void test1()
   {
      ThreadlocalPool pool = new ThreadlocalPool();
      Container container = new MockContainer();
      int maxSize = -1;
      int timeout = -1;
      pool.initialize(container, maxSize, timeout);
      BeanContext ctx = pool.get();
      pool.release(ctx);
View Full Code Here

Examples of org.jboss.ejb3.test.threadlocal.MockContainer

   }

   public void testInUse1()
   {
      ThreadlocalPool pool = new ThreadlocalPool();
      Container container = new MockContainer();
      int maxSize = -1;
      int timeout = -1;
      pool.initialize(container, maxSize, timeout);

      assertEquals(0, pool.getAvailableCount());
View Full Code Here

Examples of org.jboss.ejb3.test.threadlocal.MockContainer

   }

   public void testWithThreads() throws Exception
   {
      final ThreadlocalPool pool = new ThreadlocalPool();
      Container container = new MockContainer();
      int maxSize = -1;
      int timeout = -1;
      pool.initialize(container, maxSize, timeout);
     
      Runnable r = new Runnable()
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.