Project

General

Profile

« Previous | Next » 

Revision 8120

Added by Jing Tao over 11 years ago

Add a test query method.

View differences:

metacat-common/src/test/java/edu/ucsb/nceas/metacat/common/query/SolrQueryServiceControllerTest.java
3 3
import static org.junit.Assert.assertTrue;
4 4

  
5 5
import java.io.IOException;
6
import java.io.InputStream;
6 7
import java.net.MalformedURLException;
7 8
import java.util.List;
8 9
import java.util.Map;
9 10

  
10 11
import javax.xml.parsers.ParserConfigurationException;
11 12

  
13
import org.apache.solr.common.params.SolrParams;
12 14
import org.apache.solr.schema.SchemaField;
15
import org.apache.solr.servlet.SolrRequestParsers;
13 16
import org.dataone.service.exceptions.NotFound;
14 17
import org.dataone.service.exceptions.UnsupportedType;
15 18
import org.junit.Test;
......
61 64
       assertTrue(fields != null);
62 65
       assertTrue(!fields.isEmpty());
63 66
    }
67
    
68
    /**
69
     * Test the query method
70
     */
71
    @Test
72
    public void testQuery() throws Exception {
73
        String query = "q=*:*";
74
        SolrParams solrParams = SolrRequestParsers.parseQueryString(query);
75
        InputStream input = SolrQueryServiceController.getInstance().query(solrParams, null);
76
        assertTrue(input != null);
77
    }
64 78
}

Also available in: Unified diff