Examples of MockPageContext


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();
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
    columnConfiguration = new ColumnConfiguration();
  }
View Full Code Here

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();
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
    columnConfiguration = new ColumnConfiguration();
  }
View Full Code Here

Examples of org.springframework.mock.web.MockPageContext

  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

Examples of org.springframework.mock.web.MockPageContext

  @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

Examples of org.springframework.mock.web.MockPageContext

  @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

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

Examples of org.springframework.mock.web.MockPageContext

  @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

Examples of org.springframework.mock.web.MockPageContext

  @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

Examples of org.springframework.mock.web.MockPageContext

  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

Examples of org.springframework.mock.web.MockPageContext

  @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
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.