Fix tests
git-svn-id: https://svn.apache.org/repos/asf/manifoldcf/integration/solr-6.x/trunk@1743105 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/solr/collection1/conf/managed-schema b/solr/collection1/conf/managed-schema
new file mode 100644
index 0000000..7b1c162
--- /dev/null
+++ b/solr/collection1/conf/managed-schema
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Solr managed schema - automatically generated - DO NOT EDIT -->
+<schema name="auth" version="1.5">
+ <uniqueKey>id</uniqueKey>
+ <fieldType name="string" class="solr.StrField"/>
+ <field name="allow_token_document" type="string" default="__nosecurity__" multiValued="true" indexed="true" stored="false"/>
+ <field name="allow_token_parent" type="string" default="__nosecurity__" multiValued="true" indexed="true" stored="false"/>
+ <field name="allow_token_share" type="string" default="__nosecurity__" multiValued="true" indexed="true" stored="false"/>
+ <field name="deny_token_document" type="string" default="__nosecurity__" multiValued="true" indexed="true" stored="false"/>
+ <field name="deny_token_parent" type="string" default="__nosecurity__" multiValued="true" indexed="true" stored="false"/>
+ <field name="deny_token_share" type="string" default="__nosecurity__" multiValued="true" indexed="true" stored="false"/>
+ <field name="id" type="string" indexed="true" required="true" stored="true"/>
+</schema>
\ No newline at end of file
diff --git a/solr/collection1/conf/schema-auth.xml.bak b/solr/collection1/conf/schema-auth.xml.bak
new file mode 100644
index 0000000..e4c1a6b
--- /dev/null
+++ b/solr/collection1/conf/schema-auth.xml.bak
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+<schema name="auth" version="1.5">
+ <types>
+ <fieldType name="string" class="solr.StrField"/>
+ </types>
+ <fields>
+ <field name="id" type="string" indexed="true" stored="true" required="true"/>
+ <!-- MCF Security fields -->
+ <field name="allow_token_document" type="string" indexed="true" stored="false" multiValued="true" default="__nosecurity__"/>
+ <field name="deny_token_document" type="string" indexed="true" stored="false" multiValued="true" default="__nosecurity__"/>
+ <field name="allow_token_share" type="string" indexed="true" stored="false" multiValued="true" default="__nosecurity__"/>
+ <field name="deny_token_share" type="string" indexed="true" stored="false" multiValued="true" default="__nosecurity__"/>
+ <field name="allow_token_parent" type="string" indexed="true" stored="false" multiValued="true" default="__nosecurity__"/>
+ <field name="deny_token_parent" type="string" indexed="true" stored="false" multiValued="true" default="__nosecurity__"/>
+ </fields>
+ <uniqueKey>id</uniqueKey>
+</schema>
diff --git a/solr/collection1/conf/solrconfig-auth-load.xml b/solr/collection1/conf/solrconfig-auth-load.xml
new file mode 100644
index 0000000..4811761
--- /dev/null
+++ b/solr/collection1/conf/solrconfig-auth-load.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+<config>
+
+ <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
+ <jmx />
+
+ <dataDir>${solr.data.dir:}</dataDir>
+
+ <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
+
+ <updateHandler class="solr.DirectUpdateHandler2">
+ </updateHandler>
+
+ <!-- test MCF Security Filter settings -->
+ <searchComponent name="mcf-param" class="org.apache.solr.mcf.ManifoldCFSearchComponent" >
+ <str name="AuthorityServiceBaseURL">http://localhost:8346/mcf-as</str>
+ <int name="SocketTimeOut">3000</int>
+ <str name="AllowAttributePrefix">aap-</str>
+ <str name="DenyAttributePrefix">dap-</str>
+ </searchComponent>
+
+ <searchComponent name="mcf" class="org.apache.solr.mcf.ManifoldCFSearchComponent" >
+ <str name="AuthorityServiceBaseURL">http://localhost:8346/mcf-as</str>
+ </searchComponent>
+
+ <requestHandler name="/mcf" class="solr.SearchHandler" startup="lazy">
+ <lst name="invariants">
+ <bool name="mcf">true</bool>
+ </lst>
+ <lst name="defaults">
+ <str name="echoParams">all</str>
+ </lst>
+ <arr name="components">
+ <str>query</str>
+ <str>mcf</str>
+ </arr>
+ </requestHandler>
+
+</config>
diff --git a/solr/collection1/conf/solrconfig-auth-qparser.xml b/solr/collection1/conf/solrconfig-auth-qparser.xml
new file mode 100644
index 0000000..f1933d5
--- /dev/null
+++ b/solr/collection1/conf/solrconfig-auth-qparser.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+<config>
+
+ <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
+ <jmx />
+
+ <dataDir>${solr.data.dir:}</dataDir>
+
+ <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
+
+ <updateHandler class="solr.DirectUpdateHandler2">
+ </updateHandler>
+
+ <!-- test MCF Security Filter settings -->
+ <queryParser name="mcf-security_param" class="org.apache.solr.mcf.ManifoldCFQParserPlugin" >
+ <str name="AuthorityServiceBaseURL">http://localhost:8347/mcf-as</str>
+ <int name="SocketTimeOut">3000</int>
+ <str name="AllowAttributePrefix">aap-</str>
+ <str name="DenyAttributePrefix">dap-</str>
+ </queryParser>
+
+ <queryParser name="mcf_security" class="org.apache.solr.mcf.ManifoldCFQParserPlugin" >
+ <str name="AuthorityServiceBaseURL">http://localhost:8347/mcf-as</str>
+ </queryParser>
+
+ <requestHandler name="/mcf" class="solr.SearchHandler" startup="lazy">
+ <lst name="invariants">
+ <bool name="mcf">true</bool>
+ </lst>
+ <lst name="defaults">
+ <str name="echoParams">all</str>
+ </lst>
+ <lst name="appends">
+ <str name="fq">{!mcf_security}</str>
+ </lst>
+ <arr name="components">
+ <str>query</str>
+ </arr>
+ </requestHandler>
+
+</config>
diff --git a/solr/collection1/conf/solrconfig-auth.xml b/solr/collection1/conf/solrconfig-auth.xml
new file mode 100644
index 0000000..0f9faec
--- /dev/null
+++ b/solr/collection1/conf/solrconfig-auth.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+<config>
+
+ <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
+ <jmx />
+
+ <dataDir>${solr.data.dir:}</dataDir>
+
+ <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
+
+ <updateHandler class="solr.DirectUpdateHandler2">
+ </updateHandler>
+
+ <!-- test MCF Security Filter settings -->
+ <searchComponent name="mcf-param" class="org.apache.solr.mcf.ManifoldCFSearchComponent" >
+ <str name="AuthorityServiceBaseURL">http://localhost:8345/mcf-as</str>
+ <int name="SocketTimeOut">3000</int>
+ <str name="AllowAttributePrefix">aap-</str>
+ <str name="DenyAttributePrefix">dap-</str>
+ </searchComponent>
+
+ <searchComponent name="mcf" class="org.apache.solr.mcf.ManifoldCFSearchComponent" >
+ </searchComponent>
+
+ <requestHandler name="/mcf" class="solr.SearchHandler" startup="lazy">
+ <lst name="invariants">
+ <bool name="mcf">true</bool>
+ </lst>
+ <lst name="defaults">
+ <str name="echoParams">all</str>
+ </lst>
+ <arr name="components">
+ <str>query</str>
+ <str>mcf</str>
+ </arr>
+ </requestHandler>
+
+</config>
diff --git a/src/main/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java b/src/main/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
index 53a16da..49cdc14 100644
--- a/src/main/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
+++ b/src/main/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
@@ -258,7 +258,7 @@
}
}
- BooleanQuery bq = new BooleanQuery();
+ BooleanQuery.Builder bq = new BooleanQuery.Builder();
//bf.setMaxClauseCount(100000);
Query allowShareOpen = new TermQuery(new Term(fieldAllowShare,NOSECURITY_TOKEN));
@@ -293,7 +293,7 @@
BooleanClause.Occur.MUST);
}
- return new ConstantScoreQuery(bq);
+ return new ConstantScoreQuery(bq.build());
}
/** Calculate a complete subclause, representing something like:
@@ -302,20 +302,20 @@
*/
protected Query calculateCompleteSubquery(String allowField, String denyField, Query allowOpen, Query denyOpen, List<String> userAccessTokens)
{
- BooleanQuery bq = new BooleanQuery();
+ BooleanQuery.Builder bq = new BooleanQuery.Builder();
BooleanQuery.setMaxClauseCount(1000000);
// Add the empty-acl case
- BooleanQuery subUnprotectedClause = new BooleanQuery();
+ BooleanQuery.Builder subUnprotectedClause = new BooleanQuery.Builder();
subUnprotectedClause.add(allowOpen,BooleanClause.Occur.MUST);
subUnprotectedClause.add(denyOpen,BooleanClause.Occur.MUST);
- bq.add(subUnprotectedClause,BooleanClause.Occur.SHOULD);
+ bq.add(subUnprotectedClause.build(),BooleanClause.Occur.SHOULD);
for (String accessToken : userAccessTokens)
{
bq.add(new TermQuery(new Term(allowField,accessToken)),BooleanClause.Occur.SHOULD);
bq.add(new TermQuery(new Term(denyField,accessToken)),BooleanClause.Occur.MUST_NOT);
}
- return bq;
+ return bq.build();
}
// Protected methods
diff --git a/src/main/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java b/src/main/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
index 4a9a854..8af4fdc 100644
--- a/src/main/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
+++ b/src/main/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
@@ -251,7 +251,7 @@
userAccessTokens = getAccessTokens(domainMap);
}
- BooleanQuery bq = new BooleanQuery();
+ BooleanQuery.Builder bq = new BooleanQuery.Builder();
//bf.setMaxClauseCount(100000);
Query allowShareOpen = new TermQuery(new Term(fieldAllowShare,NOSECURITY_TOKEN));
@@ -293,7 +293,7 @@
list = new ArrayList<>();
rb.setFilters(list);
}
- list.add(new ConstantScoreQuery(bq));
+ list.add(new ConstantScoreQuery(bq.build()));
}
@Override
@@ -308,20 +308,20 @@
*/
protected Query calculateCompleteSubquery(String allowField, String denyField, Query allowOpen, Query denyOpen, List<String> userAccessTokens)
{
- BooleanQuery bq = new BooleanQuery();
+ BooleanQuery.Builder bq = new BooleanQuery.Builder();
BooleanQuery.setMaxClauseCount(1000000);
// Add the empty-acl case
- BooleanQuery subUnprotectedClause = new BooleanQuery();
+ BooleanQuery.Builder subUnprotectedClause = new BooleanQuery.Builder();
subUnprotectedClause.add(allowOpen,BooleanClause.Occur.MUST);
subUnprotectedClause.add(denyOpen,BooleanClause.Occur.MUST);
- bq.add(subUnprotectedClause,BooleanClause.Occur.SHOULD);
+ bq.add(subUnprotectedClause.build(),BooleanClause.Occur.SHOULD);
for (String accessToken : userAccessTokens)
{
bq.add(new TermQuery(new Term(allowField,accessToken)),BooleanClause.Occur.SHOULD);
bq.add(new TermQuery(new Term(denyField,accessToken)),BooleanClause.Occur.MUST_NOT);
}
- return bq;
+ return bq.build();
}
//---------------------------------------------------------------------------------
diff --git a/src/test/java/org/apache/solr/mcf/ManifoldCFQParserPluginTest.java b/src/test/java/org/apache/solr/mcf/ManifoldCFQParserPluginTest.java
index e6cbf97..17d4018 100644
--- a/src/test/java/org/apache/solr/mcf/ManifoldCFQParserPluginTest.java
+++ b/src/test/java/org/apache/solr/mcf/ManifoldCFQParserPluginTest.java
@@ -24,6 +24,7 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -33,6 +34,7 @@
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
+@SuppressSSL
public class ManifoldCFQParserPluginTest extends SolrTestCaseJ4 {
static MockMCFAuthorityService service;
diff --git a/src/test/java/org/apache/solr/mcf/ManifoldCFSCLoadTest.java b/src/test/java/org/apache/solr/mcf/ManifoldCFSCLoadTest.java
index 02417e7..09333b6 100644
--- a/src/test/java/org/apache/solr/mcf/ManifoldCFSCLoadTest.java
+++ b/src/test/java/org/apache/solr/mcf/ManifoldCFSCLoadTest.java
@@ -25,6 +25,7 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -34,6 +35,7 @@
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
+@SuppressSSL
public class ManifoldCFSCLoadTest extends SolrTestCaseJ4 {
static MockMCFAuthorityService service;
diff --git a/src/test/java/org/apache/solr/mcf/ManifoldCFSearchComponentTest.java b/src/test/java/org/apache/solr/mcf/ManifoldCFSearchComponentTest.java
index b0e14aa..9bbdd95 100644
--- a/src/test/java/org/apache/solr/mcf/ManifoldCFSearchComponentTest.java
+++ b/src/test/java/org/apache/solr/mcf/ManifoldCFSearchComponentTest.java
@@ -24,6 +24,7 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -33,6 +34,7 @@
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
+@SuppressSSL
public class ManifoldCFSearchComponentTest extends SolrTestCaseJ4 {
static MockMCFAuthorityService service;