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

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


    context.setId("anid");
    context.setStatus(Status.ACTIVE);
   
    policy.getContexts().add(context);
   
    BasicResponse response = given()
    .contentType("application/xml")
    .body(policy, 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());
   
    if (id != null)
    {
      assertEquals(id, response.getId());
    }
    else
    {
      assertNotNull(response.getId());
      id = response.getId();
    }

    // UPDATE
    context = new Context();
   
    context.setId("anotherid");
    context.setStatus(Status.ACTIVE);
    policy.getContexts().add(context);
   
    response = given()
    .contentType("application/xml")
    .body(policy, ObjectMapper.JAXB)
    .expect()
    .statusCode(200)
    .rootPath("response")
    .body("status", equalTo("SUCCESS"))
    .log().ifError()
    .when()
    .put("/" + id)
    .andReturn()
    .as(BasicResponse.class, ObjectMapper.JAXB);

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

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

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


    return a;
  }

  private static final Data fromDataModelToData(Map<String, String> keys) {
    if (keys==null) throw new IllegalArgumentException("keys must not be null");
    Data d = new Data();
    for(Map.Entry<String, String> entry : keys.entrySet()) {
      Key k = new Key();
      k.setName  (entry.getKey());
      k.setValue  (entry.getValue());
      d.getKey().add(k);
    }
    return d;
  }
View Full Code Here

  }

  private static final DynamicTdr fromDataModel(TdrDynamicRule tdrDynamicRule) {
    if (tdrDynamicRule==null) throw new IllegalArgumentException("tdrDynamicRule must not be null");

    DynamicTdr s = new DynamicTdr();
    s.setHttpHeaderName      (tdrDynamicRule.getHttpHeaderName());
    s.setTdrPropName      (tdrDynamicRule.getTdrPropName());
    s.setExtractFrom      (tdrDynamicRule.getExtractFrom());

    TdrType tdrType = new TdrType();
    s.setTypes          (tdrType);
    tdrType.getType().addAll  (tdrDynamicRule.getTypes());

    return s;
  }
View Full Code Here

    return b;
  }

  private static IpWhiteList fromDataModelToIpWhiteListAuth(AuthDetail authDetail) {
    if (authDetail==null) throw new IllegalArgumentException("authDetail must not be null");
    IpWhiteList i = new IpWhiteList();
    i.getIp().addAll  (authDetail.getWhiteListedIps());
    return i;
  }
View Full Code Here

    return i;
  }

  private static IpWhiteList fromDataModelToIpWhiteListApi(Api apiDetail) {
    if (apiDetail==null) throw new IllegalArgumentException("apiDetail must not be null");
    IpWhiteList i = new IpWhiteList();
    i.getIp().addAll  (apiDetail.getWhiteListedIps());
    return i;
  }
View Full Code Here

    provisionData.setTdrOnLimitReached    (api.getTdrOnLimitReached());
    provisionData.setStatus          (fromDataModel(api.getApiDetail().getStatus()));
    provisionData.setHttps          (fromDataModel(api.getApiDetail().getHttps()));

    for(String keyname : api.getProperties().keySet()){
      Key k = new Key();
      k.setName(keyname);
      k.setValue(api.getProperties().get(keyname));
      provisionData.getProperties().add(k);
    }

    provisionData.setHeaderTransformations  (BeanConverterUtil.<com.alu.e3.prov.restapi.model.HeaderTransformation,HeaderTransformation>fromDataModels(api.getHeaderTransformations()));
View Full Code Here

    a.setType            (fromDataModel(auth.getAuthDetail().getType()));
    a.setTdr            (fromDataModel(auth.getTdrGenerationRule()));
    a.setHeaderTransformations  (BeanConverterUtil.<com.alu.e3.prov.restapi.model.HeaderTransformation,HeaderTransformation>fromDataModels(auth.getHeaderTransformations()));

    for(String keyname : auth.getProperties().keySet()){
      Key k = new Key();
      k.setName(keyname);
      k.setValue(auth.getProperties().get(keyname));
      a.getProperties().add(k);
    }

    switch(auth.getAuthDetail().getType()) {
    case AUTHKEY:
View Full Code Here

    p.setTdrOnLimitReached    (policy.getTdrOnLimitReached());
    p.setHeaderTransformations  (BeanConverterUtil.<com.alu.e3.prov.restapi.model.HeaderTransformation,HeaderTransformation>fromDataModels(policy.getHeaderTransformations()));


    for(String keyname : policy.getProperties().keySet()){
      Key k = new Key();
      k.setName(keyname);
      k.setValue(policy.getProperties().get(keyname));
      p.getProperties().add(k);
    }

    return p;
  }
View Full Code Here

  private static final Data fromDataModelToData(Map<String, String> keys) {
    if (keys==null) throw new IllegalArgumentException("keys must not be null");
    Data d = new Data();
    for(Map.Entry<String, String> entry : keys.entrySet()) {
      Key k = new Key();
      k.setName  (entry.getKey());
      k.setValue  (entry.getValue());
      d.getKey().add(k);
    }
    return d;
  }
View Full Code Here

    return b;
  }

  private static OAuth fromDataModelToOAuth(AuthDetail authDetail) {
    if (authDetail==null) throw new IllegalArgumentException("authDetail must not be null");
    OAuth b = new OAuth();
    b.setClientId(authDetail.getClientId());
    b.setClientSecret(authDetail.getClientSecret());
    return b;
  }
View Full Code Here

TOP

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

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.