Repository: marmotta Updated Branches: refs/heads/develop 27750cd74 -> e556ade89
propagated new exceptions Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/e556ade8 Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/e556ade8 Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/e556ade8 Branch: refs/heads/develop Commit: e556ade89f43bddb38228077fe1ca0bb519e79ca Parents: 27750cd Author: Sergio Fernández <[email protected]> Authored: Fri Oct 31 11:24:52 2014 +0100 Committer: Sergio Fernández <[email protected]> Committed: Fri Oct 31 11:24:52 2014 +0100 ---------------------------------------------------------------------- .../org/apache/marmotta/client/clients/ImportClient.java | 11 ++++++----- .../org/apache/marmotta/client/test/io/ImportIT.java | 9 ++++----- 2 files changed, 10 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/e556ade8/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ImportClient.java ---------------------------------------------------------------------- diff --git a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ImportClient.java b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ImportClient.java index 5dc8fd6..eaaff34 100644 --- a/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ImportClient.java +++ b/client/marmotta-client-java/src/main/java/org/apache/marmotta/client/clients/ImportClient.java @@ -21,6 +21,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.net.URISyntaxException; import java.util.HashSet; import java.util.Set; @@ -116,7 +117,7 @@ public class ImportClient { * @throws IOException * @throws MarmottaClientException */ - public void uploadDataset(final InputStream in, final String mimeType, final String context) throws IOException, MarmottaClientException { + public void uploadDataset(final InputStream in, final String mimeType, final String context) throws IOException, MarmottaClientException, URISyntaxException { HttpClient httpClient = HTTPUtil.createClient(config, context); uploadDataset(in, mimeType, httpClient); } @@ -130,12 +131,12 @@ public class ImportClient { * @throws IOException * @throws MarmottaClientException */ - public void uploadDataset(final InputStream in, final String mimeType) throws IOException, MarmottaClientException { + public void uploadDataset(final InputStream in, final String mimeType) throws IOException, MarmottaClientException, URISyntaxException { HttpClient httpClient = HTTPUtil.createClient(config); uploadDataset(in, mimeType, httpClient); } - private void uploadDataset(final InputStream in, final String mimeType, HttpClient httpClient) throws IOException { + private void uploadDataset(final InputStream in, final String mimeType, HttpClient httpClient) throws IOException, URISyntaxException { HttpPost post = HTTPUtil.createPost(URL_UPLOAD_SERVICE, config); post.setHeader("Content-Type", mimeType); @@ -184,7 +185,7 @@ public class ImportClient { * @throws IOException * @throws MarmottaClientException */ - public void uploadDataset(String data, String mimeType) throws IOException, MarmottaClientException { + public void uploadDataset(String data, String mimeType) throws IOException, MarmottaClientException, URISyntaxException { uploadDataset(new ByteArrayInputStream(data.getBytes("utf-8")), mimeType); } @@ -198,7 +199,7 @@ public class ImportClient { * @throws IOException * @throws MarmottaClientException */ - public void uploadDataset(String data, String mimeType, String context) throws IOException, MarmottaClientException { + public void uploadDataset(String data, String mimeType, String context) throws IOException, MarmottaClientException, URISyntaxException { uploadDataset(new ByteArrayInputStream(data.getBytes("utf-8")), mimeType, context); } http://git-wip-us.apache.org/repos/asf/marmotta/blob/e556ade8/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/io/ImportIT.java ---------------------------------------------------------------------- diff --git a/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/io/ImportIT.java b/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/io/ImportIT.java index e21bb1f..7ef2c5d 100644 --- a/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/io/ImportIT.java +++ b/client/marmotta-client-java/src/test/java/org/apache/marmotta/client/test/io/ImportIT.java @@ -32,6 +32,7 @@ import org.junit.BeforeClass; import org.junit.Test; import java.io.IOException; +import java.net.URISyntaxException; /** * Add file description here! @@ -57,19 +58,17 @@ public class ImportIT { marmotta.shutdown(); } - - @Test - public void testUpload() throws IOException, MarmottaClientException { + public void testUpload() throws IOException, MarmottaClientException, URISyntaxException { ImportClient client = new ImportClient(config); String data = "<http://example.com/resource/r1> <http://example.com/resource/p1> \"Test Data\"."; - client.uploadDataset(data,"text/rdf+n3"); + client.uploadDataset(data, "text/rdf+n3"); ResourceClient resourceClient = new ResourceClient(config); Metadata m = resourceClient.getResourceMetadata("http://example.com/resource/r1"); Assert.assertNotNull(m); - Assert.assertEquals(1,m.size()); + Assert.assertEquals(1, m.size()); Assert.assertEquals("Test Data", m.getFirst("http://example.com/resource/p1").toString()); resourceClient.deleteResource("http://example.com/resource/r1");
