Package com.google.enterprise.connector.spi

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


    AclPropertyFilter factory = new AclPropertyFilter();
    Document output = factory.newDocumentFilter(input);

    Property prop = output.findProperty(SpiConstants.PROPNAME_ACLUSERS);
    Value value = prop.nextValue();

    Principal newPrincipal = ((PrincipalValue) value).getPrincipal();
    assertEquals(principal.getName(), newPrincipal.getName());
    assertEquals(CaseSensitivityType.EVERYTHING_CASE_SENSITIVE,
        newPrincipal.getCaseSensitivityType());
View Full Code Here


    AclPropertyFilter factory = new AclPropertyFilter();
    Document output = factory.newDocumentFilter(input);

    Property prop = output.findProperty(SpiConstants.PROPNAME_ACLUSERS);
    Value value = prop.nextValue();

    Principal newPrincipal = ((PrincipalValue) value).getPrincipal();
    assertEquals(principal.getName(), newPrincipal.getName());
    assertEquals(CaseSensitivityType.EVERYTHING_CASE_SENSITIVE,
        newPrincipal.getCaseSensitivityType());

    Property propInheritFrom =
        output.findProperty(SpiConstants.PROPNAME_ACLINHERITFROM);
    Value valueInheritfrom = propInheritFrom.nextValue();
    assertEquals("parentId", valueInheritfrom.toString());
  }
View Full Code Here

    Document input = ConnectorTestUtils.createSimpleDocument(props);
    Document output = createFilter(input,
        CaseSensitivityType.EVERYTHING_CASE_SENSITIVE, null, false);
    Property prop = output.findProperty(SpiConstants.PROPNAME_ACLUSERS);
    Value value;
    while ((value = prop.nextValue()) != null) {
      if (value instanceof PrincipalValue) {
        Principal newPrincipal = ((PrincipalValue) value).getPrincipal();
        assertEquals(CaseSensitivityType.EVERYTHING_CASE_SENSITIVE,
            newPrincipal.getCaseSensitivityType());
View Full Code Here

  }

  public Principal getPrincipal(Document output, String name)
      throws Exception {
    Property prop = output.findProperty(name);
    Value value = prop.nextValue();
    return ((PrincipalValue) value).getPrincipal();
  }
View Full Code Here

    AclPropertyFilter factory = new AclPropertyFilter();
    Document output = factory.newDocumentFilter(input);

    Property prop = output.findProperty(SpiConstants.PROPNAME_ACLUSERS);
    Value value = prop.nextValue();
    Principal newPrincipal = ((PrincipalValue) value).getPrincipal();
    assertEquals(CaseSensitivityType.EVERYTHING_CASE_SENSITIVE,
        newPrincipal.getCaseSensitivityType());
    assertEquals("Jane Doe", newPrincipal.getName());

    Property denyprop =
        output.findProperty(SpiConstants.PROPNAME_ACLDENYUSERS);
    Value denyvalue = denyprop.nextValue();
    Principal denyPrincipal = ((PrincipalValue) denyvalue).getPrincipal();
    assertEquals(CaseSensitivityType.EVERYTHING_CASE_SENSITIVE,
        denyPrincipal.getCaseSensitivityType());
    assertEquals("John Doe", denyPrincipal.getName());
  }
View Full Code Here

      Map<String, List<Value>> expectedProps) throws Exception {
    for (Map.Entry<String, List<Value>> entry : expectedProps.entrySet()) {
      Property prop = document.findProperty(entry.getKey());
      assertNotNull(prop);
      for (Value expectedValue : entry.getValue()) {
        Value value = prop.nextValue();
        assertNotNull(value);
        if (value instanceof BinaryValue) {
          assertEquals(getStringFromBinaryValue(expectedValue),
              getStringFromBinaryValue(value));
        } else {
          assertEquals(expectedValue.toString(), value.toString());
        }
      }
      assertNull(prop.nextValue());
    }
  }
View Full Code Here

import java.util.List;

public class SimplePropertyTest extends TestCase {

  public void testSingleValue() throws Exception {
    Value expected = Value.getStringValue("test1");
    SimpleProperty property = new SimpleProperty(expected);

    // We should get our value back, but only once.
    Value value = property.nextValue();
    assertNotNull(value);
    assertEquals(expected, value);

    // Next fetch should yield null.
    value = property.nextValue();
View Full Code Here

  private void checkMultiValues(List<Value> list) throws Exception {
    SimpleProperty property = new SimpleProperty(list);

    // We should get our values back, in order.
    for (Value expected : list) {
      Value value = property.nextValue();
      assertNotNull(value);
      assertEquals(expected, value);
    }

    // All subsequent fetches should yield null.
View Full Code Here

    JcrConnector jcrConn = new JcrConnector(mockJcrRepo);
    TraversalManager travMgr = jcrConn.login().getTraversalManager();
    Document document = travMgr.startTraversal().nextDocument();
    assertEquals("worddoc",
        Value.getSingleValueString(document, SpiConstants.PROPNAME_DOCID));
    Value v = Value.getSingleValue(document, SpiConstants.PROPNAME_CONTENT);
    InputStream contentStream = ((BinaryValue) v).getInputStream();
    InputStream encodedContentStream =
        new Base64FilterInputStream(contentStream);

    // Compare the bytes on each of the streams.
View Full Code Here

    // If a value matches the pattern, either replace or augment that value.
    LinkedList<Value> values = new LinkedList<Value>();
    for (Value value : super.getPropertyValues(source, name)) {
      String original = null;
      String modified = null;
      Value originalValue = null;
      Value modifiedValue = null;
      if (value instanceof BinaryValue) {
        String mimeType =
            Value.getSingleValueString(source, SpiConstants.PROPNAME_MIMETYPE);
        if (Strings.isNullOrEmpty(mimeType)) {
          // There is no mimetype property in the document.
View Full Code Here

TOP

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

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.