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:56:50 UTC
[sling-org-apache-sling-paxexam-util] 07/18: Add local
StartupHandler so that SlingSettingsService starts
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.paxexam.util-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-paxexam-util.git
commit 14ab9e5774c3b7c77020cdd6ac079cadc5c8d738
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Nov 3 14:13:27 2014 +0000
Add local StartupHandler so that SlingSettingsService starts
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/testing/sling-pax-util@1636357 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/paxexam/util/SlingSetupTest.java | 40 +++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/sling/paxexam/util/SlingSetupTest.java b/src/test/java/org/apache/sling/paxexam/util/SlingSetupTest.java
index 2d8ad19..13e40c2 100644
--- a/src/test/java/org/apache/sling/paxexam/util/SlingSetupTest.java
+++ b/src/test/java/org/apache/sling/paxexam/util/SlingSetupTest.java
@@ -25,6 +25,10 @@ import java.util.List;
import javax.inject.Inject;
+import org.apache.sling.launchpad.api.StartupHandler;
+import org.apache.sling.launchpad.api.StartupMode;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
@@ -34,6 +38,7 @@ import org.ops4j.pax.exam.spi.reactors.PerClass;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
/** Verify that we get a working Sling launchpad with what SlingPaxOptions provide */
@RunWith(PaxExam.class)
@@ -46,10 +51,42 @@ public class SlingSetupTest {
@Inject
private BundleContext bundleContext;
+ private ServiceRegistration<?> startupHandlerRegistration;
+
@org.ops4j.pax.exam.Configuration
public Option[] config() {
return SlingPaxOptions.defaultLaunchpadOptions(SLING_LAUNCHPAD_VERSION).getOptions();
}
+
+ @Before
+ public void setup() {
+ // In Sling launchpad 7 the SlingSettings service
+ // requires a StartupHandler, and that's usually provided
+ // by the launchpad bootstrap code. Supply our own so that
+ // everything starts properly.
+ // TODO should be provided by a utility/bootstrap bundle
+ final StartupHandler h = new StartupHandler() {
+ public void waitWithStartup(boolean b) {
+ }
+
+ public boolean isFinished() {
+ return true;
+ }
+
+ public StartupMode getMode() {
+ return StartupMode.INSTALL;
+ }
+ };
+ startupHandlerRegistration = bundleContext.registerService(StartupHandler.class.getName(), h, null);
+ }
+
+ @After
+ public void cleanup() {
+ if(startupHandlerRegistration != null) {
+ startupHandlerRegistration.unregister();
+ startupHandlerRegistration = null;
+ }
+ }
private void assertBundleActive(String symbolicName) {
assertEquals("Expecting bundle to be active:" + symbolicName, Bundle.ACTIVE, getBundleState(symbolicName));
@@ -220,7 +257,8 @@ public class SlingSetupTest {
final String [] services = {
"org.apache.sling.engine.SlingRequestProcessor",
"org.apache.sling.commons.mime.MimeTypeService",
- "org.apache.sling.jcr.api.SlingRepository"
+ "org.apache.sling.jcr.api.SlingRepository",
+ "org.apache.sling.settings.SlingSettingsService"
};
final List<String> missing = new ArrayList<String>();
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.