Package org.apache.shale.test.mock

Examples of org.apache.shale.test.mock.MockFacesContext


    String[] types         = {"number",   "percent""currency", "pattern"};
    String[] customMessage = {"number", "percent",    "currency", "pattern"};

    for (int i = 0; i < failingValues.length ; i++)
    {
      MockFacesContext context  = new MockFacesContext();
      Mock mock = buildMockUIComponent(3);
      UIComponent component = (UIComponent) mock.proxy();


      org.apache.myfaces.trinidad.convert.NumberConverter converter =
        new org.apache.myfaces.trinidad.convert.NumberConverter();

      UIViewRoot root = facesContext.getViewRoot();
      root.setLocale(Locale.US);
     

      for (int j = 0; j < 3; j++)
      {
        context.setViewRoot(root);
      }

      try
      {
         // Trinidad Converter is not lenient.
View Full Code Here


    protected FacesContext createFacesContext() {
        MockHttpSession tsession = new MockHttpSession();
        MockHttpServletRequest trequest = new MockHttpServletRequest(tsession);
        trequest.setAttribute(AjaxContext.AJAX_CONTEXT_KEY, new AjaxContextImpl());
        MockHttpServletResponse tresponse = new MockHttpServletResponse();
        MockFacesContext tfacesContext = (MockFacesContext)
        facesContextFactory.getFacesContext(servletContext,
                                            trequest,
                                            tresponse,
                                            lifecycle);
        tfacesContext.setApplication(application);
    tfacesContext.setViewRoot(application.getViewHandler().createView(facesContext, facesContext.getViewRoot().getViewId()));
        return tfacesContext;
    }
View Full Code Here

    ExternalContext externalContext = new MockExternalContext(
        servletContext, request, response);
    externalContext.getApplicationMap().put(
        WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
        applicationContext);
    FacesContext facesContext = new MockFacesContext(externalContext);
    MockFacesContext.setCurrentInstance(facesContext);
  }
View Full Code Here

    }
  }

  protected void doTestBlankValue(Converter converter)
  {
    MockFacesContext context = new MockFacesContext();
    Mock mock = mock(UIComponent.class);
    UIComponent component = (UIComponent) mock.proxy();
    Object value = converter.getAsObject(context, component,"");
    assertEquals(null, value);
  }
View Full Code Here

    String[] types         = {"number",   "percent""currency", "pattern"};
    String[] customMessage = {"number", "percent",    "currency", "pattern"};

    for (int i = 0; i < failingValues.length ; i++)
    {
      MockFacesContext context  = new MockFacesContext();
      Mock mock = buildMockUIComponent(3);
      UIComponent component = (UIComponent) mock.proxy();


      org.apache.myfaces.trinidad.convert.NumberConverter converter =
        new org.apache.myfaces.trinidad.convert.NumberConverter();

      UIViewRoot root = facesContext.getViewRoot();
      root.setLocale(Locale.US);
     

      for (int j = 0; j < 3; j++)
      {
        context.setViewRoot(root);
      }

      try
      {
         // Trinidad Converter is not lenient.
View Full Code Here

TOP

Related Classes of org.apache.shale.test.mock.MockFacesContext

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.