Project

General

Profile

1
package edu.ucsb.nceas.metacat.common.query;
2

    
3

    
4

    
5
import static org.junit.Assert.*;
6

    
7
import java.io.FileNotFoundException;
8
import java.io.IOException;
9
import java.util.List;
10

    
11
import org.apache.commons.configuration.ConfigurationException;
12
import org.junit.Before;
13
import org.junit.Test;
14

    
15
import edu.ucsb.nceas.metacat.common.MetacatCommonTestBase;
16

    
17
public class EnabledQueryEnginesTest extends MetacatCommonTestBase {
18
    /**
19
     * The setup method
20
     */
21
    @Before
22
    public void setup () throws FileNotFoundException, ConfigurationException, IOException {
23
        super.setup();
24
    }
25
    
26
    @Test
27
    public void testGetEngines() {
28
        List<String> list = EnabledQueryEngines.getInstance().getEnabled();
29
        assertTrue("testGetEngines - the first enabled engine should be "+EnabledQueryEngines.PATHQUERYENGINE+ "rather than "+list.get(0), list.get(0).equals(EnabledQueryEngines.PATHQUERYENGINE));
30
        assertTrue("testGetEngines - the second enabled engine should be "+EnabledQueryEngines.SOLRENGINE+" rather than "+list.get(1), list.get(1).equals(EnabledQueryEngines.SOLRENGINE));
31
    }
32
    
33
    @Test
34
    public void testIfEnabled() {
35
        assertTrue("testIfEnabled - the "+EnabledQueryEngines.SOLRENGINE+ " should be enabled", EnabledQueryEngines.getInstance().isEnabled(EnabledQueryEngines.SOLRENGINE));
36
        assertTrue("testIfEnabled - the "+EnabledQueryEngines.PATHQUERYENGINE+ " should be enabled", EnabledQueryEngines.getInstance().isEnabled(EnabledQueryEngines.PATHQUERYENGINE));
37
        assertTrue("testIfEnabled - the engine \"yyy\" should not be enabled", !EnabledQueryEngines.getInstance().isEnabled("yyy"));
38
    }
39
}
(1-1/2)