Some cleanup in the LDP-NR test
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/13d8e64e Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/13d8e64e Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/13d8e64e Branch: refs/heads/ldp Commit: 13d8e64e1525bce3b847b1b4c118aa070799dc09 Parents: 743eaa2 Author: Jakob Frank <[email protected]> Authored: Fri Sep 5 10:21:49 2014 +0200 Committer: Jakob Frank <[email protected]> Committed: Fri Sep 5 10:22:47 2014 +0200 ---------------------------------------------------------------------- .../ldp/webservices/LdpWebServiceTest.java | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/13d8e64e/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java ---------------------------------------------------------------------- diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java index c5f5d92..0c4891c 100644 --- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java +++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java @@ -178,20 +178,20 @@ public class LdpWebServiceTest { RestAssured.expect().statusCode(404).get(container); // Create - RestAssured + final String binaryResource = RestAssured .given() .header("Slug", resourceName) .body(IOUtils.toByteArray(LdpWebServiceTest.class.getResourceAsStream("/test.png"))) .contentType(mimeType) .expect() .statusCode(201) - .header("Location", baseUrl + newResource + ".png") .header("Link", CoreMatchers.anyOf( //TODO: RestAssured only checks the FIRST header... HeaderMatchers.isLink(baseUrl + newResource, "describedby"), HeaderMatchers.isLink(LdpWebService.LDP_SERVER_CONSTRAINTS, "describedby"), HeaderMatchers.isLink(LDP.BasicContainer.stringValue(), "type")) ) - .post(container); + .post(container) + .getHeader("Location"); // now the container hasType RestAssured @@ -211,7 +211,7 @@ public class LdpWebServiceTest { SesameMatchers.hasStatement(new URIImpl(baseUrl + container), RDF.TYPE, LDP.Container), SesameMatchers.hasStatement(new URIImpl(baseUrl + container), RDF.TYPE, LDP.BasicContainer), SesameMatchers.hasStatement(new URIImpl(baseUrl + container), DCTERMS.MODIFIED, null), - SesameMatchers.hasStatement(new URIImpl(baseUrl + container), LDP.contains, new URIImpl(baseUrl + newResource + ".png"))) + SesameMatchers.hasStatement(new URIImpl(baseUrl + container), LDP.contains, new URIImpl(binaryResource))) ) .get(container); @@ -233,7 +233,7 @@ public class LdpWebServiceTest { SesameMatchers.hasStatement(new URIImpl(baseUrl + newResource), RDF.TYPE, LDP.Resource), SesameMatchers.hasStatement(new URIImpl(baseUrl + newResource), RDF.TYPE, LDP.RDFSource), SesameMatchers.hasStatement(new URIImpl(baseUrl + newResource), DCTERMS.MODIFIED, null), - SesameMatchers.hasStatement(new URIImpl(baseUrl + newResource), DCTERMS.HAS_FORMAT, new URIImpl(baseUrl + newResource + ".png")) + SesameMatchers.hasStatement(new URIImpl(baseUrl + newResource), DCTERMS.HAS_FORMAT, new URIImpl(binaryResource)) )) .get(newResource); @@ -250,14 +250,14 @@ public class LdpWebServiceTest { ) .header("ETag", HeaderMatchers.hasEntityTag(false)) // FIXME: be more specific here .contentType(RDFFormat.TURTLE.getDefaultMIMEType()) - .body(SesameMatchers.rdfStringMatches(RDFFormat.TURTLE.getDefaultMIMEType(), baseUrl + newResource+".png", - SesameMatchers.hasStatement(new URIImpl(baseUrl + newResource+".png"), RDF.TYPE, LDP.Resource), - SesameMatchers.hasStatement(new URIImpl(baseUrl + newResource+".png"), RDF.TYPE, LDP.NonRDFSource), - SesameMatchers.hasStatement(new URIImpl(baseUrl + newResource+".png"), DCTERMS.MODIFIED, null), - SesameMatchers.hasStatement(new URIImpl(baseUrl + newResource+".png"), DCTERMS.FORMAT, new LiteralImpl(mimeType)), - SesameMatchers.hasStatement(new URIImpl(baseUrl + newResource+".png"), DCTERMS.IS_FORMAT_OF, new URIImpl(baseUrl + newResource)) + .body(SesameMatchers.rdfStringMatches(RDFFormat.TURTLE.getDefaultMIMEType(), binaryResource, + SesameMatchers.hasStatement(new URIImpl(binaryResource), RDF.TYPE, LDP.Resource), + SesameMatchers.hasStatement(new URIImpl(binaryResource), RDF.TYPE, LDP.NonRDFSource), + SesameMatchers.hasStatement(new URIImpl(binaryResource), DCTERMS.MODIFIED, null), + SesameMatchers.hasStatement(new URIImpl(binaryResource), DCTERMS.FORMAT, new LiteralImpl(mimeType)), + SesameMatchers.hasStatement(new URIImpl(binaryResource), DCTERMS.IS_FORMAT_OF, new URIImpl(baseUrl + newResource)) )) - .get(newResource + ".png"); + .get(binaryResource); // now check that the data is really there final String expectedMD5 = HashUtils.md5sum(LdpWebServiceTest.class.getResourceAsStream("/test.png")); @@ -273,7 +273,7 @@ public class LdpWebServiceTest { ) .header("ETag", HeaderMatchers.hasEntityTag(false)) // FIXME: be more specific here .contentType(mimeType) - .get(newResource + ".png") + .get(binaryResource) .body().asByteArray(); assertEquals("md5sum",expectedMD5, HashUtils.md5sum(data));
