@@ -0,0 +1,2980 @@
+/* $Id$ */%0A%0A/**%0A* Licensed to the Apache Software Foundation (ASF) under one or more%0A* contributor license agreements. See the NOTICE file distributed with%0A* this work for additional information regarding copyright ownership.%0A* The ASF licenses this file to You under the Apache License, Version 2.0%0A* (the %22License%22); you may not use this file except in compliance with%0A* the License. You may obtain a copy of the License at%0A*%0A* http://www.apache.org/licenses/LICENSE-2.0%0A*%0A* Unless required by applicable law or agreed to in writing, software%0A* distributed under the License is distributed on an %22AS IS%22 BASIS,%0A* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A* See the License for the specific language governing permissions and%0A* limitations under the License.%0A*/%0Apackage org.apache.manifoldcf.crawler.tests;%0A%0Aimport org.apache.manifoldcf.core.interfaces.*;%0Aimport org.apache.manifoldcf.agents.interfaces.*;%0Aimport org.apache.manifoldcf.crawler.interfaces.*;%0Aimport org.apache.manifoldcf.crawler.system.ManifoldCF;%0A%0Aimport java.io.*;%0Aimport java.util.*;%0Aimport java.nio.charset.Charset;%0A%0A/** Connector class to be used by general integration tests that need documents */%0Apublic class TestingRepositoryConnector extends org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnector%0A%7B%0A  protected final static String%5B%5D documents = new String%5B%5D%7B%22test1.txt%22,%22test2.txt%22,%22test3.txt%22%7D;%0A  %0A  private final static Charset UTF_8 = Charset.forName(%22UTF-8%22);%0A  %0A  public TestingRepositoryConnector()%0A  %7B%0A  %7D%0A%0A  @Override%0A  public void addSeedDocuments(ISeedingActivity activities, DocumentSpecification spec,%0A    long startTime, long endTime, int jobMode)%0A    throws ManifoldCFException, ServiceInterruption%0A  %7B%0A    for (String doc : documents)%0A    %7B%0A      activities.addSeedDocument(doc,null);%0A    %7D%0A  %7D%0A  %0A  @Override%0A  public String%5B%5D getDocumentVersions(String%5B%5D documentIdentifiers, String%5B%5D oldVersions, IVersionActivity activities,%0A    DocumentSpecification spec, int jobMode, boolean usesDefaultAuthority)%0A    throws ManifoldCFException, ServiceInterruption%0A  %7B%0A    String%5B%5D rval = new String%5BdocumentIdentifiers.length%5D;%0A    for (int i = 0; i %3C rval.length; i++)%0A    %7B%0A      rval%5Bi%5D = %22%22;%0A    %7D%0A    return rval;%0A  %7D%0A%0A  @Override%0A  public void processDocuments(String%5B%5D documentIdentifiers, String%5B%5D versions, IProcessActivity activities,%0A    DocumentSpecification spec, boolean%5B%5D scanOnly, int jobMode)%0A    throws ManifoldCFException, ServiceInterruption%0A  %7B%0A    for (int i = 0; i %3C documentIdentifiers.length; i++)%0A    %7B%0A      String documentIdentifier = documentIdentifiers%5Bi%5D;%0A      String version = versions%5Bi%5D;%0A      if (!scanOnly%5Bi%5D)%0A      %7B%0A        RepositoryDocument rd = new RepositoryDocument();%0A        byte%5B%5D bytes = documentIdentifier.getBytes(UTF_8);%0A        rd.setBinary(new ByteArrayInputStream(bytes),bytes.length);%0A        activities.ingestDocument(documentIdentifier,version,%22http://%22+documentIdentifier,rd);%0A      %7D%0A    %7D%0A  %7D%0A%0A%7D%0A

Add testing repository connector