org.springframework.mock.web.MockPageContext Java Examples

The following examples show how to use org.springframework.mock.web.MockPageContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DumpTagTest.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
    this.output = new ByteArrayOutputStream();
    this.writer = new OutputStreamWriter(this.output, UTF8);

    this.context = new MockPageContext() {
        private final MockJspWriter jspWriter = new MockJspWriter(writer);
        @Override
        public JspWriter getOut() {
            return this.jspWriter;
        }
    };

    this.tag = new DumpTag();
    this.tag.setPageContext(this.context);
}
 
Example #2
Source File: PankuzuTagTest.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {

    MockServletContext sc = new MockServletContext();
    req = new MockHttpServletRequest(sc);
    res = new MockHttpServletResponse();
    context = new MockPageContext(sc, req, res);
}
 
Example #3
Source File: LoggerAwareTagSupportTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
private void setUp(final Object page) {
    this.context = new MockPageContext() {
        @Override
        public Object getPage() {
            return page == null ? this : page;
        }
    };
    this.tag = new LoggerAwareTagSupport() {
        private static final long serialVersionUID = 1L;
    };
    this.tag.setPageContext(this.context);
}
 
Example #4
Source File: LoggingMessageTagSupportTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
private void setUp(final Level level) {
    this.tag = new LoggingMessageTagSupport() {
        private static final long serialVersionUID = 1L;

        @Override
        protected Level getLevel() {
            return level;
        }
    };
    this.tag.setPageContext(new MockPageContext());
    this.tag.setLogger(this.logger);
}
 
Example #5
Source File: TagUtilsTest.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    MockServletContext sc = new MockServletContext();
    request = new MockHttpServletRequest(sc);
    response = new MockHttpServletResponse();
    page = new MockPageContext(sc, request, response);
}
 
Example #6
Source File: JseMessagesTagTest.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {

    MockServletContext sc = new MockServletContext();
    request = new MockHttpServletRequest(sc);
    response = new MockHttpServletResponse();
    page = new MockPageContext(sc, request, response);
    request.setAttribute(DispatcherServlet.OUTPUT_FLASH_MAP_ATTRIBUTE, new FlashMap());
}
 
Example #7
Source File: JseRsTagTest.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {

    MockServletContext sc = new MockServletContext();
    req = new MockHttpServletRequest(sc);
    res = new MockHttpServletResponse();
    res.setCharacterEncoding("UTF-8");
    context = new MockPageContext(sc, req, res);
}
 
Example #8
Source File: JseErrorsTagTest.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {

    MockServletContext sc = new MockServletContext();
    request = new MockHttpServletRequest(sc);
    response = new MockHttpServletResponse();
    page = new MockPageContext(sc, request, response);
    request.setAttribute(DispatcherServlet.OUTPUT_FLASH_MAP_ATTRIBUTE, new FlashMap());
}
 
Example #9
Source File: JseValidationsTagTest.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {

    MockServletContext sc = new MockServletContext();
    request = new MockHttpServletRequest(sc);
    response = new MockHttpServletResponse();
    page = new MockPageContext(sc, request, response);
    request.setAttribute(DispatcherServlet.OUTPUT_FLASH_MAP_ATTRIBUTE, new FlashMap());
}
 
Example #10
Source File: JseInformationsTagTest.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {

    MockServletContext sc = new MockServletContext();
    request = new MockHttpServletRequest(sc);
    response = new MockHttpServletResponse();
    page = new MockPageContext(sc, request, response);
    request.setAttribute(DispatcherServlet.OUTPUT_FLASH_MAP_ATTRIBUTE, new FlashMap());
}
 
Example #11
Source File: PageNavigationTagTest.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {

    MockServletContext sc = new MockServletContext();
    WebApplicationContext wac = new StaticWebApplicationContext();
    sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    req = new MockHttpServletRequest(sc);
    resp = new MockHttpServletResponse();
    context = new MockPageContext(sc, req, resp);
    rcon = new RequestContext(req, sc);
    context.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, rcon);
}
 
Example #12
Source File: ViewIdDefinitionTagTest.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {

    MockServletContext sc = new MockServletContext();
    req = new MockHttpServletRequest(sc);
    res = new MockHttpServletResponse();
    context = new MockPageContext(sc, req, res);
}
 
Example #13
Source File: ViewIdOutTagTest.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {

    MockServletContext sc = new MockServletContext();
    req = new MockHttpServletRequest(sc);
    res = new MockHttpServletResponse();
    context = new MockPageContext(sc, req, res);
}
 
Example #14
Source File: EncodingTagTest.java    From owasp-java-encoder with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    _servletContext = new MockServletContext();
    _request = new MockHttpServletRequest();
    _response = new MockHttpServletResponse();
    _pageContext = new MockPageContext(_servletContext, _request, _response);
}
 
Example #15
Source File: CatchingTagTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
    this.tag = new CatchingTag();
    this.tag.setPageContext(new MockPageContext());
    this.tag.setLogger(this.logger);
}
 
Example #16
Source File: EnterTagTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
    this.tag = new EntryTag();
    this.tag.setPageContext(new MockPageContext());
    this.tag.setLogger(this.logger);
}
 
Example #17
Source File: IfEnabledTagTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
    this.tag = new IfEnabledTag();
    this.tag.setPageContext(new MockPageContext());
    this.tag.setLogger(this.logger);
}
 
Example #18
Source File: ExitTagTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
    this.tag = new ExitTag();
    this.tag.setPageContext(new MockPageContext());
    this.tag.setLogger(this.logger);
}
 
Example #19
Source File: SetLoggerTagTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
    this.context = new MockPageContext();
    this.tag = new SetLoggerTag();
    this.tag.setPageContext(this.context);
}