Package com.google.enterprise.connector.instantiator

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


  }

  @Override
  public Configuration getConnectorConfiguration(String connectorName)
      throws ConnectorNotFoundException {
    return new Configuration("Mock", new HashMap<String, String>(), null);
  }
View Full Code Here


    public Configuration getConnectorConfiguration(String connectorName)
        throws ConnectorNotFoundException {
      if ("UnknownConnector".equalsIgnoreCase(connectorName)) {
        throw new ConnectorNotFoundException(connectorName);
      }
      return new Configuration("Mock", new HashMap<String, String>(), null);
    }
View Full Code Here

    configData.put("name2", "valueA2");
    configData.put("name3", "valueA3");
    update = false;
    configXml = null;
    manager.setConnectorConfiguration(connectorName,
        new Configuration(connectorType, configData, configXml),
        language, update);

    configData.put("name1", "valueB1");
    configData.put("name2", "valueB2");
    update = true;
View Full Code Here

  /** Test the handler, returning the handler. */
  private SetConnectorConfigHandler doTest(String xmlBody) throws Exception {
    LOGGER.info("xmlBody: " + xmlBody);
    String name = connectorName;

    Configuration origConfig = null;
    if (update) {
      origConfig = manager.getConnectorConfiguration(connectorName);
    } else {
      // GSA 5.2 wants connectorNames to be lower case.  The handler
      // will lowercase for us, but only on new connectors; not on update.
      name = name.toLowerCase();
    }

    SetConnectorConfigHandler hdl = new SetConnectorConfigHandler(
        xmlBody, manager);
    LOGGER.info("ConnectorName: " + hdl.getConnectorName() +
                " this: " + connectorName);
    LOGGER.info("ConnectorType: " + hdl.getConnectorType() +
                " this: " + connectorType);
    if (hdl.getStatus().isSuccess()) {
      assertEquals(language, hdl.getLanguage());
      assertEquals(name, hdl.getConnectorName());
      assertEquals(connectorType, hdl.getConnectorType());
      assertEquals(update, hdl.isUpdate());
      assertEquals(configData, hdl.getConfigData());

      Configuration config = manager.getConnectorConfiguration(name);
      assertNotNull(config);
      assertEquals(connectorType, config.getTypeName());
      assertEquals(configData, config.getMap());
      if (configXml != null) {
        assertEquals(configXml, config.getXml());
        assertEquals(configXml, hdl.getConfigXml());
      } else if (origConfig != null) {
        assertEquals(origConfig.getXml(), config.getXml());
      } else {
        assertEquals(manager.getConnectorInstancePrototype(connectorType),
                     config.getXml());
      }
    }
    return hdl;
  }
View Full Code Here

               PersistentStoreException, InstantiatorException {
      ConfigureResponse response = super.setConnectorConfiguration(
        connectorName, configuration, language, update);
      if (response == null) {
        if (configuration.getXml() == null) {
          configuration = new Configuration(configuration,
              getConnectorInstancePrototype(configuration.getTypeName()));
        }
        configurations.put(connectorName, configuration);
      }
      return response;
View Full Code Here

    }

    @Override
    public Configuration getConnectorConfiguration(String connectorName)
        throws ConnectorNotFoundException {
      Configuration config = configurations.get(connectorName);
      if (config == null) {
        throw new ConnectorNotFoundException(connectorName);
      }
      return config;
    }
View Full Code Here

  public void testSetAndGetConnectorConfiguration() throws Exception {
    String typeName = instantiator.getConnectorTypeName(connectorName);
    Map<String, String> config = new HashMap<String, String>();
    config.put(PropertiesUtils.GOOGLE_CONNECTOR_NAME, connectorName);

    Configuration configuration = new Configuration(typeName, config, null);
    ConfigureResponse response = manager.setConnectorConfiguration(
        connectorName, configuration, "en", true);
    assertNull(response);

    assertEquals(instantiator.getConnectorConfiguration(connectorName),
View Full Code Here

  public void testRemoveConnector() throws Exception {
    String typeName = instantiator.getConnectorTypeName(connectorName);
    Map<String, String> config = new HashMap<String, String>();
    config.put(PropertiesUtils.GOOGLE_CONNECTOR_NAME, connectorName);

    Configuration configuration = new Configuration(typeName, config, null);
    ConfigureResponse response = manager.setConnectorConfiguration(
        connectorName, configuration, "en", true);
    assertNull(response);

    manager.getConnectorConfiguration(connectorName);
View Full Code Here

      boolean isCheckpoint, boolean isConfig, boolean isSched) {
    if (isCheckpoint) {
      store.storeConnectorState(context, new Date().toString());
    }
    if (isConfig) {
      store.storeConnectorConfiguration(context, new Configuration(
          "testType", Collections.<String, String>emptyMap(), null));
    }
    if (isSched) {
      store.storeConnectorSchedule(context,
          new Schedule("name:200:300000:0-0"));
View Full Code Here

      PersistentStore actualStore) {
    ImmutableMap<StoreContext, ConnectorStamps> inventory =
        expectedStore.getInventory();
    assertEquals(inventory.keySet(), actualStore.getInventory().keySet());
    for (StoreContext context : inventory.keySet()) {
      Configuration econfig = expectedStore.getConnectorConfiguration(context);
      Configuration aconfig = actualStore.getConnectorConfiguration(context);
      if (econfig == null) {
          assertNull(aconfig);
      } else {
        // TODO: Implement equals and hashCode for Configuration?
        assertNotNull(aconfig);
        assertEquals(econfig.getTypeName(), aconfig.getTypeName());
        assertEquals(econfig.getMap(), aconfig.getMap());
        assertEquals(econfig.getXml(), aconfig.getXml());
      }

      Schedule esched = expectedStore.getConnectorSchedule(context);
      Schedule asched = actualStore.getConnectorSchedule(context);
      if (esched == null) {
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.