Ejemplo n.º 1
0
  public void testUnselectAll() throws Exception {
    ActionHelper sah = new ActionHelper();
    sah.setUpAction(action);
    sah.setupClampListBounds();
    ActionForward forward = sah.executeAction("unselectall");

    verifyRhnSetData(sah.getUser().getId(), action.getSetDecl().getLabel(), 0);
    verifyParam(forward.getPath(), "setupdated", "true");
  }
Ejemplo n.º 2
0
  public void testFilter() throws Exception {
    ActionHelper sah = new ActionHelper();
    sah.setUpAction(action);
    sah.getRequest().setupAddParameter(RequestContext.FILTER_STRING, "zzzz");
    sah.setupClampListBounds();

    ActionForward forward = sah.executeAction("filter");
    verifyParam(forward.getPath(), RequestContext.FILTER_STRING, "zzzz");
  }
Ejemplo n.º 3
0
  public void testUnspecified() throws Exception {
    ActionHelper sah = new ActionHelper();
    sah.setUpAction(action);
    sah.setupClampListBounds();
    sah.getRequest().setupAddParameter("items_selected", new String[] {"10", "20", "30"});
    sah.getRequest().setupAddParameter("newset", (String) null);
    sah.getRequest().setupAddParameter("items_on_page", (String) null);
    ActionForward forward = sah.executeAction("unspecified");

    verifyParam(forward.getPath(), "newset", "[10, 20, 30]");
  }
Ejemplo n.º 4
0
  public void testUpdateListPipe() throws Exception {
    ActionHelper sah = new ActionHelper();
    sah.setUpAction(action);
    sah.setupClampListBounds();
    sah.getRequest().setRequestURL("foo");
    sah.getRequest()
        .setupAddParameter("items_selected", new String[] {"777|999", "99|555", "666|77656"});
    sah.getRequest().setupAddParameter("newset", (String) null);
    sah.getRequest().setupAddParameter("items_on_page", (String) null);
    sah.executeAction("updatelist");

    // let's go find the data
    verifyRhnSetData(sah.getUser().getId(), action.getSetDecl().getLabel(), 3);
  }
Ejemplo n.º 5
0
 public void testSelectAllBadDataType() throws Exception {
   ActionHelper sah = new ActionHelper();
   TestActionWithData a = new TestActionWithData();
   sah.setUpAction(a);
   sah.setupClampListBounds();
   // We check to make sure we throw
   // exception if the list has invalid types in it.
   boolean failed = false;
   try {
     sah.executeAction("selectall");
   } catch (Exception iea) {
     failed = true;
   }
   assertTrue(failed);
 }
Ejemplo n.º 6
0
  public void testUpdateList() throws Exception {
    // TestAction action = new TestAction();
    ActionHelper sah = new ActionHelper();
    sah.setUpAction(action);
    sah.setupClampListBounds();
    sah.getRequest().setRequestURL("foo");
    sah.getRequest().setupAddParameter("items_selected", new String[] {"10", "20", "30"});
    sah.getRequest().setupAddParameter("newset", (String) null);
    sah.getRequest().setupAddParameter("items_on_page", (String) null);
    ActionForward forward = sah.executeAction("updatelist");

    // let's go find the data
    verifyRhnSetData(sah.getUser().getId(), action.getSetDecl().getLabel(), 3);
    verifyParam(forward.getPath(), "setupdated", "true");
  }
Ejemplo n.º 7
0
 public void testSelectAll() throws Exception {
   ActionHelper sah = new ActionHelper();
   TestActionWithData a =
       new TestActionWithData() {
         protected DataResult getDataResult(
             User user, ActionForm formIn, HttpServletRequest request) {
           List retval = new LinkedList();
           for (int i = 0; i < 10; i++) {
             retval.add(new TestIdObject(new Long(i)));
           }
           return new DataResult(retval);
         }
       };
   sah.setUpAction(a);
   sah.setupClampListBounds();
   ActionForward forward = sah.executeAction("selectall");
   verifyRhnSetData(sah.getUser().getId(), a.getSetDecl().getLabel(), 10);
   verifyParam(forward.getPath(), "setupdated", "true");
 }