Search in sources :

Example 1 with Queries

use of org.apache.rya.benchmark.query.Parameters.Queries in project incubator-rya by apache.

the class QueriesBenchmarkConfReaderIT method load.

@Test
public void load() throws JAXBException, SAXException, ParserConfigurationException, IOException {
    // Unmarshal some XML.
    final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<QueriesBenchmarkConf>\n" + "    <Rya>\n" + "        <ryaInstanceName>test_</ryaInstanceName>\n" + "        <accumulo>\n" + "            <username>test</username>\n" + "            <password>t3stP@ssw0rd</password>\n" + "            <zookeepers>zoo-server-1,zoo-server-2</zookeepers>\n" + "            <instanceName>testInstance</instanceName>\n" + "        </accumulo>\n" + "        <secondaryIndexing>\n" + "            <usePCJ>true</usePCJ>\n" + "        </secondaryIndexing>\n" + "    </Rya>\n" + "    <Parameters>" + "        <NumReadsRuns>" + "            <NumReads>1</NumReads>" + "            <NumReads>10</NumReads>" + "            <NumReads>100</NumReads>" + "            <NumReads>ALL</NumReads>" + "        </NumReadsRuns>" + "        <Queries>\n" + "            <SPARQL><![CDATA[SELECT ?a WHERE { ?a <http://likes> <urn:icecream> . }]]></SPARQL>\n" + "            <SPARQL><![CDATA[SELECT ?a ?b WHERE { ?a <http://knows> ?b . }]]></SPARQL>\n" + "        </Queries>\n" + "    </Parameters>" + "</QueriesBenchmarkConf>";
    final InputStream xmlStream = new ByteArrayInputStream(xml.getBytes(Charsets.UTF_8));
    final QueriesBenchmarkConf benchmarkConf = new QueriesBenchmarkConfReader().load(xmlStream);
    // Ensure it was unmarshalled correctly.
    final Rya rya = benchmarkConf.getRya();
    assertEquals("test_", rya.getRyaInstanceName());
    final Accumulo accumulo = rya.getAccumulo();
    assertEquals("test", accumulo.getUsername());
    assertEquals("t3stP@ssw0rd", accumulo.getPassword());
    assertEquals("zoo-server-1,zoo-server-2", accumulo.getZookeepers());
    assertEquals("testInstance", accumulo.getInstanceName());
    final SecondaryIndexing secondaryIndexing = rya.getSecondaryIndexing();
    assertTrue(secondaryIndexing.isUsePCJ());
    final Parameters parameters = benchmarkConf.getParameters();
    final List<String> expectedNumReads = Lists.newArrayList("1", "10", "100", "ALL");
    final NumReadsRuns NumReads = parameters.getNumReadsRuns();
    assertEquals(expectedNumReads, NumReads.getNumReads());
    final List<String> expectedQueries = Lists.newArrayList("SELECT ?a WHERE { ?a <http://likes> <urn:icecream> . }", "SELECT ?a ?b WHERE { ?a <http://knows> ?b . }");
    final Queries queries = parameters.getQueries();
    assertEquals(expectedQueries, queries.getSPARQL());
}
Also used : Queries(org.apache.rya.benchmark.query.Parameters.Queries) ByteArrayInputStream(java.io.ByteArrayInputStream) NumReadsRuns(org.apache.rya.benchmark.query.Parameters.NumReadsRuns) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) Accumulo(org.apache.rya.benchmark.query.Rya.Accumulo) SecondaryIndexing(org.apache.rya.benchmark.query.Rya.SecondaryIndexing) Test(org.junit.Test)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 NumReadsRuns (org.apache.rya.benchmark.query.Parameters.NumReadsRuns)1 Queries (org.apache.rya.benchmark.query.Parameters.Queries)1 Accumulo (org.apache.rya.benchmark.query.Rya.Accumulo)1 SecondaryIndexing (org.apache.rya.benchmark.query.Rya.SecondaryIndexing)1 Test (org.junit.Test)1