MARMOTTA-508: preliminar integration of the official ldp test suite
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/bfbc30cc Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/bfbc30cc Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/bfbc30cc Branch: refs/heads/ldp Commit: bfbc30cc8dcae322b02ac3ae0a72ee38ec6ca25e Parents: 14e522d Author: Sergio Fernández <[email protected]> Authored: Thu Jun 12 20:03:57 2014 +0200 Committer: Sergio Fernández <[email protected]> Committed: Thu Jun 12 20:03:57 2014 +0200 ---------------------------------------------------------------------- platform/marmotta-ldp/pom.xml | 6 ++ .../marmotta/platform/ldp/LdpTestSuite.java | 75 ++++++++++++++++++++ 2 files changed, 81 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/bfbc30cc/platform/marmotta-ldp/pom.xml ---------------------------------------------------------------------- diff --git a/platform/marmotta-ldp/pom.xml b/platform/marmotta-ldp/pom.xml index fcc3879..451630c 100644 --- a/platform/marmotta-ldp/pom.xml +++ b/platform/marmotta-ldp/pom.xml @@ -270,6 +270,12 @@ <artifactId>sesame-sail-memory</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.w3</groupId> + <artifactId>ldp-testsuite</artifactId> + <version>1.0.0-SNAPSHOT</version> + <scope>test</scope> + </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/marmotta/blob/bfbc30cc/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/LdpTestSuite.java ---------------------------------------------------------------------- diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/LdpTestSuite.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/LdpTestSuite.java new file mode 100644 index 0000000..08cd51f --- /dev/null +++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/LdpTestSuite.java @@ -0,0 +1,75 @@ +/* + * 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.marmotta.platform.ldp; + +import com.jayway.restassured.RestAssured; +import org.apache.marmotta.platform.core.test.base.JettyMarmotta; +import org.apache.marmotta.platform.ldp.webservices.LdpWebService; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.Map; + +/** + * LDP Test Suite runner + * + * @author Sergio Fernández + */ +public class LdpTestSuite { + + private static Logger log = LoggerFactory.getLogger(LdpTestSuite.class); + + private static JettyMarmotta marmotta; + + private static String baseUrl; + + @BeforeClass + public static void setup() throws URISyntaxException, IOException { + marmotta = new JettyMarmotta("/marmotta", LdpWebService.class); + RestAssured.baseURI = "http://localhost"; + RestAssured.port = marmotta.getPort(); + RestAssured.basePath = marmotta.getContext(); + baseUrl = UriBuilder.fromUri("http://localhost").port(marmotta.getPort()).path(marmotta.getContext()).build().toString(); + } + + @AfterClass + public static void shutdown() { + marmotta.shutdown(); + marmotta = null; + } + + @Test + public void testSuite() { + Map<String, String> options = new HashMap<>(); + options.put("server", baseUrl); + options.put("basic", null); + options.put("non-rdf", null); + org.w3.ldp.testsuite.LdpTestSuite testSuite = new org.w3.ldp.testsuite.LdpTestSuite(options); + testSuite.run(); + Assert.assertEquals(0, testSuite.getStatus()); + } + +}
