This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.commons.contentdetection-1.0.2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-contentdetection.git
commit d3f5c4038722c5959c911e7f6ce06ede1a5dde64 Author: Bertrand Delacretaz <[email protected]> AuthorDate: Thu Jun 18 09:31:17 2015 +0000 SLING-4757 - additional test contributed by Satya Deep Maheshwari, thanks! git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/contentdetection@1686155 13f79535-47bb-0310-9956-ffa450edef68 --- .../it/ContentAwareMimeTypeServiceImplIT.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/test/java/org/apache/sling/commons/contentdetection/internal/it/ContentAwareMimeTypeServiceImplIT.java b/src/test/java/org/apache/sling/commons/contentdetection/internal/it/ContentAwareMimeTypeServiceImplIT.java index a0b4410..10f04cb 100644 --- a/src/test/java/org/apache/sling/commons/contentdetection/internal/it/ContentAwareMimeTypeServiceImplIT.java +++ b/src/test/java/org/apache/sling/commons/contentdetection/internal/it/ContentAwareMimeTypeServiceImplIT.java @@ -19,12 +19,15 @@ package org.apache.sling.commons.contentdetection.internal.it; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import javax.inject.Inject; +import org.apache.commons.io.IOUtils; import org.apache.sling.commons.contentdetection.ContentAwareMimeTypeService; import org.junit.Test; import org.junit.runner.RunWith; @@ -58,6 +61,23 @@ public class ContentAwareMimeTypeServiceImplIT { } } + @Test + public void testNoContentTampering() throws IOException{ + final String filename = "this-is-actually-a-wav-file.mp3"; + final InputStream s = new BufferedInputStream(getClass().getResourceAsStream("/" + filename)); + assertNotNull("Expecting stream to be found:" + filename, s); + try { + contentAwaremimeTypeService.getMimeType(filename, s); + assertTrue(IOUtils.contentEquals(s, + new BufferedInputStream(getClass().getResourceAsStream( + "/" + filename)))); + } finally { + if(s != null) { + s.close(); + } + } + } + @org.ops4j.pax.exam.Configuration public Option[] config() { return U.paxConfig(); -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
