Package com.google.enterprise.connector.instantiator

Examples of com.google.enterprise.connector.instantiator.Configuration


  private void addConnector(Instantiator instantiator,
      String name, String typeName, String configString) {
    try {
      Map<String, String> configMap =
          new JsonObjectAsMap(new JSONObject(configString));
      Configuration config = new Configuration(typeName, configMap, null);
      instantiator.setConnectorConfiguration(name, config,
          I18NUtil.getLocaleFromStandardLocaleString("en"), false);
    } catch (ConnectorExistsException cee) {
      fail(cee.toString());
    } catch (ConnectorNotFoundException cnfe) {
View Full Code Here


  // Test that configuration XML is included in the output.
  public final void testWriteConfigXml() {
    Schedule schedule =
        new Schedule("connector-02", false, 100, 300000, "0-0");
    ImportExportConnector connector = new ImportExportConnector("connector-02",
        new Configuration("TestConnector", CONFIG_MAP, CONFIG_XML),
        schedule, null);

    String xmlResult = asXmlString(connector);
    assertEquals(NEW_FORMAT_WITH_CONFIG_XML,
        StringUtils.normalizeNewlines(xmlResult));
View Full Code Here

  // Test that configuration XML with embedded CDATA is properly escaped.
  public final void testWriteConfigXmlCdata() {
    Schedule schedule =
        new Schedule("connector-02", false, 100, 300000, "0-0");
    ImportExportConnector connector = new ImportExportConnector("connector-02",
        new Configuration("TestConnector", CONFIG_MAP, CONFIG_XML_WITH_CDATA),
        schedule, null);

    String xmlResult = asXmlString(connector);
    assertEquals(NEW_FORMAT_WITH_CONFIG_XML_CDATA,
        StringUtils.normalizeNewlines(xmlResult));
View Full Code Here

  // Test that property values are properly escaped.
  public final void testWriteEscapedAttrValues() {
    HashMap<String, String> config = new HashMap<String, String>(CONFIG_MAP);
    config.put("uglyvalue", "one&two<three>four'five\"");
    ImportExportConnector connector = new ImportExportConnector("connector-01",
        new Configuration("TestConnector", config, null), null, null);

    String xmlResult = asXmlString(connector);
    assertTrue("attribute values", xmlResult.contains("Param name=\"uglyvalue\""
        + " value=\"one&amp;two&lt;three>four&#39;five&quot;\""));
  }
View Full Code Here

    ConnectorCoordinatorMap ccm = getCoordinatorMap();
    ConnectorCoordinator coordinator = ccm.getOrAdd(name);
    String typeName = "TestConnectorA";
    Map<String, String> configMap = new HashMap<String, String>(CONFIG_MAP);
    configMap.put("Color", color);
    Configuration config = new Configuration(typeName, configMap, null);
    ConfigureResponse response = coordinator.setConnectorConfiguration(
        getTypeMap().getTypeInfo(typeName), config, Locale.ENGLISH, false);
    assertNull((response == null) ? null : response.getMessage(), response);
    Schedule schedule = new Schedule(name, false, 100, 300000, "0-0");
    coordinator.setConnectorSchedule(schedule);
View Full Code Here

      }
    }
    String xml = readStoreFile(context, TypeInfo.CONNECTOR_INSTANCE_XML);
    if (props != null || xml != null) {
      String typeName = context.getTypeName();
      return new Configuration(typeName, PropertiesUtils.toMap(props), xml);
    }
    return null;
  }
View Full Code Here

    Set<String> connectorNames = ccm.getConnectorNames();
    assertTrue(connectorNames.contains("connector-01"));
    assertTrue(connectorNames.contains("connector-02"));

    ConnectorCoordinator coordinator = ccm.get("connector-01");
    Configuration config = coordinator.getConnectorConfiguration();
    assertEquals("type", "TestConnectorA", config.getTypeName());
    ImportExportConnectorTest.assertContains(config.getMap(), "Color", "red");
    assertNull("checkpoint", coordinator.getConnectorState());
    Schedule schedule = coordinator.getConnectorSchedule();
    assertFalse(schedule.isDisabled());
    assertTrue((schedule.getLoad() == 100));
    assertTrue((schedule.getRetryDelayMillis() == 300000));
    assertEquals("0-0", schedule.getTimeIntervals());

    coordinator = ccm.get("connector-02");
    config = coordinator.getConnectorConfiguration();
    assertEquals("type", "TestConnectorA", config.getTypeName());
    ImportExportConnectorTest.assertContains(config.getMap(), "Color", "blue");
    assertNull("checkpoint", coordinator.getConnectorState());
    schedule = coordinator.getConnectorSchedule();
    assertFalse(schedule.isDisabled());
    assertTrue((schedule.getLoad() == 100));
    assertTrue((schedule.getRetryDelayMillis() == 300000));
View Full Code Here

    Set<String> connectorNames = ccm.getConnectorNames();
    assertTrue(connectorNames.contains("connector-01"));
    assertTrue(connectorNames.contains("connector-02"));

    ConnectorCoordinator coordinator = ccm.get("connector-01");
    Configuration config = coordinator.getConnectorConfiguration();
    assertEquals("type", "TestConnectorA", config.getTypeName());
    ImportExportConnectorTest.assertContains(config.getMap(), "Color", "blue");
    assertEquals("checkpoint", "checkpoint", coordinator.getConnectorState());
    Schedule schedule = coordinator.getConnectorSchedule();
    assertFalse(schedule.isDisabled());
    assertTrue((schedule.getLoad() == 100));
    assertTrue((schedule.getRetryDelayMillis() == 300000));
    assertEquals("0-0", schedule.getTimeIntervals());

    coordinator = ccm.get("connector-02");
    config = coordinator.getConnectorConfiguration();
    assertEquals("type", "TestConnectorA", config.getTypeName());
    ImportExportConnectorTest.assertContains(config.getMap(), "Color", "red");
    assertEquals("checkpoint", "checkpoint", coordinator.getConnectorState());
    schedule = coordinator.getConnectorSchedule();
    assertFalse(schedule.isDisabled());
    assertTrue((schedule.getLoad() == 100));
    assertTrue((schedule.getRetryDelayMillis() == 300000));
View Full Code Here

    assertTrue(connectorNames.contains("connector-01"));
    assertTrue(connectorNames.contains("connector-02"));
    assertTrue(connectorNames.contains("connector-03"));

    ConnectorCoordinator coordinator = ccm.get("connector-01");
    Configuration config = coordinator.getConnectorConfiguration();
    assertEquals("type", "TestConnectorA", config.getTypeName());
    ImportExportConnectorTest.assertContains(config.getMap(), "Color", "blue");
    assertEquals("checkpoint", "checkpoint", coordinator.getConnectorState());
    Schedule schedule = coordinator.getConnectorSchedule();
    assertFalse(schedule.isDisabled());
    assertTrue((schedule.getLoad() == 100));
    assertTrue((schedule.getRetryDelayMillis() == 300000));
    assertEquals("0-0", schedule.getTimeIntervals());

    coordinator = ccm.get("connector-02");
    config = coordinator.getConnectorConfiguration();
    assertEquals("type", "TestConnectorA", config.getTypeName());
    ImportExportConnectorTest.assertContains(config.getMap(), "Color", "red");
    assertEquals("checkpoint", "checkpoint", coordinator.getConnectorState());
    schedule = coordinator.getConnectorSchedule();
    assertFalse(schedule.isDisabled());
    assertTrue((schedule.getLoad() == 100));
    assertTrue((schedule.getRetryDelayMillis() == 300000));
View Full Code Here

    assertTrue(connectorNames.contains("connector-01"));
    assertTrue(connectorNames.contains("connector-02"));
    assertFalse(connectorNames.contains("connector-03"));

    ConnectorCoordinator coordinator = ccm.get("connector-01");
    Configuration config = coordinator.getConnectorConfiguration();
    assertEquals("type", "TestConnectorA", config.getTypeName());
    ImportExportConnectorTest.assertContains(config.getMap(), "Color", "blue");
    assertEquals("checkpoint", "checkpoint", coordinator.getConnectorState());
    Schedule schedule = coordinator.getConnectorSchedule();
    assertFalse(schedule.isDisabled());
    assertTrue((schedule.getLoad() == 100));
    assertTrue((schedule.getRetryDelayMillis() == 300000));
    assertEquals("0-0", schedule.getTimeIntervals());

    coordinator = ccm.get("connector-02");
    config = coordinator.getConnectorConfiguration();
    assertEquals("type", "TestConnectorA", config.getTypeName());
    ImportExportConnectorTest.assertContains(config.getMap(), "Color", "red");
    assertEquals("checkpoint", "checkpoint", coordinator.getConnectorState());
    schedule = coordinator.getConnectorSchedule();
    assertFalse(schedule.isDisabled());
    assertTrue((schedule.getLoad() == 100));
    assertTrue((schedule.getRetryDelayMillis() == 300000));
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.instantiator.Configuration

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.