forked from Merck/Halyard
/
HalyardSPARQLQueryTest.java
104 lines (90 loc) · 3.33 KB
/
HalyardSPARQLQueryTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* Copyright 2016 Merck Sharp & Dohme Corp. a subsidiary of Merck & Co.,
* Inc., Kenilworth, NJ, USA.
*
* Licensed 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 com.msd.gin.halyard.strategy;
import java.net.URL;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Deque;
import java.util.List;
import org.eclipse.rdf4j.query.Dataset;
import org.eclipse.rdf4j.testsuite.query.parser.sparql.manifest.SPARQLQueryComplianceTest;
import org.eclipse.rdf4j.repository.Repository;
import org.eclipse.rdf4j.repository.dataset.DatasetRepository;
import org.eclipse.rdf4j.repository.sail.SailRepository;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
/**
*
* @author Adam Sotona (MSD)
*/
@RunWith(Parameterized.class)
public class HalyardSPARQLQueryTest extends SPARQLQueryComplianceTest {
private static final String[] defaultIgnoredTests = {
// currently very slow
"BSBM BI use case query 5",
// working draft property path syntax not supported
"sparql11-sequence-04",
// working draft property path syntax not supported
"sparql11-sequence-05",
// working draft property path syntax not supported
"sparql11-sequence-06",
// incompatible with non-sequential retrieval
"sparql11-subquery-05"
};
private static final List<String> excludedSubdirs = Arrays.asList("service");
@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(getTestData());
}
private static Object[][] getTestData() {
List<Object[]> tests = new ArrayList<>();
Deque<String> manifests = new ArrayDeque<>();
manifests.add(getManifestURL().toExternalForm());
while (!manifests.isEmpty()) {
String pop = manifests.pop();
SPARQLQueryTestManifest manifest = new SPARQLQueryTestManifest(pop, excludedSubdirs, false);
tests.addAll(manifest.getTests());
manifests.addAll(manifest.getSubManifests());
}
Object[][] result = new Object[tests.size()][6];
tests.toArray(result);
return result;
}
protected static URL getManifestURL() {
return SPARQLQueryComplianceTest.class.getClassLoader()
.getResource("testcases-sparql-1.1/manifest-evaluation.ttl");
}
public HalyardSPARQLQueryTest(String displayName, String testURI, String name, String queryFileURL,
String resultFileURL, Dataset dataset, boolean ordered, boolean laxCardinality) {
super(displayName, testURI, name, queryFileURL, resultFileURL, dataset, ordered, laxCardinality);
}
@Override
protected Repository newRepository() {
return new DatasetRepository(new SailRepository(new MockSailWithHalyardStrategy()));
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
for (String defaultIgnoredTest : defaultIgnoredTests) {
addIgnoredTest(defaultIgnoredTest);
}
}
}