Skip to content

Commit 112d8c7

Browse files
committed
issue #819: Missing type for SPARQL repo config
Constructors that take SPARQL query and/or update endpoints did not set the type field properly. Repository managers could not retrieve the config information from the system repository without the type statement later, causing getRepository to fail with an exception: org.eclipse.rdf4j.repository.config.RepositoryConfigException: Repository implementation for repository missing Signed-off-by: Xiaofeng Li <luke.the.coder@gmail.com>
1 parent 8fea325 commit 112d8c7

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

core/repository/sparql/src/main/java/org/eclipse/rdf4j/repository/sparql/config/SPARQLRepositoryConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public SPARQLRepositoryConfig() {
4141
}
4242

4343
public SPARQLRepositoryConfig(String queryEndpointUrl) {
44+
this();
4445
setQueryEndpointUrl(queryEndpointUrl);
4546
}
4647

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.eclipse.rdf4j.repository.sparql.config;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.assertEquals;
6+
import static org.junit.Assert.assertNull;
7+
8+
/**
9+
* Tests for {@link SPARQLRepositoryConfig}.
10+
*
11+
* @author infgeoax
12+
*/
13+
public class SPARQLRepositoryConfigTest {
14+
15+
private static final String QUERY_ENDPOINT_URL = "http://example.com/sparql";
16+
17+
private static final String UPDATE_ENDPOINT_URL = "http://example.com/update";
18+
19+
@Test public void testConstructorWithSPARQLEndpoint() {
20+
SPARQLRepositoryConfig config = new SPARQLRepositoryConfig(QUERY_ENDPOINT_URL);
21+
assertEquals(QUERY_ENDPOINT_URL, config.getQueryEndpointUrl());
22+
assertNull(config.getUpdateEndpointUrl());
23+
assertEquals(SPARQLRepositoryFactory.REPOSITORY_TYPE, config.getType());
24+
}
25+
26+
@Test public void testConstructorWithQueryAndUpdateEndpoints() {
27+
SPARQLRepositoryConfig config = new SPARQLRepositoryConfig(QUERY_ENDPOINT_URL, UPDATE_ENDPOINT_URL);
28+
assertEquals(QUERY_ENDPOINT_URL, config.getQueryEndpointUrl());
29+
assertEquals(UPDATE_ENDPOINT_URL, config.getUpdateEndpointUrl());
30+
assertEquals(SPARQLRepositoryFactory.REPOSITORY_TYPE, config.getType());
31+
}
32+
}

0 commit comments

Comments
 (0)