Fix broken tests

This commit is contained in:
Michael Suzuki
2016-07-15 17:48:05 +01:00
parent ed7783e714
commit d4fe7ca02a
3 changed files with 6 additions and 29 deletions

View File

@@ -36,7 +36,8 @@ import org.junit.Test;
public class SolrAuthTest extends AbstractAlfrescoSolrTests { public class SolrAuthTest extends AbstractAlfrescoSolrTests {
@BeforeClass @BeforeClass
public static void beforeClass() throws Exception { public static void beforeClass() throws Exception
{
initAlfrescoCore("solrconfig-afts.xml", "schema-afts.xml"); initAlfrescoCore("solrconfig-afts.xml", "schema-afts.xml");
} }
@@ -84,6 +85,7 @@ public class SolrAuthTest extends AbstractAlfrescoSolrTests {
refCounted = h.getCore().getSearcher(); refCounted = h.getCore().getSearcher();
searcher = refCounted.get(); searcher = refCounted.get();
refCounted.decref();
//Index Main Documents //Index Main Documents
String[] doc = {"id", "1", "content@s___t@{http://www.alfresco.org/model/content/1.0}content", "YYYY", "ACLID", "5000", "OWNER", "jim"}; String[] doc = {"id", "1", "content@s___t@{http://www.alfresco.org/model/content/1.0}content", "YYYY", "ACLID", "5000", "OWNER", "jim"};
@@ -107,12 +109,12 @@ public class SolrAuthTest extends AbstractAlfrescoSolrTests {
refCounted = h.getCore().getSearcher(); refCounted = h.getCore().getSearcher();
searcher = refCounted.get(); searcher = refCounted.get();
refCounted.decref();
Thread.sleep(1000); Thread.sleep(1000);
refCounted = h.getCore().getSearcher(); refCounted = h.getCore().getSearcher();
searcher = refCounted.get(); searcher = refCounted.get();
refCounted.decref();
ModifiableSolrParams params = new ModifiableSolrParams(); ModifiableSolrParams params = new ModifiableSolrParams();
params.add("q", "t1:YYYY"); params.add("q", "t1:YYYY");
params.add("qt", "/afts"); params.add("qt", "/afts");

View File

@@ -32,9 +32,6 @@ import org.junit.Test;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope; import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
import java.util.ArrayList;
import java.util.List;
import static org.alfresco.solr.AlfrescoSolrUtils.*; import static org.alfresco.solr.AlfrescoSolrUtils.*;
import static org.alfresco.solr.AlfrescoSolrUtils.getAclReaders; import static org.alfresco.solr.AlfrescoSolrUtils.getAclReaders;
import static org.alfresco.solr.AlfrescoSolrUtils.list; import static org.alfresco.solr.AlfrescoSolrUtils.list;
@@ -117,29 +114,7 @@ public class DistributedAlfrescoSolrTrackerTest extends AbstractAlfrescoDistribu
query("{\"locales\":[\"en\"], \"templates\": [{\"name\":\"t1\", \"template\":\"%cm:content\"}]}", query("{\"locales\":[\"en\"], \"templates\": [{\"name\":\"t1\", \"template\":\"%cm:content\"}]}",
params("q", "t1:world", "qt", "/afts", "shards.qt", "/afts", "start", "0", "rows", "6", "sort", "id asc")); params("q", "t1:world", "qt", "/afts", "shards.qt", "/afts", "start", "0", "rows", "6", "sort", "id asc"));
int numNodes = 100;
//First create a transaction (only updates)
Transaction txns = getTransaction(0, numNodes);
List<Node> nodes = new ArrayList<>(numNodes+1);
List<NodeMetaData> nodesMeta = new ArrayList<>(numNodes+1);
for (int i= 0; i<numNodes;i++)
{
//Next create nodes to update for the transaction
Node fNode = getNode(txns, acl, Node.SolrApiNodeStatus.UPDATED);
nodes.add(fNode);
nodesMeta.add(getNodeMetaData(fNode, txns, acl, "mike", ancestors(folderMetaData.getNodeRef()), false));
}
//Index the transaction, nodes, and nodeMetaDatas.
indexTransaction(txns, nodes, nodesMeta);
waitForDocCount(new TermQuery(new Term("content@s___t@{http://www.alfresco.org/model/content/1.0}content", "world")), numNodes+2, 100000);
//This will run the query on the control client and the cluster and compare the result.
query("{\"locales\":[\"en\"], \"templates\": [{\"name\":\"t1\", \"template\":\"%cm:content\"}]}",
params("q", "t1:world", "qt", "/afts", "shards.qt", "/afts", "start", "0", "rows", String.valueOf(numNodes+6), "sort", "id asc"));
}
} }
}

View File

@@ -181,7 +181,7 @@
</arr> </arr>
</listener> </listener>
--> -->
<listener event="firstSearcher" class="org.alfresco.solr.registration.FirstSearcherListener" />
</query> </query>
<queryResponseWriter name="xml" default="true" <queryResponseWriter name="xml" default="true"