You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2014/08/21 08:21:08 UTC
[1/4] git commit: Stub for junit test.
Repository: vxquery
Updated Branches:
refs/heads/master e7ba96b81 -> 5ee0a43a7
Stub for junit test.
Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/131096b6
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/131096b6
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/131096b6
Branch: refs/heads/master
Commit: 131096b6887b30843e44f311bc2558bd7fb5955c
Parents: e7ba96b
Author: Preston Carman <pr...@apache.org>
Authored: Thu Aug 14 12:23:27 2014 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Aug 14 12:23:27 2014 -0700
----------------------------------------------------------------------
.../org/apache/vxquery/xtest/VXQueryTest.java | 49 ++++++++++++++++++++
1 file changed, 49 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/vxquery/blob/131096b6/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java b/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
new file mode 100644
index 0000000..39f4b4f
--- /dev/null
+++ b/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
@@ -0,0 +1,49 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.vxquery.xtest;
+
+import java.io.File;
+import java.util.Collection;
+
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class VXQueryTest {
+
+ private static final String PATH_QUERIES = StringUtils.join(new String[] { "Queries", "XQuery" + File.separator },
+ File.separator);
+ private static final String PATH_RESULTS = "ExpectedTestResults" + File.separator;
+ private static final String PATH_TESTS = "cat" + File.separator;
+ private static final String PATH_BASE = StringUtils.join(
+ new String[] { "src", "test", "resources" + File.separator }, File.separator);
+
+ @Parameters
+ public static Collection<Object[]> tests() throws Exception {
+ return null;
+ }
+
+ public VXQueryTest() {
+ }
+
+ @Test
+ public void test() throws Exception {
+ }
+}
\ No newline at end of file
[2/4] git commit: Added a single text to maven.
Posted by pr...@apache.org.
Added a single text to maven.
Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/1ac6b407
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/1ac6b407
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/1ac6b407
Branch: refs/heads/master
Commit: 1ac6b40764fcefec915adf33690f02ad0578e407
Parents: 131096b
Author: Preston Carman <pr...@apache.org>
Authored: Mon Aug 18 16:01:17 2014 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Mon Aug 18 16:01:17 2014 -0700
----------------------------------------------------------------------
pom.xml | 4 +-
.../vxquery/xtest/AbstractTestCaseFactory.java | 198 +++++++++++++++++++
.../apache/vxquery/xtest/TestCaseFactory.java | 196 +-----------------
.../org/apache/vxquery/xtest/TestRunner.java | 168 ++++++++++++++++
.../apache/vxquery/xtest/TestRunnerFactory.java | 143 +-------------
.../java/org/apache/vxquery/xtest/XTest.java | 2 +-
.../vxquery/xtest/JUnitTestCaseFactory.java | 43 ++++
.../org/apache/vxquery/xtest/VXQueryTest.java | 50 ++++-
.../ExpectedTestResults/Simple/add.txt | 1 +
.../ExpectedTestResults/Simple/list.txt | 3 +
.../test/resources/Queries/XQuery/Simple/add.xq | 18 ++
.../resources/Queries/XQuery/Simple/list.xq | 18 ++
.../src/test/resources/VXQuerySingleCatalog.xml | 96 +++++++++
.../src/test/resources/cat/SingleQuery.xml | 28 +++
14 files changed, 630 insertions(+), 338 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6dc0c26..ed391b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -536,9 +536,9 @@
<modules>
<module>vxquery-core</module>
- <module>vxquery-xtest</module>
- <module>vxquery-benchmark</module>
<module>vxquery-server</module>
<module>vxquery-cli</module>
+ <module>vxquery-xtest</module>
+ <module>vxquery-benchmark</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/AbstractTestCaseFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/AbstractTestCaseFactory.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/AbstractTestCaseFactory.java
new file mode 100644
index 0000000..4d8f0fb
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/AbstractTestCaseFactory.java
@@ -0,0 +1,198 @@
+package org.apache.vxquery.xtest;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URL;
+import java.util.regex.Pattern;
+
+import javax.xml.namespace.QName;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+public abstract class AbstractTestCaseFactory {
+ public TestConfiguration tConfig;
+ public File catalog;
+ public String baseDirectory;
+ public TestCase tc;
+ public Pattern include;
+ public Pattern exclude;
+ public XTestOptions opts;
+ public String nextVariable;
+ public boolean expectedError;
+ public boolean outputFile;
+ public int currPathLen;
+ public int count;
+
+ public AbstractTestCaseFactory(XTestOptions opts) {
+ System.err.println("opts.catalog: " + opts.catalog);
+ this.catalog = new File(opts.catalog);
+ this.baseDirectory = this.catalog.getParent();
+ tConfig = new TestConfiguration();
+ tConfig.options = opts;
+ this.opts = opts;
+ if (opts.include != null) {
+ this.include = Pattern.compile(opts.include);
+ }
+ if (opts.exclude != null) {
+ this.exclude = Pattern.compile(opts.exclude);
+ }
+ try {
+ currPathLen = new File(".").getCanonicalPath().length();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public int process() throws Exception {
+ count = 0;
+ XMLReader parser = XMLReaderFactory.createXMLReader();
+ nextVariable = null;
+ Handler handler = new Handler();
+ parser.setContentHandler(handler);
+ parser.setEntityResolver(new EntityResolver() {
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
+ URL url = new URL(systemId);
+ return new InputSource(baseDirectory
+ + new File(url.getFile()).getCanonicalPath().substring(currPathLen));
+ }
+ });
+ parser.parse(new InputSource(new FileReader(catalog)));
+ return count;
+ }
+
+ protected abstract void submit(TestCase tc);
+
+ protected class Handler implements ContentHandler {
+ StringBuilder buffer = null;
+
+ @Override
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ if (buffer == null) {
+ buffer = new StringBuilder();
+ }
+ buffer.append(ch, start, length);
+ }
+
+ private void flushChars() {
+ if (buffer == null) {
+ return;
+ }
+ String str = buffer.toString();
+ buffer = null;
+ if (nextVariable != null) {
+ if (tConfig.sourceFileMap.get(str) == null) {
+ System.err.println(tc.getXQueryFile());
+ System.err.println(str);
+ }
+ tc.addExternalVariableBinding(new QName(nextVariable), tConfig.sourceFileMap.get(str));
+ } else if (expectedError) {
+ tc.setExpectedError(str);
+ } else if (outputFile) {
+ ExpectedResult er = new ExpectedResult(str);
+ tc.addExpectedResult(er);
+ }
+ }
+
+ @Override
+ public void endDocument() throws SAXException {
+ flushChars();
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String name) throws SAXException {
+ flushChars();
+ if ("test-case".equals(localName)) {
+ if (tc != null) {
+ submit(tc);
+ tc = null;
+ }
+ } else if ("input-file".equals(localName)) {
+ nextVariable = null;
+ } else if ("output-file".equals(localName)) {
+ outputFile = false;
+ } else if ("expected-error".equals(localName)) {
+ expectedError = false;
+ }
+ }
+
+ @Override
+ public void endPrefixMapping(String prefix) throws SAXException {
+ }
+
+ @Override
+ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+ }
+
+ @Override
+ public void processingInstruction(String target, String data) throws SAXException {
+ flushChars();
+ }
+
+ @Override
+ public void setDocumentLocator(Locator locator) {
+ flushChars();
+ }
+
+ @Override
+ public void skippedEntity(String name) throws SAXException {
+ flushChars();
+ }
+
+ @Override
+ public void startDocument() throws SAXException {
+ flushChars();
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException {
+ flushChars();
+ try {
+ if ("query".equals(localName)) {
+ if (tc != null) {
+ String tcName = atts.getValue("", "name");
+ tc.setName(tcName);
+ }
+ } else if ("expected-error".equals(localName)) {
+ if (tc != null) {
+ expectedError = true;
+ }
+ } else if ("input-file".equals(localName)) {
+ nextVariable = atts.getValue("", "variable");
+ } else if ("output-file".equals(localName)) {
+ outputFile = true;
+ } else if ("test-case".equals(localName)) {
+ tc = new TestCase(tConfig);
+ String folder = atts.getValue("", "FilePath");
+ tc.setFolder(folder);
+ } else if ("source".equals(localName)) {
+ String id = atts.getValue("", "ID");
+ File srcFile = new File(tConfig.testRoot, atts.getValue("", "FileName"));
+ tConfig.sourceFileMap.put(id, srcFile);
+ } else if ("test-suite".equals(localName)) {
+ tConfig.testRoot = new File(new File(baseDirectory).getCanonicalFile(), atts.getValue("",
+ "SourceOffsetPath"));
+ tConfig.xqueryQueryOffsetPath = new File(tConfig.testRoot, atts.getValue("",
+ "XQueryQueryOffsetPath"));
+ tConfig.resultOffsetPath = new File(tConfig.testRoot, atts.getValue("", "ResultOffsetPath"));
+ tConfig.xqueryFileExtension = atts.getValue("", "XQueryFileExtension");
+ tConfig.xqueryxFileExtension = atts.getValue("", "XQueryXFileExtension");
+ }
+ } catch (Exception e) {
+ throw new SAXException(e);
+ }
+ }
+
+ @Override
+ public void startPrefixMapping(String prefix, String uri) throws SAXException {
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestCaseFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestCaseFactory.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestCaseFactory.java
index cadd5a7..f3980db 100644
--- a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestCaseFactory.java
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestCaseFactory.java
@@ -14,80 +14,20 @@
*/
package org.apache.vxquery.xtest;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.net.URL;
import java.util.concurrent.ExecutorService;
-import java.util.regex.Pattern;
-import javax.xml.namespace.QName;
+public class TestCaseFactory extends AbstractTestCaseFactory {
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
+ public TestRunnerFactory trf;
+ public ExecutorService eSvc;
-public class TestCaseFactory {
- private TestConfiguration tConfig;
- private File catalog;
- private String baseDirectory;
- private TestRunnerFactory trf;
- private ExecutorService eSvc;
- private TestCase tc;
- private Pattern include;
- private Pattern exclude;
- private XTestOptions opts;
-
- private String nextVariable;
- private boolean expectedError;
- private boolean outputFile;
- private int currPathLen;
- int count;
-
- public TestCaseFactory(String catalog, TestRunnerFactory trf, ExecutorService eSvc, XTestOptions opts) {
- this.catalog = new File(catalog);
- this.baseDirectory = this.catalog.getParent();
+ public TestCaseFactory(TestRunnerFactory trf, ExecutorService eSvc, XTestOptions opts) {
+ super(opts);
this.trf = trf;
- tConfig = new TestConfiguration();
- tConfig.options = opts;
this.eSvc = eSvc;
- this.opts = opts;
- if (opts.include != null) {
- this.include = Pattern.compile(opts.include);
- }
- if (opts.exclude != null) {
- this.exclude = Pattern.compile(opts.exclude);
- }
- try {
- currPathLen = new File(".").getCanonicalPath().length();
- } catch (IOException e) {
- e.printStackTrace();
- }
}
- public int process() throws Exception {
- count = 0;
- XMLReader parser = XMLReaderFactory.createXMLReader();
- nextVariable = null;
- Handler handler = new Handler();
- parser.setContentHandler(handler);
- parser.setEntityResolver(new EntityResolver() {
- @Override
- public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
- URL url = new URL(systemId);
- return new InputSource(baseDirectory + new File(url.getFile()).getCanonicalPath().substring(currPathLen));
- }
- });
- parser.parse(new InputSource(new FileReader(catalog)));
- return count;
- }
-
- private void submit(TestCase tc) {
+ protected void submit(TestCase tc) {
boolean toSubmit = include == null || include.matcher(tc.getXQueryDisplayName()).find();
toSubmit = toSubmit && (exclude == null || !exclude.matcher(tc.getXQueryDisplayName()).find());
if (toSubmit) {
@@ -99,128 +39,4 @@ public class TestCaseFactory {
}
}
- private class Handler implements ContentHandler {
- StringBuilder buffer = null;
-
- @Override
- public void characters(char[] ch, int start, int length) throws SAXException {
- if (buffer == null) {
- buffer = new StringBuilder();
- }
- buffer.append(ch, start, length);
- }
-
- private void flushChars() {
- if (buffer == null) {
- return;
- }
- String str = buffer.toString();
- buffer = null;
- if (nextVariable != null) {
- if (tConfig.sourceFileMap.get(str) == null) {
- System.err.println(tc.getXQueryFile());
- System.err.println(str);
- }
- tc.addExternalVariableBinding(new QName(nextVariable), tConfig.sourceFileMap.get(str));
- } else if (expectedError) {
- tc.setExpectedError(str);
- } else if (outputFile) {
- ExpectedResult er = new ExpectedResult(str);
- tc.addExpectedResult(er);
- }
- }
-
- @Override
- public void endDocument() throws SAXException {
- flushChars();
- }
-
- @Override
- public void endElement(String uri, String localName, String name) throws SAXException {
- flushChars();
- if ("test-case".equals(localName)) {
- if (tc != null) {
- submit(tc);
- tc = null;
- }
- } else if ("input-file".equals(localName)) {
- nextVariable = null;
- } else if ("output-file".equals(localName)) {
- outputFile = false;
- } else if ("expected-error".equals(localName)) {
- expectedError = false;
- }
- }
-
- @Override
- public void endPrefixMapping(String prefix) throws SAXException {
- }
-
- @Override
- public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
- }
-
- @Override
- public void processingInstruction(String target, String data) throws SAXException {
- flushChars();
- }
-
- @Override
- public void setDocumentLocator(Locator locator) {
- flushChars();
- }
-
- @Override
- public void skippedEntity(String name) throws SAXException {
- flushChars();
- }
-
- @Override
- public void startDocument() throws SAXException {
- flushChars();
- }
-
- @Override
- public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException {
- flushChars();
- try {
- if ("query".equals(localName)) {
- if (tc != null) {
- String tcName = atts.getValue("", "name");
- tc.setName(tcName);
- }
- } else if ("expected-error".equals(localName)) {
- if (tc != null) {
- expectedError = true;
- }
- } else if ("input-file".equals(localName)) {
- nextVariable = atts.getValue("", "variable");
- } else if ("output-file".equals(localName)) {
- outputFile = true;
- } else if ("test-case".equals(localName)) {
- tc = new TestCase(tConfig);
- String folder = atts.getValue("", "FilePath");
- tc.setFolder(folder);
- } else if ("source".equals(localName)) {
- String id = atts.getValue("", "ID");
- File srcFile = new File(tConfig.testRoot, atts.getValue("", "FileName"));
- tConfig.sourceFileMap.put(id, srcFile);
- } else if ("test-suite".equals(localName)) {
- tConfig.testRoot = new File(new File(baseDirectory).getCanonicalFile(), atts.getValue("",
- "SourceOffsetPath"));
- tConfig.xqueryQueryOffsetPath = new File(tConfig.testRoot, atts.getValue("",
- "XQueryQueryOffsetPath"));
- tConfig.resultOffsetPath = new File(tConfig.testRoot, atts.getValue("", "ResultOffsetPath"));
- tConfig.xqueryFileExtension = atts.getValue("", "XQueryFileExtension");
- tConfig.xqueryxFileExtension = atts.getValue("", "XQueryXFileExtension");
- }
- } catch (Exception e) {
- throw new SAXException(e);
- }
- }
-
- @Override
- public void startPrefixMapping(String prefix, String uri) throws SAXException {
- }
- }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
new file mode 100644
index 0000000..9c0bc64
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.ByteBuffer;
+import java.util.EnumSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.vxquery.compiler.CompilerControlBlock;
+import org.apache.vxquery.compiler.algebricks.VXQueryGlobalDataFactory;
+import org.apache.vxquery.context.DynamicContext;
+import org.apache.vxquery.context.DynamicContextImpl;
+import org.apache.vxquery.context.RootStaticContextImpl;
+import org.apache.vxquery.context.StaticContextImpl;
+import org.apache.vxquery.exceptions.ErrorCode;
+import org.apache.vxquery.exceptions.SystemException;
+import org.apache.vxquery.result.ResultUtils;
+import org.apache.vxquery.xmlquery.query.XMLQueryCompiler;
+
+import edu.uci.ics.hyracks.api.client.HyracksConnection;
+import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
+import edu.uci.ics.hyracks.api.comm.IFrameTupleAccessor;
+import edu.uci.ics.hyracks.api.dataset.IHyracksDataset;
+import edu.uci.ics.hyracks.api.dataset.IHyracksDatasetReader;
+import edu.uci.ics.hyracks.api.dataset.ResultSetId;
+import edu.uci.ics.hyracks.api.exceptions.HyracksException;
+import edu.uci.ics.hyracks.api.job.JobFlag;
+import edu.uci.ics.hyracks.api.job.JobId;
+import edu.uci.ics.hyracks.api.job.JobSpecification;
+import edu.uci.ics.hyracks.client.dataset.HyracksDataset;
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.common.controllers.CCConfig;
+import edu.uci.ics.hyracks.control.common.controllers.NCConfig;
+import edu.uci.ics.hyracks.control.nc.NodeControllerService;
+import edu.uci.ics.hyracks.dataflow.common.comm.io.ResultFrameTupleAccessor;
+
+public class TestRunner {
+ private static final int FRAME_SIZE = 65536;
+
+ private static final Pattern EMBEDDED_SYSERROR_PATTERN = Pattern
+ .compile("org\\.apache\\.vxquery\\.exceptions\\.SystemException: (\\p{javaUpperCase}{4}\\d{4})");
+
+ private XTestOptions opts;
+ private ClusterControllerService cc;
+ private NodeControllerService nc1;
+ private IHyracksClientConnection hcc;
+ private IHyracksDataset hds;
+
+ public TestRunner(XTestOptions opts) throws Exception {
+ this.opts = opts;
+ }
+
+ public void open() throws Exception {
+ CCConfig ccConfig = new CCConfig();
+ ccConfig.clientNetIpAddress = "127.0.0.1";
+ ccConfig.clientNetPort = 39000;
+ ccConfig.clusterNetIpAddress = "127.0.0.1";
+ ccConfig.clusterNetPort = 39001;
+ ccConfig.profileDumpPeriod = 10000;
+ File outDir = new File("target/ClusterController");
+ outDir.mkdirs();
+ File ccRoot = File.createTempFile(TestRunner.class.getName(), ".data", outDir);
+ ccRoot.delete();
+ ccRoot.mkdir();
+ ccConfig.ccRoot = ccRoot.getAbsolutePath();
+ cc = new ClusterControllerService(ccConfig);
+ cc.start();
+
+ NCConfig ncConfig1 = new NCConfig();
+ ncConfig1.ccHost = "localhost";
+ ncConfig1.ccPort = 39001;
+ ncConfig1.clusterNetIPAddress = "127.0.0.1";
+ ncConfig1.dataIPAddress = "127.0.0.1";
+ ncConfig1.datasetIPAddress = "127.0.0.1";
+ ncConfig1.nodeId = "nc1";
+ nc1 = new NodeControllerService(ncConfig1);
+ nc1.start();
+
+ hcc = new HyracksConnection(ccConfig.clientNetIpAddress, ccConfig.clientNetPort);
+ }
+
+ public TestCaseResult run(final TestCase testCase) {
+ TestCaseResult res = new TestCaseResult(testCase);
+ if (opts.verbose) {
+ System.err.println("Starting " + testCase.getXQueryDisplayName());
+ }
+ long start = System.currentTimeMillis();
+ try {
+ try {
+ XMLQueryCompiler compiler = new XMLQueryCompiler(null, new String[] { "nc1" }, FRAME_SIZE);
+ Reader in = new InputStreamReader(new FileInputStream(testCase.getXQueryFile()), "UTF-8");
+ CompilerControlBlock ccb = new CompilerControlBlock(new StaticContextImpl(
+ RootStaticContextImpl.INSTANCE), new ResultSetId(testCase.getXQueryDisplayName().hashCode()),
+ testCase.getSourceFileMap());
+ compiler.compile(testCase.getXQueryDisplayName(), in, ccb, opts.optimizationLevel);
+ JobSpecification spec = compiler.getModule().getHyracksJobSpecification();
+
+ DynamicContext dCtx = new DynamicContextImpl(compiler.getModule().getModuleContext());
+ spec.setGlobalJobDataFactory(new VXQueryGlobalDataFactory(dCtx.createFactory()));
+
+ spec.setMaxReattempts(0);
+ JobId jobId = hcc.startJob(spec, EnumSet.of(JobFlag.PROFILE_RUNTIME));
+
+ if (hds == null) {
+ hds = new HyracksDataset(hcc, spec.getFrameSize(), opts.threads);
+ }
+ ByteBuffer buffer = ByteBuffer.allocate(spec.getFrameSize());
+ IHyracksDatasetReader reader = hds.createReader(jobId, ccb.getResultSetId());
+ IFrameTupleAccessor frameTupleAccessor = new ResultFrameTupleAccessor(spec.getFrameSize());
+ buffer.clear();
+ res.result = "";
+ while (reader.read(buffer) > 0) {
+ buffer.clear();
+ res.result += ResultUtils.getStringFromBuffer(buffer, frameTupleAccessor);
+ }
+ res.result.trim();
+ hcc.waitForCompletion(jobId);
+ } catch (HyracksException e) {
+ Throwable t = e;
+ while (t.getCause() != null) {
+ t = t.getCause();
+ }
+ Matcher m = EMBEDDED_SYSERROR_PATTERN.matcher(t.getMessage());
+ if (m.find()) {
+ String eCode = m.group(1);
+ throw new SystemException(ErrorCode.valueOf(eCode), e);
+ }
+ throw e;
+ }
+ } catch (SystemException e) {
+ res.error = e;
+ } catch (Throwable e) {
+ res.error = e;
+ } finally {
+ try {
+ res.compare();
+ } catch (Exception e) {
+ System.err.println("Framework error");
+ e.printStackTrace();
+ }
+ long end = System.currentTimeMillis();
+ res.time = end - start;
+ }
+ return res;
+ }
+
+ public void close() throws Exception {
+ nc1.stop();
+ cc.stop();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunnerFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunnerFactory.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunnerFactory.java
index 6b3fb4b..1910f84 100644
--- a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunnerFactory.java
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunnerFactory.java
@@ -14,87 +14,19 @@
*/
package org.apache.vxquery.xtest;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.EnumSet;
import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.vxquery.compiler.CompilerControlBlock;
-import org.apache.vxquery.compiler.algebricks.VXQueryGlobalDataFactory;
-import org.apache.vxquery.context.DynamicContext;
-import org.apache.vxquery.context.DynamicContextImpl;
-import org.apache.vxquery.context.RootStaticContextImpl;
-import org.apache.vxquery.context.StaticContextImpl;
-import org.apache.vxquery.exceptions.ErrorCode;
-import org.apache.vxquery.exceptions.SystemException;
-import org.apache.vxquery.result.ResultUtils;
-import org.apache.vxquery.xmlquery.query.XMLQueryCompiler;
-
-import edu.uci.ics.hyracks.api.client.HyracksConnection;
-import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
-import edu.uci.ics.hyracks.api.comm.IFrameTupleAccessor;
-import edu.uci.ics.hyracks.api.dataset.IHyracksDataset;
-import edu.uci.ics.hyracks.api.dataset.IHyracksDatasetReader;
-import edu.uci.ics.hyracks.api.dataset.ResultSetId;
-import edu.uci.ics.hyracks.api.exceptions.HyracksException;
-import edu.uci.ics.hyracks.api.job.JobFlag;
-import edu.uci.ics.hyracks.api.job.JobId;
-import edu.uci.ics.hyracks.api.job.JobSpecification;
-import edu.uci.ics.hyracks.client.dataset.HyracksDataset;
-import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
-import edu.uci.ics.hyracks.control.common.controllers.CCConfig;
-import edu.uci.ics.hyracks.control.common.controllers.NCConfig;
-import edu.uci.ics.hyracks.control.nc.NodeControllerService;
-import edu.uci.ics.hyracks.dataflow.common.comm.io.ResultFrameTupleAccessor;
public class TestRunnerFactory {
- private static final Pattern EMBEDDED_SYSERROR_PATTERN = Pattern
- .compile("org\\.apache\\.vxquery\\.exceptions\\.SystemException: (\\p{javaUpperCase}{4}\\d{4})");
private List<ResultReporter> reporters;
- private XTestOptions opts;
- private ClusterControllerService cc;
- private NodeControllerService nc1;
- private IHyracksClientConnection hcc;
- private IHyracksDataset hds;
+ private TestRunner tr;
public TestRunnerFactory(XTestOptions opts) throws Exception {
+ tr = new TestRunner(opts);
+ tr.open();
reporters = new ArrayList<ResultReporter>();
- this.opts = opts;
-
- CCConfig ccConfig = new CCConfig();
- ccConfig.clientNetIpAddress = "127.0.0.1";
- ccConfig.clientNetPort = 39000;
- ccConfig.clusterNetIpAddress = "127.0.0.1";
- ccConfig.clusterNetPort = 39001;
- ccConfig.profileDumpPeriod = 10000;
- File outDir = new File("target/ClusterController");
- outDir.mkdirs();
- File ccRoot = File.createTempFile(TestRunnerFactory.class.getName(), ".data", outDir);
- ccRoot.delete();
- ccRoot.mkdir();
- ccConfig.ccRoot = ccRoot.getAbsolutePath();
- cc = new ClusterControllerService(ccConfig);
- cc.start();
-
- NCConfig ncConfig1 = new NCConfig();
- ncConfig1.ccHost = "localhost";
- ncConfig1.ccPort = 39001;
- ncConfig1.clusterNetIPAddress = "127.0.0.1";
- ncConfig1.dataIPAddress = "127.0.0.1";
- ncConfig1.datasetIPAddress = "127.0.0.1";
- ncConfig1.nodeId = "nc1";
- nc1 = new NodeControllerService(ncConfig1);
- nc1.start();
-
- hcc = new HyracksConnection(ccConfig.clientNetIpAddress, ccConfig.clientNetPort);
}
public void registerReporter(ResultReporter reporter) {
@@ -105,73 +37,13 @@ public class TestRunnerFactory {
return new Runnable() {
@Override
public void run() {
- TestCaseResult res = new TestCaseResult(testCase);
- if (opts.verbose) {
- System.err.println("Starting " + testCase.getXQueryDisplayName());
- }
- long start = System.currentTimeMillis();
- try {
+ TestCaseResult res = tr.run(testCase);
+ for (ResultReporter r : reporters) {
try {
- XMLQueryCompiler compiler = new XMLQueryCompiler(null, new String[] { "nc1" }, 65536);
- Reader in = new InputStreamReader(new FileInputStream(testCase.getXQueryFile()), "UTF-8");
- CompilerControlBlock ccb = new CompilerControlBlock(new StaticContextImpl(
- RootStaticContextImpl.INSTANCE), new ResultSetId(testCase.getXQueryDisplayName()
- .hashCode()), testCase.getSourceFileMap());
- compiler.compile(testCase.getXQueryDisplayName(), in, ccb, opts.optimizationLevel);
- JobSpecification spec = compiler.getModule().getHyracksJobSpecification();
-
- DynamicContext dCtx = new DynamicContextImpl(compiler.getModule().getModuleContext());
- spec.setGlobalJobDataFactory(new VXQueryGlobalDataFactory(dCtx.createFactory()));
-
- spec.setMaxReattempts(0);
- JobId jobId = hcc.startJob(spec, EnumSet.of(JobFlag.PROFILE_RUNTIME));
-
- if (hds == null) {
- hds = new HyracksDataset(hcc, spec.getFrameSize(), opts.threads);
- }
- ByteBuffer buffer = ByteBuffer.allocate(spec.getFrameSize());
- IHyracksDatasetReader reader = hds.createReader(jobId, ccb.getResultSetId());
- IFrameTupleAccessor frameTupleAccessor = new ResultFrameTupleAccessor(spec.getFrameSize());
- buffer.clear();
- res.result = "";
- while (reader.read(buffer) > 0) {
- buffer.clear();
- res.result += ResultUtils.getStringFromBuffer(buffer, frameTupleAccessor);
- }
- res.result.trim();
- hcc.waitForCompletion(jobId);
- } catch (HyracksException e) {
- Throwable t = e;
- while (t.getCause() != null) {
- t = t.getCause();
- }
- Matcher m = EMBEDDED_SYSERROR_PATTERN.matcher(t.getMessage());
- if (m.find()) {
- String eCode = m.group(1);
- throw new SystemException(ErrorCode.valueOf(eCode), e);
- }
- throw e;
- }
- } catch (SystemException e) {
- res.error = e;
- } catch (Throwable e) {
- res.error = e;
- } finally {
- try {
- res.compare();
+ r.reportResult(res);
} catch (Exception e) {
- System.err.println("Framework error");
e.printStackTrace();
}
- long end = System.currentTimeMillis();
- res.time = end - start;
- for (ResultReporter r : reporters) {
- try {
- r.reportResult(res);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
}
}
};
@@ -182,7 +54,6 @@ public class TestRunnerFactory {
}
public void close() throws Exception {
- nc1.stop();
- cc.stop();
+ tr.close();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/XTest.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/XTest.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/XTest.java
index 41040f4..87f0687 100644
--- a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/XTest.java
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/XTest.java
@@ -78,7 +78,7 @@ public class XTest {
});
trf = new TestRunnerFactory(opts);
trf.registerReporters(reporters);
- TestCaseFactory tcf = new TestCaseFactory(opts.catalog, trf, eSvc, opts);
+ TestCaseFactory tcf = new TestCaseFactory(trf, eSvc, opts);
count = tcf.process();
}
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/JUnitTestCaseFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/JUnitTestCaseFactory.java b/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/JUnitTestCaseFactory.java
new file mode 100644
index 0000000..337fbd2
--- /dev/null
+++ b/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/JUnitTestCaseFactory.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class JUnitTestCaseFactory extends AbstractTestCaseFactory {
+
+ private Collection<Object[]> testCases;
+
+ public JUnitTestCaseFactory(XTestOptions opts) {
+ super(opts);
+ }
+
+ protected void submit(TestCase tc) {
+ boolean toSubmit = include == null || include.matcher(tc.getXQueryDisplayName()).find();
+ toSubmit = toSubmit && (exclude == null || !exclude.matcher(tc.getXQueryDisplayName()).find());
+ if (toSubmit) {
+ testCases.add(new Object[] { tc });
+ ++count;
+ }
+ }
+
+ public Collection<Object[]> getList() throws Exception {
+ testCases = new ArrayList<Object[]>();
+ this.process();
+ return testCases;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java b/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
index 39f4b4f..b9dc37d 100644
--- a/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
+++ b/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.vxquery.xtest;
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.util.Collection;
@@ -27,23 +29,53 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class VXQueryTest {
+ private TestCase tc;
+ private TestRunner tr;
+
+ // private final String CATALOG = "VXQueryCatalog.xml";
+ private static String CATALOG = "VXQuerySingleCatalog.xml";
- private static final String PATH_QUERIES = StringUtils.join(new String[] { "Queries", "XQuery" + File.separator },
- File.separator);
- private static final String PATH_RESULTS = "ExpectedTestResults" + File.separator;
- private static final String PATH_TESTS = "cat" + File.separator;
- private static final String PATH_BASE = StringUtils.join(
- new String[] { "src", "test", "resources" + File.separator }, File.separator);
+ private static XTestOptions getOptions() {
+ XTestOptions opts = new XTestOptions();
+ opts.catalog = StringUtils.join(new String[] { "src", "test", "resources", CATALOG }, File.separator);
+ opts.verbose = true;
+ return opts;
+ }
@Parameters
public static Collection<Object[]> tests() throws Exception {
- return null;
+ JUnitTestCaseFactory jtcf = new JUnitTestCaseFactory(getOptions());
+ return jtcf.getList();
}
- public VXQueryTest() {
+ public VXQueryTest(TestCase tc) throws Exception {
+ this.tc = tc;
+ System.err.println("Query: " + tc.getXQueryFile());
+ tr = new TestRunner(getOptions());
}
@Test
public void test() throws Exception {
+ tr.open();
+ TestCaseResult result = tr.run(tc);
+ System.err.println("result.result: " + result.result);
+ System.err.println("result.report: " + result.report);
+ System.err.println("result.state: " + result.state);
+ switch (result.state) {
+ case EXPECTED_ERROR_GOT_DIFFERENT_ERROR:
+ case EXPECTED_ERROR_GOT_FAILURE:
+ case EXPECTED_ERROR_GOT_RESULT:
+ case EXPECTED_RESULT_GOT_DIFFERENT_RESULT:
+ case EXPECTED_RESULT_GOT_ERROR:
+ case EXPECTED_RESULT_GOT_FAILURE:
+ fail(result.state + " (" + result.time + " ms): " + result.testCase.getXQueryDisplayName());
+ break;
+ case EXPECTED_ERROR_GOT_SAME_ERROR:
+ case EXPECTED_RESULT_GOT_SAME_RESULT:
+ break;
+ case NO_RESULT_FILE:
+ break;
+ }
+ tr.close();
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/add.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/add.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/add.txt
new file mode 100644
index 0000000..e440e5c
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/add.txt
@@ -0,0 +1 @@
+3
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/list.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/list.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/list.txt
new file mode 100644
index 0000000..5f5fbe7
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/list.txt
@@ -0,0 +1,3 @@
+1
+2
+3
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/test/resources/Queries/XQuery/Simple/add.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Simple/add.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Simple/add.xq
new file mode 100644
index 0000000..2b904bd
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Simple/add.xq
@@ -0,0 +1,18 @@
+(: Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License. :)
+
+1+2
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/test/resources/Queries/XQuery/Simple/list.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Simple/list.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Simple/list.xq
new file mode 100644
index 0000000..f1f6e71
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Simple/list.xq
@@ -0,0 +1,18 @@
+(: Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License. :)
+
+(1, 2, 3)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/test/resources/VXQuerySingleCatalog.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/VXQuerySingleCatalog.xml b/vxquery-xtest/src/test/resources/VXQuerySingleCatalog.xml
new file mode 100644
index 0000000..c0fe358
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/VXQuerySingleCatalog.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!DOCTYPE test-suite [
+
+<!ENTITY AggregatePartition1Queries SYSTEM "cat/AggregatePartition1Queries.xml">
+<!ENTITY AggregatePartition2Queries SYSTEM "cat/AggregatePartition2Queries.xml">
+<!ENTITY AggregatePartition4Queries SYSTEM "cat/AggregatePartition4Queries.xml">
+
+<!ENTITY GhcndPartition1Queries SYSTEM "cat/GhcndPartition1Queries.xml">
+<!ENTITY GhcndPartition2Queries SYSTEM "cat/GhcndPartition2Queries.xml">
+<!ENTITY GhcndPartition4Queries SYSTEM "cat/GhcndPartition4Queries.xml">
+
+<!ENTITY GhcndRecordsPartition1Queries SYSTEM "cat/GhcndRecordsPartition1Queries.xml">
+<!ENTITY GhcndRecordsPartition2Queries SYSTEM "cat/GhcndRecordsPartition2Queries.xml">
+<!ENTITY GhcndRecordsPartition4Queries SYSTEM "cat/GhcndRecordsPartition4Queries.xml">
+
+<!ENTITY GhcndCountPartition1Queries SYSTEM "cat/GhcndCountPartition1Queries.xml">
+<!ENTITY GhcndCountPartition2Queries SYSTEM "cat/GhcndCountPartition2Queries.xml">
+<!ENTITY GhcndCountPartition4Queries SYSTEM "cat/GhcndCountPartition4Queries.xml">
+
+<!ENTITY SingleQuery SYSTEM "cat/SingleQuery.xml">
+
+]>
+<test-suite xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ CatalogDesignDate="2014-04-01"
+ version="0.0.1"
+ SourceOffsetPath="./"
+ ResultOffsetPath="ExpectedTestResults/"
+ XQueryQueryOffsetPath="Queries/XQuery/"
+ XQueryXQueryOffsetPath="Queries/XQueryX/"
+ XQueryFileExtension=".xq"
+ XQueryXFileExtension=".xqx"
+ xsi:schemaLocation="http://www.w3.org/2005/02/query-test-XQTSCatalog XQTSCatalog.xsd">
+ <test-suite-info>
+ <title>VXQuery Test Suite</title>
+ <description>
+ Test Suite for VXQuery.
+ </description>
+ </test-suite-info>
+ <sources>
+ <source ID="VXQueryCatalog" FileName="VXQueryCatalog.xml" Creator="VXQuery team">
+ <description last-mod="2014-04-02">VXQuery Test Suite Catalog</description>
+ </source>
+ <source ID="ghcnd" FileName="TestSources/ghcnd" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ <source ID="ghcnd_half_1" FileName="TestSources/ghcnd/half_1" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ <source ID="ghcnd_half_2" FileName="TestSources/ghcnd/half_2" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ <source ID="ghcnd_quarter_1" FileName="TestSources/ghcnd/half_1/quarter_1" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ <source ID="ghcnd_quarter_2" FileName="TestSources/ghcnd/half_1/quarter_2" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ <source ID="ghcnd_quarter_3" FileName="TestSources/ghcnd/half_2/quarter_3" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ <source ID="ghcnd_quarter_4" FileName="TestSources/ghcnd/half_2/quarter_4" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ </sources>
+ <test-group name="SingleQuery" featureOwner="Preston Carman">
+ <GroupInfo>
+ <title>Single Query</title>
+ <description/>
+ </GroupInfo>
+ <test-group name="SingleTest" featureOwner="Preston Carman">
+ <GroupInfo>
+ <title>Single Test</title>
+ <description/>
+ </GroupInfo>
+ &SingleQuery;
+ </test-group>
+ </test-group>
+</test-suite>
http://git-wip-us.apache.org/repos/asf/vxquery/blob/1ac6b407/vxquery-xtest/src/test/resources/cat/SingleQuery.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/cat/SingleQuery.xml b/vxquery-xtest/src/test/resources/cat/SingleQuery.xml
new file mode 100644
index 0000000..19011b7
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/cat/SingleQuery.xml
@@ -0,0 +1,28 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<test-group xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog" name="AggregatePartition1Queries" featureOwner="VXQuery">
+ <GroupInfo>
+ <title>Single Test</title>
+ <description/>
+ </GroupInfo>
+ <test-case name="simple-add" FilePath="Simple/" Creator="Preston Carman">
+ <description>Adds two numbers.</description>
+ <query name="add" date="2014-08-18"/>
+ <output-file compare="Text">add.txt</output-file>
+ </test-case>
+</test-group>
\ No newline at end of file
[3/4] git commit: Added a few single query tests and fixed the maven
test to run the XQuery test suite.
Posted by pr...@apache.org.
Added a few single query tests and fixed the maven test to run the XQuery test suite.
Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/6ded3150
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/6ded3150
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/6ded3150
Branch: refs/heads/master
Commit: 6ded3150f39df3b223adcda4f1b329e9b4819c1f
Parents: 1ac6b40
Author: Preston Carman <pr...@apache.org>
Authored: Mon Aug 18 16:41:41 2014 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Mon Aug 18 16:41:41 2014 -0700
----------------------------------------------------------------------
.../org/apache/vxquery/xtest/TestRunner.java | 1 +
.../org/apache/vxquery/xtest/VXQueryTest.java | 8 +-
.../src/test/resources/VXQueryCatalog.xml | 23 +++++
.../resources/VXQuerySingleAlternateCatalog.xml | 96 ++++++++++++++++++++
.../src/test/resources/VXQuerySingleCatalog.xml | 3 +-
.../test/resources/cat/SingleAlternateQuery.xml | 28 ++++++
6 files changed, 152 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/vxquery/blob/6ded3150/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
index 9c0bc64..daba8ca 100644
--- a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
@@ -133,6 +133,7 @@ public class TestRunner {
res.result.trim();
hcc.waitForCompletion(jobId);
} catch (HyracksException e) {
+ e.printStackTrace();
Throwable t = e;
while (t.getCause() != null) {
t = t.getCause();
http://git-wip-us.apache.org/repos/asf/vxquery/blob/6ded3150/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java b/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
index b9dc37d..a759819 100644
--- a/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
+++ b/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
@@ -32,13 +32,13 @@ public class VXQueryTest {
private TestCase tc;
private TestRunner tr;
- // private final String CATALOG = "VXQueryCatalog.xml";
- private static String CATALOG = "VXQuerySingleCatalog.xml";
+ private static String CATALOG = "VXQueryCatalog.xml";
private static XTestOptions getOptions() {
XTestOptions opts = new XTestOptions();
opts.catalog = StringUtils.join(new String[] { "src", "test", "resources", CATALOG }, File.separator);
opts.verbose = true;
+ opts.threads = 1;
return opts;
}
@@ -50,7 +50,6 @@ public class VXQueryTest {
public VXQueryTest(TestCase tc) throws Exception {
this.tc = tc;
- System.err.println("Query: " + tc.getXQueryFile());
tr = new TestRunner(getOptions());
}
@@ -58,9 +57,6 @@ public class VXQueryTest {
public void test() throws Exception {
tr.open();
TestCaseResult result = tr.run(tc);
- System.err.println("result.result: " + result.result);
- System.err.println("result.report: " + result.report);
- System.err.println("result.state: " + result.state);
switch (result.state) {
case EXPECTED_ERROR_GOT_DIFFERENT_ERROR:
case EXPECTED_ERROR_GOT_FAILURE:
http://git-wip-us.apache.org/repos/asf/vxquery/blob/6ded3150/vxquery-xtest/src/test/resources/VXQueryCatalog.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/VXQueryCatalog.xml b/vxquery-xtest/src/test/resources/VXQueryCatalog.xml
index 014005a..30ebdc5 100644
--- a/vxquery-xtest/src/test/resources/VXQueryCatalog.xml
+++ b/vxquery-xtest/src/test/resources/VXQueryCatalog.xml
@@ -34,6 +34,9 @@
<!ENTITY GhcndCountPartition2Queries SYSTEM "cat/GhcndCountPartition2Queries.xml">
<!ENTITY GhcndCountPartition4Queries SYSTEM "cat/GhcndCountPartition4Queries.xml">
+<!ENTITY SingleQuery SYSTEM "cat/SingleQuery.xml">
+<!ENTITY SingleAlternateQuery SYSTEM "cat/SingleAlternateQuery.xml">
+
]>
<test-suite xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -78,6 +81,26 @@
<description last-mod="2014-04-02">Collection of files</description>
</source>
</sources>
+ <test-group name="SingleQuery" featureOwner="Preston Carman">
+ <GroupInfo>
+ <title>Single Query</title>
+ <description/>
+ </GroupInfo>
+ <test-group name="SingleTestAdd" featureOwner="Preston Carman">
+ <GroupInfo>
+ <title>Single Test Add</title>
+ <description/>
+ </GroupInfo>
+ &SingleQuery;
+ </test-group>
+ <test-group name="SingleTestList" featureOwner="Preston Carman">
+ <GroupInfo>
+ <title>Single Test List</title>
+ <description/>
+ </GroupInfo>
+ &SingleAlternateQuery;
+ </test-group>
+ </test-group>
<test-group name="AggregatePartitionQueries" featureOwner="Preston Carman">
<GroupInfo>
<title>Aggregate Partition Queries</title>
http://git-wip-us.apache.org/repos/asf/vxquery/blob/6ded3150/vxquery-xtest/src/test/resources/VXQuerySingleAlternateCatalog.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/VXQuerySingleAlternateCatalog.xml b/vxquery-xtest/src/test/resources/VXQuerySingleAlternateCatalog.xml
new file mode 100644
index 0000000..c0fe358
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/VXQuerySingleAlternateCatalog.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!DOCTYPE test-suite [
+
+<!ENTITY AggregatePartition1Queries SYSTEM "cat/AggregatePartition1Queries.xml">
+<!ENTITY AggregatePartition2Queries SYSTEM "cat/AggregatePartition2Queries.xml">
+<!ENTITY AggregatePartition4Queries SYSTEM "cat/AggregatePartition4Queries.xml">
+
+<!ENTITY GhcndPartition1Queries SYSTEM "cat/GhcndPartition1Queries.xml">
+<!ENTITY GhcndPartition2Queries SYSTEM "cat/GhcndPartition2Queries.xml">
+<!ENTITY GhcndPartition4Queries SYSTEM "cat/GhcndPartition4Queries.xml">
+
+<!ENTITY GhcndRecordsPartition1Queries SYSTEM "cat/GhcndRecordsPartition1Queries.xml">
+<!ENTITY GhcndRecordsPartition2Queries SYSTEM "cat/GhcndRecordsPartition2Queries.xml">
+<!ENTITY GhcndRecordsPartition4Queries SYSTEM "cat/GhcndRecordsPartition4Queries.xml">
+
+<!ENTITY GhcndCountPartition1Queries SYSTEM "cat/GhcndCountPartition1Queries.xml">
+<!ENTITY GhcndCountPartition2Queries SYSTEM "cat/GhcndCountPartition2Queries.xml">
+<!ENTITY GhcndCountPartition4Queries SYSTEM "cat/GhcndCountPartition4Queries.xml">
+
+<!ENTITY SingleQuery SYSTEM "cat/SingleQuery.xml">
+
+]>
+<test-suite xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ CatalogDesignDate="2014-04-01"
+ version="0.0.1"
+ SourceOffsetPath="./"
+ ResultOffsetPath="ExpectedTestResults/"
+ XQueryQueryOffsetPath="Queries/XQuery/"
+ XQueryXQueryOffsetPath="Queries/XQueryX/"
+ XQueryFileExtension=".xq"
+ XQueryXFileExtension=".xqx"
+ xsi:schemaLocation="http://www.w3.org/2005/02/query-test-XQTSCatalog XQTSCatalog.xsd">
+ <test-suite-info>
+ <title>VXQuery Test Suite</title>
+ <description>
+ Test Suite for VXQuery.
+ </description>
+ </test-suite-info>
+ <sources>
+ <source ID="VXQueryCatalog" FileName="VXQueryCatalog.xml" Creator="VXQuery team">
+ <description last-mod="2014-04-02">VXQuery Test Suite Catalog</description>
+ </source>
+ <source ID="ghcnd" FileName="TestSources/ghcnd" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ <source ID="ghcnd_half_1" FileName="TestSources/ghcnd/half_1" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ <source ID="ghcnd_half_2" FileName="TestSources/ghcnd/half_2" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ <source ID="ghcnd_quarter_1" FileName="TestSources/ghcnd/half_1/quarter_1" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ <source ID="ghcnd_quarter_2" FileName="TestSources/ghcnd/half_1/quarter_2" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ <source ID="ghcnd_quarter_3" FileName="TestSources/ghcnd/half_2/quarter_3" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ <source ID="ghcnd_quarter_4" FileName="TestSources/ghcnd/half_2/quarter_4" Creator="Preston Carman">
+ <description last-mod="2014-04-02">Collection of files</description>
+ </source>
+ </sources>
+ <test-group name="SingleQuery" featureOwner="Preston Carman">
+ <GroupInfo>
+ <title>Single Query</title>
+ <description/>
+ </GroupInfo>
+ <test-group name="SingleTest" featureOwner="Preston Carman">
+ <GroupInfo>
+ <title>Single Test</title>
+ <description/>
+ </GroupInfo>
+ &SingleQuery;
+ </test-group>
+ </test-group>
+</test-suite>
http://git-wip-us.apache.org/repos/asf/vxquery/blob/6ded3150/vxquery-xtest/src/test/resources/VXQuerySingleCatalog.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/VXQuerySingleCatalog.xml b/vxquery-xtest/src/test/resources/VXQuerySingleCatalog.xml
index c0fe358..7be226f 100644
--- a/vxquery-xtest/src/test/resources/VXQuerySingleCatalog.xml
+++ b/vxquery-xtest/src/test/resources/VXQuerySingleCatalog.xml
@@ -35,6 +35,7 @@
<!ENTITY GhcndCountPartition4Queries SYSTEM "cat/GhcndCountPartition4Queries.xml">
<!ENTITY SingleQuery SYSTEM "cat/SingleQuery.xml">
+<!ENTITY SingleAlternateQuery SYSTEM "cat/SingleAlternateQuery.xml">
]>
<test-suite xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog"
@@ -90,7 +91,7 @@
<title>Single Test</title>
<description/>
</GroupInfo>
- &SingleQuery;
+ &SingleAlternateQuery;
</test-group>
</test-group>
</test-suite>
http://git-wip-us.apache.org/repos/asf/vxquery/blob/6ded3150/vxquery-xtest/src/test/resources/cat/SingleAlternateQuery.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/cat/SingleAlternateQuery.xml b/vxquery-xtest/src/test/resources/cat/SingleAlternateQuery.xml
new file mode 100644
index 0000000..ea444d8
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/cat/SingleAlternateQuery.xml
@@ -0,0 +1,28 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<test-group xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog" name="AggregatePartition1Queries" featureOwner="VXQuery">
+ <GroupInfo>
+ <title>Single Test</title>
+ <description/>
+ </GroupInfo>
+ <test-case name="simple-list" FilePath="Simple/" Creator="Preston Carman">
+ <description>Adds two numbers.</description>
+ <query name="list" date="2014-08-18"/>
+ <output-file compare="Text">list.txt</output-file>
+ </test-case>
+</test-group>
\ No newline at end of file
[4/4] git commit: Remove extra reporting.
Posted by pr...@apache.org.
Remove extra reporting.
Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/5ee0a43a
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/5ee0a43a
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/5ee0a43a
Branch: refs/heads/master
Commit: 5ee0a43a73289ccf7b40e9f4c14b0102dd709a77
Parents: 6ded315
Author: Preston Carman <pr...@apache.org>
Authored: Wed Aug 20 23:19:45 2014 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Wed Aug 20 23:19:45 2014 -0700
----------------------------------------------------------------------
.../src/main/java/org/apache/vxquery/xtest/TestRunner.java | 1 -
.../src/test/java/org/apache/vxquery/xtest/VXQueryTest.java | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/vxquery/blob/5ee0a43a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
index daba8ca..9c0bc64 100644
--- a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
@@ -133,7 +133,6 @@ public class TestRunner {
res.result.trim();
hcc.waitForCompletion(jobId);
} catch (HyracksException e) {
- e.printStackTrace();
Throwable t = e;
while (t.getCause() != null) {
t = t.getCause();
http://git-wip-us.apache.org/repos/asf/vxquery/blob/5ee0a43a/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java b/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
index a759819..28d7735 100644
--- a/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
+++ b/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
@@ -37,7 +37,7 @@ public class VXQueryTest {
private static XTestOptions getOptions() {
XTestOptions opts = new XTestOptions();
opts.catalog = StringUtils.join(new String[] { "src", "test", "resources", CATALOG }, File.separator);
- opts.verbose = true;
+ opts.verbose = false;
opts.threads = 1;
return opts;
}