public void test()
      throws ConfigurationException, IOException, NestedActionException, DocumentException,
          ClassNotFoundException, InstantiationException, IllegalAccessException,
          InvocationTargetException, NoSuchMethodException, BadXMLException {

    // execContext.put("data_source", DataStructureTest.getDatabase());
    // execContext.put("connection", DBServerTest.getConnection());
    execContext.put(ActionConst.WEB_REAL_PATH_BEAN_REF, "src/test/resources");
    Action action = new Action("/pages", "callback_phone.uhtml", "pager");
    String page = action.processPage(execContext);
    log.debug("page:" + page);
    assertTrue(page.indexOf("form action") > -1);
  }
예제 #2
0
  public void testPagerLoad()
      throws IOException, NestedActionException, DocumentException, ClassNotFoundException,
          InstantiationException, IllegalAccessException, InvocationTargetException,
          NoSuchMethodException, BadXMLException {

    execContext.put(ActionConst.PAGE_NAMESPACE_BEAN_REF, "pager");
    execContext.put(ActionConst.WEB_REAL_PATH_BEAN_REF, "/pages");
    Action action = new Action("/pages", "put.xhtml", "pager");
    String page = action.processPage(execContext);
    // log.debug("page:" + page);
    assertTrue(
        "Should have found [1st put content] on the page", page.indexOf("1st put content") > -1);
  }
예제 #3
0
  public void testEval()
      throws IOException, NestedActionException, ClassNotFoundException, InstantiationException,
          IllegalAccessException, InvocationTargetException, NoSuchMethodException,
          BadXMLException {

    String page =
        "<pager:eval key=\"eval-content\">1+1*100</pager:eval>"
            + "<pager:echo>eval-content:${eval-content}</pager:echo>";

    Action action = new Action("", "", ActionConst.DEFAULT_PAGER_NAMESPACE);
    String newPage = action.processPage(execContext, page);
    // log.debug("newPage:" + newPage);
    assertEquals("eval-content:101", newPage);
  }
예제 #4
0
  public void testPutInsert2()
      throws IOException, NestedActionException, ClassNotFoundException, InstantiationException,
          IllegalAccessException, InvocationTargetException, NoSuchMethodException,
          BadXMLException {

    execContext.put(ActionConst.WEB_REAL_PATH_BEAN_REF, "/pages");
    String page =
        "<pager:put key=\"put-content\"><pager:insert page=\"insert3.xhtml\"/></pager:put>"
            + "<pager:echo>put-content:[${put-content}]</pager:echo>";

    Action action = new Action("/pages", "", ActionConst.DEFAULT_PAGER_NAMESPACE);
    String newPage = action.processPage(execContext, page);
    String s = execContext.getString("put-content");
    assertEquals("content of insert3.html", s);
    assertEquals("put-content:[content of insert3.html]", newPage);
  }
예제 #5
0
  public void testPut2()
      throws IOException, NestedActionException, ClassNotFoundException, InstantiationException,
          IllegalAccessException, InvocationTargetException, NoSuchMethodException,
          BadXMLException {

    String page =
        "<pager:put key=\"put-content\">This is the 1st put content"
            + "[<pager:echo>inner echo content</pager:echo>]</pager:put>"
            + "<pager:echo>from execContext:${put-content}</pager:echo>";

    Action action = new Action("", "", ActionConst.DEFAULT_PAGER_NAMESPACE);
    String newPage = action.processPage(execContext, page);
    log.debug("newPage:" + newPage);
    assertEquals("from execContext:This is the 1st put content[inner echo content]", newPage);
    // assertTrue(newPage.startsWith("put-content:This is the 1st put content"));
  }
예제 #6
0
  public void testPutInsert()
      throws IOException, NestedActionException, ClassNotFoundException, InstantiationException,
          IllegalAccessException, InvocationTargetException, NoSuchMethodException,
          BadXMLException {
    URL url = ResourceUtils.class.getResource("/pages");
    Validate.notNull(url, "Resource [" + "/pages" + "] not found");

    // log.warn("url.path:" + url.getPath());
    // log.warn("url.file:" + url.getFile());
    execContext.put(ActionConst.WEB_REAL_PATH_BEAN_REF, "/pages");
    String page =
        "<pager:put key=\"put-content\"><pager:insert page=\"insert3.xhtml\"/></pager:put>"
            + "<pager:echo>put-content:${put-content}</pager:echo>";

    Action action = new Action("", "", ActionConst.DEFAULT_PAGER_NAMESPACE);
    String newPage = action.processPage(execContext, page);
    String s = execContext.getString("put-content");
    assertEquals("content of insert3.html", s);
    assertEquals("put-content:content of insert3.html", newPage);
  }