Package com.alu.e3.prov.restapi.model

Examples of com.alu.e3.prov.restapi.model.BulkPolicyQuotaRLBucketType


    Action action = new Action() {

      protected Object doAction(Object... params) {
        try {
          List<String> apiIdsList = apiService.getAll();
          return new ApiResponse(ApiResponse.SUCCESS, apiIdsList);

        } catch (ProvisionException e) {
          throw new WebApplicationException(e);
        }
      }
View Full Code Here


    return new Action() {

      @Override
      protected Object doAction(Object... params) {
        String policyId = (String) params[0];
        AuthIdsNoIdType authIds = (AuthIdsNoIdType) params[1];

        if(authIds.getId() == null || authIds.getId().equals("")) {
          // create the id
          authIds.setId(UUID.randomUUID().toString());
        }

        if(LOG.isDebugEnabled()) {
          LOG.debug("Create bucket:", authIds.getId());
        }

        com.alu.e3.data.model.sub.QuotaRLBucket authIdsDataModel = BeanConverterUtil.toDataModel(authIds);
        dataManager.createBucket(policyId, authIdsDataModel);

        PolicyResponse response = new PolicyResponse(PolicyResponse.SUCCESS);
        response.setId(authIds.getId());

        return response;
      }
    };
  }
View Full Code Here

      @Override
      protected Object doAction(Object... params) {
        String policyId = (String) params[0];
        String bucketId = (String) params[1];
        AuthIdsNoIdType authIds = (AuthIdsNoIdType) params[2];

        if(LOG.isDebugEnabled()) {
          LOG.debug("Add auths to policy:" + policyId + " on bucket:", bucketId);
        }
View Full Code Here

      @Override
      protected Object doAction(Object... params) {
        String policyId = (String) params[0];
        String bucketId = (String) params[1];
        AuthIdsNoIdType authIds = (AuthIdsNoIdType) params[2];

        if(LOG.isDebugEnabled()) {
          LOG.debug("Remove auths fromo policy:" + policyId + " on bucket:", bucketId);
        }

        for (String authId : authIds.getAuthIds())
        {
          dataManager.removeAuthFromBucket(policyId, bucketId, authId);
        }

        return new PolicyResponse(PolicyResponse.SUCCESS);
View Full Code Here

    return s;
  }

  private static final AuthKeyAuth fromDataModelToAuthKeyAuth(AuthDetail authDetail) {
    if (authDetail==null) throw new IllegalArgumentException("authDetail must not be null");
    AuthKeyAuth a = new AuthKeyAuth();
    a.setKeyValue  (authDetail.getAuthKeyValue());
    return a;
  }
View Full Code Here

    return th;
  }

  private static final Authentication fromDataModel(SBAuthentication authentication) {
    if (authentication==null) return null; // throw new IllegalArgumentException("authentication must not be null");
    Authentication a = new Authentication();
    a.setType  (authentication.getType());
    a.setData  (fromDataModelToData(authentication.getKeys()));
    return a;
  }
View Full Code Here

  }

  private static final ProvisionAuthentication fromDataModelToProvisionAuthentication(ApiDetail apiDetail) {
    if (apiDetail==null) throw new IllegalArgumentException("apiDetail must not be null");

    Authkey ak = new Authkey();
    ak.setKeyName    (apiDetail.getAuthKeyName());
    ak.setHeaderName  (apiDetail.getAuthHeaderName());

    ProvisionAuthentication p = new ProvisionAuthentication();
    p.setAuthKey    (ak);
    p.getAuths().addAll  (BeanConverterUtil.<AuthType, NBAuthType>fromDataModels(apiDetail.getEnabledAuthType()));
View Full Code Here

    return a;
  }

  private static BasicAuth fromDataModelToBasicAuth(AuthDetail authDetail) {
    if (authDetail==null) throw new IllegalArgumentException("authDetail must not be null");
    BasicAuth b = new BasicAuth();
    b.setUsername  (authDetail.getUsername());
    b.setPassword  (authDetail.getPassword());
    return b;
  }
View Full Code Here

  @Test
  public void testCreateDeleteBulkBucket() throws Exception {
    String bucketId = "bucket_1";

    BulkPolicyQuotaRLBucketType bulk = newBulkProvision(bucketId);

    BasicResponse response = given().contentType("application/xml").body(bulk, ObjectMapper.JAXB).expect().statusCode(200).rootPath("response").body("status", equalTo("SUCCESS")).log().ifError()
        .when().post(baseBulkPath).andReturn().as(BasicResponse.class, ObjectMapper.JAXB);

    assertNotNull(response);
    assertEquals("SUCCESS", response.getStatus());
   
   
    bulk.getQuotaRLBucket().getAuthIds().add("a_3");
    bulk.getQuotaRLBucket().getAuthIds().add("a_4");
   
    // append
   
    response = given().contentType("application/xml").body(bulk, ObjectMapper.JAXB).expect().statusCode(500).rootPath("response").body("status", equalTo("FAILURE")).log().ifError()
    .when().put(baseBulkPath  + "/" + "wrongBucketID").andReturn().as(BasicResponse.class, ObjectMapper.JAXB);
   
    response = given().contentType("application/xml").body(bulk, ObjectMapper.JAXB).expect().statusCode(200).rootPath("response").body("status", equalTo("SUCCESS")).log().ifError()
    .when().put(baseBulkPath  + "/" + bulk.getQuotaRLBucket().getId()).andReturn().as(BasicResponse.class, ObjectMapper.JAXB);

    assertNotNull(response);
    assertEquals("SUCCESS", response.getStatus());
   
    // Delete step
    response = given().contentType("application/xml").body(bulk).expect().statusCode(200).rootPath("response").body("status", equalTo("SUCCESS")).log().ifError().when()
        .put(baseBulkPath + "/" + bulk.getQuotaRLBucket().getId() +"/deleteBucket").andReturn().as(BasicResponse.class, ObjectMapper.JAXB);

    assertNotNull(response);
    assertEquals("SUCCESS", response.getStatus());
  }
View Full Code Here

    return data;
  }

  private BulkPolicyQuotaRLBucketType newBulkProvision(String bucketId) {

    BulkPolicyQuotaRLBucketType bulk = new BulkPolicyQuotaRLBucketType();
    PolicyIdsType policies = new PolicyIdsType();

    bulk.setPolicies(policies);

    policies.getId().add("p_1");
    policies.getId().add("p_2");
    policies.getId().add("p_3");

    AuthIdsNoIdType authBucket = new AuthIdsNoIdType();
    bulk.setQuotaRLBucket(authBucket);

    authBucket.getAuthIds().add("a_1");
    authBucket.getAuthIds().add("a_2");
    //authBucket.getAuthIds().add("a_3");
    //authBucket.getAuthIds().add("a_4");
View Full Code Here

TOP

Related Classes of com.alu.e3.prov.restapi.model.BulkPolicyQuotaRLBucketType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.