@Path("stop/{id}")
  @POST
  @Produces(MediaType.APPLICATION_JSON)
  public Response stopApp(@PathParam("id") String id) {
    AppCatalogSolrClient sc = new AppCatalogSolrClient();
    AppEntry app = sc.findAppEntry(id);
    Service yarnApp = app.getYarnfile();
    yarnApp.setState(ServiceState.STOPPED);
    try {
      YarnServiceClient yc = new YarnServiceClient();
      yc.stopApp(yarnApp);
    } catch (JsonProcessingException e) {
      return Response.status(Status.BAD_REQUEST).build();
    }
    return Response.ok().build();
  }
@Test
  void testStopApp() throws Exception {
    String id = "application 1";
    AppDetailsController ac = Mockito.mock(AppDetailsController.class);

    Service yarnfile = new Service();
    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.stopApp(id)).thenReturn(Response.ok().build());
    final Response actual = ac.stopApp(id);
    assertEquals(expected.getStatus(), actual.getStatus());
  }