From 4aa75106eb252e74a64a530abc17d1d56e6a6083 Mon Sep 17 00:00:00 2001 From: Andy Seaborne Date: Thu, 13 Aug 2026 10:40:21 +0100 Subject: [PATCH] GH-4153: Remove upload of dataset assembler/service config --- .../jena/fuseki/mgt/ActionDatasets.java | 120 +------ .../apache/jena/fuseki/mgt/ActionReload.java | 2 + .../apache/jena/fuseki/mgt/FusekiAdmin.java | 42 --- .../jena/fuseki/mod/admin/TSMod_Admin.java | 1 - .../admin/TestAdminAddDatasetsConfigFile.java | 321 ------------------ .../testing/Config/config-ds-bad-name-1.ttl | 15 - .../testing/Config/config-ds-bad-name-2.ttl | 15 - .../testing/Config/config-ds-bad-name-3.ttl | 15 - .../testing/Config/config-ds-bad-name-4.ttl | 15 - .../testing/Config/config-ds-inf.ttl | 30 -- .../testing/Config/config-ds-plain-1.ttl | 17 - .../testing/Config/config-ds-plain-2.ttl | 18 - .../testing/Config/config-tdb2a.ttl | 18 - .../testing/Config/config-tdb2b.ttl | 18 - .../testing/Config/config-tdb2c.ttl | 19 -- 15 files changed, 6 insertions(+), 660 deletions(-) delete mode 100644 jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mgt/FusekiAdmin.java delete mode 100644 jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/mod/admin/TestAdminAddDatasetsConfigFile.java delete mode 100644 jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-1.ttl delete mode 100644 jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-2.ttl delete mode 100644 jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-3.ttl delete mode 100644 jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-4.ttl delete mode 100644 jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-inf.ttl delete mode 100644 jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-plain-1.ttl delete mode 100644 jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-plain-2.ttl delete mode 100644 jena-fuseki2/jena-fuseki-main/testing/Config/config-tdb2a.ttl delete mode 100644 jena-fuseki2/jena-fuseki-main/testing/Config/config-tdb2b.ttl delete mode 100644 jena-fuseki2/jena-fuseki-main/testing/Config/config-tdb2c.ttl diff --git a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java index 82b8b25813b..df3abd767b5 100644 --- a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java +++ b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java @@ -28,7 +28,6 @@ import java.nio.file.Path; import java.util.*; -import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.apache.jena.atlas.RuntimeIOException; import org.apache.jena.atlas.io.IO; @@ -36,11 +35,9 @@ import org.apache.jena.atlas.json.JsonValue; import org.apache.jena.atlas.lib.FileOps; import org.apache.jena.atlas.lib.InternalErrorException; -import org.apache.jena.atlas.lib.NotImplemented; import org.apache.jena.atlas.logging.FmtLog; import org.apache.jena.atlas.web.ContentType; import org.apache.jena.datatypes.xsd.XSDDatatype; -import org.apache.jena.dboe.base.file.Location; import org.apache.jena.fuseki.FusekiConfigException; import org.apache.jena.fuseki.build.DatasetDescriptionMap; import org.apache.jena.fuseki.build.FusekiConfig; @@ -51,13 +48,8 @@ import org.apache.jena.fuseki.servlets.ActionLib; import org.apache.jena.fuseki.servlets.HttpAction; import org.apache.jena.fuseki.servlets.ServletOps; -import org.apache.jena.fuseki.system.FusekiNetLib; -import org.apache.jena.graph.Graph; import org.apache.jena.graph.Node; -import org.apache.jena.query.Query; -import org.apache.jena.query.QueryFactory; import org.apache.jena.rdf.model.*; -import org.apache.jena.rdf.model.impl.Util; import org.apache.jena.riot.*; import org.apache.jena.riot.system.StreamRDF; import org.apache.jena.riot.system.StreamRDFLib; @@ -65,12 +57,7 @@ import org.apache.jena.sparql.core.DatasetGraph; import org.apache.jena.sparql.core.Quad; import org.apache.jena.sparql.core.assembler.AssemblerUtils; -import org.apache.jena.sparql.exec.QueryExec; -import org.apache.jena.sparql.exec.RowSet; import org.apache.jena.sparql.util.FmtUtils; -import org.apache.jena.system.G; -import org.apache.jena.tdb1.TDB1; -import org.apache.jena.tdb2.TDB2; import org.apache.jena.vocabulary.RDF; import org.apache.jena.web.HttpSC; @@ -140,21 +127,15 @@ protected JsonValue execPostContainer(HttpAction action) { Model modelFromRequest = ModelFactory.createDefaultModel(); StreamRDF dest = StreamRDFLib.graph(modelFromRequest.getGraph()); - boolean templatedRequest = false; - try { if ( hasParams || WebContent.isHtmlForm(ct) ) { + // ?dbType=...&dbName=... assemblerFromForm(action, dest); - templatedRequest = true; - // dbName, dbType } else if ( WebContent.isMultiPartForm(ct) ) { - // Cannot be enabled. ServletOps.errorBadRequest("Service configuration from a multipart upload not supported"); - //assemblerFromUpload(action, dest); } else { - if ( ! FusekiAdmin.allowConfigFiles() ) - ServletOps.errorBadRequest("Service configuration from an upload file not supported"); - assemblerFromBody(action, dest); + action.log.error(format("[%d] Service configuration from an upload file not supported", action.id)); + ServletOps.errorBadRequest("Service configuration from an upload file not supported"); } } catch (RiotException ex) { ActionLib.consumeBody(action); @@ -186,7 +167,7 @@ protected JsonValue execPostContainer(HttpAction action) { final String datasetPath; { String datasetName = object.getLexicalForm(); - // This duplicates the code FusekiBuilder.buildDataAccessPoint to give better error messages and HTTP status code." + // This duplicates the code FusekiBuilder.buildDataAccessPoint to give better error messages and HTTP status code. // ---- Check and canonicalize name. // Various explicit check for better error messages. @@ -233,19 +214,6 @@ protected JsonValue execPostContainer(HttpAction action) { ServletOps.error(HttpSC.CONFLICT_409, format("Name already registered '%s'", datasetPath)); } - // -- Validate any TDB locations. - // If this is a templated request, there is no need to do this - // because the location is "datasetPath" which has been checked. - if ( ! templatedRequest ) { - List tdbLocations = tdbLocations(action, model.getGraph()); - for(String tdbLocation : tdbLocations ) { - if ( ! isValidTDBLocation(tdbLocation) ) { - action.log.warn(format("[%d] TDB database location not acceptable: '%s'", action.id, tdbLocation)); - ServletOps.error(HttpSC.BAD_REQUEST_400, format("TDB database location not acceptable: '%s'", tdbLocation)); - } - } - } - // ---- // Keep a persistent copy with a globally unique name. // This is not used for anything other than being "for the record". @@ -321,21 +289,6 @@ private boolean isValidServiceName(String datasetPath) { return true; } - // This works for TDB1 as well. - private boolean isValidTDBLocation(String tdbLocation) { - Location location = Location.create(tdbLocation); - if ( location.isMem() ) - return true; - // No ".." - if (tdbLocation.startsWith("..") || tdbLocation.contains("/..") ) { - // That test was too strict. - List components = FileOps.pathComponents(tdbLocation); - if ( components.contains("..") ) - return false; - } - return true; - } - /** Find the service resource. There must be only one in the configuration. */ private Statement findService(Model model) { // Try to find by unique pServiceName (max backwards compatibility) @@ -502,10 +455,6 @@ protected void execDeleteItem(HttpAction action) { } } - private static void assemblerFromBody(HttpAction action, StreamRDF dest) { - bodyAsGraph(action, dest); - } - private static Map dbTypeToTemplate = new HashMap<>(); static { dbTypeToTemplate.put(tDatabaseTDB, Template.templateTDB1_FN); @@ -545,11 +494,6 @@ private static void assemblerFromForm(HttpAction action, StreamRDF dest) { RDFParser.create().source(new StringReader(instance)).base("http://base/").lang(Lang.TTL).parse(dest); } - private static void assemblerFromUpload(HttpAction action, StreamRDF dest) { - throw new NotImplemented(); - //DataUploader.incomingData(action, dest); - } - // ---- Auxiliary functions private static Quad getOne(DatasetGraph dsg, Node g, Node s, Node p, Node o) { @@ -571,60 +515,4 @@ private static Statement getOne(Model m, Resource s, Property p, RDFNode o) { return null; return stmt; } - - private static void bodyAsGraph(HttpAction action, StreamRDF dest) { - HttpServletRequest request = action.getRequest(); - String base = ActionLib.wholeRequestURL(request); - ContentType ct = FusekiNetLib.getContentType(request); - Lang lang = RDFLanguages.contentTypeToLang(ct.getContentTypeStr()); - if ( lang == null ) { - ServletOps.errorBadRequest("Unknown content type for triples: " + ct); - return; - } - dest.prefix("root", base+"#"); - ActionLib.parse(action, dest, lang, base); - } - - // ---- POST - - private static final String NL = "\n"; - - @SuppressWarnings("removal") - private static final String queryStringLocations = - "PREFIX tdb1: <"+TDB1.namespace+">"+NL+ - "PREFIX tdb2: <"+TDB2.namespace+">"+NL+ - """ - SELECT * { - ?x ( tdb2:location | tdb1:location) ?location - } - """ ; - - private static final Query queryLocations = QueryFactory.create(queryStringLocations); - - private static List tdbLocations(HttpAction action, Graph configGraph) { - try ( QueryExec exec = QueryExec.graph(configGraph).query(queryLocations).build() ) { - RowSet results = exec.select(); - List locations = new ArrayList<>(); - results.forEach(b->{ - Node loc = b.get("location"); - String location; - if ( loc.isURI() ) - location = loc.getURI(); - else if ( Util.isSimpleString(loc) ) - location = G.asString(loc); - else { - //action.log.warn(format("[%d] Database location is not a string nor a URI", action.id)); - // No return - ServletOps.errorBadRequest("TDB database location is not a string"); - location = null; - } - locations.add(location); - }); - return locations; - } catch (Exception ex) { - // No return - ServletOps.errorBadRequest("TDB database location can not be deterined"); - return null; - } - } } diff --git a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mgt/ActionReload.java b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mgt/ActionReload.java index cb7b0592976..82f2414b3bb 100644 --- a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mgt/ActionReload.java +++ b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mgt/ActionReload.java @@ -41,6 +41,8 @@ */ public class ActionReload extends ActionCtl { + public ActionReload() {} + @Override public void validate(HttpAction action) { if ( action.getRequestMethod() != HttpMethod.METHOD_POST ) { diff --git a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mgt/FusekiAdmin.java b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mgt/FusekiAdmin.java deleted file mode 100644 index 80e3c73d10e..00000000000 --- a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mgt/FusekiAdmin.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 - * - * https://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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.apache.jena.fuseki.mgt; - -public class FusekiAdmin { - /** - * Control whether to allow creating new dataservices by uploading a config file. - * See {@link ActionDatasets}. - * - */ - public static final String allowConfigFileProperty = "fuseki:allowAddByConfigFile"; - - /** - * Return whether to allow service configuration files to be uploaded as a file. - * See {@link ActionDatasets}. - */ - public static boolean allowConfigFiles() { - String value = System.getProperty(allowConfigFileProperty); - if ( value != null ) - return "true".equals(value); - return false; - } -} diff --git a/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/mod/admin/TSMod_Admin.java b/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/mod/admin/TSMod_Admin.java index 53d6e5bb451..0ee0ff1128c 100644 --- a/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/mod/admin/TSMod_Admin.java +++ b/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/mod/admin/TSMod_Admin.java @@ -28,7 +28,6 @@ @SelectClasses({ TestAdmin.class, TestAdminDatabaseOps.class, - TestAdminAddDatasetsConfigFile.class, TestAdminAddDatasetTemplate.class, TestFusekiReload.class, }) diff --git a/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/mod/admin/TestAdminAddDatasetsConfigFile.java b/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/mod/admin/TestAdminAddDatasetsConfigFile.java deleted file mode 100644 index 22703507884..00000000000 --- a/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/mod/admin/TestAdminAddDatasetsConfigFile.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * 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 - * - * https://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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.apache.jena.fuseki.mod.admin; - -import static org.apache.jena.fuseki.mgt.ServerMgtConst.opDatasets; -import static org.apache.jena.http.HttpOp.httpDelete; -import static org.apache.jena.http.HttpOp.httpGet; -import static org.apache.jena.http.HttpOp.httpPost; -import static org.junit.jupiter.api.Assumptions.assumeFalse; - -import java.io.FileNotFoundException; -import java.net.http.HttpRequest.BodyPublisher; -import java.net.http.HttpRequest.BodyPublishers; -import java.nio.file.Path; -import java.util.Objects; -import java.util.function.Consumer; - -import org.apache.commons.lang3.SystemUtils; -import org.apache.jena.atlas.io.IO; -import org.apache.jena.atlas.logging.LogCtl; -import org.apache.jena.atlas.web.TypedInputStream; -import org.apache.jena.fuseki.Fuseki; -import org.apache.jena.fuseki.main.FusekiServer; -import org.apache.jena.fuseki.main.FusekiTestLib; -import org.apache.jena.fuseki.main.sys.FusekiModules; -import org.apache.jena.fuseki.mgt.FusekiAdmin; -import org.apache.jena.fuseki.test.HttpTest; -import org.apache.jena.riot.WebContent; -import org.apache.jena.web.HttpSC; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -/** - * Tests of the admin functionality adding and deleting datasets dynamically. - * See also {@link TestAdminAddDatasetTemplate}. - */ -public class TestAdminAddDatasetsConfigFile extends FusekiServerPerTest { - // Name of the dataset in the assembler file. - static String dsTest = "test-ds1"; - static String dsTestInf = "test-ds4"; - - static final String dsTestTdb2a = "test-tdb2a"; - static final String dsTestTdb2b = "test-tdb2b"; - static final String dsTestTdb2c = "test-tdb2c"; - static String fileBase = "testing/Config/"; - - // Exactly the module under test - @Override - protected FusekiModules modulesSetup() { - return FusekiModules.create(FMod_Admin.create()); - } - - @BeforeAll public static void loggingAdmin() { - LogCtl.setLevel(Fuseki.adminLogName, "ERROR"); - } - - @AfterAll public static void resetLoggingAdmin() { - LogCtl.setLevel(Fuseki.adminLogName, "ERROR"); - } - - protected void withServerFileEnabled(Consumer action) { - System.setProperty(FusekiAdmin.allowConfigFileProperty, "true"); - try { - super.withServer(null, action); - } finally { - System.getProperties().remove(FusekiAdmin.allowConfigFileProperty); - } - } - - @Test public void add_block_dataset_1() { - // Blocked by default. - withServer(server -> { - FusekiTestLib.expect400(()->addTestDatasetByFile(server, "config-ds-plain-1.ttl")); - }); - } - - @Test public void add_unblocked_dataset_1() { - // Blocked by default. - withServerFileEnabled(server -> { - addTestDatasetByFile(server, "config-ds-plain-1.ttl"); - }); - } - - // Try to add twice - @Test public void add_add_dataset_1() { - withServerFileEnabled(server -> { - checkNotThere(server, dsTest); - - addTestDatasetByFile(server, "config-ds-plain-1.ttl"); - checkExists(server, dsTest); - - // Second try should fail. - FusekiTestLib.expect409(()->addTestDatasetByFile(server, "config-ds-plain-1.ttl")); - - // Check still exists. - checkExists(server, dsTest); - // Delete-able. - deleteDataset(server, dsTest); - checkNotThere(server, dsTest); - }); - } - - @Test public void add_delete_dataset_1() { - withServerFileEnabled(server -> { - - checkNotThere(server, dsTest); - checkNotThere(server, dsTestInf); - addTestDatasetByFile(server, "config-ds-inf.ttl"); - checkNotThere(server, dsTest); - checkExists(server, dsTestInf); - - deleteDataset(server, dsTestInf); - - checkNotThere(server, dsTestInf); - addTestDatasetByFile(server, "config-ds-inf.ttl"); - checkExists(server, dsTestInf); - deleteDataset(server, dsTestInf); - }); - } - - @Test public void add_delete_dataset_2() { - withServerFileEnabled(server -> { - // New style operations : cause two fuseki:names - addTestDatasetByFile(server, "config-ds-plain-2.ttl"); - checkExists(server, "test-ds2"); - }); - } - - @Test public void add_delete_dataset_TDB_1() { - withServerFileEnabled(server -> { - - String testDB = dsTestTdb2a; - assumeNotWindows(); - - checkNotThere(server, testDB); - - addTestDatasetTDB2(server, testDB); - - // Check exists. - checkExists(server, testDB); - - // Remove it. - deleteDataset(server, testDB); - checkNotThere(server, testDB); - }); - } - - @Test public void add_delete_dataset_TDB_2() { - withServerFileEnabled(server -> { - // This has location "--mem--" - String testDB = dsTestTdb2b; - checkNotThere(server, testDB); - addTestDatasetTDB2(server, testDB); - // Check exists. - checkExists(server, testDB); - // Remove it. - deleteDataset(server, testDB); - checkNotThere(server, testDB); - }); - } - - @Test public void add_dataset_error_1() { - withServerFileEnabled(server -> { - HttpTest.execWithHttpException(HttpSC.BAD_REQUEST_400, - ()-> addTestDatasetByFile(server, "config-ds-bad-name-1.ttl")); - }); - } - - @Test public void add_dataset_error_2() { - withServerFileEnabled(server -> { - HttpTest.execWithHttpException(HttpSC.BAD_REQUEST_400, - ()-> addTestDatasetByFile(server, "config-ds-bad-name-2.ttl")); - }); - } - - @Test public void add_dataset_error_3() { - withServerFileEnabled(server -> { - HttpTest.execWithHttpException(HttpSC.BAD_REQUEST_400, - ()-> addTestDatasetByFile(server, "config-ds-bad-name-3.ttl")); - }); - } - - @Test public void add_dataset_error_4() { - withServerFileEnabled(server -> { - HttpTest.execWithHttpException(HttpSC.BAD_REQUEST_400, - ()-> addTestDatasetByFile(server, "config-ds-bad-name-4.ttl")); - }); - } - - @Test public void add_dataset_error_5() { - withServerFileEnabled(server -> { - HttpTest.execWithHttpException(HttpSC.BAD_REQUEST_400, - ()-> addTestDatasetBodyPublisher(server, BodyPublishers.noBody())); - }); - } - - @Test public void add_dataset_error_6() { - withServerFileEnabled(server -> { - HttpTest.execWithHttpException(HttpSC.BAD_REQUEST_400, - ()-> addTestDatasetBodyPublisher(server, BodyPublishers.ofString(""))); - }); - } - - @Test public void add_dataset_error_7() { - withServerFileEnabled(server -> { - String level = LogCtl.getLevel(Fuseki.adminLog); - LogCtl.setLevel(Fuseki.adminLog, "FATAL"); - HttpTest.execWithHttpException(HttpSC.BAD_REQUEST_400, - ()-> addTestDatasetBodyPublisher(server, BodyPublishers.ofString("JUNK"))); - LogCtl.setLevel(Fuseki.adminLog, level); - }); - } - - @Test public void add_dataset_error_8() { - withServerFileEnabled(server -> { - String level = LogCtl.getLevel(Fuseki.adminLog); - LogCtl.setLevel(Fuseki.adminLog, "FATAL"); - HttpTest.execWithHttpException(HttpSC.BAD_REQUEST_400, - ()-> addTestDatasetTDB2(server, dsTestTdb2c)); - LogCtl.setLevel(Fuseki.adminLog, level); - }); - } - - @Test public void delete_dataset_1() { - withServerFileEnabled(server -> { - String name = "NoSuchDataset"; - HttpTest.expect404( ()-> httpDelete(server.serverURL()+"$/"+opDatasets+"/"+name) ); - }); - } - - // ---- Backup - - private void assumeNotWindows() { - assumeFalse(SystemUtils.IS_OS_WINDOWS, "Test may be unstable on Windows due to inability to delete memory-mapped files"); - } - - private void deleteDataset(FusekiServer server, String name) { - httpDelete(server.serverURL()+"$/"+opDatasets+"/"+name); - } - - private void addTestDatasetWithName(FusekiServer server, String dsName) { - addTestDatasetWithName(server, dsName, "mem"); - } - - private void addTestDatasetWithName(FusekiServer server, String dsName, String dbType) { - String URL = server.serverURL()+"$/"+opDatasets+"?dbName="+dsName+"&dbType="+dbType; - String ct = WebContent.contentTypeTurtle; - httpPost(URL); - } - - private void addTestDatasetTDB2(FusekiServer server, String DBname) { - Objects.nonNull(DBname); - switch(DBname) { - case dsTestTdb2a-> addTestDatasetByFile(server, "config-tdb2a.ttl"); - case dsTestTdb2b-> addTestDatasetByFile(server, "config-tdb2b.ttl"); - case dsTestTdb2c-> addTestDatasetByFile(server, "config-tdb2c.ttl"); - default->throw new IllegalArgumentException("No configuration for "+DBname); - } - } - - private void addTestDatasetByFile(FusekiServer server, String filename) { - try { - Path f = Path.of(fileBase+filename); - BodyPublisher body = BodyPublishers.ofFile(f); - addTestDatasetBodyPublisher(server, body); - } catch (FileNotFoundException e) { - IO.exception(e); - } - } - - private void addTestDatasetBodyPublisher(FusekiServer server, BodyPublisher body) { - String ct = WebContent.contentTypeTurtle; - httpPost(server.serverURL()+"$/"+opDatasets, ct, body); - } - - private void askPing(FusekiServer server, String name) { - if ( name.startsWith("/") ) - name = name.substring(1); - try ( TypedInputStream in = httpGet(server.serverURL()+name+"/sparql?query=ASK%7B%7D") ) { - IO.skipToEnd(in); - } - } - - private void adminPing(FusekiServer server, String name) { - try ( TypedInputStream in = httpGet(server.serverURL()+"$/"+opDatasets+"/"+name) ) { - IO.skipToEnd(in); - } - } - - private void checkExists(FusekiServer server, String name) { - adminPing(server, name); - askPing(server, name); - } - - private void checkNotThere(FusekiServer server, String name) { - String n = (name.startsWith("/")) ? name.substring(1) : name; - // Check gone exists. - HttpTest.expect404(()-> adminPing(server, n)); - HttpTest.expect404(() -> askPing(server, n)); - } -} diff --git a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-1.ttl b/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-1.ttl deleted file mode 100644 index 05640fd0cf8..00000000000 --- a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-1.ttl +++ /dev/null @@ -1,15 +0,0 @@ -@prefix : <#> . -@prefix fuseki: . -@prefix rdf: . - -@prefix rdfs: . -@prefix ja: . - -<#service1> rdf:type fuseki:Service ; - # URI of the dataset -- http://host:port/ds - fuseki:name "" ; - fuseki:serviceQuery "sparql" ; - fuseki:dataset <#emptyDataset> ; - . - -<#emptyDataset> rdf:type ja:RDFDataset . diff --git a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-2.ttl b/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-2.ttl deleted file mode 100644 index 27df06bcb45..00000000000 --- a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-2.ttl +++ /dev/null @@ -1,15 +0,0 @@ -@prefix : <#> . -@prefix fuseki: . -@prefix rdf: . - -@prefix rdfs: . -@prefix ja: . - -<#service1> rdf:type fuseki:Service ; - # URI of the dataset -- http://host:port/ds - fuseki:name " " ; - fuseki:serviceQuery "sparql" ; - fuseki:dataset <#emptyDataset> ; - . - -<#emptyDataset> rdf:type ja:RDFDataset . diff --git a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-3.ttl b/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-3.ttl deleted file mode 100644 index 19caef108be..00000000000 --- a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-3.ttl +++ /dev/null @@ -1,15 +0,0 @@ -@prefix : <#> . -@prefix fuseki: . -@prefix rdf: . - -@prefix rdfs: . -@prefix ja: . - -<#service1> rdf:type fuseki:Service ; - # URI of the dataset -- http://host:port/ds - fuseki:name "ABC DEF" ; - fuseki:serviceQuery "sparql" ; - fuseki:dataset <#emptyDataset> ; - . - -<#emptyDataset> rdf:type ja:RDFDataset . diff --git a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-4.ttl b/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-4.ttl deleted file mode 100644 index f57840e4185..00000000000 --- a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-bad-name-4.ttl +++ /dev/null @@ -1,15 +0,0 @@ -@prefix : <#> . -@prefix fuseki: . -@prefix rdf: . - -@prefix rdfs: . -@prefix ja: . - -<#service1> rdf:type fuseki:Service ; - # URI of the dataset -- http://host:port/ds - fuseki:name "/ABC DEF " ; - fuseki:serviceQuery "sparql" ; - fuseki:dataset <#emptyDataset> ; - . - -<#emptyDataset> rdf:type ja:RDFDataset . diff --git a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-inf.ttl b/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-inf.ttl deleted file mode 100644 index b75cf18ce38..00000000000 --- a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-inf.ttl +++ /dev/null @@ -1,30 +0,0 @@ -PREFIX : <#> -PREFIX fuseki: -PREFIX rdf: - -PREFIX rdfs: -PREFIX ja: -PREFIX tdb2: - -<#service2> rdf:type fuseki:Service ; - fuseki:name "test-ds4" ; - fuseki:serviceQuery "sparql" ; - fuseki:dataset <#infDataset> ; - . - -<#infDataset> rdf:type ja:RDFDataset ; - ja:defaultGraph <#infGraph> ; - . - -<#infGraph> a ja:InfModel; - ja:reasoner [ja:reasonerURL ] ; - ja:baseModel <#tdb_graph> ; - . - -<#tdb_graph> rdf:type tdb2:GraphTDB ; - tdb2:dataset <#tdb_dataset> ; - . - -<#tdb_dataset> rdf:type tdb2:DatasetTDB ; - tdb2:location "--mem--" ; - . diff --git a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-plain-1.ttl b/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-plain-1.ttl deleted file mode 100644 index f993f350fd6..00000000000 --- a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-plain-1.ttl +++ /dev/null @@ -1,17 +0,0 @@ -## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 - -PREFIX : <#> -PREFIX fuseki: -PREFIX rdf: - -PREFIX rdfs: -PREFIX ja: - -<#service1> #rdf:type fuseki:Service ; - # URI of the dataset -- http://host:port/ds - fuseki:name "test-ds1" ; - fuseki:serviceQuery "sparql" ; - fuseki:dataset <#emptyDataset> ; - . - -<#emptyDataset> rdf:type ja:RDFDataset . diff --git a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-plain-2.ttl b/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-plain-2.ttl deleted file mode 100644 index d4b3fc90221..00000000000 --- a/jena-fuseki2/jena-fuseki-main/testing/Config/config-ds-plain-2.ttl +++ /dev/null @@ -1,18 +0,0 @@ -## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 - -PREFIX : <#> -PREFIX fuseki: -PREFIX rdf: -PREFIX rdfs: -PREFIX ja: - -<#service1> rdf:type fuseki:Service ; - fuseki:name "test-ds2" ; - fuseki:endpoint [ - fuseki:operation fuseki:query ; - fuseki:name "sparql" - ] ; - fuseki:dataset <#emptyDataset> ; - . - -<#emptyDataset> rdf:type ja:MemoryDataset . diff --git a/jena-fuseki2/jena-fuseki-main/testing/Config/config-tdb2a.ttl b/jena-fuseki2/jena-fuseki-main/testing/Config/config-tdb2a.ttl deleted file mode 100644 index 6ad26b9835f..00000000000 --- a/jena-fuseki2/jena-fuseki-main/testing/Config/config-tdb2a.ttl +++ /dev/null @@ -1,18 +0,0 @@ -## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 - -PREFIX : <#> -PREFIX fuseki: -PREFIX rdf: - -PREFIX rdfs: -PREFIX ja: -PREFIX tdb2: - -<#service1> rdf:type fuseki:Service ; - fuseki:name "test-tdb2a" ; - fuseki:endpoint [ fuseki:name "sparql" ; - fuseki:operation fuseki:query ] ; - fuseki:dataset <#dataset> . - -<#dataset> rdf:type tdb2:DatasetTDB2 ; - tdb2:location "target/tdb2a" . diff --git a/jena-fuseki2/jena-fuseki-main/testing/Config/config-tdb2b.ttl b/jena-fuseki2/jena-fuseki-main/testing/Config/config-tdb2b.ttl deleted file mode 100644 index 56a8a9a0d3e..00000000000 --- a/jena-fuseki2/jena-fuseki-main/testing/Config/config-tdb2b.ttl +++ /dev/null @@ -1,18 +0,0 @@ -## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 - -PREFIX : <#> -PREFIX fuseki: -PREFIX rdf: - -PREFIX rdfs: -PREFIX ja: -PREFIX tdb2: - -<#service1> rdf:type fuseki:Service ; - fuseki:name "test-tdb2b" ; - fuseki:endpoint [ fuseki:name "sparql" ; - fuseki:operation fuseki:query ] ; - fuseki:dataset <#dataset> . - -<#dataset> rdf:type tdb2:DatasetTDB2 ; - tdb2:location "--mem--" . diff --git a/jena-fuseki2/jena-fuseki-main/testing/Config/config-tdb2c.ttl b/jena-fuseki2/jena-fuseki-main/testing/Config/config-tdb2c.ttl deleted file mode 100644 index 359edd43dee..00000000000 --- a/jena-fuseki2/jena-fuseki-main/testing/Config/config-tdb2c.ttl +++ /dev/null @@ -1,19 +0,0 @@ -## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 - -PREFIX : <#> -PREFIX fuseki: -PREFIX rdf: - -PREFIX rdfs: -PREFIX ja: -PREFIX tdb2: - -<#service1> rdf:type fuseki:Service ; - fuseki:name "test-tdb2b" ; - fuseki:endpoint [ fuseki:name "sparql" ; - fuseki:operation fuseki:query ] ; - fuseki:dataset <#dataset> . - -<#dataset> rdf:type tdb2:DatasetTDB2 ; - # Bad. - tdb2:location "../tdb2c" .