Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockPageContext


  @Test
  public void should_return_the_capitalized_default_message_when_the_key_is_null() throws UnsupportedEncodingException, IOException{
    // Setup
    InputStream stream = getClass().getClassLoader().getResourceAsStream("com/github/dandelion/datatables/jsp/i18n/datatables_en.properties");
    ResourceBundle bundle = new PropertyResourceBundle(new InputStreamReader(stream, "UTF-8"));
    pageContext = new MockPageContext();
    pageContext.setAttribute(Config.FMT_LOCALIZATION_CONTEXT + ".page", new LocalizationContext(bundle, new Locale("en", "US")));
    JstlMessageResolver messageResolver = new JstlMessageResolver(request);
   
    // Test
    String message = messageResolver.getResource(null, "default", pageContext);
View Full Code Here


  @Test
  public void should_return_the_message_when_the_key_is_present_in_the_bundle() throws UnsupportedEncodingException, IOException{
    // Setup
    InputStream stream = getClass().getClassLoader().getResourceAsStream("com/github/dandelion/datatables/jsp/i18n/datatables_en.properties");
    ResourceBundle bundle = new PropertyResourceBundle(new InputStreamReader(stream, "UTF-8"));
    pageContext = new MockPageContext();
    pageContext.setAttribute(Config.FMT_LOCALIZATION_CONTEXT + ".page", new LocalizationContext(bundle, new Locale("en", "US")));
    JstlMessageResolver messageResolver = new JstlMessageResolver(request);

    // Test
    String message = messageResolver.getResource("global.msg.info", "default", pageContext);
View Full Code Here

  @Test
  public void should_return_the_capitalized_default_message_if_the_key_is_null() throws UnsupportedEncodingException, IOException{
    // Setup
    InputStream stream = getClass().getClassLoader().getResourceAsStream("com/github/dandelion/datatables/jsp/i18n/datatables_en.properties");
    ResourceBundle bundle = new PropertyResourceBundle(new InputStreamReader(stream, "UTF-8"));
    pageContext = new MockPageContext();
    pageContext.setAttribute(Config.FMT_LOCALIZATION_CONTEXT + ".page", new LocalizationContext(bundle, new Locale("en", "US")));
    JstlMessageResolver messageResolver = new JstlMessageResolver(request);

    // Test
    String message = messageResolver.getResource(null, "default", pageContext);
View Full Code Here

  public void setup() {
    // mock ServletContext
    MockServletContext mockServletContext = new MockServletContext();

    // mock PageContext
    mockPageContext = new MockPageContext(mockServletContext);
    mockPageContext.getRequest().setAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE, new Context(new MockFilterConfig()));
    buildTable();
   
    try {
      tableTagBuilder.getTableTag().doStartTag();
View Full Code Here

  @Before
  public void setupTest() throws JspException {
   
    MockServletContext mockServletContext = new MockServletContext();

    mockPageContext = new MockPageContext(mockServletContext);
    mockPageContext.getRequest().setAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE, new Context(new MockFilterConfig()));
   
    tableTagBuilder = new TableTagBuilder(Mock.persons, "myTableId").context(mockPageContext).defaultTable();
    tableTag = tableTagBuilder.getTableTag();
View Full Code Here

  private ExportConf fakeExportConf;
 
  @Before
  public void setup(){
    mockServletContext = new MockServletContext();
    mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    request.setAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE, new Context(new MockFilterConfig()));
    fakeExportConf = new ExportConf.Builder("csv")
      .header(true)
      .exportClass(new CsvExport())
View Full Code Here

  private MockHttpServletResponse response;

  @Before
  public void setup() {
    mockServletContext = new MockServletContext();
    mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    request.setAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE, new Context(new MockFilterConfig()));
  }
View Full Code Here

  private HttpServletResponse response;
 
  @Before
  public void createHtmlTable() {
    mockServletContext = new MockServletContext();
    mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    request.setAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE, new Context(new MockFilterConfig()));
    response = (HttpServletResponse) mockPageContext.getResponse();
    System.setProperty(DandelionConfig.DANDELION_MODE.getName(), DandelionMode.DEVELOPMENT.toString());
  }
View Full Code Here

  StandardConfigurationLoader loader;
 
  @Before
  public void setup() {
    MockServletContext mockServletContext = new MockServletContext();
    mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    loader = new StandardConfigurationLoader();
    loader.loadDefaultConfiguration();
   
    System.clearProperty(SystemConstants.DANDELION_DT_CONFIGURATION);
View Full Code Here

            @Override
            protected Level getLevel() {
                return level;
            }
        };
        this.tag.setPageContext(new MockPageContext());
        this.tag.setLogger(this.logger);
    }
View Full Code Here

TOP

Related Classes of org.springframework.mock.web.MockPageContext

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.