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

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


    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()));

    return p;
  }
View Full Code Here


    return mSchema;
  }

  private static final com.alu.e3.prov.restapi.model.ResourceItem fromDataModel(com.alu.e3.data.model.sub.ResourceItem item) {

    ResourceItem wsItem = new ResourceItem();
    wsItem.setName(item.getName());
    wsItem.setGrammar(item.getGrammar());
    wsItem.setIsMain(item.isIsMain());   

    return wsItem;
  }
View Full Code Here

  }

  public static final SSLCert fromDataModel(Certificate cert){
    if(cert == null) throw new IllegalArgumentException("cert must not be null");

    SSLCert sslCert = new SSLCert();
    sslCert.setDisplayName(cert.getCertDetail().getName());
    sslCert.setContent(cert.getData());
    sslCert.setId(cert.getId());
    sslCert.setKeyId(cert.getCertDetail().getKeyId());

    return sslCert;
  }
View Full Code Here

 
  protected final Action newCreateCertAction() {
    return new  Action("create") {
      protected Object doAction(Object... params) {
        String keyId = (String) params[0];
        SSLCert cert = (SSLCert) params[1];
       
        if (cert.getId() == null || cert.getId().isEmpty()) {
          cert.setId(UUID.randomUUID().toString());
        }

        if(cert.getDisplayName() == null || cert.getDisplayName().isEmpty()) {
          throw new IllegalArgumentException("Must include a display name when creating a cert");
        }
       
        if(LOG.isDebugEnabled())
          LOG.debug("Creating SSLCert ID:", cert.getId());
       
        cert.setKeyId(keyId);
       
        Certificate certificate = BeanConverterUtil.toDataModel(cert);
        dataManager.addCert(certificate);
     
        SSLCertResponse response = new SSLCertResponse(SSLCertResponse.SUCCESS);
       
        response.setId(cert.getId());
        return response;
      }
    };
  }
View Full Code Here

  }
 
  protected final Action newUpdateCertAction() {
    return new  Action("update") {
      protected Object doAction(Object... params) {
        SSLCert cert = (SSLCert) params[0];
        String keyId = (String) params[1];
        String certId = (String) params[2];
       
        if(LOG.isDebugEnabled())
          LOG.debug("Updating SSLCert ID: {}", keyId);
       
        if(cert.getId() == null || cert.getId().equals(""))
          cert.setId(certId);
        else if(cert.getId().equals(certId) == false)
          throw new InvalidParameterException("SSLCert ID mismatch");

        cert.setKeyId(keyId);
       
        Certificate certificate = BeanConverterUtil.toDataModel(cert);
        dataManager.updateCert(certificate);
       
        SSLCertResponse response = new SSLCertResponse(SSLCertResponse.SUCCESS);
        response.setId(cert.getId());
        return response;
      }
    };
  }
View Full Code Here

       
        if(LOG.isDebugEnabled())
          LOG.debug("Getting Cert ID: {}", id);
       
        Certificate c = dataManager.getCertById(id, true);
        SSLCert cert = BeanConverterUtil.fromDataModel(c);
       
        SSLCertResponse response = new SSLCertResponse(SSLCertResponse.SUCCESS);
        response.setCert(cert);
        return response;
      }
View Full Code Here

  protected final Action newCreateCAAction() {
    return new Action() {

      protected Object doAction(Object... params) {
        SSLCert cert = (SSLCert) params[0];

        if ((cert.getId() == null) || (cert.getId().equals("")))
        {
          // create the id
          cert.setId(UUID.randomUUID().toString());
        }
       
        if(LOG.isDebugEnabled()) {
          LOG.debug("Creating CA:", cert.getId());
        }
       
        com.alu.e3.data.model.Certificate certDataModel = BeanConverterUtil.toDataModel(cert);
        dataManager.addCA(certDataModel);
       
        SSLCertResponse response = new SSLCertResponse(SSLCertResponse.SUCCESS);
        response.setId(cert.getId());

        return response;
      }
    };
  }
View Full Code Here

          LOG.debug("Getting CA:", caId);
        }
       
        com.alu.e3.data.model.Certificate caDataModel = dataManager.getCAById(caId);
       
        SSLCert cert = BeanConverterUtil.fromDataModel(caDataModel);

        SSLCertResponse response = new SSLCertResponse(SSLCertResponse.SUCCESS);
        response.setCert(cert);
       
        return response;
View Full Code Here

  protected final Action newUpdateCAAction() {
    return new Action() {

      protected Object doAction(Object... params) {
        SSLCert cert = (SSLCert) params[0];
        String caId = (String) params[1];

        if(LOG.isDebugEnabled()) {
          LOG.debug("Updating CA:", caId);
        }

        if(cert.getId() == null || cert.getId().equals(""))
          cert.setId(caId);
        else if(cert.getId().equals(caId) == false)
          throw new InvalidParameterException("CA ID mismatch");

        com.alu.e3.data.model.Certificate certDataModel = BeanConverterUtil.toDataModel(cert);       
        dataManager.updateCA(certDataModel);
View Full Code Here

  public void tearDown() throws Exception {
  }
 
  private void baseTestCreateUpdateDeleteCA(String id) throws Exception {
    // CREATE
    SSLCert cert = new SSLCert();
   
    cert.setId(id);
    cert.setContent("iurezahfskdqhflk");

    BasicResponse response = given()
    .contentType("application/xml")
    .body(cert, ObjectMapper.JAXB)
    .expect()
    .statusCode(200)
    .rootPath("response")
    .body("status", equalTo("SUCCESS"))
    .log().ifError()
    .when()
    .post("/certs")
    .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
    cert.setContent(null);
    cert.setDisplayName("titi");
   
    response = given()
    .contentType("application/xml")
    .body(cert, ObjectMapper.JAXB)
    .expect()
View Full Code Here

TOP

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

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.