コード例 #1
0
  /** Test get policies by policy key. */
  public void testGetPoliciesByPolicyKey() {
    PolicyKey key = new PolicyKey();
    key.setType("BLACKLIST");
    key.setName("Goofy");
    key.setId(new Long(9));
    QueryCondition condition = new QueryCondition();
    condition.addQuery(new QueryCondition.Query(QueryCondition.ActivePoliciesOnlyValue.FALSE));
    service.findPolicies(
        null,
        Collections.singletonList(key),
        null,
        null,
        null,
        null,
        null,
        condition,
        new AsyncCallback<GetPoliciesResponse>() {
          public void onFailure(Throwable arg0) {
            GWT.log("getPolicies failed " + arg0);
          }

          public void onSuccess(GetPoliciesResponse arg0) {

            GWT.log("getPolicies succeeded: " + arg0.getPolicies().size());
          }
        });
  }
コード例 #2
0
  /** Test enable policy. */
  public void testEnablePolicy() {
    PolicyKey key = new PolicyKey();
    key.setId(new Long(100));
    key.setName("FooPolicy");
    key.setType("BLACKLIST");

    service.enablePolicy(
        key,
        new AsyncCallback<EnablePolicyResponse>() {
          @Override
          public void onFailure(Throwable arg0) {
            GWT.log("enablePolicy failed " + arg0);
          }

          @Override
          public void onSuccess(EnablePolicyResponse arg0) {

            GWT.log("enablePolicy succeeded: ");
          }
        });
  }