コード例 #1
0
  /** {@inheritDoc} */
  @Override
  public ActionForward handleDispatch(
      ListSessionSetHelper helper,
      ActionMapping mapping,
      ActionForm formIn,
      HttpServletRequest request,
      HttpServletResponse response) {
    RequestContext context = new RequestContext(request);
    ActivationKey key = context.lookupAndBindActivationKey();
    ConfigChannelListProcessor proc = new ConfigChannelListProcessor();
    Set<String> set = helper.getSet();

    for (String id : set) {
      Long ccid = Long.valueOf(id);
      ConfigChannel cc = ConfigurationFactory.lookupConfigChannelById(ccid);
      proc.remove(key.getConfigChannelsFor(context.getCurrentUser()), cc);
    }
    getStrutsDelegate()
        .saveMessage(
            "config_channels_to_unsubscribe.unsubscribe.success",
            new String[] {String.valueOf(set.size())},
            request);

    Map<String, Object> params = new HashMap<String, Object>();
    params.put(RequestContext.TOKEN_ID, key.getToken().getId().toString());
    StrutsDelegate strutsDelegate = getStrutsDelegate();
    return strutsDelegate.forwardParams(mapping.findForward("success"), params);
  }
コード例 #2
0
  public void testDeployConfig() throws Exception {
    UserTestUtils.addUserRole(user, RoleFactory.ACTIVATION_KEY_ADMIN);

    // need a tools channel for config deploy
    Channel base = ChannelTestUtils.createBaseChannel(user);
    ChannelTestUtils.setupBaseChannelForVirtualization(user, base);

    ActivationKey key = createActivationKey();
    // Create a config channel
    ConfigChannel cc = ConfigTestUtils.createConfigChannel(user.getOrg());
    ConfigChannelListProcessor proc = new ConfigChannelListProcessor();
    proc.add(key.getConfigChannelsFor(user), cc);
    key.setDeployConfigs(true);
    ActivationKeyFactory.save(key);
    assertTrue(key.getDeployConfigs());
    assertFalse(key.getChannels().isEmpty());
    assertFalse(key.getPackages().isEmpty());
  }