Esempio n. 1
0
  public void XtestDownloadFileRestlet() throws Exception {
    NuxeoServer nxServer = new NuxeoServer("http://127.0.0.1:8080/nuxeo");

    nxServer.setAuthType(NuxeoServer.AUTH_TYPE_BASIC);
    nxServer.setBasicAuthentication("Administrator", "Administrator");

    List<String> pathParams =
        Arrays.asList("default", "9473fa94-4b34-43e3-ab3b-1a2c005d3c0e", "downloadFile");

    Representation res = nxServer.doRestletGetCall(pathParams, null);
    InputStream inputStream = res.getStream();

    assertEquals(res.getSize(), 123);
  }
Esempio n. 2
0
  @Test
  public void testSimpleBA() throws IOException {
    NuxeoServer nxServer = new NuxeoServer("http://127.0.0.1:8080/nuxeo");

    nxServer.setAuthType(NuxeoServer.AUTH_TYPE_BASIC);
    nxServer.setBasicAuthentication("Administrator", "Administrator");

    List<String> pathParams = Arrays.asList("vocabulary", "country");

    Representation res = nxServer.doRestletGetCall(pathParams, null);

    System.out.println(res.getText());
    assertEquals(res.getMediaType().getName(), MediaType.TEXT_XML.getName());
  }
Esempio n. 3
0
  @Test
  public void testDownloadFileCall() throws Exception {
    NuxeoServer nxServer = new NuxeoServer("http://127.0.0.1:8080/nuxeo");
    nxServer.setRestPrefix("nxfile");

    nxServer.setAuthType(NuxeoServer.AUTH_TYPE_BASIC);
    nxServer.setBasicAuthentication("Administrator", "Administrator");

    List<String> pathParams =
        Arrays.asList(
            "default", "94830dca-22f3-4a22-9c61-fdf13eefc01c", "file:content", "singles_large.jpg");

    Representation res = nxServer.doRestletGetCall(pathParams, null);

    assertEquals(res.getSize(), 27189794);
  }
Esempio n. 4
0
  public void XtestSimpleSecretWithParams() throws IOException {
    NuxeoServer nxServer = new NuxeoServer("http://127.0.0.1:8080/nuxeo");

    nxServer.setAuthType(NuxeoServer.AUTH_TYPE_SECRET);
    nxServer.setSharedSecretAuthentication("Administrator", "nuxeo5secretkey");

    List<String> pathParams = Arrays.asList("execQueryModel", "USER_DOCUMENTS");

    Map<String, String> queryParams = new HashMap<String, String>();

    queryParams.put("QP1", "$USER");
    queryParams.put("format", "JSON");
    Representation res = nxServer.doRestletGetCall(pathParams, queryParams);
    System.out.println(res.getText());
    assertEquals(res.getMediaType().getName(), MediaType.TEXT_PLAIN.getName());

    queryParams.put("format", "XML");
    res = nxServer.doRestletGetCall(pathParams, queryParams);
    System.out.println(res.getText());
    assertEquals(res.getMediaType().getName(), MediaType.TEXT_XML.getName());
  }