Project

General

Profile

1
package edu.ucsb.nceas.metacat.index;
2

    
3
import static org.junit.Assert.assertEquals;
4
import static org.junit.Assert.assertTrue;
5

    
6
import java.util.List;
7

    
8
import org.dataone.cn.indexer.parser.IDocumentSubprocessor;
9
import org.dataone.cn.indexer.parser.ScienceMetadataDocumentSubprocessor;
10
import org.dataone.configuration.Settings;
11
import org.junit.Test;
12

    
13
public class ApplicationControllerTest {
14
    public static final String pathToHazelcastFile = "../lib/hazelcast.xml";
15
    
16
    /**
17
     * Test lookup from default properties file
18
     */
19
    @Test
20
    public void testConstructor() {
21
        Settings.getConfiguration().setProperty("dataone.hazelcast.configFilePath", pathToHazelcastFile);
22
        ApplicationController controller = new ApplicationController();
23
        List<SolrIndex> list = controller.getSolrIndexes();
24
        assertTrue(list.size() == 1);
25
        SolrIndex[] solrIndexesarray = list.toArray(new SolrIndex[list.size()]);
26
        SolrIndex index = solrIndexesarray[0];
27
        List<IDocumentSubprocessor> subprocessors = index.getSubprocessors();
28
        IDocumentSubprocessor[] subprocessorArray = subprocessors.toArray(new IDocumentSubprocessor[subprocessors.size()]);
29
        assertTrue(subprocessorArray[0] instanceof ScienceMetadataDocumentSubprocessor);
30
    }
31
    
32
}
(1-1/2)