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/11/07 09:20:48 UTC

[sling-org-apache-sling-commons-contentdetection] 08/30: SLING-4757 - factor out Pax config

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 900de6991803eb394e453f5308ba9a586f532314
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jun 1 12:38:28 2015 +0000

    SLING-4757 - factor out Pax config
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/contentdetection@1682887 13f79535-47bb-0310-9956-ffa450edef68
---
 .../it/ContentAwareMimeTypeServiceImplIT.java      | 21 +++++-----------
 .../internal/it/FileNameExtractorImplIT.java       | 19 ++++-----------
 ...ntentAwareMimeTypeServiceImplIT.java => U.java} | 28 ++++------------------
 3 files changed, 15 insertions(+), 53 deletions(-)

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 82fe4b9..fec301f 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
@@ -17,19 +17,15 @@
 
 package org.apache.sling.commons.contentdetection.internal.it;
 
+import static org.junit.Assert.assertEquals;
+
+import javax.inject.Inject;
+
 import org.apache.sling.commons.contentdetection.ContentAwareMimeTypeService;
-import org.apache.sling.paxexam.util.SlingPaxOptions;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.options.DefaultCompositeOption;
-
-import javax.inject.Inject;
-import java.io.File;
-
-import static org.junit.Assert.*;
 
 @RunWith(PaxExam.class)
 public class ContentAwareMimeTypeServiceImplIT {
@@ -46,11 +42,6 @@ public class ContentAwareMimeTypeServiceImplIT {
 
     @org.ops4j.pax.exam.Configuration
     public Option[] config() {
-        final File thisProjectsBundle = new File(System.getProperty( "bundle.file.name", "BUNDLE_FILE_NOT_SET" ));
-        final String launchpadVersion = System.getProperty("sling.launchpad.version", "LAUNCHPAD_VERSION_NOT_SET");
-        return new DefaultCompositeOption(
-                SlingPaxOptions.defaultLaunchpadOptions(launchpadVersion),
-                CoreOptions.provision(CoreOptions.bundle(thisProjectsBundle.toURI().toString()))
-        ).getOptions();
+        return U.paxConfig();
     }
-}
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/commons/contentdetection/internal/it/FileNameExtractorImplIT.java b/src/test/java/org/apache/sling/commons/contentdetection/internal/it/FileNameExtractorImplIT.java
index e0e55fb..bc2aaaf 100644
--- a/src/test/java/org/apache/sling/commons/contentdetection/internal/it/FileNameExtractorImplIT.java
+++ b/src/test/java/org/apache/sling/commons/contentdetection/internal/it/FileNameExtractorImplIT.java
@@ -17,19 +17,15 @@
 
 package org.apache.sling.commons.contentdetection.internal.it;
 
+import static org.junit.Assert.assertEquals;
+
+import javax.inject.Inject;
+
 import org.apache.sling.commons.contentdetection.FileNameExtractor;
-import org.apache.sling.paxexam.util.SlingPaxOptions;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.options.DefaultCompositeOption;
-
-import javax.inject.Inject;
-import java.io.File;
-
-import static org.junit.Assert.*;
 
 @RunWith(PaxExam.class)
 public class FileNameExtractorImplIT {
@@ -46,11 +42,6 @@ public class FileNameExtractorImplIT {
 
     @org.ops4j.pax.exam.Configuration
     public Option[] config() {
-        final File thisProjectsBundle = new File(System.getProperty( "bundle.file.name", "BUNDLE_FILE_NOT_SET" ));
-        final String launchpadVersion = System.getProperty("sling.launchpad.version", "LAUNCHPAD_VERSION_NOT_SET");
-        return new DefaultCompositeOption(
-                SlingPaxOptions.defaultLaunchpadOptions(launchpadVersion),
-                CoreOptions.provision(CoreOptions.bundle(thisProjectsBundle.toURI().toString()))
-        ).getOptions();
+        return U.paxConfig();
     }
 }
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/U.java
similarity index 68%
copy from src/test/java/org/apache/sling/commons/contentdetection/internal/it/ContentAwareMimeTypeServiceImplIT.java
copy to src/test/java/org/apache/sling/commons/contentdetection/internal/it/U.java
index 82fe4b9..33ecd38 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/U.java
@@ -17,35 +17,15 @@
 
 package org.apache.sling.commons.contentdetection.internal.it;
 
-import org.apache.sling.commons.contentdetection.ContentAwareMimeTypeService;
+import java.io.File;
+
 import org.apache.sling.paxexam.util.SlingPaxOptions;
-import org.junit.Test;
-import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.options.DefaultCompositeOption;
 
-import javax.inject.Inject;
-import java.io.File;
-
-import static org.junit.Assert.*;
-
-@RunWith(PaxExam.class)
-public class ContentAwareMimeTypeServiceImplIT {
-
-    @Inject
-    private ContentAwareMimeTypeService contentAwaremimeTypeService;
-
-    @Test
-    public void testContentAwareMimeTypeService(){
-        String mimeTypeName = "test.mp3";
-        String mimeType = "audio/mpeg";
-        assertEquals(mimeType, contentAwaremimeTypeService.getMimeType(mimeTypeName));
-    }
-
-    @org.ops4j.pax.exam.Configuration
-    public Option[] config() {
+public class U {
+    public static Option[] paxConfig() {
         final File thisProjectsBundle = new File(System.getProperty( "bundle.file.name", "BUNDLE_FILE_NOT_SET" ));
         final String launchpadVersion = System.getProperty("sling.launchpad.version", "LAUNCHPAD_VERSION_NOT_SET");
         return new DefaultCompositeOption(

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.