Package org.slim3.tester

Examples of org.slim3.tester.MockServletContext


     */
    @Test
    public void copyBRForEmptyString() throws Exception {
        SrcBR src = new SrcBR();
        src.aaa = "";
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest dest =
            new MockHttpServletRequest(servletContext);
        dest.setAttribute("aaa", "111");
        BeanUtil.copy(src, dest);
        assertThat((String) dest.getAttribute("aaa"), is(""));
View Full Code Here


     */
    @Test
    public void copyBRForExcludeEmptyString() throws Exception {
        SrcBR src = new SrcBR();
        src.aaa = "";
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest dest =
            new MockHttpServletRequest(servletContext);
        dest.setAttribute("aaa", "111");
        BeanUtil.copy(src, dest, new CopyOptions().excludeEmptyString());
        assertThat((String) dest.getAttribute("aaa"), is("111"));
View Full Code Here

     */
    @Test
    public void copyBRForConverter() throws Exception {
        SrcBR src = new SrcBR();
        src.aaa = "1,000";
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest dest =
            new MockHttpServletRequest(servletContext);
        BeanUtil.copy(src, dest, new CopyOptions().numberConverter(
            "#,##0",
            "aaa"));
View Full Code Here

    static class TestScenicController extends ScenicController {
        private ScenicPage page;
        TestScenicController(ScenicPage page) {
            this.page = page;
            this.basePath = "aaa";
            this.servletContext = new MockServletContext();
            this.request = new MockHttpServletRequest(servletContext);
            this.response = new MockHttpServletResponse();
            this.errors = new Errors();
        }
View Full Code Here

    @Before
    public void setUp() throws Exception {
        target = new ScenicPage() {
        };
        servletContext = new MockServletContext();
        request = new MockHttpServletRequest(servletContext);
        response = new MockHttpServletResponse();
        controller = new ScenicController() {
            {
                super.servletContext = ScenicPageTest.this.servletContext;
View Full Code Here

        request.setParameter("_method", "DELETE");
        assertThat(target.getMethodForREST(request), is("DELETE"));
    }

    private MockHttpServletRequest getRequest(String method) {
        MockServletContext ctx = new MockServletContext();
        MockHttpServletRequest request = new MockHttpServletRequest(ctx);
        request.setMethod(method);
        return request;
    }
View Full Code Here

    static {
        initialize();
    }

    private static void initialize() {
        Cleaner.add(new Cleanable() {
            public void clean() {
                modelMetaCache.clear();
                initialized = false;
            }
        });
View Full Code Here

    private TwitterService service = new TwitterService();
    private TweetMeta meta = TweetMeta.get();

    @Override
    public Navigation run() throws Exception {
        RequestMap requestMap = new RequestMap(request);
//        int index = Integer.parseInt(requestMap.get("index").toString());
//        String content = requestMap.get("content").toString();
//        List<Tweet> listTween = service.getTweetList();
//        int maxIndex = listTween.size();
//        if (index < maxIndex) {
//            service.updateTweet(listTween.get(index).getKey(), content);
//            listTween = service.getTweetList();
//            requestScope("tweetList", listTween);
//        }
        if (validate() && (!requestMap.get("content").toString().trim().equals(""))) {
            service.updateTweet(asKey(meta.key), asLong(meta.version), requestMap);
        } else {
            return forward ("edit.jsp");
        }
        return redirect(basePath);
View Full Code Here

    private TwitterService service = new TwitterService();
    private TweetMeta meta = TweetMeta.get();

    @Override
    public Navigation run() throws Exception {
        RequestMap requestMap = new RequestMap(request);
        if (validate() && (!requestMap.get("content").toString().trim().equals(""))) {
            service.tweet(requestMap);
        }
        return redirect(basePath);
    }
View Full Code Here

                encoding = "UTF-8";
            }
            try {
                return URLEncoder.encode(path, encoding);
            } catch (UnsupportedEncodingException e) {
                throw new WrapRuntimeException(e);
            }
        }
View Full Code Here

TOP

Related Classes of org.slim3.tester.MockServletContext

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.