clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [2/2] clerezza git commit: CLEREZZA-994: created integration tests against the content launcher
Date Sat, 13 Jun 2015 11:03:27 GMT
CLEREZZA-994: created integration tests against the content launcher

Project: http://git-wip-us.apache.org/repos/asf/clerezza/repo
Commit: http://git-wip-us.apache.org/repos/asf/clerezza/commit/e734ab8a
Tree: http://git-wip-us.apache.org/repos/asf/clerezza/tree/e734ab8a
Diff: http://git-wip-us.apache.org/repos/asf/clerezza/diff/e734ab8a

Branch: refs/heads/master
Commit: e734ab8a593d9cdb936ea2faa16492ddb93ca295
Parents: 3495b27
Author: Reto Gmuer <reto@apache.org>
Authored: Sat Jun 13 11:03:14 2015 +0000
Committer: Reto Gmuer <reto@apache.org>
Committed: Sat Jun 13 11:03:14 2015 +0000

----------------------------------------------------------------------
 provisioning/launchers/content-launcher/pom.xml |   2 +-
 .../tests/content-launcher-tests/pom.xml        | 195 ++++++++++++++++
 .../integration/tests/AdminGraphsTest.java      |  44 ++++
 .../clerezza/integration/tests/BaseTest.java    | 222 +++++++++++++++++++
 .../integration/tests/UploadAndAccessTest.java  |  94 ++++++++
 .../tests/UploadAndAccessWithRdfJsonTest.java   |  28 +++
 provisioning/rdf/pom.xml                        |  13 +-
 report.xml                                      |  35 ---
 8 files changed, 590 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/e734ab8a/provisioning/launchers/content-launcher/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/launchers/content-launcher/pom.xml b/provisioning/launchers/content-launcher/pom.xml
index 831386d..3590b9e 100644
--- a/provisioning/launchers/content-launcher/pom.xml
+++ b/provisioning/launchers/content-launcher/pom.xml
@@ -230,7 +230,7 @@
        <dependency>
             <groupId>org.apache.clerezza.provisioning</groupId>
             <artifactId>rdf</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <type>partialbundlelist</type>
         </dependency>
 		

http://git-wip-us.apache.org/repos/asf/clerezza/blob/e734ab8a/provisioning/launchers/tests/content-launcher-tests/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/launchers/tests/content-launcher-tests/pom.xml b/provisioning/launchers/tests/content-launcher-tests/pom.xml
new file mode 100644
index 0000000..a4a4039
--- /dev/null
+++ b/provisioning/launchers/tests/content-launcher-tests/pom.xml
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.clerezza</groupId>
+        <artifactId>clerezza</artifactId>
+        <version>7</version>
+        <relativePath>../../../../parent</relativePath>
+    </parent>
+
+    <groupId>org.apache.clerezza.provisioning.tests</groupId>
+    <artifactId>content-launcher-tests</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>jar</packaging>
+
+    <name>Clerezza - Provisioning - Launchers - Tests - Content Launcher Tests</name>
+
+
+    <properties>
+        <!-- Set this to run the server on a specific port -->
+        <http.port></http.port>
+
+        <!-- Set this to run tests against an existing server instance -->
+        <!-- <test.server.url>http://localhost:8080/</test.server.url> -->
+
+        <!-- Options for the VM that executes our runnable jar -->
+        <!-- add the following to debug instance under test: -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8888,server=y,suspend=y
-->
+        <jar.executor.vm.options>-Xmx1g -XX:MaxPermSize=256m -Dorg.apache.stanbol.offline.mode=true</jar.executor.vm.options>
+
+        <!-- Set this to true to keep the runnable jar running - useful to debug tests
-->
+        <keepJarRunning>false</keepJarRunning>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>2.10</version>
+                <executions>
+                    <execution>
+                        <id>copy-runnable-jar</id>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <phase>process-resources</phase>
+                        <configuration>
+                            <includeArtifactIds>content-launcher</includeArtifactIds>
+                            <excludeTransitive>true</excludeTransitive>
+                            <overWriteReleases>false</overWriteReleases>
+                            <overWriteSnapshots>false</overWriteSnapshots>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <!-- Find free ports to run our server -->
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.9.1</version>                
+                <executions>
+                    <execution>
+                        <id>reserve-server-port</id>
+                        <goals>
+                            <goal>reserve-network-port</goal>
+                        </goals>
+                        <phase>process-resources</phase>
+                        <configuration>
+                            <portNames>
+                                <portName>http.port</portName>
+                            </portNames>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18.1</version>
+                <configuration>
+                    <systemPropertyVariables>
+                        <test.server.url>${test.server.url}</test.server.url>
+                        <jar.executor.server.port>${http.port}</jar.executor.server.port>
+                        <jar.executor.vm.options>${jar.executor.vm.options}</jar.executor.vm.options>
+                        <jar.executor.jar.folder>${project.basedir}/target/dependency</jar.executor.jar.folder>
+                        <jar.executor.jar.name.regexp>.*launcher.*\.jar$</jar.executor.jar.name.regexp>
+                        <jar.executor.workingdirectory>${project.build.directory}/launchdir</jar.executor.workingdirectory>
+                        <keepJarRunning>${keepJarRunning}</keepJarRunning>
+                        <server.ready.timeout.seconds>240</server.ready.timeout.seconds>
+                        <server.ready.path.1>/:Clerezza:Accept:text/html</server.ready.path.1>
+                        <server.ready.path.2>/system/console/bundles:!Starting:Accept:text/html</server.ready.path.2>
+                    </systemPropertyVariables>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.clerezza.provisioning</groupId>
+            <artifactId>content-launcher</artifactId>
+            <version>1.0.1-SNAPSHOT</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>*</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.3.5</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.jayway.restassured</groupId>
+            <artifactId>rest-assured</artifactId>
+            <version>2.3.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stanbol</groupId>
+            <artifactId>org.apache.stanbol.commons.testing.jarexec</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.core</artifactId>
+            <version>1.0.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.utils</artifactId>
+            <version>1.0.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.jena.parser</artifactId>
+            <version>1.0.0</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.jena.serializer</artifactId>
+            <version>1.0.0</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>rdf.rdfjson</artifactId>
+            <version>1.0.1-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-jdk14</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>platform</artifactId>
+            <version>1.0.0</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/e734ab8a/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/AdminGraphsTest.java
----------------------------------------------------------------------
diff --git a/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/AdminGraphsTest.java
b/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/AdminGraphsTest.java
new file mode 100644
index 0000000..eec3163
--- /dev/null
+++ b/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/AdminGraphsTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * 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 org.apache.clerezza.integration.tests;
+
+import com.jayway.restassured.RestAssured;
+import com.jayway.restassured.response.Response;
+import org.apache.clerezza.platform.Constants;
+import org.apache.http.HttpStatus;
+import static org.hamcrest.Matchers.*;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class AdminGraphsTest extends BaseTest {
+    
+    
+    @Test
+    public void htmlVersion() {
+        Response response = RestAssured.given().header("Accept", "text/html")
+                .auth().basic("admin", "admin")
+                .expect().statusCode(HttpStatus.SC_OK).when()
+                .get("/admin/graphs");
+        response.then().assertThat().body(containsString(Constants.CONTENT_GRAPH_URI_STRING));
+    }
+    
+   
+    
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/e734ab8a/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/BaseTest.java
----------------------------------------------------------------------
diff --git a/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/BaseTest.java
b/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/BaseTest.java
new file mode 100644
index 0000000..ae3e4d1
--- /dev/null
+++ b/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/BaseTest.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * 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 org.apache.clerezza.integration.tests;
+
+import com.jayway.restassured.RestAssured;
+import java.io.File;
+import java.net.ConnectException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.TreeSet;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
+import org.apache.stanbol.commons.testing.jarexec.JarExecutor;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author reto
+ */
+
+public abstract class BaseTest {
+
+    public static final String TEST_SERVER_URL_PROP = "test.server.url";
+    public static final String SERVER_READY_TIMEOUT_PROP = "server.ready.timeout.seconds";
+    public static final String SERVER_READY_PROP_PREFIX = "server.ready.path";
+    public static final String KEEP_JAR_RUNNING_PROP = "keepJarRunning";
+
+    protected static String serverBaseUrl;
+
+    private static final Logger log = LoggerFactory.getLogger(BaseTest.class);
+
+    private static void delete(File file) {
+        if (file.isDirectory()) {
+            for (File child: file.listFiles()) {
+                delete(child);
+            }
+        }
+        file.delete();
+    }
+
+    protected boolean serverReady = false;
+    //protected RequestBuilder builder;
+    protected DefaultHttpClient httpClient = new DefaultHttpClient();
+    //protected RequestExecutor executor = new RequestExecutor(httpClient);
+
+    @BeforeClass
+    public static synchronized void startRunnableJar() throws Exception {
+        if (serverBaseUrl != null) {
+            // concurrent initialization by loading subclasses
+            return;
+        }
+        final String configuredUrl = System.getProperty(TEST_SERVER_URL_PROP);
+        if ((configuredUrl != null) && !configuredUrl.isEmpty()) {
+            serverBaseUrl = configuredUrl;
+            log.info(TEST_SERVER_URL_PROP + " is set: not starting server jar (" + serverBaseUrl
+ ")");
+        } else {
+            final File workingDir = new File(System.getProperty(JarExecutor.PROP_WORKING_DIRECTORY));
+            if (workingDir.exists()) {
+               delete(workingDir);
+            }
+            final JarExecutor j = JarExecutor.getInstance(System.getProperties());
+            j.start();
+            serverBaseUrl = "http://localhost:" + j.getServerPort();
+            log.info("Forked subprocess server listening to: " + serverBaseUrl);
+
+            
+        }
+        RestAssured.baseURI = serverBaseUrl;
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        // Optionally block here so that the runnable jar stays up - we can
+        // then run tests against it from another VM
+        if ("true".equals(System.getProperty(KEEP_JAR_RUNNING_PROP))) {
+            log.info(KEEP_JAR_RUNNING_PROP + " set to true - entering infinite loop"
+                    + " so that runnable jar stays up. Kill this process to exit.");
+            while (true) {
+                try {
+                    Thread.sleep(1000L);
+                } catch (InterruptedException ex) {
+                    Thread.currentThread().interrupt();
+                }
+            }
+        }
+    }
+
+    @Before
+    public void waitForServerReady() throws Exception {
+        log.debug("> before {}#waitForServerReady()",getClass().getSimpleName());
+        if (serverReady) {
+            log.debug(" ... server already marked as ready!");
+            return;
+        }
+
+        // Timeout for readiness test
+        final String sec = System.getProperty(SERVER_READY_TIMEOUT_PROP);
+        final int timeoutSec = sec == null ? 60 : Integer.valueOf(sec);
+        log.info("Will wait up to " + timeoutSec + " seconds for server to become ready");
+        final long endTime = System.currentTimeMillis() + timeoutSec * 1000L;
+
+        // Get the list of paths to test and expected content regexps
+        final List<String> testPaths = new ArrayList<String>();
+        final TreeSet<Object> propertyNames = new TreeSet<Object>();
+        propertyNames.addAll(System.getProperties().keySet());
+        for (Object o : propertyNames) {
+            final String key = (String) o;
+            if (key.startsWith(SERVER_READY_PROP_PREFIX)) {
+                testPaths.add(System.getProperty(key));
+            }
+        }
+
+        // Consider the server ready if it responds to a GET on each of 
+        // our configured request paths with a 200 result and content
+        // that matches the regexp supplied with the path
+        long sleepTime = 100;
+        readyLoop:
+        while (!serverReady && System.currentTimeMillis() < endTime) {
+            // Wait a bit between checks, to let the server come up
+            Thread.sleep(sleepTime);
+            sleepTime = Math.min(5000L, sleepTime * 2);
+
+            // A test path is in the form path:substring or just path, in which case
+            // we don't check that the content contains the substring 
+            log.debug(" - check serverReady Paths");
+            for (String p : testPaths) {
+                log.debug("    > path: {}", p);
+                final String[] s = p.split(":");
+                final String path = s[0];
+                final String substring = (s.length > 0 ? s[1] : null);
+                final String url = serverBaseUrl + path;
+                log.debug("    > url: {}", url);
+                log.debug("    > content: {}", substring);
+                final HttpGet get = new HttpGet(url);
+                //authenticate as admin with password admin
+                get.setHeader("Authorization", "Basic YWRtaW46YWRtaW4=");
+                for(int i = 2; i+1<s.length;i=i+2){
+                    log.debug("    > header: {}:{}", s[i], s[i+1]);
+                    if(s[i] != null && !s[i].isEmpty() &&
+                            s[i+1] != null && !s[i+1].isEmpty()){
+                        get.setHeader(s[i], s[i+1]);
+                    }
+                }
+                HttpEntity entity = null;
+                try {
+                    log.debug("    > execute: {}", get);
+                    HttpResponse response = httpClient.execute(get);
+                    log.debug("    > response: {}", response);
+                    entity = response.getEntity();
+                    final int status = response.getStatusLine().getStatusCode();
+                    if (status != 200) {
+                        log.info("Got {} at {} - will retry", status, url);
+                        continue readyLoop;
+                    } else {
+                        log.debug("Got {} at {} - will retry", status, url);
+                    }
+
+                    if (substring != null) {
+                        if (entity == null) {
+                            log.info("No entity returned for {} - will retry", url);
+                            continue readyLoop;
+                        }
+                        final String content = EntityUtils.toString(entity);
+                        final boolean checkAbsence = substring.startsWith("!");
+                        final String notPresentString = substring.substring(1);
+                        if ((!checkAbsence && content.contains(substring)) || 
+                                (checkAbsence && content.contains(notPresentString)))
{
+                            log.debug("Returned content for {}  contains {} - ready", 
+                                url, substring);
+                        } else {
+                            log.info("Returned content for {}  does not contain " 
+                                    + "{} - will retry", url, substring);
+                            continue readyLoop;
+                            
+                        }
+                    }
+                } catch (ConnectException e) {
+                    log.info("Got {} at {} - will retry", e.getClass().getSimpleName(), url);
+                    continue readyLoop;
+                } finally {
+                    if (entity != null) {
+                        entity.consumeContent();
+                    }
+                }
+            }
+            log.info("Got expected content for all configured requests, server is ready");
+            //Some additional wait time, as not everything can be tested with the paths
+            try {
+                Thread.sleep(5000);
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+            }
+            serverReady = true;
+        }
+
+        if (!serverReady) {
+            throw new Exception("Server not ready after " + timeoutSec + " seconds");
+        }
+    }
+   
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/e734ab8a/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/UploadAndAccessTest.java
----------------------------------------------------------------------
diff --git a/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/UploadAndAccessTest.java
b/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/UploadAndAccessTest.java
new file mode 100644
index 0000000..1470c74
--- /dev/null
+++ b/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/UploadAndAccessTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * 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 org.apache.clerezza.integration.tests;
+
+import com.jayway.restassured.RestAssured;
+import com.jayway.restassured.response.Response;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import org.apache.clerezza.commons.rdf.ImmutableGraph;
+import org.apache.clerezza.platform.Constants;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.http.HttpHeaders;
+import org.apache.http.HttpStatus;
+import static org.hamcrest.Matchers.containsString;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author reto
+ */
+public class UploadAndAccessTest extends BaseTest {
+    
+    String smallGraphTurtle = null;
+    ImmutableGraph smallGraph;
+    
+    protected String getRdfFormat() {
+        return "text/turtle";
+        
+    }
+    
+    @Test
+    public void uploadAndQuery() throws Exception {
+        smallGraphTurtle = "<"+RestAssured.baseURI+"/test-resource> <http://www.w3.org/2000/01/rdf-schema#comment>
\"A test resource\".";
+        smallGraph = Parser.getInstance().parse(new ByteArrayInputStream(smallGraphTurtle.getBytes("utf-8")),
"text/turtle");
+        uploadTurtle();
+        sparqlAsk();
+        dereferenceResource();
+    }
+    
+    protected void uploadTurtle() {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        Serializer.getInstance().serialize(baos, smallGraph, getRdfFormat());
+        RestAssured.given().header("Accept", "text/html")
+                .auth().basic("admin", "admin")
+                .formParam("name", Constants.CONTENT_GRAPH_URI_STRING)
+                .multiPart("graph", "test.ttl", baos.toByteArray(), getRdfFormat())
+                .formParam("append", "Append")
+                .expect().statusCode(HttpStatus.SC_NO_CONTENT).when()
+                .post("/graph");
+    }
+    
+
+    protected void sparqlAsk() {
+        final String sparqlQuery = "ASK {"+smallGraphTurtle+"}";
+        Response response = RestAssured.given().header("Accept", "application/sparql-results+xml")
+                .auth().basic("admin", "admin")
+                .formParam("query", sparqlQuery)
+                .formParam("default-graph-uri", Constants.CONTENT_GRAPH_URI_STRING)
+                .expect()
+                .statusCode(HttpStatus.SC_OK)
+                .header(HttpHeaders.CONTENT_TYPE, "application/sparql-results+xml")
+                .when()
+                .post("/sparql");
+        response.then().assertThat().body(containsString("true"));
+    }
+    
+    protected void dereferenceResource() {
+        Response response = RestAssured.given().header("Accept", getRdfFormat())
+                .expect()
+                .statusCode(HttpStatus.SC_OK)
+                .header(HttpHeaders.CONTENT_TYPE, getRdfFormat())
+                .when()
+                .get("/test-resource");
+        ImmutableGraph returnedGraph = Parser.getInstance().parse(response.getBody().asInputStream(),
getRdfFormat());
+        Assert.assertEquals("Returned Graph has wrong size", 1, returnedGraph.size());
+        Assert.assertEquals(smallGraph, returnedGraph);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/e734ab8a/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/UploadAndAccessWithRdfJsonTest.java
----------------------------------------------------------------------
diff --git a/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/UploadAndAccessWithRdfJsonTest.java
b/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/UploadAndAccessWithRdfJsonTest.java
new file mode 100644
index 0000000..c9dd7e7
--- /dev/null
+++ b/provisioning/launchers/tests/content-launcher-tests/src/test/java/org/apache/clerezza/integration/tests/UploadAndAccessWithRdfJsonTest.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * 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 org.apache.clerezza.integration.tests;
+
+/**
+ *
+ * @author reto
+ */
+public class UploadAndAccessWithRdfJsonTest extends UploadAndAccessTest {
+    @Override
+    protected String getRdfFormat() {
+        return "application/rdf+json";        
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/e734ab8a/provisioning/rdf/pom.xml
----------------------------------------------------------------------
diff --git a/provisioning/rdf/pom.xml b/provisioning/rdf/pom.xml
index d5c0580..08a20a6 100644
--- a/provisioning/rdf/pom.xml
+++ b/provisioning/rdf/pom.xml
@@ -132,16 +132,15 @@
             <version>1.0.0-SNAPSHOT</version>
         </dependency>
         -->
-        <!-- <dependency>
+        <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.rdfjson</artifactId>
-            <version>0.4</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.clerezza.ext</groupId>
-            <artifactId>org.json.simple</artifactId>
-            <version>0.4</version>
-        </dependency> -->
+            <groupId>com.googlecode.json-simple</groupId>
+            <artifactId>json-simple</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.jena.serializer</artifactId>
@@ -155,7 +154,7 @@
         <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>rdf.jena.sparql</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/e734ab8a/report.xml
----------------------------------------------------------------------
diff --git a/report.xml b/report.xml
deleted file mode 100644
index 9b0d503..0000000
--- a/report.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<dfxml xmloutputversion='1.0'>
-  <metadata 
-  xmlns='http://afflib.org/tcpflow/' 
-  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
-  xmlns:dc='http://purl.org/dc/elements/1.1/'>
-    <dc:type>Feature Extraction</dc:type>
-  </metadata>
-  <creator version='1.0'>
-    <program>TCPFLOW</program>
-    <version>1.4.4</version>
-    <build_environment>
-      <compiler>4.8.2 (4.8.2 20140110 (prerelease) [ibm/gcc-4_8-branch merged from
gcc-4_8-branch, revision 205847])</compiler>
-      <CPPFLAGS>-pthread -I/usr/local/include -D_FORTIFY_SOURCE=2 -DUTC_OFFSET=+0000
</CPPFLAGS>
-      <CFLAGS>-g   -pthread -g -O3 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -MD -D_FORTIFY_SOURCE=2 -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes
-Wshadow -Wwrite-strings -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef
-Wredundant-decls -Wdisabled-optimization -Wfloat-equal -Wmultichar -Wc++-compat -Wmissing-noreturn
-Wall -Wstrict-prototypes</CFLAGS>
-      <CXXFLAGS>-g -pthread -g -O3 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -std=c++11 -Wall -MD -D_FORTIFY_SOURCE=2 -Wpointer-arith -Wshadow
-Wwrite-strings -Wcast-align -Wredundant-decls -Wdisabled-optimization -Wfloat-equal -Wmultichar
-Wmissing-noreturn -Woverloaded-virtual -Wsign-promo -funit-at-a-time -Wstrict-null-sentinel
-Weffc++ </CXXFLAGS>
-      <LDFLAGS>-L/usr/local/lib -Wl,-Bsymbolic-functions -Wl,-z,relro</LDFLAGS>
-      <LIBS>-lpcap -lcairo -lfontconfig -lfreetype -lpixman-1 -lexpat  -lssl -lcrypto
-lz -lssl -lcrypto </LIBS>
-      <compilation_date>2014-01-13T17:14:40</compilation_date>
-      <library name="boost" version="105400"/>
-    </build_environment>
-    <execution_environment>
-      <os_sysname>Linux</os_sysname>
-      <os_release>3.13.0-52-generic</os_release>
-      <os_version>#86-Ubuntu SMP Mon May 4 04:32:59 UTC 2015</os_version>
-      <host>5033e1dfa905</host>
-      <arch>x86_64</arch>
-      <command_line>tcpflow -c port 8080 -i lo</command_line>
-      <uid>0</uid>
-      <start_time>2015-05-18T11:19:57Z</start_time>
-    </execution_environment>
-  </creator>
-  <configuration>
-  </configuration>
-  <tdelta>0</tdelta>


Mime
View raw message