Examples of DocumentHandle


Examples of com.google.enterprise.connector.util.diffing.DocumentHandle

    jsonDocument = new JsonDocument(jsonObjectUtil.getProperties(),
                                    jsonObjectUtil.getJsonObject());
  }

  public void testGetDocument() throws Exception {
    DocumentHandle handle = new DBHandle(jsonDocument);
    Document doc = handle.getDocument();
    assertNotNull(doc);
    assertEquals(properties.keySet(), doc.getPropertyNames());

    for (Map.Entry<String, String>  entry : properties.entrySet()) {
      Property property = doc.findProperty(entry.getKey());
View Full Code Here

Examples of com.google.enterprise.connector.util.diffing.DocumentHandle

  /**
   * Tests that the JSON object handle string includes all of the
   * document properties.
   */
  public void testToString() {
    DocumentHandle handle = new DBHandle(jsonDocument);
    Object expected = "{\"google:ispublic\":\"false\",\"google:docid\":\"1\","
        + "\"google:mimetype\":\"text/plain\","
        + "\"google:lastmodified\":\"" + lastModified + "\"}";
    assertEquals(expected, handle.toString());
  }
View Full Code Here

Examples of com.google.enterprise.connector.util.diffing.DocumentHandle

   * lifecycle tests are, or in JsonDocumentTest, since the date
   * handling is in JsonDocument at the moment, but we're
   * fundamentally testing the behavior of the document handle.
   */
  public void testDeserializedDate() throws RepositoryException {
    DocumentHandle handle = new DBHandle(jsonDocument);
    Document document = handle.getDocument();
    DocumentHandle deserialHandle = new DBHandle(handle.toString());
    Document deserialDocument = deserialHandle.getDocument();

    Value value = Value.getSingleValue(document,
        SpiConstants.PROPNAME_LASTMODIFIED);
    Value deserialValue = Value.getSingleValue(deserialDocument,
        SpiConstants.PROPNAME_LASTMODIFIED);
View Full Code Here

Examples of com.google.enterprise.connector.util.diffing.DocumentHandle

    DocumentSnapshot snapshot = getSnapshotUnderTest(configMap);
    DocumentSnapshot deserialSnapshot = getDeserializedSnapshot(snapshot);

    // This is the core assertion, that a deserialized snapshot
    // compares as identical to the repository source snapshot.
    DocumentHandle update = snapshot.getUpdate(deserialSnapshot);
    if (update != null) {
      fail(update.toString());
    }

    assertEquals(snapshot.getDocumentId(), deserialSnapshot.getDocumentId());
    assertEquals(snapshot.toString(), deserialSnapshot.toString());
  }
View Full Code Here

Examples of com.google.enterprise.connector.util.diffing.DocumentHandle

      throws Exception {
    DocumentSnapshot snapshot = getSnapshotUnderTest(configMap);
    DocumentSnapshot deserialSnapshot = getDeserializedSnapshot(snapshot);

    try {
      DocumentHandle update = deserialSnapshot.getUpdate(snapshot);
      fail("Expected an UnsupportedOperationException exception");
    } catch (UnsupportedOperationException expected) {
    }
  }
View Full Code Here

Examples of com.google.enterprise.connector.util.diffing.DocumentHandle

  public void testHandleLifecycle(Map<String, String> configMap)
      throws Exception {
    DocumentSnapshot snapshot = getSnapshotUnderTest(configMap);

    DocumentHandle handle = snapshot.getUpdate(null);
    assertNotNull(handle);

    Document doc = handle.getDocument();
    assertNotNull(doc);
    Set<String> propertyNames = doc.getPropertyNames();

    String serialHandle = handle.toString();
    DocumentHandle deserialHandle =
        new DBHandleFactory().fromString(serialHandle);
    assertNotNull(deserialHandle);
    assertEquals("document ID",
        handle.getDocumentId(), deserialHandle.getDocumentId());
    assertJsonEquals("serialization not value preserving",
        serialHandle, deserialHandle.toString());

    Document recoveryDoc = deserialHandle.getDocument();
    assertNotNull(recoveryDoc);
    // This is the core assertion, that a document from a deserialized
    // handle has the same properties as the original handle from the
    // SnapshotRepository.
    assertEquals("document from deserialized handle",
View Full Code Here

Examples of com.google.enterprise.connector.util.diffing.DocumentHandle

    // The diffing framework sends in a null to indicate that it has not
    // seen this snapshot before.
    // Assert that our DocumentHolder is used to create the DocumentHandle.
    expect(builder.getDocumentHandle(same(holder))).andReturn(null);
    replay(builder);
    DocumentHandle actual = documentSnapshot.getUpdate(null);
    verify(builder);
  }
View Full Code Here

Examples of com.google.enterprise.connector.util.diffing.DocumentHandle

        builder.getJsonString(documentSnapshot.getDocumentId(), "9999"));

    // Assert that our DocumentHolder is used to create the DocumentHandle.
    expect(builder.getDocumentHandle(same(holder))).andReturn(null);
    replay(builder);
    DocumentHandle update = documentSnapshot.getUpdate(onGsa);
    verify(builder);
  }
View Full Code Here

Examples of complex.persistent_window_states.DocumentHandle

                continue;
      }
            String cfg = settings[1];

            // load a document
            DocumentHandle handle = loadDocument(xMSF, settings[0]);

            // first size
            Rectangle rect1 = handle.getDocumentPosSize();

            // resize
            handle.resizeDocument();
            // after resize
            Rectangle rect2 = handle.getDocumentPosSize();

            // disposeManager and start a new office
            if (!disconnect()) return;

            if (!connect()) return;

            // get configuration
            settings = getConfigurationAndLoader(xMSF, els[i]);

            String newCfg = settings[1];

            // load a document
            handle = loadDocument(xMSF, settings[0]);

            Rectangle newRect = handle.getDocumentPosSize();

            // print the settings and window sizes
            log.println("----------------------------");
            log.println("Initial Config String      : " + cfg);
            log.println("Config String after restart: " + newCfg);
View Full Code Here

Examples of complex.persistent_window_states.DocumentHandle

     * @param docLoader A documet loader
     * @return A handle to the document
     */
    private DocumentHandle loadDocument(XMultiServiceFactory xMSF,
                                                            String docLoader) {
        DocumentHandle docHandle = null;
        try {
            // create component loaader
            XComponentLoader xCompLoader = (XComponentLoader)
                                UnoRuntime.queryInterface(
                                XComponentLoader.class, xMSF.createInstance(
                                "com.sun.star.frame.Desktop"));
            XFramesSupplier xFrameSupp = (XFramesSupplier)UnoRuntime.queryInterface(XFramesSupplier.class, xCompLoader);
            // close all existing frames
            XFrames xFrames = xFrameSupp.getFrames();
            XIndexAccess xAcc = (XIndexAccess)UnoRuntime.queryInterface(XIndexAccess.class, xFrames);
            for ( int i=0; i<xAcc.getCount(); i++ ) {
                XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xAcc.getByIndex(i));
                try {
                    if ( xClose != null ) {
                        xClose.close(false);
                    }
                    else  {
                        failed("Could not query frame for XCloseable!");
                    }
                }
                catch( com.sun.star.uno.Exception e ) {
                    e.printStackTrace((java.io.PrintWriter)log);
                    failed("Could not query frame for XCloseable!");
                }
            }
            docHandle = new DocumentHandle(xCompLoader);
            docHandle.loadDocument(docLoader, false);
        }
        catch(com.sun.star.uno.Exception e) {
            e.printStackTrace();
        }
        catch(java.lang.Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.