You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:18:48 UTC
[sling-org-apache-sling-commons-contentdetection] 14/39: SLING-4757
- additional test contributed by Satya Deep Maheshwari, thanks!
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-contentdetection.git
commit e05eacb1b247fcb18ef7c3af785cdb6da017e19b
Author: Bertrand Delacretaz <bd...@apache.org>
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@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
"commits@sling.apache.org" <co...@sling.apache.org>.