mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-09-17 14:21:20 +00:00
Merge branch 'master' of git.alfresco.com:search_discovery/insightengine into fix/SEARCH-1994_multiple_versions
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
<name>Search Analytics E2E Tests</name>
|
<name>Search Analytics E2E Tests</name>
|
||||||
<description>Test Project to test Search Service and Analytics Features on a complete setup of Alfresco, Share</description>
|
<description>Test Project to test Search Service and Analytics Features on a complete setup of Alfresco, Share</description>
|
||||||
<properties>
|
<properties>
|
||||||
<tas.rest.api.version>1.20</tas.rest.api.version>
|
<tas.rest.api.version>1.21</tas.rest.api.version>
|
||||||
<tas.cmis.api.version>1.11</tas.cmis.api.version>
|
<tas.cmis.api.version>1.11</tas.cmis.api.version>
|
||||||
<tas.utility.version>3.0.16</tas.utility.version>
|
<tas.utility.version>3.0.16</tas.utility.version>
|
||||||
<rm.version>3.2.0</rm.version>
|
<rm.version>3.2.0</rm.version>
|
||||||
|
@@ -33,7 +33,6 @@ import org.apache.solr.core.SolrCore;
|
|||||||
import org.apache.solr.request.LocalSolrQueryRequest;
|
import org.apache.solr.request.LocalSolrQueryRequest;
|
||||||
import org.apache.solr.request.SolrQueryRequest;
|
import org.apache.solr.request.SolrQueryRequest;
|
||||||
import org.apache.solr.response.SolrQueryResponse;
|
import org.apache.solr.response.SolrQueryResponse;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -83,8 +82,9 @@ import static org.alfresco.repo.search.adaptor.lucene.QueryConstants.FIELD_VERSI
|
|||||||
* class hierarchy. Ideally this function should be retired in favour of better
|
* class hierarchy. Ideally this function should be retired in favour of better
|
||||||
* annotations..
|
* annotations..
|
||||||
*
|
*
|
||||||
* @since solr 1.5
|
* @since solr 1.4.1
|
||||||
* @author Michael Suzuki
|
* @author Michael Suzuki
|
||||||
|
* @author Andrea Gazzarini
|
||||||
*/
|
*/
|
||||||
@ThreadLeakLingering(linger = 5000)
|
@ThreadLeakLingering(linger = 5000)
|
||||||
public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
||||||
@@ -92,8 +92,8 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
protected static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
protected static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||||
|
|
||||||
protected String[] deadServers;
|
protected String[] deadServers;
|
||||||
protected static SolrResponsesComparator solrComparator = new SolrResponsesComparator();
|
protected static SolrResponsesComparator SOLR_RESPONSE_COMPARATOR = new SolrResponsesComparator();
|
||||||
protected static RandomSupplier solrRandomSupplier;
|
protected static RandomSupplier SOLR_RANDOM_SUPPLIER;
|
||||||
|
|
||||||
// to stress with higher thread counts and requests, make sure the junit
|
// to stress with higher thread counts and requests, make sure the junit
|
||||||
// xml formatter is not being used (all output will be buffered before
|
// xml formatter is not being used (all output will be buffered before
|
||||||
@@ -112,34 +112,26 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
* Test configs may use the <code>${hostContext}</code> variable to access
|
* Test configs may use the <code>${hostContext}</code> variable to access
|
||||||
* this system property.
|
* this system property.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpSolrTestProperties()
|
public static void setUpSolrTestProperties()
|
||||||
{
|
{
|
||||||
|
SOLR_RANDOM_SUPPLIER = new RandomSupplier();
|
||||||
System.setProperty("alfresco.test", "true");
|
System.setProperty("alfresco.test", "true");
|
||||||
System.setProperty("solr.tests.maxIndexingThreads", "10");
|
System.setProperty("solr.tests.maxIndexingThreads", "10");
|
||||||
System.setProperty("solr.tests.ramBufferSizeMB", "1024");
|
System.setProperty("solr.tests.ramBufferSizeMB", "1024");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
public static final String[] FIELD_NAMES = new String[] { "n_ti1", "n_f1", "n_tf1", "n_d1", "n_td1", "n_l1", "n_tl1", "n_dt1", "n_tdt1" };
|
||||||
public void setupPerTest()
|
|
||||||
{
|
|
||||||
this.solrRandomSupplier = new RandomSupplier();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static String[] fieldNames = new String[]
|
|
||||||
{ "n_ti1", "n_f1", "n_tf1", "n_d1", "n_td1", "n_l1", "n_tl1", "n_dt1", "n_tdt1" };
|
|
||||||
|
|
||||||
|
|
||||||
protected static String[] getFieldNames()
|
protected static String[] getFieldNames()
|
||||||
{
|
{
|
||||||
return fieldNames;
|
return FIELD_NAMES;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void putHandleDefaults() {
|
protected static void putHandleDefaults()
|
||||||
solrComparator.putHandleDefaults();
|
{
|
||||||
|
SOLR_RESPONSE_COMPARATOR.putHandleDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,8 +139,6 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
* @param query - query to execute
|
* @param query - query to execute
|
||||||
* @param count - min number of results each shard must satisfy
|
* @param count - min number of results each shard must satisfy
|
||||||
* @param waitMillis - total ms to wait
|
* @param waitMillis - total ms to wait
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static boolean checkMinCountPerShard(Query query, int count, long waitMillis) throws SolrServerException,IOException
|
public static boolean checkMinCountPerShard(Query query, int count, long waitMillis) throws SolrServerException,IOException
|
||||||
{
|
{
|
||||||
@@ -160,7 +150,7 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
for (SolrClient singleShard : shardedClients)
|
for (SolrClient singleShard : shardedClients)
|
||||||
{
|
{
|
||||||
allShardCompliant = false;
|
allShardCompliant = false;
|
||||||
int totalHits = 0;
|
int totalHits;
|
||||||
int cycles = 1;
|
int cycles = 1;
|
||||||
while ((new Date()).getTime() < timeout && (!allShardCompliant))
|
while ((new Date()).getTime() < timeout && (!allShardCompliant))
|
||||||
{
|
{
|
||||||
@@ -172,11 +162,11 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Thread.sleep((long) (500 * cycles++));
|
Thread.sleep(500 * cycles++);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e)
|
catch (InterruptedException e)
|
||||||
{
|
{
|
||||||
continue;
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,11 +195,6 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits until all cores (including shards) reach a count.
|
* Waits until all cores (including shards) reach a count.
|
||||||
*
|
|
||||||
* @param query
|
|
||||||
* @param count
|
|
||||||
* @param waitMillis
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static void waitForDocCountAllCores(Query query, int count, long waitMillis) throws Exception
|
public static void waitForDocCountAllCores(Query query, int count, long waitMillis) throws Exception
|
||||||
{
|
{
|
||||||
@@ -230,12 +215,9 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delele by query on all Clients
|
* Delele by query on all Clients
|
||||||
*
|
|
||||||
* @param q
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static void deleteByQueryAllClients(String q) throws Exception {
|
public static void deleteByQueryAllClients(String q) throws Exception
|
||||||
|
{
|
||||||
List<SolrClient> clients = getStandaloneAndShardedClients();
|
List<SolrClient> clients = getStandaloneAndShardedClients();
|
||||||
|
|
||||||
for (SolrClient client : clients) {
|
for (SolrClient client : clients) {
|
||||||
@@ -245,15 +227,12 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Default test client.
|
* Gets the Default test client.
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
protected static SolrClient getDefaultTestClient()
|
protected static SolrClient getDefaultTestClient()
|
||||||
{
|
{
|
||||||
return solrCollectionNameToStandaloneClient.get(DEFAULT_TEST_CORENAME);
|
return solrCollectionNameToStandaloneClient.get(DEFAULT_TEST_CORENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected static List<SolrClient> getShardedClients()
|
protected static List<SolrClient> getShardedClients()
|
||||||
{
|
{
|
||||||
return clientShards;
|
return clientShards;
|
||||||
@@ -266,7 +245,7 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
*/
|
*/
|
||||||
public static List<SolrClient> getStandaloneAndShardedClients()
|
public static List<SolrClient> getStandaloneAndShardedClients()
|
||||||
{
|
{
|
||||||
List<SolrClient> clients = new ArrayList();
|
List<SolrClient> clients = new ArrayList<>();
|
||||||
clients.addAll(solrCollectionNameToStandaloneClient.values());
|
clients.addAll(solrCollectionNameToStandaloneClient.values());
|
||||||
clients.addAll(clientShards);
|
clients.addAll(clientShards);
|
||||||
return clients;
|
return clients;
|
||||||
@@ -275,17 +254,11 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
|
|
||||||
public static List<SolrClient> getStandaloneClients()
|
public static List<SolrClient> getStandaloneClients()
|
||||||
{
|
{
|
||||||
List<SolrClient> clients = new ArrayList();
|
return new ArrayList<>(solrCollectionNameToStandaloneClient.values());
|
||||||
clients.addAll(solrCollectionNameToStandaloneClient.values());
|
|
||||||
return clients;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for the doc count on the first core available, then checks all the Shards match.
|
* Waits for the doc count on the first core available, then checks all the Shards match.
|
||||||
* @param query
|
|
||||||
* @param count
|
|
||||||
* @param waitMillis
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static void waitForDocCount(Query query, int count, long waitMillis) throws Exception
|
public static void waitForDocCount(Query query, int count, long waitMillis) throws Exception
|
||||||
{
|
{
|
||||||
@@ -332,7 +305,8 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
return escapedField + ":" + value + " ";
|
return escapedField + ":" + value + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String escapeQueryChars(String query) {
|
protected static String escapeQueryChars(String query)
|
||||||
|
{
|
||||||
return query.replaceAll("\\:", "\\\\:")
|
return query.replaceAll("\\:", "\\\\:")
|
||||||
.replaceAll("\\{", "\\\\{")
|
.replaceAll("\\{", "\\\\{")
|
||||||
.replaceAll("\\}", "\\\\}");
|
.replaceAll("\\}", "\\\\}");
|
||||||
@@ -341,7 +315,7 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
public static SolrQuery luceneToSolrQuery(Query query)
|
public static SolrQuery luceneToSolrQuery(Query query)
|
||||||
{
|
{
|
||||||
String[] terms = query.toString().split(" ");
|
String[] terms = query.toString().split(" ");
|
||||||
String escapedQuery = new String();
|
String escapedQuery = "";
|
||||||
for (String t : terms)
|
for (String t : terms)
|
||||||
{
|
{
|
||||||
escapedQuery += escapeQueryClause(t);
|
escapedQuery += escapeQueryClause(t);
|
||||||
@@ -366,8 +340,10 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
waitForShardsCount(solrQuery, count, waitMillis, start);
|
waitForShardsCount(solrQuery, count, waitMillis, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void injectDocToShards(long txnId, long aclId, long dbId, String owner) throws Exception {
|
protected static void injectDocToShards(long txnId, long aclId, long dbId, String owner) throws Exception
|
||||||
for(SolrClient clientShard : clientShards) {
|
{
|
||||||
|
for(SolrClient clientShard : clientShards)
|
||||||
|
{
|
||||||
SolrInputDocument doc = new SolrInputDocument();
|
SolrInputDocument doc = new SolrInputDocument();
|
||||||
String id = AlfrescoSolrDataModel.getNodeDocumentId(AlfrescoSolrDataModel.DEFAULT_TENANT, aclId, dbId);
|
String id = AlfrescoSolrDataModel.getNodeDocumentId(AlfrescoSolrDataModel.DEFAULT_TENANT, aclId, dbId);
|
||||||
doc.addField(FIELD_SOLR4_ID, id);
|
doc.addField(FIELD_SOLR4_ID, id);
|
||||||
@@ -383,21 +359,20 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the cores for the jetty instances
|
* Gets the cores for the jetty instances
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
protected static List<SolrCore> getJettyCores(Collection<JettySolrRunner> runners)
|
protected static List<SolrCore> getJettyCores(Collection<JettySolrRunner> runners)
|
||||||
{
|
{
|
||||||
List<SolrCore> cores = new ArrayList();
|
List<SolrCore> cores = new ArrayList<>();
|
||||||
for (JettySolrRunner jettySolrRunner : runners)
|
for (JettySolrRunner jettySolrRunner : runners)
|
||||||
{
|
{
|
||||||
jettySolrRunner.getCoreContainer().getCores().forEach(aCore -> cores.add(aCore));
|
cores.addAll(jettySolrRunner.getCoreContainer().getCores());
|
||||||
}
|
}
|
||||||
return cores;
|
return cores;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static List<AlfrescoCoreAdminHandler> getAdminHandlers(Collection<JettySolrRunner> runners)
|
protected static List<AlfrescoCoreAdminHandler> getAdminHandlers(Collection<JettySolrRunner> runners)
|
||||||
{
|
{
|
||||||
List<AlfrescoCoreAdminHandler> coreAdminHandlers = new ArrayList();
|
List<AlfrescoCoreAdminHandler> coreAdminHandlers = new ArrayList<>();
|
||||||
for (JettySolrRunner jettySolrRunner : runners)
|
for (JettySolrRunner jettySolrRunner : runners)
|
||||||
{
|
{
|
||||||
CoreContainer coreContainer = jettySolrRunner.getCoreContainer();
|
CoreContainer coreContainer = jettySolrRunner.getCoreContainer();
|
||||||
@@ -418,32 +393,27 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
List<SolrClient> clients = getShardedClients();
|
List<SolrClient> clients = getShardedClients();
|
||||||
SolrQuery query = luceneToSolrQuery(new TermQuery(new Term(FIELD_DOC_TYPE, SolrInformationServer.DOC_TYPE_NODE)));
|
SolrQuery query = luceneToSolrQuery(new TermQuery(new Term(FIELD_DOC_TYPE, SolrInformationServer.DOC_TYPE_NODE)));
|
||||||
StringBuilder error = new StringBuilder();
|
StringBuilder error = new StringBuilder();
|
||||||
for (int i = 0; i < clients.size(); ++i)
|
for (SolrClient client : clients)
|
||||||
{
|
{
|
||||||
SolrClient client = clients.get(i);
|
|
||||||
|
|
||||||
|
|
||||||
QueryResponse response = client.query(query);
|
QueryResponse response = client.query(query);
|
||||||
int totalHits = (int) response.getResults().getNumFound();
|
int totalHits = (int) response.getResults().getNumFound();
|
||||||
|
|
||||||
|
|
||||||
if(totalHits > 0)
|
if (totalHits > 0)
|
||||||
{
|
{
|
||||||
shardHit++;
|
shardHit++;
|
||||||
}
|
}
|
||||||
if(totalHits < count)
|
|
||||||
|
if (totalHits < count)
|
||||||
{
|
{
|
||||||
if (ignoreZero && totalHits == 0)
|
if (ignoreZero && totalHits == 0) {
|
||||||
{
|
log.info(client + ": have zero hits ");
|
||||||
log.info(client+": have zero hits ");
|
} else {
|
||||||
}
|
error.append(" " + client + ": ");
|
||||||
else
|
error.append("Expected nodes per shard greater than " + count + " found " + totalHits + " : " + query.toString());
|
||||||
{
|
|
||||||
error.append(" "+client+": ");
|
|
||||||
error.append("Expected nodes per shard greater than "+count+" found "+totalHits+" : "+query.toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info(client+": Hits "+totalHits);
|
log.info(client + ": Hits " + totalHits);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,7 +530,7 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
|
|
||||||
protected String getShardsString()
|
protected String getShardsString()
|
||||||
{
|
{
|
||||||
Random r = solrRandomSupplier.getRandomGenerator();
|
Random r = SOLR_RANDOM_SUPPLIER.getRandomGenerator();
|
||||||
if (deadServers == null)
|
if (deadServers == null)
|
||||||
return shards;
|
return shards;
|
||||||
|
|
||||||
@@ -610,7 +580,7 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
|
|
||||||
protected static SolrInputDocument addRandFields(SolrInputDocument sdoc)
|
protected static SolrInputDocument addRandFields(SolrInputDocument sdoc)
|
||||||
{
|
{
|
||||||
addFields(sdoc, solrRandomSupplier.getRandFields(getFieldNames(), solrRandomSupplier.getRandValues()));
|
addFields(sdoc, SOLR_RANDOM_SUPPLIER.getRandFields(getFieldNames(), SOLR_RANDOM_SUPPLIER.getRandValues()));
|
||||||
return sdoc;
|
return sdoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,7 +632,7 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
{
|
{
|
||||||
UpdateResponse controlRsp = add(client1, params, sdocs);
|
UpdateResponse controlRsp = add(client1, params, sdocs);
|
||||||
UpdateResponse specificRsp = add(client2, params, sdocs);
|
UpdateResponse specificRsp = add(client2, params, sdocs);
|
||||||
solrComparator.compareSolrResponses(specificRsp, controlRsp);
|
SOLR_RESPONSE_COMPARATOR.compareSolrResponses(specificRsp, controlRsp);
|
||||||
return specificRsp;
|
return specificRsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,9 +694,6 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* * Commits to the specified client, and optionally all shards
|
* * Commits to the specified client, and optionally all shards
|
||||||
* @param client
|
|
||||||
* @param andShards
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
protected static void commit(SolrClient client, boolean andShards) throws Exception
|
protected static void commit(SolrClient client, boolean andShards) throws Exception
|
||||||
{
|
{
|
||||||
@@ -743,7 +710,7 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
|
|
||||||
protected static QueryResponse queryRandomShard(ModifiableSolrParams params) throws SolrServerException, IOException
|
protected static QueryResponse queryRandomShard(ModifiableSolrParams params) throws SolrServerException, IOException
|
||||||
{
|
{
|
||||||
Random r = solrRandomSupplier.getRandomGenerator();
|
Random r = SOLR_RANDOM_SUPPLIER.getRandomGenerator();
|
||||||
int which = r.nextInt(clientShards.size());
|
int which = r.nextInt(clientShards.size());
|
||||||
SolrClient client = clientShards.get(which);
|
SolrClient client = clientShards.get(which);
|
||||||
QueryResponse rsp = client.query(params);
|
QueryResponse rsp = client.query(params);
|
||||||
@@ -755,13 +722,13 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
params.set("distrib", "false");
|
params.set("distrib", "false");
|
||||||
QueryRequest request = getAlfrescoRequest(json, params);
|
QueryRequest request = getAlfrescoRequest(json, params);
|
||||||
QueryResponse controlRsp = request.process(solrClient);
|
QueryResponse controlRsp = request.process(solrClient);
|
||||||
solrComparator.validateResponse(controlRsp);
|
SOLR_RESPONSE_COMPARATOR.validateResponse(controlRsp);
|
||||||
if (andShards)
|
if (andShards)
|
||||||
{
|
{
|
||||||
params.remove("distrib");
|
params.remove("distrib");
|
||||||
setDistributedParams(params);
|
setDistributedParams(params);
|
||||||
QueryResponse rsp = queryRandomShard(json, params);
|
QueryResponse rsp = queryRandomShard(json, params);
|
||||||
solrComparator.compareResponses(rsp, controlRsp);
|
SOLR_RESPONSE_COMPARATOR.compareResponses(rsp, controlRsp);
|
||||||
return rsp;
|
return rsp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -772,7 +739,7 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
|
|
||||||
protected static QueryResponse queryRandomShard(String json, SolrParams params) throws SolrServerException, IOException
|
protected static QueryResponse queryRandomShard(String json, SolrParams params) throws SolrServerException, IOException
|
||||||
{
|
{
|
||||||
Random r = solrRandomSupplier.getRandomGenerator();
|
Random r = SOLR_RANDOM_SUPPLIER.getRandomGenerator();
|
||||||
int which = r.nextInt(clientShards.size());
|
int which = r.nextInt(clientShards.size());
|
||||||
SolrClient client = clientShards.get(which);
|
SolrClient client = clientShards.get(which);
|
||||||
QueryRequest request = getAlfrescoRequest(json, params);
|
QueryRequest request = getAlfrescoRequest(json, params);
|
||||||
@@ -791,13 +758,13 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
*/
|
*/
|
||||||
protected QueryResponse query(SolrClient solrClient, boolean setDistribParams, SolrParams p) throws Exception
|
protected QueryResponse query(SolrClient solrClient, boolean setDistribParams, SolrParams p) throws Exception
|
||||||
{
|
{
|
||||||
Random r = solrRandomSupplier.getRandomGenerator();
|
Random r = SOLR_RANDOM_SUPPLIER.getRandomGenerator();
|
||||||
final ModifiableSolrParams params = new ModifiableSolrParams(p);
|
final ModifiableSolrParams params = new ModifiableSolrParams(p);
|
||||||
|
|
||||||
// TODO: look into why passing true causes fails
|
// TODO: look into why passing true causes fails
|
||||||
params.set("distrib", "false");
|
params.set("distrib", "false");
|
||||||
final QueryResponse controlRsp = solrClient.query(params);
|
final QueryResponse controlRsp = solrClient.query(params);
|
||||||
solrComparator.validateResponse(controlRsp);
|
SOLR_RESPONSE_COMPARATOR.validateResponse(controlRsp);
|
||||||
|
|
||||||
params.remove("distrib");
|
params.remove("distrib");
|
||||||
if (setDistribParams)
|
if (setDistribParams)
|
||||||
@@ -805,7 +772,7 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
|
|
||||||
QueryResponse rsp = queryRandomShard(params);
|
QueryResponse rsp = queryRandomShard(params);
|
||||||
|
|
||||||
solrComparator.compareResponses(rsp, controlRsp);
|
SOLR_RESPONSE_COMPARATOR.compareResponses(rsp, controlRsp);
|
||||||
|
|
||||||
if (stress > 0)
|
if (stress > 0)
|
||||||
{
|
{
|
||||||
@@ -827,7 +794,7 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
QueryResponse rsp = client.query(new ModifiableSolrParams(params));
|
QueryResponse rsp = client.query(new ModifiableSolrParams(params));
|
||||||
if (verifyStress)
|
if (verifyStress)
|
||||||
{
|
{
|
||||||
solrComparator.compareResponses(rsp, controlRsp);
|
SOLR_RESPONSE_COMPARATOR.compareResponses(rsp, controlRsp);
|
||||||
}
|
}
|
||||||
} catch (SolrServerException | IOException e)
|
} catch (SolrServerException | IOException e)
|
||||||
{
|
{
|
||||||
@@ -865,7 +832,7 @@ public abstract class AbstractAlfrescoDistributedIT extends SolrITInitializer
|
|||||||
first = rsp;
|
first = rsp;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
solrComparator.compareResponses(first, rsp);
|
SOLR_RESPONSE_COMPARATOR.compareResponses(first, rsp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,8 +91,8 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
//Standalone Tests
|
//Standalone Tests
|
||||||
protected static SolrCore defaultCore;
|
protected static SolrCore defaultCore;
|
||||||
|
|
||||||
protected static final int clientConnectionTimeout = DEFAULT_CONNECTION_TIMEOUT;;
|
protected static final int clientConnectionTimeout = DEFAULT_CONNECTION_TIMEOUT;
|
||||||
protected static final int clientSoTimeout = 90000;;
|
protected static final int clientSoTimeout = 90000;
|
||||||
|
|
||||||
protected static final String id = "id";
|
protected static final String id = "id";
|
||||||
|
|
||||||
@@ -129,21 +129,22 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
jettyContainers = new HashMap<>();
|
jettyContainers = new HashMap<>();
|
||||||
|
|
||||||
nodeCnt = new AtomicInteger(0);
|
nodeCnt = new AtomicInteger(0);
|
||||||
String serverName = testClassName;
|
currentTestName = testClassName;
|
||||||
currentTestName = serverName;
|
|
||||||
String[] coreNames = new String[]{DEFAULT_TEST_CORENAME};
|
String[] coreNames = new String[]{DEFAULT_TEST_CORENAME};
|
||||||
|
|
||||||
distribSetUp(serverName);
|
distribSetUp(testClassName);
|
||||||
RandomSupplier.RandVal.uniqueValues = new HashSet(); // reset random values
|
RandomSupplier.RandVal.uniqueValues = new HashSet<>(); // reset random values
|
||||||
createServers(serverName, coreNames, numShards,solrcoreProperties);
|
createServers(testClassName, coreNames, numShards,solrcoreProperties);
|
||||||
System.setProperty("solr.solr.home", testDir.toPath().resolve(serverName).toString());
|
System.setProperty("solr.solr.home", testDir.toPath().resolve(testClassName).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Properties addExplicitShardingProperty(Properties solrcoreProperties)
|
private static Properties addExplicitShardingProperty(Properties solrcoreProperties)
|
||||||
{
|
{
|
||||||
if(solrcoreProperties == null){
|
if(solrcoreProperties == null)
|
||||||
|
{
|
||||||
solrcoreProperties = new Properties();
|
solrcoreProperties = new Properties();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(solrcoreProperties.getProperty("shard.method")==null)
|
if(solrcoreProperties.getProperty("shard.method")==null)
|
||||||
{
|
{
|
||||||
solrcoreProperties.put("shard.method", "EXPLICIT_ID");
|
solrcoreProperties.put("shard.method", "EXPLICIT_ID");
|
||||||
@@ -151,7 +152,8 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
return solrcoreProperties;
|
return solrcoreProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initSingleSolrServer(String testClassName, Properties solrcoreProperties) throws Throwable {
|
public static void initSingleSolrServer(String testClassName, Properties solrcoreProperties) throws Throwable
|
||||||
|
{
|
||||||
initSolrServers(0,testClassName,solrcoreProperties);
|
initSolrServers(0,testClassName,solrcoreProperties);
|
||||||
|
|
||||||
JettySolrRunner jsr = jettyContainers.get(testClassName);
|
JettySolrRunner jsr = jettyContainers.get(testClassName);
|
||||||
@@ -163,7 +165,8 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
extras = new String[solrcoreProperties.size()*2];
|
extras = new String[solrcoreProperties.size()*2];
|
||||||
for (Map.Entry<Object, Object> prop:solrcoreProperties.entrySet()) {
|
for (Map.Entry<Object, Object> prop:solrcoreProperties.entrySet())
|
||||||
|
{
|
||||||
extras[i++] = "property."+prop.getKey();
|
extras[i++] = "property."+prop.getKey();
|
||||||
extras[i++] = (String) prop.getValue();
|
extras[i++] = (String) prop.getValue();
|
||||||
}
|
}
|
||||||
@@ -185,7 +188,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
destroyServers();
|
destroyServers();
|
||||||
distribTearDown();
|
distribTearDown();
|
||||||
|
|
||||||
boolean keepTests = Boolean.valueOf(System.getProperty("keep.tests"));
|
boolean keepTests = Boolean.parseBoolean(System.getProperty("keep.tests"));
|
||||||
if (!keepTests) FileUtils.deleteDirectory(testDir);
|
if (!keepTests) FileUtils.deleteDirectory(testDir);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -203,7 +206,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
return System.getProperty("user.dir") + "/target/test-classes/test-files";
|
return System.getProperty("user.dir") + "/target/test-classes/test-files";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void distribSetUp(String serverName) throws Exception
|
public static void distribSetUp(String serverName)
|
||||||
{
|
{
|
||||||
SolrTestCaseJ4.resetExceptionIgnores(); // ignore anything with
|
SolrTestCaseJ4.resetExceptionIgnores(); // ignore anything with
|
||||||
// ignore_exception in it
|
// ignore_exception in it
|
||||||
@@ -213,7 +216,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
System.setProperty("solr.log.dir", testDir.toPath().resolve(serverName).toString());
|
System.setProperty("solr.log.dir", testDir.toPath().resolve(serverName).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void distribTearDown() throws Exception
|
public static void distribTearDown()
|
||||||
{
|
{
|
||||||
System.clearProperty("solr.directoryFactory");
|
System.clearProperty("solr.directoryFactory");
|
||||||
System.clearProperty("solr.log.dir");
|
System.clearProperty("solr.log.dir");
|
||||||
@@ -230,8 +233,6 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a JettySolrRunner (if one didn't exist already). DOES NOT START IT.
|
* Creates a JettySolrRunner (if one didn't exist already). DOES NOT START IT.
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
protected static JettySolrRunner createJetty(String jettyKey, boolean basicAuth) throws Exception
|
protected static JettySolrRunner createJetty(String jettyKey, boolean basicAuth) throws Exception
|
||||||
{
|
{
|
||||||
@@ -243,19 +244,13 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
{
|
{
|
||||||
Path jettySolrHome = testDir.toPath().resolve(jettyKey);
|
Path jettySolrHome = testDir.toPath().resolve(jettyKey);
|
||||||
seedSolrHome(jettySolrHome);
|
seedSolrHome(jettySolrHome);
|
||||||
JettySolrRunner jetty = createJetty(jettySolrHome.toFile(), null, null, false, 0, getSchemaFile(), basicAuth);
|
return createJetty(jettySolrHome.toFile(), null, null, false, 0, getSchemaFile(), basicAuth);
|
||||||
return jetty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the core config information to the jetty file system.
|
* Adds the core config information to the jetty file system.
|
||||||
* Its best to call this before calling start() on Jetty
|
* Its best to call this before calling start() on Jetty
|
||||||
* @param jettyKey
|
|
||||||
* @param sourceConfigName
|
|
||||||
* @param coreName
|
|
||||||
* @param additionalProperties
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
protected static void addCoreToJetty(String jettyKey, String sourceConfigName, String coreName, Properties additionalProperties) throws Exception
|
protected static void addCoreToJetty(String jettyKey, String sourceConfigName, String coreName, Properties additionalProperties) throws Exception
|
||||||
{
|
{
|
||||||
@@ -289,17 +284,14 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
out.close();
|
out.close();
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts jetty if its not already running
|
* Starts jetty if its not already running
|
||||||
* @param jsr
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
protected static void startJetty(JettySolrRunner jsr) throws Exception {
|
protected static void startJetty(JettySolrRunner jsr) throws Exception
|
||||||
|
{
|
||||||
if (!jsr.isRunning())
|
if (!jsr.isRunning())
|
||||||
{
|
{
|
||||||
jsr.start();
|
jsr.start();
|
||||||
@@ -310,37 +302,40 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
{
|
{
|
||||||
boolean basicAuth = additionalProperties != null ? Boolean.parseBoolean(additionalProperties.getProperty("BasicAuth", "false")) : false;
|
boolean basicAuth = additionalProperties != null ? Boolean.parseBoolean(additionalProperties.getProperty("BasicAuth", "false")) : false;
|
||||||
|
|
||||||
|
|
||||||
JettySolrRunner jsr = createJetty(jettyKey, basicAuth);
|
JettySolrRunner jsr = createJetty(jettyKey, basicAuth);
|
||||||
jettyContainers.put(jettyKey, jsr);
|
jettyContainers.put(jettyKey, jsr);
|
||||||
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
|
|
||||||
if(additionalProperties != null && additionalProperties.size() > 0) {
|
if(additionalProperties != null && additionalProperties.size() > 0)
|
||||||
|
{
|
||||||
properties.putAll(additionalProperties);
|
properties.putAll(additionalProperties);
|
||||||
properties.remove("shard.method");
|
properties.remove("shard.method");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < coreNames.length; i++)
|
for (String coreName : coreNames)
|
||||||
{
|
{
|
||||||
addCoreToJetty(jettyKey, coreNames[i], coreNames[i], properties);
|
addCoreToJetty(jettyKey, coreName, coreName, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Now start jetty
|
//Now start jetty
|
||||||
startJetty(jsr);
|
startJetty(jsr);
|
||||||
|
|
||||||
int jettyPort = jsr.getLocalPort();
|
int jettyPort = jsr.getLocalPort();
|
||||||
for (int i = 0; i < coreNames.length; i++)
|
for (String coreName : coreNames)
|
||||||
{
|
{
|
||||||
String url = buildUrl(jettyPort) + "/" + coreNames[i];
|
String url = buildUrl(jettyPort) + "/" + coreName;
|
||||||
|
|
||||||
log.info(url);
|
log.info(url);
|
||||||
solrCollectionNameToStandaloneClient.put(coreNames[i], createNewSolrClient(url));
|
|
||||||
|
solrCollectionNameToStandaloneClient.put(coreName, createNewSolrClient(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
shardsArr = new String[numShards];
|
shardsArr = new String[numShards];
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
if (additionalProperties == null) {
|
if (additionalProperties == null)
|
||||||
|
{
|
||||||
additionalProperties = new Properties();
|
additionalProperties = new Properties();
|
||||||
}
|
}
|
||||||
String[] ranges = {"0-100", "100-200", "200-300", "300-400"};
|
String[] ranges = {"0-100", "100-200", "200-300", "300-400"};
|
||||||
@@ -382,6 +377,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
solrHomes.add(jetty.getSolrHome());
|
solrHomes.add(jetty.getSolrHome());
|
||||||
jetty.stop();
|
jetty.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SolrClient jClients : solrCollectionNameToStandaloneClient.values())
|
for (SolrClient jClients : solrCollectionNameToStandaloneClient.values())
|
||||||
{
|
{
|
||||||
jClients.close();
|
jClients.close();
|
||||||
@@ -409,25 +405,16 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
solrCollectionNameToStandaloneClient.clear();
|
solrCollectionNameToStandaloneClient.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, boolean sslEnabled, int port, String schemaOverride, boolean basicAuth) throws Exception
|
public static JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, boolean sslEnabled, int port, String schemaOverride, boolean basicAuth)
|
||||||
{
|
{
|
||||||
return createJetty(solrHome, dataDir, shardList, sslEnabled, port, schemaOverride, useExplicitNodeNames, basicAuth);
|
return createJetty(solrHome, dataDir, shardList, sslEnabled, port, schemaOverride, useExplicitNodeNames, basicAuth);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a solr jetty server.
|
* Create a solr jetty server.
|
||||||
*
|
|
||||||
* @param solrHome
|
|
||||||
* @param dataDir
|
|
||||||
* @param shardList
|
|
||||||
* @param port
|
|
||||||
* @param schemaOverride
|
|
||||||
* @param explicitCoreNodeName
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, boolean sslEnabled, int port,
|
public static JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, boolean sslEnabled, int port,
|
||||||
String schemaOverride, boolean explicitCoreNodeName, boolean basicAuth) throws Exception
|
String schemaOverride, boolean explicitCoreNodeName, boolean basicAuth)
|
||||||
{
|
{
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
if (schemaOverride != null)
|
if (schemaOverride != null)
|
||||||
@@ -443,20 +430,21 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
{
|
{
|
||||||
props.setProperty("coreNodeName", Integer.toString(nodeCnt.incrementAndGet()));
|
props.setProperty("coreNodeName", Integer.toString(nodeCnt.incrementAndGet()));
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLConfig sslConfig = new SSLConfig(sslEnabled, false, null, null, null, null);
|
SSLConfig sslConfig = new SSLConfig(sslEnabled, false, null, null, null, null);
|
||||||
|
|
||||||
JettyConfig config = null;
|
JettyConfig config;
|
||||||
|
|
||||||
if(basicAuth) {
|
if(basicAuth)
|
||||||
System.out.println("###### adding basic auth ######");
|
{
|
||||||
|
log.info("###### adding basic auth ######");
|
||||||
config = JettyConfig.builder().setContext("/solr").setPort(port).withFilter(BasicAuthFilter.class, "/sql/*").stopAtShutdown(true).withSSLConfig(sslConfig).build();
|
config = JettyConfig.builder().setContext("/solr").setPort(port).withFilter(BasicAuthFilter.class, "/sql/*").stopAtShutdown(true).withSSLConfig(sslConfig).build();
|
||||||
} else {
|
} else {
|
||||||
System.out.println("###### no basic auth ######");
|
log.info("###### no basic auth ######");
|
||||||
config = JettyConfig.builder().setContext("/solr").setPort(port).stopAtShutdown(true).withSSLConfig(sslConfig).build();
|
config = JettyConfig.builder().setContext("/solr").setPort(port).stopAtShutdown(true).withSSLConfig(sslConfig).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
JettySolrRunner jetty = new JettySolrRunner(solrHome.getAbsolutePath(), props, config);
|
return new JettySolrRunner(solrHome.getAbsolutePath(), props, config);
|
||||||
return jetty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -510,11 +498,8 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
*/
|
*/
|
||||||
protected static void seedSolrHome(Path jettyHome) throws IOException
|
protected static void seedSolrHome(Path jettyHome) throws IOException
|
||||||
{
|
{
|
||||||
String solrxml = getSolrXml();
|
FileUtils.copyFile(new File(getTestFilesHome(), getSolrXml()), jettyHome.resolve(getSolrXml()).toFile());
|
||||||
if (solrxml != null)
|
|
||||||
{
|
|
||||||
FileUtils.copyFile(new File(getTestFilesHome(), solrxml), jettyHome.resolve(getSolrXml()).toFile());
|
|
||||||
}
|
|
||||||
//Add solr home conf folder with alfresco based configuration.
|
//Add solr home conf folder with alfresco based configuration.
|
||||||
FileUtils.copyDirectory(new File(getTestFilesHome() + "/conf"), jettyHome.resolve("conf").toFile());
|
FileUtils.copyDirectory(new File(getTestFilesHome() + "/conf"), jettyHome.resolve("conf").toFile());
|
||||||
// Add alfresco data model def
|
// Add alfresco data model def
|
||||||
@@ -547,36 +532,26 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
FileUtils.copyDirectory(coreSourceConfig.resolve("conf").toFile(), confDir.toFile());
|
FileUtils.copyDirectory(coreSourceConfig.resolve("conf").toFile(), confDir.toFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupJettySolrHome(String coreName, Path jettyHome) throws IOException
|
public static class BasicAuthFilter implements Filter
|
||||||
{
|
{
|
||||||
seedSolrHome(jettyHome);
|
|
||||||
|
|
||||||
Properties coreProperties = new Properties();
|
public BasicAuthFilter()
|
||||||
coreProperties.setProperty("name", coreName);
|
{
|
||||||
coreProperties.setProperty("shard", "${shard:}");
|
|
||||||
coreProperties.setProperty("collection", "${collection:" + coreName + "}");
|
|
||||||
coreProperties.setProperty("config", "${solrconfig:solrconfig.xml}");
|
|
||||||
coreProperties.setProperty("schema", "${schema:schema.xml}");
|
|
||||||
coreProperties.setProperty("coreNodeName", "${coreNodeName:}");
|
|
||||||
|
|
||||||
writeCoreProperties(jettyHome.resolve("cores").resolve(coreName), coreProperties, coreName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BasicAuthFilter implements Filter {
|
|
||||||
|
|
||||||
public BasicAuthFilter() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(FilterConfig config) {
|
public void init(FilterConfig config)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
|
||||||
throws IOException, ServletException {
|
throws IOException, ServletException
|
||||||
|
{
|
||||||
//Parse the basic auth filter
|
//Parse the basic auth filter
|
||||||
String auth = ((HttpServletRequest)request).getHeader("Authorization");
|
String auth = ((HttpServletRequest)request).getHeader("Authorization");
|
||||||
if(auth != null) {
|
if(auth != null)
|
||||||
|
{
|
||||||
auth = auth.replace("Basic ", "");
|
auth = auth.replace("Basic ", "");
|
||||||
byte[] bytes = Base64.getDecoder().decode(auth);
|
byte[] bytes = Base64.getDecoder().decode(auth);
|
||||||
String decodedBytes = new String(bytes);
|
String decodedBytes = new String(bytes);
|
||||||
@@ -584,17 +559,23 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
|||||||
String user = pair[0];
|
String user = pair[0];
|
||||||
String password = pair[1];
|
String password = pair[1];
|
||||||
//Just look for the hard coded user and password.
|
//Just look for the hard coded user and password.
|
||||||
if (user.equals("test") && password.equals("pass")) {
|
if (user.equals("test") && password.equals("pass"))
|
||||||
|
{
|
||||||
filterChain.doFilter(request, response);
|
filterChain.doFilter(request, response);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
((HttpServletResponse) response).sendError(HttpServletResponse.SC_FORBIDDEN);
|
((HttpServletResponse) response).sendError(HttpServletResponse.SC_FORBIDDEN);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
((HttpServletResponse) response).sendError(HttpServletResponse.SC_FORBIDDEN);
|
((HttpServletResponse) response).sendError(HttpServletResponse.SC_FORBIDDEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user