manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1354313 - in /manifoldcf/integration/solr-4.x/trunk: ./ mcf/ mcf/src/java/org/apache/solr/mcf/ mcf/src/test/org/apache/solr/mcf/
Date Wed, 27 Jun 2012 01:57:19 GMT
Author: kwright
Date: Wed Jun 27 01:57:17 2012
New Revision: 1354313

URL: http://svn.apache.org/viewvc?rev=1354313&view=rev
Log:
Get it to build again - part of CONNECTORS-485 - but tests still fail.

Added:
    manifoldcf/integration/solr-4.x/trunk/mcf/ivy.xml   (with props)
Modified:
    manifoldcf/integration/solr-4.x/trunk/README.txt
    manifoldcf/integration/solr-4.x/trunk/build.xml
    manifoldcf/integration/solr-4.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
    manifoldcf/integration/solr-4.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
    manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFQParserPluginTest.java
    manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFSCLoadTest.java
    manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFSearchComponentTest.java

Modified: manifoldcf/integration/solr-4.x/trunk/README.txt
URL: http://svn.apache.org/viewvc/manifoldcf/integration/solr-4.x/trunk/README.txt?rev=1354313&r1=1354312&r2=1354313&view=diff
==============================================================================
--- manifoldcf/integration/solr-4.x/trunk/README.txt (original)
+++ manifoldcf/integration/solr-4.x/trunk/README.txt Wed Jun 27 01:57:17 2012
@@ -22,12 +22,15 @@ Instructions for Building Apache Manifol
    on your command path.  To test this, issue a "java -version" command from your
    shell and verify that the Java version is 1.6 or greater.
 
-2. Download the Apache Ant binary distribution (1.7.0 or greater) from http://ant.apache.org.
+2. Download the Apache Ant binary distribution (1.8.2 or greater) from http://ant.apache.org.
    You will need Ant installed and the %ANT_HOME%\bin directory included on your
    command path.  To test this, issue a "ant -version" command from your
    shell and verify that Ant is available.
 
-3. In a shell, change to the root directory of the source (where you find the outermost
+3. Download the Apache Ivy binary distribution (2.2.0 or greater) from http://ant.apache.org/ivy.
+    Copy the ivy jar into the ant lib area into the %ANT_HOME%\lib directory.
+    
+4. In a shell, change to the root directory of the source (where you find the outermost
    build.xml file), and type "ant" for directions.
 
 

Modified: manifoldcf/integration/solr-4.x/trunk/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/integration/solr-4.x/trunk/build.xml?rev=1354313&r1=1354312&r2=1354313&view=diff
==============================================================================
--- manifoldcf/integration/solr-4.x/trunk/build.xml (original)
+++ manifoldcf/integration/solr-4.x/trunk/build.xml Wed Jun 27 01:57:17 2012
@@ -27,9 +27,9 @@
   
   <target name="download-solr">
     <mkdir dir="solr" />
-    <exec dir="solr" executable="svn" failifexecutionfails="true">
+    <exec dir="solr" executable="svn" failifexecutionfails="true" failonerror="true">
       <arg value="checkout" />
-      <arg value="http://svn.apache.org/repos/asf/lucene/dev/trunk" />
+      <arg value="http://svn.apache.org/repos/asf/lucene/dev/branches/branch_4x/" />
       <arg value="." />
     </exec>
   </target>

Added: manifoldcf/integration/solr-4.x/trunk/mcf/ivy.xml
URL: http://svn.apache.org/viewvc/manifoldcf/integration/solr-4.x/trunk/mcf/ivy.xml?rev=1354313&view=auto
==============================================================================
--- manifoldcf/integration/solr-4.x/trunk/mcf/ivy.xml (added)
+++ manifoldcf/integration/solr-4.x/trunk/mcf/ivy.xml Wed Jun 27 01:57:17 2012
@@ -0,0 +1,33 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you 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.    
+-->
+<ivy-module version="2.0">
+    <info organisation="org.apache.solr" module="mcf"/>
+    <dependencies>
+      <dependency org="commons-codec" name="commons-codec" rev="1.6" transitive="false"/>
+      <dependency org="commons-fileupload" name="commons-fileupload" rev="1.2.1" transitive="false"/>
+      <dependency org="org.apache.httpcomponents" name="httpcore" rev="4.1.4" transitive="false"/>
+      <dependency org="org.apache.httpcomponents" name="httpclient" rev="4.1.3" transitive="false"/>
+      <dependency org="org.apache.httpcomponents" name="httpmime" rev="4.1.3" transitive="false"/>
+      <dependency org="org.slf4j" name="slf4j-api" rev="1.6.1" transitive="false"/>
+      <dependency org="commons-io" name="commons-io" rev="2.1" transitive="false"/>
+      <dependency org="commons-lang" name="commons-lang" rev="2.6" transitive="false"/>
+      <dependency org="junit" name="junit" rev="4.10" transitive="false"/>
+      <exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/> 
+    </dependencies>
+</ivy-module>

Propchange: manifoldcf/integration/solr-4.x/trunk/mcf/ivy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/integration/solr-4.x/trunk/mcf/ivy.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: manifoldcf/integration/solr-4.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
URL: http://svn.apache.org/viewvc/manifoldcf/integration/solr-4.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java?rev=1354313&r1=1354312&r2=1354313&view=diff
==============================================================================
--- manifoldcf/integration/solr-4.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
(original)
+++ manifoldcf/integration/solr-4.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
Wed Jun 27 01:57:17 2012
@@ -38,9 +38,19 @@ import org.apache.solr.handler.component
 import org.apache.solr.core.CloseHook;
 import org.apache.solr.util.plugin.SolrCoreAware;
 import org.apache.solr.core.SolrCore;
-import org.apache.commons.httpclient.*;
-import org.apache.commons.httpclient.methods.*;
-import org.apache.commons.httpclient.params.*;
+import org.apache.http.client.HttpClient;
+import org.apache.http.HttpStatus;
+import org.apache.http.HttpException;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.conn.ConnectTimeoutException;
+import org.apache.http.HttpResponse;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpParams;
+import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.util.EntityUtils;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.DefaultRedirectStrategy;
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
 import org.slf4j.*;
 
 import java.io.*;
@@ -78,8 +88,8 @@ public class ManifoldCFQParserPlugin ext
   String fieldDenyShare = null;
   int socketTimeOut;
   Integer connectionManagerSynchronizer = new Integer(0);
-  MultiThreadedHttpConnectionManager httpConnectionManager = null;
-  HttpClient client = null;
+  ThreadSafeClientConnManager httpConnectionManager = null;
+  DefaultHttpClient client = null;
   int poolSize;
   
   public ManifoldCFQParserPlugin()
@@ -116,14 +126,15 @@ public class ManifoldCFQParserPlugin ext
       if (client == null)
       {
         // Initialize the connection pool
-        HttpConnectionManagerParams params = new HttpConnectionManagerParams();
-        params.setTcpNoDelay(true);
-        params.setStaleCheckingEnabled(false);
-        params.setDefaultMaxConnectionsPerHost(poolSize);
-        params.setMaxTotalConnections(poolSize);
-        httpConnectionManager = new MultiThreadedHttpConnectionManager();
-        httpConnectionManager.setParams(params);
-        client = new HttpClient(httpConnectionManager);
+        httpConnectionManager = new ThreadSafeClientConnManager();
+        httpConnectionManager.setMaxTotal(poolSize);
+        httpConnectionManager.setDefaultMaxPerRoute(poolSize);
+        BasicHttpParams params = new BasicHttpParams();
+        params.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY,true);
+        params.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK,false);
+        params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT,socketTimeOut);
+        client = new DefaultHttpClient(httpConnectionManager,params);
+        client.setRedirectStrategy(new DefaultRedirectStrategy());
         core.addCloseHook(new CloseHandler());
       }
     }
@@ -261,21 +272,20 @@ public class ManifoldCFQParserPlugin ext
       // We can make this more complicated later, with support for https etc., but this is
enough to demonstrate how it all should work.
       String theURL = authorityBaseURL + "/UserACLs?username="+URLEncoder.encode(authenticatedUserName,"utf-8");
         
-      GetMethod method = new GetMethod(theURL);
+      HttpGet method = new HttpGet(theURL);
       try
       {
-        method.getParams().setParameter("http.socket.timeout", socketTimeOut);
-        method.setFollowRedirects(true);
-        int rval = client.executeMethod(method);
+        HttpResponse httpResponse = client.execute(method);
+        int rval = httpResponse.getStatusLine().getStatusCode();
         if (rval != 200)
         {
-          String response = method.getResponseBodyAsString();
+          String response = EntityUtils.toString(httpResponse.getEntity(),null);
           throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Couldn't fetch user's
access tokens from ManifoldCF authority service: "+Integer.toString(rval)+"; "+response);
         }
-        InputStream is = method.getResponseBodyAsStream();
+        InputStream is = httpResponse.getEntity().getContent();
         try
         {
-          Reader r = new InputStreamReader(is,method.getResponseCharSet());
+          Reader r = new InputStreamReader(is,EntityUtils.getContentCharSet(httpResponse.getEntity()));
           try
           {
             BufferedReader br = new BufferedReader(r);
@@ -317,7 +327,7 @@ public class ManifoldCFQParserPlugin ext
       }
       finally
       {
-        method.releaseConnection();
+        //method.releaseConnection();
       }
     }
   }

Modified: manifoldcf/integration/solr-4.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
URL: http://svn.apache.org/viewvc/manifoldcf/integration/solr-4.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java?rev=1354313&r1=1354312&r2=1354313&view=diff
==============================================================================
--- manifoldcf/integration/solr-4.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
(original)
+++ manifoldcf/integration/solr-4.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
Wed Jun 27 01:57:17 2012
@@ -29,9 +29,19 @@ import org.apache.solr.handler.component
 import org.apache.solr.core.CloseHook;
 import org.apache.solr.util.plugin.SolrCoreAware;
 import org.apache.solr.core.SolrCore;
-import org.apache.commons.httpclient.*;
-import org.apache.commons.httpclient.methods.*;
-import org.apache.commons.httpclient.params.*;
+import org.apache.http.client.HttpClient;
+import org.apache.http.HttpStatus;
+import org.apache.http.HttpException;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.conn.ConnectTimeoutException;
+import org.apache.http.HttpResponse;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpParams;
+import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.util.EntityUtils;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.DefaultRedirectStrategy;
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
 import org.slf4j.*;
 
 import java.io.*;
@@ -69,8 +79,8 @@ public class ManifoldCFSearchComponent e
   String fieldAllowShare = null;
   String fieldDenyShare = null;
   int socketTimeOut;
-  MultiThreadedHttpConnectionManager httpConnectionManager = null;
-  HttpClient client = null;
+  ThreadSafeClientConnManager httpConnectionManager = null;
+  DefaultHttpClient client = null;
   int poolSize;
   
   public ManifoldCFSearchComponent()
@@ -101,14 +111,15 @@ public class ManifoldCFSearchComponent e
     poolSize = (connectionPoolSize==null)?50:connectionPoolSize.intValue();
 
     // Initialize the connection pool
-    HttpConnectionManagerParams params = new HttpConnectionManagerParams();
-    params.setTcpNoDelay(true);
-    params.setStaleCheckingEnabled(false);
-    params.setDefaultMaxConnectionsPerHost(poolSize);
-    params.setMaxTotalConnections(poolSize);
-    httpConnectionManager = new MultiThreadedHttpConnectionManager();
-    httpConnectionManager.setParams(params);
-    client = new HttpClient(httpConnectionManager);
+    httpConnectionManager = new ThreadSafeClientConnManager();
+    httpConnectionManager.setMaxTotal(poolSize);
+    httpConnectionManager.setDefaultMaxPerRoute(poolSize);
+    BasicHttpParams params = new BasicHttpParams();
+    params.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY,true);
+    params.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK,false);
+    params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT,socketTimeOut);
+    client = new DefaultHttpClient(httpConnectionManager,params);
+    client.setRedirectStrategy(new DefaultRedirectStrategy());
   }
 
   @Override
@@ -255,9 +266,9 @@ public class ManifoldCFSearchComponent e
   }
 
   @Override
-  public String getSourceId()
+  public Category getCategory()
   {
-    return "$Id$";
+    return Category.QUERYHANDLER;
   }
 
   @Override
@@ -279,22 +290,21 @@ public class ManifoldCFSearchComponent e
   {
     // We can make this more complicated later, with support for https etc., but this is
enough to demonstrate how it all should work.
     String theURL = authorityBaseURL + "/UserACLs?username="+URLEncoder.encode(authenticatedUserName,"utf-8");
-      
-    GetMethod method = new GetMethod(theURL);
+        
+    HttpGet method = new HttpGet(theURL);
     try
     {
-      method.getParams().setParameter("http.socket.timeout", socketTimeOut);
-      method.setFollowRedirects(true);
-      int rval = client.executeMethod(method);
+      HttpResponse httpResponse = client.execute(method);
+      int rval = httpResponse.getStatusLine().getStatusCode();
       if (rval != 200)
       {
-        String response = method.getResponseBodyAsString();
+        String response = EntityUtils.toString(httpResponse.getEntity(),null);
         throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Couldn't fetch user's
access tokens from ManifoldCF authority service: "+Integer.toString(rval)+"; "+response);
       }
-      InputStream is = method.getResponseBodyAsStream();
+      InputStream is = httpResponse.getEntity().getContent();
       try
       {
-        Reader r = new InputStreamReader(is,method.getResponseCharSet());
+        Reader r = new InputStreamReader(is,EntityUtils.getContentCharSet(httpResponse.getEntity()));
         try
         {
           BufferedReader br = new BufferedReader(r);
@@ -336,7 +346,7 @@ public class ManifoldCFSearchComponent e
     }
     finally
     {
-      method.releaseConnection();
+      //method.releaseConnection();
     }
   }
   
@@ -360,6 +370,7 @@ public class ManifoldCFSearchComponent e
       if (httpConnectionManager != null)
       {
         httpConnectionManager.shutdown();
+	System.out.println("Just shutdown httpConnectionmanager");
         httpConnectionManager = null;
         client = null;
       }

Modified: manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFQParserPluginTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFQParserPluginTest.java?rev=1354313&r1=1354312&r2=1354313&view=diff
==============================================================================
--- manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFQParserPluginTest.java
(original)
+++ manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFQParserPluginTest.java
Wed Jun 27 01:57:17 2012
@@ -27,9 +27,12 @@ import org.apache.solr.SolrTestCaseJ4;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHolder;
+
+import org.eclipse.jetty.server.handler.ContextHandlerCollection;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
 
 public class ManifoldCFQParserPluginTest extends SolrTestCaseJ4 {
   
@@ -142,8 +145,12 @@ public class ManifoldCFQParserPluginTest
     
     public MockMCFAuthorityService() {
       server = new Server(8347);
-      Context asContext = new Context(server,"/mcf-as",Context.SESSIONS);
+      ContextHandlerCollection contexts = new ContextHandlerCollection();
+      server.setHandler(contexts);
+
+      ServletContextHandler asContext = new ServletContextHandler(contexts,"/mcf-as",ServletContextHandler.SESSIONS);
       asContext.addServlet(new ServletHolder(new UserACLServlet()), "/UserACLs");
+      contexts.addHandler(asContext);
     }
     
     public void start() throws Exception {

Modified: manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFSCLoadTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFSCLoadTest.java?rev=1354313&r1=1354312&r2=1354313&view=diff
==============================================================================
--- manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFSCLoadTest.java
(original)
+++ manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFSCLoadTest.java
Wed Jun 27 01:57:17 2012
@@ -27,9 +27,12 @@ import org.apache.solr.SolrTestCaseJ4;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHolder;
+
+import org.eclipse.jetty.server.handler.ContextHandlerCollection;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
 
 public class ManifoldCFSCLoadTest extends SolrTestCaseJ4 {
   
@@ -101,8 +104,12 @@ public class ManifoldCFSCLoadTest extend
     
     public MockMCFAuthorityService() {
       server = new Server(8346);
-      Context asContext = new Context(server,"/mcf-as",Context.SESSIONS);
+      ContextHandlerCollection contexts = new ContextHandlerCollection();
+      server.setHandler(contexts);
+
+      ServletContextHandler asContext = new ServletContextHandler(contexts,"/mcf-as",ServletContextHandler.SESSIONS);
       asContext.addServlet(new ServletHolder(new UserACLServlet()), "/UserACLs");
+      contexts.addHandler(asContext);
     }
     
     public void start() throws Exception {

Modified: manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFSearchComponentTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFSearchComponentTest.java?rev=1354313&r1=1354312&r2=1354313&view=diff
==============================================================================
--- manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFSearchComponentTest.java
(original)
+++ manifoldcf/integration/solr-4.x/trunk/mcf/src/test/org/apache/solr/mcf/ManifoldCFSearchComponentTest.java
Wed Jun 27 01:57:17 2012
@@ -27,9 +27,12 @@ import org.apache.solr.SolrTestCaseJ4;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHolder;
+
+import org.eclipse.jetty.server.handler.ContextHandlerCollection;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
 
 public class ManifoldCFSearchComponentTest extends SolrTestCaseJ4 {
   
@@ -153,8 +156,12 @@ public class ManifoldCFSearchComponentTe
     
     public MockMCFAuthorityService() {
       server = new Server(8345);
-      Context asContext = new Context(server,"/mcf-authority-service",Context.SESSIONS);
+      ContextHandlerCollection contexts = new ContextHandlerCollection();
+      server.setHandler(contexts);
+
+      ServletContextHandler asContext = new ServletContextHandler(contexts,"/mcf-as",ServletContextHandler.SESSIONS);
       asContext.addServlet(new ServletHolder(new UserACLServlet()), "/UserACLs");
+      contexts.addHandler(asContext);
     }
     
     public void start() throws Exception {



Mime
View raw message