diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 16a25ca7f..4d4ee9741 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -12,20 +12,40 @@ on: jobs: build: runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + jdk: ['8', '11'] + # temurin is Eclipse/AdoptOpenJDK/Adoptium + # liberica is a build of Oracle GraalVM + distribution: ['temurin', 'zulu', 'liberica'] + experimental: [false] + # jena 3.x has some locking problems under JDK 16/17 +# include: +# - jdk: '16' +# experimental: true +# distribution: zulu +# - jdk: '17' +# experimental: true +# distribution: zulu +## - jdk: '18-ea' +# experimental: true + continue-on-error: ${{ matrix.experimental }} steps: - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - name: Set up JDK ${{ matrix.jdk }} + uses: actions/setup-java@v2 with: - java-version: 1.8 + distribution: ${{ matrix.distribution }} + java-version: ${{ matrix.jdk }} - uses: actions/cache@v1 with: path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-${{ matrix.jdk }}_${{ matrix.distribution }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | - ${{ runner.os }}-maven- + ${{ runner.os }}-${{ matrix.jdk }}_${{ matrix.distribution }}-maven- - name: Build with Maven run: | mvn -B package --file pom.xml diff --git a/client/oslc-client/pom.xml b/client/oslc-client/pom.xml index a67283642..d79d29cd0 100644 --- a/client/oslc-client/pom.xml +++ b/client/oslc-client/pom.xml @@ -107,17 +107,14 @@ org.mockito mockito-core - 2.23.4 test junit junit - 4.13.1 test - org.assertj assertj-core test @@ -146,18 +143,4 @@ - - - - xml-apis - xml-apis - 1.3.04 - - - xerces - xercesImpl - 2.12.0 - - - diff --git a/client/oslc-java-client/pom.xml b/client/oslc-java-client/pom.xml index 2c45a13e1..df3f82c38 100644 --- a/client/oslc-java-client/pom.xml +++ b/client/oslc-java-client/pom.xml @@ -64,7 +64,7 @@ org.apache.jena apache-jena-libs pom - 3.14.0 + 3.16.0 net.oauth.core @@ -143,10 +143,6 @@ xerces xercesImpl - - xml-apis - xml-apis - javax.servlet javax.servlet-api @@ -168,13 +164,12 @@ org.mockito mockito-core - 1.8.5 + 3.9.0 test junit junit - 4.13.1 test @@ -230,13 +225,6 @@ - org.apache.httpcomponents httpclient @@ -250,7 +238,7 @@ xml-apis xml-apis - 1.3.04 + 1.4.01 xerces @@ -262,6 +250,11 @@ jaxb-impl 2.2 + + javax.xml.bind + jaxb-api + 2.2.1 + diff --git a/core/oslc4j-core/pom.xml b/core/oslc4j-core/pom.xml index f60a0c9d9..76b5c261c 100644 --- a/core/oslc4j-core/pom.xml +++ b/core/oslc4j-core/pom.xml @@ -11,10 +11,6 @@ Lyo :: Core :: OSLC Core components of the Eclipse Lyo OSLC4J SDK. - - 1.6.5 - - jakarta.ws.rs @@ -76,15 +72,8 @@ test - org.powermock - powermock-module-junit4 - ${powermock.version} - test - - - org.powermock - powermock-api-mockito - ${powermock.version} + org.mockito + mockito-core test @@ -116,7 +105,6 @@ org.apache.maven.plugins maven-resources-plugin - 2.4.3 diff --git a/core/oslc4j-core/src/test/java/org/eclipse/lyo/oslc4j/core/model/ResourceShapeFactoryTest.java b/core/oslc4j-core/src/test/java/org/eclipse/lyo/oslc4j/core/model/ResourceShapeFactoryTest.java index 1b65472a3..677823b6a 100644 --- a/core/oslc4j-core/src/test/java/org/eclipse/lyo/oslc4j/core/model/ResourceShapeFactoryTest.java +++ b/core/oslc4j-core/src/test/java/org/eclipse/lyo/oslc4j/core/model/ResourceShapeFactoryTest.java @@ -1,16 +1,13 @@ package org.eclipse.lyo.oslc4j.core.model; +import org.eclipse.lyo.oslc4j.core.exception.OslcCoreMissingSetMethodException; +import org.junit.Test; + import java.math.BigDecimal; import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; -import org.eclipse.lyo.oslc4j.core.exception.OslcCoreMissingSetMethodException; -import org.junit.Test; -import static org.junit.Assert.*; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; /** * @version $version-stub$ diff --git a/core/shacl/pom.xml b/core/shacl/pom.xml index 877a71e82..de505de36 100644 --- a/core/shacl/pom.xml +++ b/core/shacl/pom.xml @@ -46,7 +46,6 @@ org.apache.maven.plugins maven-resources-plugin - 2.4.3 diff --git a/pom.xml b/pom.xml index da68e8597..d91c675ee 100644 --- a/pom.xml +++ b/pom.xml @@ -11,13 +11,11 @@ UTF-8 UTF-8 - 1.8 - 1.8 ${project.version} - 1.5.10 - 1.4.32 + 1.5.32 + 1.5.31 3.16.0 2.25.1 @@ -200,28 +198,19 @@ - javax.xml.bind jaxb-api - 2.2.1 + 2.3.1 - - com.sun.xml.bind - jaxb-impl - 2.2.1.1 + org.glassfish.jaxb + jaxb-runtime + 2.3.5 - - junit - junit - 4.13.1 - - - org.assertj assertj-core - 3.8.0 + 3.21.0 @@ -338,12 +327,28 @@ commons-lang3 3.11 - + + + + + org.mockito + mockito-core + 4.1.0 + test + + + + junit + junit + 4.13.2 + test + commons-codec @@ -360,11 +365,6 @@ guava ${v.guava} - - org.objenesis - objenesis - 2.6 - javax.annotation javax.annotation-api @@ -372,12 +372,12 @@ - - + net.oauth.core @@ -388,14 +388,20 @@ org.apache.thrift libthrift - 0.14.1 + 0.14.2 org.apache.tomcat.embed tomcat-embed-core - 8.5.66 - + 8.5.73 + + @@ -403,6 +409,18 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + 1.8 + 1.8 + -Xlint:deprecation,unchecked + + org.apache.maven.plugins maven-source-plugin @@ -443,6 +461,11 @@ false + + org.apache.maven.plugins + maven-resources-plugin + 3.2.0 + org.apache.maven.plugins maven-site-plugin @@ -456,7 +479,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M3 + 3.0.0 @@ -483,6 +506,11 @@ + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + @@ -506,6 +534,18 @@ + + + xerces + xml-apis + com.sun.xml.bind:jaxb-impl + + + + + org.apache.logging.log4j:log4j-core + + 3.0 @@ -513,7 +553,12 @@ 1.8 - + + + + org.osgi:org.osgi.core + + The reactor is not valid false diff --git a/server/oslc4j-registry/pom.xml b/server/oslc4j-registry/pom.xml index 95440e1cd..0e3bc2000 100644 --- a/server/oslc4j-registry/pom.xml +++ b/server/oslc4j-registry/pom.xml @@ -198,6 +198,24 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce + + + + + com.sun.xml.bind:jaxb-impl + + + + + + + diff --git a/server/oslc4j-wink/pom.xml b/server/oslc4j-wink/pom.xml index e65d9addc..c82434511 100644 --- a/server/oslc4j-wink/pom.xml +++ b/server/oslc4j-wink/pom.xml @@ -82,6 +82,24 @@ org.apache.maven.plugins maven-javadoc-plugin + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce + + + + + com.sun.xml.bind:jaxb-impl + + + + + + + diff --git a/store/pom.xml b/store/pom.xml index 71b750939..530d28876 100644 --- a/store/pom.xml +++ b/store/pom.xml @@ -31,47 +31,17 @@ - - - org.apache.jena - apache-jena-libs - ${v.jena} - pom - org.apache.jena jena-querybuilder ${v.jena} - - org.slf4j - slf4j-api - ${v.slf4j} - org.slf4j jcl-over-slf4j ${v.slf4j} - - - xml-apis - xml-apis - 1.3.04 - - - - - junit - junit - 4.13.1 - - - org.assertj - assertj-core - 3.8.0 - diff --git a/store/store-core/pom.xml b/store/store-core/pom.xml index 78e26c872..cd76d8c2a 100644 --- a/store/store-core/pom.xml +++ b/store/store-core/pom.xml @@ -13,7 +13,7 @@ store-core Lyo :: Store :: Core - + ${project.parent.version} @@ -82,11 +82,6 @@ com.google.guava guava - - - xml-apis - xml-apis - @@ -170,14 +165,6 @@ - org.codehaus.mojo cobertura-maven-plugin diff --git a/store/store-core/src/test/java/org/eclipse/lyo/store/DatasetBuilderTest.java b/store/store-core/src/test/java/org/eclipse/lyo/store/DatasetBuilderTest.java index 5ee6fa406..5bc117b79 100644 --- a/store/store-core/src/test/java/org/eclipse/lyo/store/DatasetBuilderTest.java +++ b/store/store-core/src/test/java/org/eclipse/lyo/store/DatasetBuilderTest.java @@ -25,6 +25,8 @@ import org.junit.Ignore; import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; + /** * DatasetBuilderTest is . * @author Andrew Berezovskyi @@ -43,7 +45,7 @@ public void testNewDatasetIsEmpty() throws IOException { dataset = DatasetBuilder.buildPersistent(tempDirectory); final Iterator names = dataset.listNames(); - Assertions.assertThat(names).isEmpty(); + assertThat(names).isExhausted(); } @@ -54,6 +56,6 @@ public void testWrongPathCausesExceptionNoPermissions() throws IOException { dataset = DatasetBuilder.buildPersistent(tempDirectory); final Iterator names = dataset.listNames(); - Assertions.assertThat(names).isEmpty(); + assertThat(names).isExhausted(); } } diff --git a/trs/client/pom.xml b/trs/client/pom.xml index cf566e11e..c64ad38b5 100644 --- a/trs/client/pom.xml +++ b/trs/client/pom.xml @@ -107,11 +107,6 @@ - - junit - junit - 4.13.1 - org.apache.jena jena-tdb @@ -127,11 +122,6 @@ jersey-client ${v.jersey} - - com.j2bugzilla - j2bugzilla - 2.2.1 - diff --git a/trs/client/trs-client/pom.xml b/trs/client/trs-client/pom.xml index 103b5506d..f211dde04 100644 --- a/trs/client/trs-client/pom.xml +++ b/trs/client/trs-client/pom.xml @@ -103,6 +103,10 @@ org.eclipse.rdf4j rdf4j-repository-sparql + + org.glassfish.jersey.core + jersey-client + @@ -115,17 +119,6 @@ slf4j-log4j12 test - - com.j2bugzilla - j2bugzilla - test - - - - - org.glassfish.jersey.core - jersey-client - diff --git a/trs/client/trs-client/src/test/java/org/eclipse/lyo/trs/client/ModelCreationUtil.java b/trs/client/trs-client/src/test/java/org/eclipse/lyo/trs/client/ModelCreationUtil.java deleted file mode 100644 index e4e8175da..000000000 --- a/trs/client/trs-client/src/test/java/org/eclipse/lyo/trs/client/ModelCreationUtil.java +++ /dev/null @@ -1,510 +0,0 @@ -/* - * Copyright (c) 2020 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License 1.0 - * which is available at http://www.eclipse.org/org/documents/edl-v10.php. - * - * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause - */ - -package org.eclipse.lyo.trs.client; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Random; -import java.util.concurrent.ThreadLocalRandom; - -import javax.servlet.ServletException; -import javax.ws.rs.WebApplicationException; - -import org.apache.jena.query.Query; -import org.apache.jena.query.QueryExecution; -import org.apache.jena.query.QueryExecutionFactory; -import org.apache.jena.query.QueryFactory; -import org.apache.jena.rdf.model.Model; -import org.eclipse.lyo.trs.client.util.SparqlUtil; -import org.eclipse.lyo.trs.client.util.RdfUtil; -import org.eclipse.rdf4j.model.Value; -import org.eclipse.rdf4j.query.BindingSet; -import org.eclipse.rdf4j.query.TupleQueryResult; -import org.eclipse.rdf4j.repository.RepositoryConnection; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.j2bugzilla.base.Bug; -import com.j2bugzilla.base.BugFactory; -import com.j2bugzilla.base.BugzillaConnector; -import com.j2bugzilla.base.BugzillaException; -import com.j2bugzilla.base.ConnectionException; -import com.j2bugzilla.rpc.LogIn; -import com.j2bugzilla.rpc.ReportBug; - -/** - * contains utility classes to create bugzilla bugs, and to link data in the - * triplestore together with some randomization. - * - * @author Omar - * - */ -public class ModelCreationUtil { - - private Logger logger = LoggerFactory.getLogger(ModelCreationUtil.class); - - private static String fusekiSparqlUpdateService = "https://vservices.offis.de/rtp/fuseki/v1.0/ldr/update"; - private static String fusekiSparqlQueryService = "https://vservices.offis.de/rtp/fuseki/v1.0/ldr/query"; - private String sesameSparqlUpdateService = "https://vservices.offis.de/rtp/openrdf-sesame/v1.0/repositories/ldr/statements"; - String sesameSparqlQueryService = "https://vservices.offis.de/rtp/openrdf-sesame/v1.0/repositories/ldr"; - - private static String lineSep = " \n"; - - private static final String[] products = { "TestProduct" }; - - private static final String[] components = { "TestComponent" }; - - private static final String[] os = { "windows", "Mac OS", "Linux", "All", "Other" }; - - private static final String[] versions = { "unspecified" }; - - private static final String[] platforms = { "PC", "Macintosh", "All", "Other" }; - - private static final String[] summaries = { "this is a change request ", "this is a bug", "this is a task", - "this is a reminder" }; - - private static final String[] descriptions = { "this is a the description of the bug ", - "this is the description of the task" }; - - private static String oslc_cm_prefix = "http://open-services.net/ns/cm#"; - private static String oslc_am_prefix = "http://open-services.net/ns/am#"; - private static String oslc_rm_prefix = "http://open-services.net/ns/rm#"; - - private static String oslc_cm_changes = oslc_cm_prefix + "changes"; - private static String oslc_cm_changed_by = oslc_cm_prefix + "changed_by"; - public static String oslc_rm_refined_by = oslc_rm_prefix + "refined_by"; - private static String oslc_rm_refines = oslc_rm_prefix + "refines"; - - private static String oslc_am_implements = oslc_am_prefix + "implements"; - - public void randomChangeRequestsCreationTest() throws ServletException, BugzillaException { - - BugzillaConnector bc = login("http://10.238.2.145", "@tc.informatik.uni-oldenburg.de", "m7fMXrBgwspd"); - ThreadLocalRandom rand = ThreadLocalRandom.current(); - for (int i = 0; i != 500; i++) { - int randomInt = rand.nextInt(0, 500); - String randomString = String.valueOf(randomInt); - String productId = products[rand.nextInt(products.length)]; - String summary = summaries[rand.nextInt(summaries.length)] + randomString; - String component = components[rand.nextInt(components.length)]; - String version = versions[rand.nextInt(versions.length)]; - String operatingSystem = os[rand.nextInt(os.length)]; - String platform = platforms[rand.nextInt(platforms.length)]; - String description = descriptions[rand.nextInt(descriptions.length)] + randomString; - createBug(bc, summary, component, version, operatingSystem, platform, description, productId); - - } - - } - - private static BugzillaConnector login(String bugzillaUri, String user, String pwd) - throws ServletException, BugzillaException { - BugzillaConnector bc = new BugzillaConnector(); - - try { - bc.connectTo(bugzillaUri + "/xmlrpc.cgi", user, pwd); - } catch (ConnectionException e) { - throw new ServletException(e); - } - - LogIn login = new LogIn(user, pwd); - - bc.executeMethod(login); - - return bc; - } - - private static String createBug(BugzillaConnector bc, String summary, String component, - String version, String operatingSystem, String platform, String description, - final String productIdString) { - String newBugId; - try { - - // final int productId = Integer.parseInt(productIdString); - // GetProduct getProducts = new GetProduct(productId); - // bc.executeMethod(getProducts); - // - // final Product product = getProducts.getProduct(); - - BugFactory factory = new BugFactory().newBug().setProduct(productIdString); - if (summary != null) { - factory.setSummary(summary); - } - if (version != null) { - factory.setVersion(version); - } - if (component != null) { - factory.setComponent(component); - } - if (platform != null) { - factory.setPlatform(platform); - } else - factory.setPlatform("Other"); - - if (operatingSystem != null) { - factory.setOperatingSystem(operatingSystem); - } else - factory.setOperatingSystem("Other"); - - if (description != null) { - factory.setDescription(description); - } - - Bug bug = factory.createBug(); - ReportBug reportBug = new ReportBug(bug); - bc.executeMethod(reportBug); - newBugId = Integer.toString(reportBug.getID()); - - } catch (Exception e) { - e.printStackTrace(); - throw new WebApplicationException(e); - } - return newBugId; - } - - /** - * Query for retrieving all the elements that are part of the matlab world - * and bugzilla change requests - */ - - public static void linkBugzToSimAndReq() { - RepositoryConnection conn = SparqlUtil.getRepoConnection(fusekiSparqlQueryService, fusekiSparqlUpdateService, - "", ""); - conn.begin(); - try { - StringBuilder matlabQb = new StringBuilder(); - matlabQb.append("SELECT DISTINCT ?s \n" + "WHERE \n" + "{" + "\n GRAPH ?g \n" + "{" - + "\n ?s ?o .FILTER contains(str(?o), \"http://mathworks.com/simulink/rdf\") . " - + "\n }" + "}"); - - StringBuilder bugzQb = new StringBuilder(); - bugzQb.append("SELECT DISTINCT ?s \n" + "WHERE \n" + "{" + "\n GRAPH ?g \n" + "{ \n" + "?s ?p ?o . " - + "\n } FILTER contains(str(?s), \"changeRequests" + "/" + "\") . " + "}"); - - StringBuilder reqifQb = new StringBuilder(); - reqifQb.append("SELECT DISTINCT ?s \n" + "WHERE \n" + "{" + "\n GRAPH ?g \n" + "{ \n" + "?s ?p ?o . " - + "\n } FILTER contains(str(?s), \"rm-services" + "/" + "\") . " + "}"); - - TupleQueryResult bugzQueryResult = SparqlUtil.evalQuery(conn, bugzQb.toString()); - - TupleQueryResult matlabQueryresult = SparqlUtil.evalQuery(conn, matlabQb.toString()); - - TupleQueryResult reqIfQueryResult = SparqlUtil.evalQuery(conn, reqifQb.toString()); - - String updateQuery = new String(); - List matlabResources = new ArrayList(); - List bugzillaResources = new ArrayList(); - List reqIfResources = new ArrayList(); - - while (matlabQueryresult.hasNext()) { - BindingSet maltabbs = matlabQueryresult.next(); - Value matlabRes = maltabbs.getValue("s"); - String mtlabResStringVal = matlabRes.stringValue(); - matlabResources.add(mtlabResStringVal); - } - - while (bugzQueryResult.hasNext()) { - BindingSet bugzBs = bugzQueryResult.next(); - Value bugzRes = bugzBs.getValue("s"); - String bugzResStringVal = bugzRes.stringValue(); - bugzillaResources.add(bugzResStringVal); - } - - while (reqIfQueryResult.hasNext()) { - BindingSet reqIfBs = reqIfQueryResult.next(); - Value reqIfRes = reqIfBs.getValue("s"); - String reqIfResStringVal = reqIfRes.stringValue(); - reqIfResources.add(reqIfResStringVal); - } - Random random = ThreadLocalRandom.current(); - - Collections.shuffle(matlabResources, random); - Collections.shuffle(bugzillaResources, random); - Collections.shuffle(reqIfResources, random); - - for (String bugzResStringVal : bugzillaResources) { - int i = 0; - List simRestoBeRemoved = new ArrayList(); - for (String mtlabResStringVal : matlabResources) { - i++; - boolean links = random.nextBoolean(); - if (links) { - String changesTriple = SparqlUtil.linkTriple(bugzResStringVal, mtlabResStringVal, - oslc_cm_changes); - String changedTriple = SparqlUtil.linkTriple(mtlabResStringVal, bugzResStringVal, - oslc_cm_changed_by); - - String changesQuery = SparqlUtil.addTriplesToGraphQuery(bugzResStringVal, changesTriple); - String changedQuery = SparqlUtil.addTriplesToGraphQuery(mtlabResStringVal, changedTriple); - - updateQuery = SparqlUtil.appendSparqldQuery(updateQuery, changesQuery); - updateQuery = SparqlUtil.appendSparqldQuery(updateQuery, changedQuery); - - } - simRestoBeRemoved.add(mtlabResStringVal); - if (i == 40) - break; - } - i = 0; - for (String reqIfResStringVal : reqIfResources) { - i++; - boolean links = random.nextBoolean(); - if (links) { - String changesTriple = SparqlUtil.linkTriple(bugzResStringVal, reqIfResStringVal, - oslc_cm_changes); - - String changesQuery = SparqlUtil.addTriplesToGraphQuery(bugzResStringVal, changesTriple); - - updateQuery = SparqlUtil.appendSparqldQuery(updateQuery, changesQuery); - - - } - if (i == 40) - break; - } - Collections.shuffle(reqIfResources, random); - Collections.shuffle(matlabResources, random); - } - - SparqlUtil.processQuery_sesame(updateQuery, conn); - } finally - - { - conn.close(); - } - } - - /** - * Query for retrieving all the elements that are part of the matlab world - * and bugzilla change requests - */ - private static void linkReqToReq() { - RepositoryConnection conn = SparqlUtil.getRepoConnection(fusekiSparqlQueryService, fusekiSparqlUpdateService, - "", ""); - conn.begin(); - try { - StringBuilder reqifQb = new StringBuilder(); - - reqifQb.append("SELECT DISTINCT ?s \n" + "WHERE \n" + "{" + "\n GRAPH ?g \n" + "{ \n" + "?s ?p ?o . " - + "\n } FILTER contains(str(?s), \"rm-services" + "/" + "\") . " + "}"); - - TupleQueryResult reqIfQueryResult = SparqlUtil.evalQuery(conn, reqifQb.toString()); - - String updateQuery = new String(); - List reqIfResources = new ArrayList(); - - while (reqIfQueryResult.hasNext()) { - BindingSet reqIfBs = reqIfQueryResult.next(); - Value reqIfRes = reqIfBs.getValue("s"); - String reqIfResStringVal = reqIfRes.stringValue(); - reqIfResources.add(reqIfResStringVal); - } - - Random random = ThreadLocalRandom.current(); - - Collections.shuffle(reqIfResources, random); - int i = 0; - for (Iterator iterator = reqIfResources.iterator(); iterator.hasNext();) { - i++; - String reqIfResStringVal = iterator.next(); - - int[] ex = { reqIfResources.indexOf(reqIfResStringVal) }; - if (reqIfResources.size() > 1) { - int randomRefinedReqIndex = getRandomWithExclusion(random, 0, reqIfResources.size() - 1, ex); - - String randomRefinedReq = reqIfResources.get(randomRefinedReqIndex); - - String implementsTriple = SparqlUtil.linkTriple(reqIfResStringVal, randomRefinedReq, - oslc_rm_refines); - - String refinesUpdate = SparqlUtil.addTriplesToGraphQuery(reqIfResStringVal, implementsTriple); - - updateQuery = SparqlUtil.appendSparqldQuery(updateQuery, refinesUpdate); - iterator.remove(); - } - - } - - SparqlUtil.processQuery_sesame(updateQuery, conn); - } finally - - { - conn.close(); - } - } - - /** - * Query for retrieving all the elements that are part of the matlab world - * and bugzilla change requests - */ - - public static void linkSimulinkToReq() { - RepositoryConnection conn = SparqlUtil.getRepoConnection(fusekiSparqlQueryService, fusekiSparqlUpdateService, - "", ""); - conn.begin(); - try { - StringBuilder matlabQb = new StringBuilder(); - matlabQb.append("SELECT DISTINCT ?s \n" + "WHERE \n" + "{" + "\n GRAPH ?g \n" + "{" - + "\n ?s ?o .FILTER contains(str(?o), \"http://mathworks.com/simulink/rdf\") . " - + "\n }" + "}"); - - StringBuilder reqifQb = new StringBuilder(); - reqifQb.append("SELECT DISTINCT ?s \n" + "WHERE \n" + "{" + "\n GRAPH ?g \n" + "{ \n" + "?s ?p ?o . " - + "\n } FILTER contains(str(?s), \"rm-services" + "/" + "\") . " + "}"); - - TupleQueryResult matlabQueryresult = SparqlUtil.evalQuery(conn, matlabQb.toString()); - - TupleQueryResult reqIfQueryResult = SparqlUtil.evalQuery(conn, reqifQb.toString()); - - String updateQuery = new String(); - List matlabResources = new ArrayList(); - List reqIfResources = new ArrayList(); - - while (matlabQueryresult.hasNext()) { - BindingSet maltabbs = matlabQueryresult.next(); - Value matlabRes = maltabbs.getValue("s"); - String mtlabResStringVal = matlabRes.stringValue(); - matlabResources.add(mtlabResStringVal); - } - - while (reqIfQueryResult.hasNext()) { - BindingSet reqIfBs = reqIfQueryResult.next(); - Value reqIfRes = reqIfBs.getValue("s"); - String reqIfResStringVal = reqIfRes.stringValue(); - reqIfResources.add(reqIfResStringVal); - } - - Random random = ThreadLocalRandom.current(); - - Collections.shuffle(matlabResources, random); - Collections.shuffle(reqIfResources, random); - - for (String reqIfResStringVal : reqIfResources) { - int i = 0; - for (String mtlabResStringVal : matlabResources) { - i++; - boolean links = random.nextBoolean(); - if (links) { - String implementsTriple = SparqlUtil.linkTriple(mtlabResStringVal, reqIfResStringVal, - oslc_am_implements); - String changesQuery = SparqlUtil.addTriplesToGraphQuery(mtlabResStringVal, implementsTriple); - updateQuery = SparqlUtil.appendSparqldQuery(updateQuery, changesQuery); - } - if (i == 40) - break; - } - Collections.shuffle(matlabResources, random); - } - - SparqlUtil.processQuery_sesame(updateQuery, conn); - } finally - - { - conn.close(); - } - } - - /** - * Test the correct functionality of the concantenation of several sparql - * updates - */ - - public void addTripleToGraphTest() { - - String triple = " ."; - String modificationEventQuery = SparqlUtil - .getModificationEventQuery("http://waals:8085/OSLC4JBugzilla/services/1/changeRequests/3", triple); - SparqlUtil.processQuery(modificationEventQuery, fusekiSparqlUpdateService); - } - - /** - * Test the correct functionality of the concantenation of several sparql - * updates - */ - - public void sparqlQuerySesameTest() { - String triple = " ."; - String modificationEventQuery = SparqlUtil - .getModificationEventQuery("http://waals:8085/OSLC4JBugzilla/services/1/changeRequests/3", triple); - SparqlUtil.processQuery(modificationEventQuery, fusekiSparqlUpdateService); - } - - /** - * Test the correct functionality of the concantenation of several sparql - * updates - */ - - public void sparqlUpdateSesameTest() { - String triple = " ."; - String modificationEventQuery = SparqlUtil.getModificationEventQuery("http://waals:3030/example/exampleGraph2", - triple); - SparqlUtil.processQuery(modificationEventQuery, sesameSparqlUpdateService); - } - - /** - * Test the correct functionality of the concantenation of several sparql - * updates - */ - - public void sparqlConcatTest() { - String triple = " ."; - String modificationEventQuery = SparqlUtil - .getModificationEventQuery("http://waals:8085/OSLC4JBugzilla/services/1/changeRequests/3", triple); - SparqlUtil.processQuery(modificationEventQuery, fusekiSparqlUpdateService); - } - - public void sparqlConstructTestTest() { - String queryString = "CONSTRUCT { ?x ?y ?z}" + lineSep + "WHERE {" + lineSep - + "GRAPH {" + lineSep + "?x ?y ?z" - + lineSep + "FILTER (" + lineSep - + "?x = " + lineSep + ")" + lineSep - + "} " + lineSep + "} "; - Query query = QueryFactory.create(queryString); - QueryExecution qe = QueryExecutionFactory.sparqlService(fusekiSparqlQueryService, query); - final Model resulModel = qe.execConstruct(); - try { - String modelRdfRepresentation = RdfUtil.modelToRdfXml(resulModel); - logger.debug(modelRdfRepresentation); - } catch (IOException e) { - logger.error("Failure while serializing the model"); - } - - } - - - public static void main(String[] args) { - linkReqToReq(); - } - - private static int getRandomWithExclusion(Random rnd, int start, int end, int... exclude) { - try { - int random = start + rnd.nextInt(end - start + 1 - exclude.length); - for (int ex : exclude) { - if (random < ex) { - break; - } - random++; - } - return random; - } catch (Exception e) { - e.printStackTrace(); - return -1; - } - - } -} diff --git a/trs/server/pom.xml b/trs/server/pom.xml index 8c4343323..1ab0d2edc 100644 --- a/trs/server/pom.xml +++ b/trs/server/pom.xml @@ -101,7 +101,6 @@ org.assertj assertj-core - 3.11.1 test diff --git a/validation/pom.xml b/validation/pom.xml index 23778b9c8..fb106a88c 100644 --- a/validation/pom.xml +++ b/validation/pom.xml @@ -77,29 +77,20 @@ ${v.lyo} - - xml-apis - xml-apis - 1.4.01 - - org.slf4j - slf4j-log4j12 - 1.7.24 - runtime + slf4j-simple + test org.assertj assertj-core - 3.9.1 test junit junit - 4.13.1 test @@ -134,7 +125,6 @@ org.apache.maven.plugins maven-resources-plugin - 2.4.3 maven-enforcer-plugin @@ -149,29 +139,10 @@ - - central https://repo1.maven.org/maven2 - - github - https://maven.pkg.github.com/weso/shaclex - - false - -