示例#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");
  }
示例#2
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);
  }
示例#3
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");
  }
示例#4
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");
 }
  public void testAddOne() throws Exception {
    BaseSystemListAction action = createAction();
    ActionHelper ah = new ActionHelper();
    ah.setUpAction(action);
    ah.setupProcessPagination();

    User user = ah.getUser();
    user.addPermanentRole(RoleFactory.ORG_ADMIN);
    // Create a server that can be put in the set. Note that the
    // server is not set up entirely right for subclasses, which would
    // only display servers with certain attributes, e.g. a satellite.
    // But this test is only concerned with keeping a server in the set
    // w/o having it cleaned up by the set cleaner
    Server server =
        ServerFactoryTest.createTestServer(
            user, true, ServerConstants.getServerGroupTypeEnterpriseEntitled());
    UserManager.storeUser(user);
    String sid = server.getId().toString();
    ah.getRequest().setupAddParameter("items_on_page", (String[]) null);
    ah.getRequest().setupAddParameter("items_selected", new String[] {sid});
    ah.executeAction("updatelist");

    RhnSetActionTest.verifyRhnSetData(ah.getUser(), RhnSetDecl.SYSTEMS, 1);
  }
示例#6
0
 public static void verifyRhnSetData(User user, RhnSetDecl decl, int size)
     throws HibernateException, SQLException {
   verifyRhnSetData(user.getId(), decl.getLabel(), size);
 }