You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2015/06/01 14:51:07 UTC
svn commit: r1682890 - in
/sling/trunk/bundles/commons/contentdetection/src/test:
java/org/apache/sling/commons/contentdetection/internal/it/ContentAwareMimeTypeServiceImplIT.java
resources/ resources/this-is-actually-a-wav-file.mp3
Author: bdelacretaz
Date: Mon Jun 1 12:51:07 2015
New Revision: 1682890
URL: http://svn.apache.org/r1682890
Log:
SLING-4757 - make sure we have the right service in integration tests
Added:
sling/trunk/bundles/commons/contentdetection/src/test/resources/
sling/trunk/bundles/commons/contentdetection/src/test/resources/this-is-actually-a-wav-file.mp3 (with props)
Modified:
sling/trunk/bundles/commons/contentdetection/src/test/java/org/apache/sling/commons/contentdetection/internal/it/ContentAwareMimeTypeServiceImplIT.java
Modified: sling/trunk/bundles/commons/contentdetection/src/test/java/org/apache/sling/commons/contentdetection/internal/it/ContentAwareMimeTypeServiceImplIT.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/contentdetection/src/test/java/org/apache/sling/commons/contentdetection/internal/it/ContentAwareMimeTypeServiceImplIT.java?rev=1682890&r1=1682889&r2=1682890&view=diff
==============================================================================
--- sling/trunk/bundles/commons/contentdetection/src/test/java/org/apache/sling/commons/contentdetection/internal/it/ContentAwareMimeTypeServiceImplIT.java (original)
+++ sling/trunk/bundles/commons/contentdetection/src/test/java/org/apache/sling/commons/contentdetection/internal/it/ContentAwareMimeTypeServiceImplIT.java Mon Jun 1 12:51:07 2015
@@ -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 ContentAwareMimeTypeService
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();
Added: sling/trunk/bundles/commons/contentdetection/src/test/resources/this-is-actually-a-wav-file.mp3
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/contentdetection/src/test/resources/this-is-actually-a-wav-file.mp3?rev=1682890&view=auto
==============================================================================
Binary file - no diff available.
Propchange: sling/trunk/bundles/commons/contentdetection/src/test/resources/this-is-actually-a-wav-file.mp3
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream