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

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


        if(LOG.isDebugEnabled())
          LOG.debug("Getting Auth ID: {}", id);

        com.alu.e3.data.model.Auth authDataModel = dataManager.getAuthById(id, true);
        Auth auth = BeanConverterUtil.fromDataModel(authDataModel);

        AuthResponse response = new AuthResponse(AuthResponse.SUCCESS);
        response.setAuth(auth);
        return response;
View Full Code Here


  }
 
  @Test
  public void testCreateAuth() throws Exception {

    Auth data = newAuthProvision("usedId");
   
   
    BasicResponse response = given()
    .contentType("application/xml")
    .body(data, ObjectMapper.JAXB)
View Full Code Here

  }
 
  @Test
  public void testCreateAndDeleteAuth() throws Exception {
   
    Auth data = newAuthProvision("reusableId");   
   
    // Create step
    BasicResponse response = given()
    .contentType("application/xml")
    .body(data, ObjectMapper.JAXB)
    .expect()
    .statusCode(200)
    .rootPath("response")
    .body("status", equalTo("SUCCESS"))
    .body("apiID", notNullValue())
    .log().ifError()
    .when()
    .post("")
    .andReturn()
    .as(BasicResponse.class, ObjectMapper.JAXB);
   
   
    assertNotNull(response);
    assertEquals("SUCCESS", response.getStatus());
   
   
    // Delete step
    response = given()
    .contentType("application/xml")
    .expect()
    .statusCode(200)
    .rootPath("response")
    .body("status", equalTo("SUCCESS"))
    .log().ifError()
    .when()
    .delete("/" + data.getId())
    .andReturn()
    .as(BasicResponse.class, ObjectMapper.JAXB);

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

  }
 
  @Test
  public void testSecondCreateAndDeleteAuth() throws Exception {
   
    Auth data = newAuthProvision("reusableId");   
   
    // Create step
    BasicResponse response = given()
    .contentType("application/xml")
    .body(data, ObjectMapper.JAXB)
    .expect()
    .statusCode(200)
    .rootPath("response")
    .body("status", equalTo("SUCCESS"))
    .body("apiID", notNullValue())
    .log().ifError()
    .when()
    .post("")
    .andReturn()
    .as(BasicResponse.class, ObjectMapper.JAXB);
   
   
    assertNotNull(response);
    assertEquals("SUCCESS", response.getStatus());
   
   
    // Delete step
    response = given()
    .contentType("application/xml")
    .expect()
    .statusCode(200)
    .rootPath("response")
    .body("status", equalTo("SUCCESS"))
    .log().ifError()
    .when()
    .delete("/" + data.getId())
    .andReturn()
    .as(BasicResponse.class, ObjectMapper.JAXB);

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

 
  @Test
  public void testCreateAndUpdateAuth() throws Exception {
    String id = ""+(System.currentTimeMillis());

    Auth data = newAuthProvision(id);   

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

    assertNotNull(response);
    assertEquals("SUCCESS", response.getStatus());
   
       
    data.setStatus(Status.INACTIVE);
   
   
    response = given()
    .contentType("application/xml")
    .body(data, ObjectMapper.JAXB)
View Full Code Here

   
  }
 
  private Auth newAuthProvision(String authId) {

    Auth data = new Auth();
   
    data.setId(authId);
    data.setType(AuthType.BASIC);
    data.setStatus(Status.ACTIVE);
    data.setApiContext("apiCtx");
    data.setPolicyContext("policyCtx");
   
    data.setBasicAuth(new BasicAuth());
    data.getBasicAuth().setUsername("username0");
    data.getBasicAuth().setPassword(("password0" + authId).getBytes());
   
    //data.setIpWhiteListAuth(new IpWhiteListAuth());
    //data.getIpWhiteListAuth().getIp().add("192.168.84.67");
   
    //data.setAuthKeyAuth(new AuthKeyAuth());
View Full Code Here

    assertEquals("SUCCESS", response.getStatus());
  }

  public void createAuth(String id) throws Exception {

    Auth data = newAuthProvision(id);

    BasicResponse response = given()
    .contentType("application/xml")
    .body(data, ObjectMapper.JAXB)
    .expect()
View Full Code Here

  }

  private Auth newAuthProvision(String authId) {

    Auth data = new Auth();

    data.setId(authId);
    data.setType(AuthType.BASIC);
    data.setStatus(Status.ACTIVE);
    data.setApiContext("apiCtx");
    data.setPolicyContext("policyCtx");

    data.setBasicAuth(new BasicAuth());
    data.getBasicAuth().setUsername("username0");
    data.getBasicAuth().setPassword(("password0" + authId).getBytes());

    //data.setIpWhiteListAuth(new IpWhiteListAuth());
    //data.getIpWhiteListAuth().getIp().add("192.168.84.67");

    //data.setAuthKeyAuth(new AuthKeyAuth());
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

TOP

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

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.