@Path("upgrade/{id}")
  @PUT
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  public Response upgradeApp(@PathParam("id") String id, Service app) {
    try {
      AppCatalogSolrClient sc = new AppCatalogSolrClient();
      sc.upgradeApp(app);
      YarnServiceClient yc = new YarnServiceClient();
      yc.upgradeApp(app);
    } catch (IOException | SolrServerException e) {
      return Response.status(Status.BAD_REQUEST).entity(e.toString()).build();
    }
    String output = "{\"status\":\"Application upgrade requested.\",\"id\":\"" +
        app.getName() + "\"}";
    return Response.status(Status.ACCEPTED).entity(output).build();
  }
@Test
  void testUpgradeApp() throws Exception {
    String id = "application1";
    AppDetailsController ac = Mockito.mock(AppDetailsController.class);

    Service yarnfile = new Service();
    yarnfile.setVersion("1.0");
    Component comp = new Component();
    Container c = new Container();
    c.setId("container-1");
    List<Container> containers = new ArrayList<Container>();
    containers.add(c);
    comp.setContainers(containers);
    yarnfile.addComponent(comp);
    Response expected = Response.ok().build();
    when(ac.upgradeApp(id, yarnfile)).thenReturn(Response.ok().build());
    final Response actual = ac.upgradeApp(id, yarnfile);
    assertEquals(expected.getStatus(), actual.getStatus());
  }