Package com.google.enterprise.connector.manager

Examples of com.google.enterprise.connector.manager.Context


    // Clear out any old connector state files.
    ConnectorTestUtils.deleteAllFiles(connectorDir);

    // Create a stand alone context with real ProductionManager.
    Context.refresh();
    Context context = Context.getInstance();
    context.setStandaloneContext(Context.DEFAULT_JUNIT_CONTEXT_LOCATION,
        Context.DEFAULT_JUNIT_COMMON_DIR_PATH);
    context.setFeeding(false);
    context.start();
    manager = context.getManager();

    req = new MockHttpServletRequest();
    res = new MockHttpServletResponse();
  }
View Full Code Here


    Files.copy(testPropFile, configPropFile);
    Files.copy(new File(new File("testdata", "mocktestdata"), APP_PROP_FILE),
               appPropFile);

    Context.refresh();
    Context context = Context.getInstance();
    context.setStandaloneContext(APPLICATION_CONTEXT,
        Context.DEFAULT_JUNIT_COMMON_DIR_PATH);

    classesDirectory = new File(context.getCommonDirPath(), "classes");
    classesPropFile = new File(classesDirectory, PROP_FILE);
    assertTrue(ConnectorTestUtils.mkdirs(classesDirectory));

    feedLogger =  (Logger) context.getApplicationContext()
        .getBean("FeedWrapperLogger", Logger.class);
    feedLogger.setLevel(Level.OFF);

    rootLogger = Logger.getLogger("");
    origLevel = rootLogger.getLevel();
View Full Code Here

    LOGGER.info("Making an XmlWebApplicationContext");
    XmlWebApplicationContext ac = new XmlWebApplicationContext();
    ac.setServletContext(servletContext);
    ac.refresh();

    Context context = Context.getInstance();
    context.setServletContext(ac, servletContext.getRealPath("/WEB-INF"));
    context.start();
    LOGGER.info("Connector Manager started.");
  }
View Full Code Here

      } catch (BeansException e) {
        throw new FactoryCreationFailureException(e, defaults, name);
      }
    }

    Context context = Context.getInstance();
    EncryptedPropertyPlaceholderConfigurer cfg = null;
    try {
        cfg = (EncryptedPropertyPlaceholderConfigurer) context.getBean(
            factory, null, EncryptedPropertyPlaceholderConfigurer.class);
    } catch (BeansException e) {
      throw new BeanInstantiationFailureException(e, prototype, name,
          EncryptedPropertyPlaceholderConfigurer.class.getName());
    }
    if (cfg == null) {
      cfg = new EncryptedPropertyPlaceholderConfigurer();
    }

    try {
      cfg.setLocation(getPropertiesResource(name, config.getMap()));
      cfg.postProcessBeanFactory(factory);
    } catch (BeansException e) {
      throw new PropertyProcessingFailureException(e, prototype, name);
    }

    Connector connector = null;
    try {
      connector = (Connector) context.getBean(factory, null, Connector.class);
    } catch (BeansException e) {
      throw new BeanInstantiationFailureException(e, prototype, name,
          Connector.class.getName());
    }
    if (connector == null) {
View Full Code Here

      throws IOException, FileNotFoundException {
    // Are we retrieving Connector logs, Feed logs, or TeedFeed file?
    LogHandler handler;
    String logsTag;
    try {
      Context context = Context.getInstance();
      if (req.getServletPath().indexOf("Teed") > 0) {
        handler = new TeedFeedHandler(context);
        logsTag = ServletUtil.XMLTAG_TEED_FEED;
      } else if (req.getServletPath().indexOf("Feed") > 0) {
        handler = new FeedLogHandler(context);
View Full Code Here

  private static final String BEANS_POSTFIX = "</beans>\n";

  @Override
  protected void setUp() throws Exception {
    Context.refresh();
    Context context = Context.getInstance();
    context.setStandaloneContext(APPLICATION_CONTEXT,
        Context.DEFAULT_JUNIT_COMMON_DIR_PATH);
    getTypeMap().init();
  }
View Full Code Here

    return (ConnectorCoordinatorImpl) getCoordinatorMap()
        .getOrAdd(name);
  }

  private ConnectorCoordinatorMap getCoordinatorMap() {
    Context context = Context.getInstance();
    return (ConnectorCoordinatorMap) context.getRequiredBean(
        "ConnectorCoordinatorMap", ConnectorCoordinatorMap.class);
  }   
View Full Code Here

    return (ConnectorCoordinatorMap) context.getRequiredBean(
        "ConnectorCoordinatorMap", ConnectorCoordinatorMap.class);
  }   

  private TypeMap getTypeMap() {
    Context context = Context.getInstance();
    return (TypeMap) context.getRequiredBean("TypeMap", TypeMap.class);
  }
View Full Code Here

    Properties props = new Properties();
    props.put(Context.GSA_FEED_HOST_PROPERTY_KEY, "fubar");
    PropertiesUtils.storeToFile(props, propFile, "Initial Props");

    Context.refresh();
    Context context = Context.getInstance();
    context.setStandaloneContext(applicationContext,
        Context.DEFAULT_JUNIT_COMMON_DIR_PATH);
    context.setFeeding(false);

    // Inject our test ConnectorType into the TypeMap.
    TypeInfo typeInfo = new TypeInfo(GDataPropertiesConnectorType.TYPE_NAME,
        new GDataPropertiesConnectorType(), null, null);
    getTypeMap().addTypeInfo(typeInfo);
    context.start();

    // Create the Connector and verify it was seeded with initial feed host.
    ConnectorCoordinatorImpl instance = createGDataPropsConnector("gdata");
    GDataPropertiesConnector connector =
        (GDataPropertiesConnector) instance.getInstanceInfo().getConnector();
    assertEquals("fubar", connector.googleFeedHost);

    // Change the feed host and verify it gets updated in connector.
    context.setConnectorManagerConfig("", "shme", 14,
        Context.GSA_FEED_SECURE_PORT_INVALID, null);
    assertEquals("shme", connector.googleFeedHost);

    removeConnector(instance);
    context.shutdown(true);
    ConnectorTestUtils.deleteAllFiles(baseDirectory);
  }
View Full Code Here

      System.err.println("Failed to read keystore configuration: " + e);
      System.exit(-1);
    }

    // Setup the standalone application Context.
    Context context = Context.getInstance();
    File contextLocation = new File(webInfDir, "applicationContext.xml");
    try {
      context.setStandaloneContext(
           contextLocation.getAbsoluteFile().toURI().toURL().toString(),
           webInfDir.getAbsoluteFile().getParent(),
           webInfDir.getAbsolutePath());

      // At this point the beans have been created, but the Connector Manager
      // has not started up.
      if (doStart) {
        context.setFeeding(false);
        context.start();
      }
    } catch (Exception e) {
      System.err.println(
          "Failed to initialize standalone application context: " + e);
      System.exit(-1);
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.manager.Context

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.