Refactor AFTS test to use @BeforeClass to load data

This commit is contained in:
Michael Suzuki
2016-06-21 13:53:34 +01:00
parent 036bbd1c9e
commit 1f4e54c931
4 changed files with 9 additions and 56 deletions

View File

@@ -1,50 +0,0 @@
/*
* 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.query.afts;
import org.alfresco.solr.AbstractAlfrescoSolrTests;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(value = Suite.class)
@SuiteClasses({
LoadAFTSTestData.class,
TestsAlfrescoFTSQParserPlugin.class
})
/**
* Test AFTS query and parsing plugin.
* The suite works by loading all the test data using LoadAFTSTestData.
* This step load the data directly into the harness.
* Once the data load completes the test executes the TestsAlfrescoFTSQParserPlugin
* which contains all the tests.
*
* @author Michael Suzuki
*
*/
public class AFTSQParserPluginSuite extends AbstractAlfrescoSolrTests
{
@BeforeClass
public static void beforeClass() throws Exception
{
initAlfrescoCore("solrconfig-afts.xml", "schema-afts.xml");
Thread.sleep(30000);
}
}

View File

@@ -24,7 +24,6 @@ import java.util.Locale;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.search.adaptor.lucene.QueryConstants;
import org.alfresco.service.namespace.QName;
import org.alfresco.solr.AbstractAlfrescoSolrTests;
import org.alfresco.solr.AlfrescoSolrDataModel;
import org.alfresco.solr.SolrInformationServer;
import org.alfresco.util.SearchLanguageConversion;
@@ -35,7 +34,7 @@ import org.junit.Test;
@LuceneTestCase.SuppressCodecs({"Appending","Lucene3x","Lucene40","Lucene41","Lucene42","Lucene43", "Lucene44", "Lucene45","Lucene46","Lucene47","Lucene48","Lucene49"})
@SolrTestCaseJ4.SuppressSSL
public class TestsAlfrescoFTSQParserPlugin extends AbstractAlfrescoSolrTests implements QueryConstants {
public class AlfrescoFTSQParserPluginTest extends LoadAFTSTestData implements QueryConstants {
/*

View File

@@ -22,7 +22,6 @@ import static org.alfresco.solr.AlfrescoSolrUtils.addNode;
import static org.alfresco.solr.AlfrescoSolrUtils.addStoreRoot;
import static org.alfresco.solr.AlfrescoSolrUtils.createGUID;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
@@ -48,7 +47,7 @@ import org.alfresco.solr.client.MultiPropertyValue;
import org.alfresco.solr.client.PropertyValue;
import org.alfresco.solr.client.StringPropertyValue;
import org.apache.solr.core.SolrCore;
import org.junit.Test;
import org.junit.BeforeClass;
/**
* Load test data as part of legacy test.
* @author Michael Suzuki
@@ -56,8 +55,12 @@ import org.junit.Test;
*/
public class LoadAFTSTestData extends AbstractAlfrescoSolrTests implements AlfrecsoSolrConstants
{
@Test
public void loadTestSet() throws IOException {
@BeforeClass
public static void loadTestSet() throws Exception
{
initAlfrescoCore("solrconfig-afts.xml", "schema-afts.xml");
Thread.sleep(30000);
// Root
SolrCore core = h.getCore();
AlfrescoSolrDataModel dataModel = AlfrescoSolrDataModel.getInstance();

View File

@@ -60,6 +60,7 @@ public class LoadCMISData extends AbstractAlfrescoSolrTests
protected static QName testCMISBaseFolderQName;
protected static QName testCMISFolder00QName;
protected static Date testCMISDate00;
private static String[] mlOrderable_en = new String[] { "AAAA BBBB", "EEEE FFFF", "II", "KK", "MM", "OO", "QQ",
"SS", "UU", "AA", "CC" };