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 c1a005b7b362f08555b081f8cccf85ad0bd888b4
Author: Bertrand Delacretaz <[email protected]>
AuthorDate: Mon Jun 1 12:51:07 2015 +0000

    SLING-4757 - make sure we have the right service in integration tests
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/contentdetection@1682890
 13f79535-47bb-0310-9956-ffa450edef68
---
 .../it/ContentAwareMimeTypeServiceImplIT.java       |  20 +++++++++++++++++++-
 src/test/resources/this-is-actually-a-wav-file.mp3  | Bin 0 -> 10000 bytes
 2 files changed, 19 insertions(+), 1 deletion(-)

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 fec301f..a0b4410 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
@@ -18,6 +18,10 @@
 package org.apache.sling.commons.contentdetection.internal.it;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.io.InputStream;
 
 import javax.inject.Inject;
 
@@ -34,12 +38,26 @@ public class ContentAwareMimeTypeServiceImplIT {
     private ContentAwareMimeTypeService contentAwaremimeTypeService;
 
     @Test
-    public void testContentAwareMimeTypeService(){
+    public void detectFromExtension(){
         String mimeTypeName = "test.mp3";
         String mimeType = "audio/mpeg";
         assertEquals(mimeType, 
contentAwaremimeTypeService.getMimeType(mimeTypeName));
     }
 
+    @Test
+    public void detectFromContent() throws IOException{
+        final String filename = "this-is-actually-a-wav-file.mp3";
+        final InputStream s = getClass().getResourceAsStream("/" + filename);
+        assertNotNull("Expecting stream to be found:" + filename, s);
+        try {
+            assertEquals("audio/x-wav", 
contentAwaremimeTypeService.getMimeType(filename, s));
+        } finally {
+            if(s != null) {
+                s.close();
+            }
+        }
+    }
+
     @org.ops4j.pax.exam.Configuration
     public Option[] config() {
         return U.paxConfig();
diff --git a/src/test/resources/this-is-actually-a-wav-file.mp3 
b/src/test/resources/this-is-actually-a-wav-file.mp3
new file mode 100644
index 0000000..50f3f65
Binary files /dev/null and b/src/test/resources/this-is-actually-a-wav-file.mp3 
differ

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to