<commit_before>// Copyright (C) 2007-2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.enterprise.connector.otex;

import java.io.File;

import junit.framework.TestCase;

import com.google.enterprise.connector.spi.Document;
import com.google.enterprise.connector.spi.DocumentList;
import com.google.enterprise.connector.spi.RepositoryException;
import com.google.enterprise.connector.spi.TraversalManager;
import com.google.enterprise.connector.manager.Context;
import com.google.enterprise.connector.pusher.FeedException;
import com.google.enterprise.connector.pusher.Pusher;
import com.google.enterprise.connector.pusher.PushException;
import com.google.enterprise.connector.pusher.DocPusher;
import com.google.enterprise.connector.pusher.GsaFeedConnection;
import com.google.enterprise.connector.traversal.FileSizeLimitInfo;
import com.google.enterprise.connector.otex.client.Client;
import com.google.enterprise.connector.otex.client.ClientValue;

/**
 * Pushes a single document (DocID) to the GSA
 */
public class PushOneDocumentTest extends TestCase {
    private LivelinkConnector conn;
    private LivelinkSession sess;
    private Client client;
    private Pusher pusher;

    // TODO: get pusher server and port from [connector.?] properties
    //private String feedServer = "192.168.3.11";
    private String feedServer = "gogol.vizdom.com";
    private int feedPort = 19900;

    public void setUp() throws Exception {
        conn = LivelinkConnectorFactory.getConnector("connector.");
        sess = (LivelinkSession) conn.login();
        client = sess.getFactory().createClient();
        pusher = new DocPusher(new GsaFeedConnection(feedServer, feedPort),
            "livelink", new FileSizeLimitInfo());

        // Iinitialize the Context for DocPusher.take.
        // FIXME: This code is duplicated in LivelinkQueryTraverserTest..<commit_msg>Fix the tests to compile against connector manager 2.8 (as of 2.8.0-M4).<commit_after>// Copyright (C) 2007-2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.enterprise.connector.otex;

import java.io.File;

import junit.framework.TestCase;

import com.google.enterprise.connector.spi.Document;
import com.google.enterprise.connector.spi.DocumentList;
import com.google.enterprise.connector.spi.RepositoryException;
import com.google.enterprise.connector.spi.TraversalManager;
import com.google.enterprise.connector.manager.Context;
import com.google.enterprise.connector.pusher.FeedException;
import com.google.enterprise.connector.pusher.Pusher;
import com.google.enterprise.connector.pusher.PushException;
import com.google.enterprise.connector.pusher.DocPusher;
import com.google.enterprise.connector.pusher.GsaFeedConnection;
import com.google.enterprise.connector.traversal.FileSizeLimitInfo;
import com.google.enterprise.connector.util.filter.DocumentFilterChain;
import com.google.enterprise.connector.otex.client.Client;
import com.google.enterprise.connector.otex.client.ClientValue;

/**
 * Pushes a single document (DocID) to the GSA
 */
public class PushOneDocumentTest extends TestCase {
    private LivelinkConnector conn;
    private LivelinkSession sess;
    private Client client;
    private Pusher pusher;

    // TODO: get pusher server and port from [connector.?] properties
    private String feedServer = "gogol";
    private int feedPort = 19900;

    public void setUp() throws Exception {
        conn = LivelinkConnectorFactory.getConnector("connector.");
        sess = (LivelinkSession) conn.login();
        client = sess.getFactory().createClient();
        pusher = new DocPusher(
            new GsaFeedConnection(null, feedServer, feedPort, -1),
            "livelink", new FileSizeLimitInfo(), new DocumentFilterChain());

        // Iinitialize the Context for DocPusher.take.
        // FIXME: This code is duplicated in LivelinkQueryTraverserTest..
{'fraction_non_alphanumeric': 0.09603720177921553, 'fraction_numerical': 0.010109179134654266, 'mean_word_length': 4.105263157894737, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6207921', 'n_tokens_mistral': 1389, 'n_tokens_neox': 1366, 'n_words': 401}