@Test
  public void shouldFetchDocumentProperties() throws Exception {
    client.setResponse("application/json+nxentity", HttpResponses.DOC_DEFAULT_DOMAIN);

    Session session = client.getSession("Administrator", "Administrator");
    Document defaultDomain =
        (Document) session.newRequest("Document.Fetch").set("value", "/default-domain").execute();
    assertEquals("6e4ee4b8-af3f-4fb4-ad31-1a0a88720dfb", defaultDomain.getId());
    assertEquals(1368704100560L, defaultDomain.getLastModified().getTime());
    assertEquals(2, defaultDomain.getFacets().size());
    assertEquals("SuperSpace", defaultDomain.getFacets().getString(0));
    assertEquals("Folderish", defaultDomain.getFacets().getString(1));
    assertEquals(null, defaultDomain.getLock());
    assertEquals(null, defaultDomain.getLockCreated());
    assertEquals(false, defaultDomain.isLocked());
    assertEquals(null, defaultDomain.getLockOwner());
    assertEquals("/default-domain", defaultDomain.getPath());
    assertEquals("", defaultDomain.getVersionLabel());
    assertEquals("Domain", defaultDomain.getType());
    assertEquals("Default Domain", defaultDomain.getTitle());
    assertEquals("project", defaultDomain.getState());
    assertEquals("default", defaultDomain.getRepository());

    client.shutdown();
  }
Ejemplo n.º 2
0
 public static void main(String[] args) throws Exception {
   try {
     HttpAutomationClient client =
         new HttpAutomationClient("http://localhost:8080/nuxeo/site/automation");
     Session session = client.getSession("Administrator", "Administrator");
     DocumentService rs = session.getAdapter(DocumentService.class);
     Documents docs = rs.query("SELECT * from Workspace");
     System.out.println(docs);
     for (Document d : docs) {
       System.out.println(
           d.getTitle()
               + " at "
               + d.getLastModified()
               + " facets :"
               + d.getFacets()
               + " token:"
               + d.getChangeToken());
     }
     client.shutdown();
   } catch (RemoteException e) {
     e.printStackTrace();
     System.out.println(e.getRemoteStackTrace());
   }
 }