use of org.apache.sling.settings.SlingSettingsService in project sling by apache.
the class RunModeImplTest method testInstallOptions.
@org.junit.Test
public void testInstallOptions() {
final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar", null, "a,b,c|d,e,f"));
assertActive(rm, true, "foo", "bar", "a", "d");
assertActive(rm, false, "b", "c", "e", "f");
}
use of org.apache.sling.settings.SlingSettingsService in project sling by apache.
the class RunModeImplTest method testInstallOptionsSelected.
@org.junit.Test
public void testInstallOptionsSelected() {
final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e", null, "a,b,c|d,e,f"));
assertActive(rm, true, "foo", "bar", "c", "e");
assertActive(rm, false, "a", "b", "d", "f");
}
use of org.apache.sling.settings.SlingSettingsService in project sling by apache.
the class RunModeImplTest method testInstallOptionsMultipleSelected2.
@org.junit.Test
public void testInstallOptionsMultipleSelected2() {
final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,d,f,a", null, "a,b,c|d,e,f"));
assertActive(rm, true, "foo", "bar", "a", "d");
assertActive(rm, false, "b", "c", "e", "f");
}
use of org.apache.sling.settings.SlingSettingsService in project sling by apache.
the class SlingSettingsServiceImplTest method testGetSlingIdFromTooLargeData.
@Test
public void testGetSlingIdFromTooLargeData() throws IOException {
final String expected = SlingIdUtil.createSlingId();
// 1MB long random String
final String data = expected + RandomStringUtils.randomAscii(1024 * 1024);
SlingIdUtil.writeSlingId(slingIdFile, data);
final SlingSettingsService slingSettingsService = createSlingSettingsService(slingIdFile, optionsFile);
final String slingId = slingSettingsService.getSlingId();
assertNotNull(slingId);
assertEquals(expected, slingId);
}
use of org.apache.sling.settings.SlingSettingsService in project sling by apache.
the class SlingContextImpl method runMode.
/**
* Set current run mode(s).
* @param runModes Run mode(s).
*/
public final void runMode(String... runModes) {
Set<String> newRunModes = ImmutableSet.<String>builder().add(runModes).build();
ServiceReference<SlingSettingsService> ref = bundleContext().getServiceReference(SlingSettingsService.class);
if (ref != null) {
MockSlingSettingService slingSettings = (MockSlingSettingService) bundleContext().getService(ref);
slingSettings.setRunModes(newRunModes);
}
}
Aggregations