Пример #1
0
 Issue createIssueInJira(Issue issue) {
   ClientResponse postResponse = restAccess.post("/issue", issue);
   if (postResponse.getStatus() == Status.CREATED.getStatusCode()) {
     return postResponse.getEntity(Issue.class);
   } else {
     System.err.println("Problems while creating issue: " + postResponse.getEntity(String.class));
     return null;
   }
 }
 public String createVM(String service_id, ServiceComponent sc, int index)
     throws ServiceInstantiationException {
   WebResource r = client.resource(base_url + "/optimis_compute");
   try {
     ClientResponse res =
         r.type(MediaType.APPLICATION_JSON_TYPE)
             .post(ClientResponse.class, renderCompute(service_id, sc, index));
     if (res.getStatus() != Status.CREATED.getStatusCode()) {
       throw new ServiceInstantiationException(
           "There was a problem while processing the request: " + res.getStatus(),
           new Exception());
     }
     // return res.getHeaders().get(HttpHeaders.LOCATION).get(0);
     return res.getLocation().toString();
   } catch (JSONEncodingException e) {
     throw new ServiceInstantiationException(
         "There was a problem when transforming the service component to JSON format", e);
   }
 }