Package com.google.enterprise.connector.spi

Examples of com.google.enterprise.connector.spi.Property


    NotesDocumentMock crawlDoc = new NotesDocumentMock();
    crawlDoc.addItem(new NotesItemMock("name", "x.foo", "type", NotesItem.TEXT,
            "values", "this is the text for field foo"));
    doc.crawlDoc = crawlDoc;
    doc.setMetaFields();
    Property p = doc.findProperty("foo");
    assertNotNull("property foo missing", p);
    Value v = p.nextValue();
    assertNotNull("property foo value missing", v);
    assertEquals("property foo", "this is the text for field foo",
        v.toString());
    assertNull(p.nextValue());
  }
View Full Code Here


    NotesDocumentMock crawlDoc = new NotesDocumentMock();
    crawlDoc.addItem(new NotesItemMock("name", "x.foo", "type",
            NotesItem.NUMBERS, "values", new Double(11)));
    doc.crawlDoc = crawlDoc;
    doc.setMetaFields();
    Property p = doc.findProperty("foo");
    assertNotNull("property foo missing", p);
    Value v = p.nextValue();
    assertNotNull("property foo value missing", v);
    assertEquals("property foo", "11.0", v.toString());
    assertNull(p.nextValue());
  }
View Full Code Here

    NotesDocumentMock crawlDoc = new NotesDocumentMock();
    crawlDoc.addItem(new NotesItemMock("name", "x.foo", "type",
            NotesItem.NUMBERS, "values", new NotesDateTimeMock(testDate)));
    doc.crawlDoc = crawlDoc;
    doc.setMetaFields();
    Property p = doc.findProperty("foo");
    assertNotNull("property foo missing", p);
    Value v = p.nextValue();
    assertNotNull("property foo value missing", v);
    assertEquals("property foo",
        Value.calendarToIso8601(testCalendar), v.toString());
    assertNull(p.nextValue());
  }
View Full Code Here

    NotesDocumentMock crawlDoc = new NotesDocumentMock();
    crawlDoc.addItem(new NotesItemMock("name", "x.foo", "type", NotesItem.TEXT,
            "values", "foo text 1", "foo text 2", "foo text 3"));
    doc.crawlDoc = crawlDoc;
    doc.setMetaFields();
    Property p = doc.findProperty("foo");
    assertNotNull("property foo missing", p);
    Value v = p.nextValue();
    assertNotNull("property foo value missing", v);
    assertEquals("property foo 1", "foo text 1", v.toString());
    v = p.nextValue();
    assertEquals("property foo 2", "foo text 2", v.toString());
    v = p.nextValue();
    assertEquals("property foo 3", "foo text 3", v.toString());
    assertNull(p.nextValue());
  }
View Full Code Here

  public void testDocumentDisplayURL() throws Exception {
    NotesDocumentMock crawlDoc = getAttachmentDoc();
    NotesConnectorDocument document = new NotesConnectorDocument(
        connectorSession, session, connectorDatabase);
    document.setCrawlDoc("unid123", crawlDoc);
    Property displayUrl =
        document.findProperty(SpiConstants.PROPNAME_DISPLAYURL);
    assertNotNull(displayUrl);
  }
View Full Code Here

  }

  private void assertPropertyEquals(String expected,
      NotesConnectorDocument document, String property, int index)
      throws Exception {
    Property p = document.findProperty(property);
    assertNotNull("Missing property " + property, p);

    int i = 0;
    Value v;
    while ((v = p.nextValue()) != null) {
      if (i == index) {
        if (v instanceof PrincipalValue) {
          assertEquals(expected, ((PrincipalValue) v).getPrincipal().getName());
        } else {
          assertEquals(expected, v.toString());
View Full Code Here

    return crawlDoc;
  }

  private Principal getFirstPrincipal(NotesConnectorDocument document,
      String propertyName) throws Exception {
    Property property = document.findProperty(propertyName);
    assertNotNull("Missing " + propertyName, property);
    Value value = property.nextValue();
    assertNotNull("Missing value for " + propertyName, value);
    assertTrue("Not PrincipalValue: " + propertyName,
        value instanceof PrincipalValue);
    return ((PrincipalValue) value).getPrincipal();
  }
View Full Code Here

    return false;
  }

  private void getDocumentProperty(NotesConnectorDocument doc,
      Collection<String> readers, String propName) throws Exception {
    Property prop = doc.findProperty(propName);
    assertNotNull(prop);
    Value v;
    while ((v = prop.nextValue()) != null) {
      String decoded = URLDecoder.decode(v.toString(), "UTF-8");
      readers.add(decoded.replaceFirst("Domino/", ""));
    }
  }
View Full Code Here

  }

  private static List<String> getValues(Document doc, String name)
      throws Exception {
    List<String> values = new ArrayList<String>();
    Property p = doc.findProperty(name);
    if (p != null) {
      Value v = p.nextValue();
      if (v != null) {
        values.add(v.toString());
      }
    }
    return values;
View Full Code Here

        .contains(contentNonce));
  }
 
  private static String getFirstStringValue(Document doc, String key) {
    try {
      Property prop = doc.findProperty(key);
      return prop.nextValue().toString();
    } catch (RepositoryException re) {
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.spi.Property

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.