Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockPageContext


  protected Map<ConfigToken<?>, Object> confToBeApplied;

  @Before
  public void setup() {
    MockServletContext mockServletContext = new MockServletContext();
    MockPageContext mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    request.setAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE, new Context(new MockFilterConfig()));
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
    columnConfiguration = new ColumnConfiguration();
  }
View Full Code Here


  protected Map<ConfigToken<?>, Object> confToBeApplied;

  @Before
  public void setup() {
    MockServletContext mockServletContext = new MockServletContext();
    MockPageContext mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
    columnConfiguration = new ColumnConfiguration();
  }
View Full Code Here

 
  @Before
  public void setup() {
    processor = getProcessor();
    MockServletContext mockServletContext = new MockServletContext();
    MockPageContext mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    request.setAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE, new Context(new MockFilterConfig()));
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
    tableConfiguration.setTableId("fakeId");
  }
View Full Code Here

  protected Map<ConfigToken<?>, Object> confToBeApplied;

  @Before
  public void setup() {
    MockServletContext mockServletContext = new MockServletContext();
    MockPageContext mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
    columnConfiguration = new ColumnConfiguration();
  }
View Full Code Here

 
  @Before
  public void setup() {
    processor = getProcessor();
    MockServletContext mockServletContext = new MockServletContext();
    MockPageContext mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
    tableConfiguration.setTableId("fakeId");
    columnConfiguration = new ColumnConfiguration();
  }
View Full Code Here

  protected Map<ConfigToken<?>, Object> confToBeApplied;

  @Before
  public void setup() {
    MockServletContext mockServletContext = new MockServletContext();
    MockPageContext mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
    columnConfiguration = new ColumnConfiguration();
  }
View Full Code Here

  protected Map<ConfigToken<?>, Object> confToBeApplied;

  @Before
  public void setup() {
    MockServletContext mockServletContext = new MockServletContext();
    MockPageContext mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
    columnConfiguration = new ColumnConfiguration();
  }
View Full Code Here

  private MockHttpServletRequest request;
 
  @Test
  public void should_return_error_message_when_the_bundle_doesnt_exist() throws UnsupportedEncodingException, IOException{
    // Setup
    pageContext = new MockPageContext();
    pageContext.setAttribute(Config.FMT_LOCALIZATION_CONTEXT + ".page", null);
    JstlMessageResolver messageResolver = new JstlMessageResolver(request);

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

  @Test
  public void should_return_error_message_when_the_key_is_undefined() 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("undefinedKey", "default", pageContext);
View Full Code Here

  @Test
  public void should_return_blank_when_the_key_is_defined_but_message_is_blank() 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.blank.value", "default", pageContext);
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.