Package org.apache.ambari.view.pig.resources.files

Examples of org.apache.ambari.view.pig.resources.files.FileResource


      FilePaginator paginator = new FilePaginator(filePath, context);

      if (page == null)
        page = 0L;

      FileResource file = new FileResource();
      file.setFilePath(filePath);
      file.setFileContent(paginator.readPage(page));
      file.setHasNext(paginator.pageCount() > page + 1);
      file.setPage(page);
      file.setPageCount(paginator.pageCount());

      JSONObject object = new JSONObject();
      object.put("file", file);
      return Response.ok(object).status(200).build();
    } catch (WebApplicationException ex) {
View Full Code Here


    return doCreateFile(name, content, "/tmp/");
  }

  private Response doCreateFile(String name, String content, String filePath) throws IOException, InterruptedException {
    FileService.FileResourceRequest request = new FileService.FileResourceRequest();
    request.file = new FileResource();
    request.file.setFilePath(filePath + name);
    request.file.setFileContent(content);

    HttpServletResponse resp_obj = createNiceMock(HttpServletResponse.class);
    resp_obj.setHeader(eq("Location"), anyString());
View Full Code Here

    String name = UUID.randomUUID().toString().replaceAll("-", "");
    String filePath = "/tmp/" + name;

    Response createdFile = doCreateFile(name, "some content");
    FileService.FileResourceRequest request = new FileService.FileResourceRequest();
    request.file = new FileResource();
    request.file.setFilePath(filePath);
    request.file.setFileContent("1234567890")// 10 bytes, 3*(4b page)

    Response response = fileService.updateFile(request, filePath);
    Assert.assertEquals(204, response.getStatus());
View Full Code Here

    return doCreateFile(name, content, "/tmp/");
  }

  private Response doCreateFile(String name, String content, String filePath) throws IOException, InterruptedException {
    FileService.FileResourceRequest request = new FileService.FileResourceRequest();
    request.file = new FileResource();
    request.file.setFilePath(filePath + name);
    request.file.setFileContent(content);

    HttpServletResponse resp_obj = createNiceMock(HttpServletResponse.class);
    resp_obj.setHeader(eq("Location"), anyString());
View Full Code Here

    String name = UUID.randomUUID().toString().replaceAll("-", "");
    String filePath = "/tmp/" + name;

    Response createdFile = doCreateFile(name, "some content");
    FileService.FileResourceRequest request = new FileService.FileResourceRequest();
    request.file = new FileResource();
    request.file.setFilePath(filePath);
    request.file.setFileContent("1234567890")// 10 bytes, 3*(4b page)

    Response response = fileService.updateFile(request, filePath);
    Assert.assertEquals(204, response.getStatus());
View Full Code Here

      FilePaginator paginator = new FilePaginator(filePath, context);

      if (page == null)
        page = 0L;

      FileResource file = new FileResource();
      file.setFilePath(filePath);
      file.setFileContent(paginator.readPage(page));
      file.setHasNext(paginator.pageCount() > page + 1);
      file.setPage(page);
      file.setPageCount(paginator.pageCount());

      JSONObject object = new JSONObject();
      object.put("file", file);
      return Response.ok(object).status(200).build();
    } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.apache.ambari.view.pig.resources.files.FileResource

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.