SEARCH-540: Fixed issues after moving enterprise only code

This commit is contained in:
Tuna Aksoy
2017-08-31 13:31:17 +01:00
parent 85816b90c1
commit db42224c86
6 changed files with 2066 additions and 2074 deletions
@@ -5,7 +5,6 @@ import org.alfresco.solr.client.Node;
import org.alfresco.solr.client.NodeMetaData;
import org.alfresco.solr.client.SOLRAPIQueueClient;
import org.alfresco.solr.client.Transaction;
import org.alfresco.solr.stream.AlfrescoStreamHandler;
import org.apache.commons.io.FileUtils;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.Query;
@@ -1033,7 +1032,7 @@ public abstract class AbstractAlfrescoDistributedTest extends SolrTestCaseJ4
}
protected QueryRequest getAlfrescoRequest(String json, SolrParams params) {
QueryRequest request = new AlfrescoStreamHandler.AlfrescoQueryRequest(json, params);
QueryRequest request = new AlfrescoJsonQueryRequest(json, params);
request.setMethod(SolrRequest.METHOD.POST);
return request;
}
@@ -1,84 +1,83 @@
/*
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.solr;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.alfresco.solr.stream.AlfrescoStreamHandler;
import org.apache.solr.BaseDistributedSearchTestCase;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.ContentStream;
import org.apache.solr.common.util.ContentStreamBase;
/**
* @author Joel
*/
@SolrTestCaseJ4.SuppressSSL
public abstract class AlfrescoBaseDistributedSearchTestCase extends BaseDistributedSearchTestCase
{
public AlfrescoBaseDistributedSearchTestCase()
{
System.setProperty("alfresco.test", "true");
}
protected QueryRequest getAlfrescoRequest(String json, SolrParams params) {
QueryRequest request = new AlfrescoStreamHandler.AlfrescoQueryRequest(json, params);
request.setMethod(SolrRequest.METHOD.POST);
return request;
}
/**
* Returns the QueryResponse from {@link #queryServer}
*/
protected QueryResponse query(String json, ModifiableSolrParams params) throws Exception
{
params.set("distrib", "false");
QueryRequest request = getAlfrescoRequest(json, params);
QueryResponse controlRsp = request.process(controlClient);
validateControlData(controlRsp);
params.remove("distrib");
setDistributedParams(params);
QueryResponse rsp = queryServer(json, params);
compareResponses(rsp, controlRsp);
return rsp;
}
protected QueryResponse queryServer(String json, SolrParams params) throws SolrServerException, IOException
{
// query a random server
int which = r.nextInt(clients.size());
SolrClient client = clients.get(which);
QueryRequest request = getAlfrescoRequest(json, params);
return request.process(client);
}
}
/*
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.solr;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.solr.BaseDistributedSearchTestCase;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.ContentStream;
import org.apache.solr.common.util.ContentStreamBase;
/**
* @author Joel
*/
@SolrTestCaseJ4.SuppressSSL
public abstract class AlfrescoBaseDistributedSearchTestCase extends BaseDistributedSearchTestCase
{
public AlfrescoBaseDistributedSearchTestCase()
{
System.setProperty("alfresco.test", "true");
}
protected QueryRequest getAlfrescoRequest(String json, SolrParams params) {
QueryRequest request = new AlfrescoJsonQueryRequest(json, params);
request.setMethod(SolrRequest.METHOD.POST);
return request;
}
/**
* Returns the QueryResponse from {@link #queryServer}
*/
protected QueryResponse query(String json, ModifiableSolrParams params) throws Exception
{
params.set("distrib", "false");
QueryRequest request = getAlfrescoRequest(json, params);
QueryResponse controlRsp = request.process(controlClient);
validateControlData(controlRsp);
params.remove("distrib");
setDistributedParams(params);
QueryResponse rsp = queryServer(json, params);
compareResponses(rsp, controlRsp);
return rsp;
}
protected QueryResponse queryServer(String json, SolrParams params) throws SolrServerException, IOException
{
// query a random server
int which = r.nextInt(clients.size());
SolrClient client = clients.get(which);
QueryRequest request = getAlfrescoRequest(json, params);
return request.process(client);
}
}
@@ -0,0 +1,47 @@
/*
* Copyright (C) 2005-2017 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.solr;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.ContentStream;
import org.apache.solr.common.util.ContentStreamBase;
public class AlfrescoJsonQueryRequest extends QueryRequest
{
private static final long serialVersionUID = 3259015603145833490L;
private String json;
public AlfrescoJsonQueryRequest(String json, SolrParams params)
{
super(params);
this.json =json;
}
public Collection<ContentStream> getContentStreams()
{
List<ContentStream> streams = new ArrayList<ContentStream>();
streams.add(new ContentStreamBase.StringStream(json));
return streams;
}
}
@@ -27,6 +27,5 @@ public interface SolrTestFiles
public final String TEST_FILES_LOCATION = "target/test-classes/test-files";
public final String TEST_SOLR_COLLECTION = TEST_FILES_LOCATION + "/collection1";
public final String TEST_SOLR_CONF = TEST_SOLR_COLLECTION + "/conf/";
public final String RERANK_CONF = "src/main/resources/solr/instance/templates/rerank/conf/";
public final String RERANK_CONF = TEST_FILES_LOCATION + "/templates/rerank/conf/";
}
@@ -359,26 +359,6 @@
</arr>
</requestHandler>
<requestHandler name="/stream" class="org.alfresco.solr.stream.AlfrescoStreamHandler">
<lst name="defaults">
<str name="wt">json</str>
</lst>
<lst name="invariants">
<str name="distrib">false</str>
</lst>
</requestHandler>
<requestHandler name="/sql" class="org.apache.solr.handler.AlfrescoSQLHandler">
<lst name="defaults">
<str name="wt">json</str>
</lst>
<lst name="invariants">
<str name="distrib">false</str>
</lst>
</requestHandler>
<requestHandler name="/mlt" class="solr.MoreLikeThisHandler">
</requestHandler>
@@ -495,16 +475,9 @@
<queryParser name="afts" class="org.alfresco.solr.query.AlfrescoFTSQParserPlugin"/>
<queryParser name="cmis" class="org.alfresco.solr.query.CmisQParserPlugin"/>
<expressible name="timeSeries" class="org.alfresco.solr.stream.TimeSeriesStream"/>
<expressible name="stats" class="org.alfresco.solr.stream.StatsStream"/>
<expressible name="alfrescoStats" class="org.alfresco.solr.stream.AlfrescoStatsStream"/>
<expressible name="alfrescoTimeSeries" class="org.alfresco.solr.stream.AlfrescoTimeSeriesStream"/>
<expressible name="alfrescoExpr" class="org.alfresco.solr.stream.AlfrescoExpressionStream"/>
<expressible name="search" class="org.alfresco.solr.stream.SearchStream"/>
<expressible name="facet" class="org.alfresco.solr.stream.FacetStream"/>
<expressible name="alfrescoFacets" class="org.alfresco.solr.stream.AlfrescoFacetStream"/>
<expressible name="having" class="org.apache.solr.client.solrj.io.stream.HavingStream"/>
<expressible name="limit" class="org.alfresco.solr.stream.LimitStream"/>
<xi:include href="solrconfig_insight.xml" xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:fallback/>
</xi:include>
<!--
<queryParser name="mimetype" class="org.alfresco.solr.query.MimetypeGroupingQParserPlugin" >
<str name="mapping">conf/mime_types.csv</str>