use of org.apache.sling.settings.SlingSettingsService in project sling by apache.
the class MockFactory method mockSlingSettingsService.
public static SlingSettingsService mockSlingSettingsService(final String slingId) {
Mockery context = new JUnit4Mockery();
final SlingSettingsService settingsService = context.mock(SlingSettingsService.class);
context.checking(new Expectations() {
{
allowing(settingsService).getSlingId();
will(returnValue(slingId));
allowing(settingsService).getSlingHomePath();
will(returnValue("/n/a"));
}
});
return settingsService;
}
use of org.apache.sling.settings.SlingSettingsService in project sling by apache.
the class NoClusterDiscoveryServiceTest method createService.
private DiscoveryService createService(final boolean activate) {
final DiscoveryService service = new NoClusterDiscoveryService();
setField(service, "settingsService", new SlingSettingsService() {
@Override
public String getSlingId() {
return "my-sling-id";
}
@Override
public String getSlingHomePath() {
return null;
}
@Override
public URL getSlingHome() {
return null;
}
@Override
public Set<String> getRunModes() {
return null;
}
@Override
public String getAbsolutePathWithinSlingHome(String relativePath) {
return null;
}
});
if (activate) {
invoke(service, "activate");
}
return service;
}
use of org.apache.sling.settings.SlingSettingsService in project sling by apache.
the class RunModeImplTest method testEmptyRunModesWithOptions.
@org.junit.Test
public void testEmptyRunModesWithOptions() {
final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("", "a,b,c|d,e,f", null));
assertActive(rm, true, "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 testInstallOptionsMultipleSelected.
@org.junit.Test
public void testInstallOptionsMultipleSelected() {
final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e,f,a", null, "a,b,c|d,e,f"));
assertActive(rm, true, "foo", "bar", "a", "e");
assertActive(rm, false, "b", "c", "d", "f");
}
use of org.apache.sling.settings.SlingSettingsService in project sling by apache.
the class RunModeImplTest method testOptionsSelected.
@org.junit.Test
public void testOptionsSelected() {
final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e", "a,b,c|d,e,f", null));
assertActive(rm, true, "foo", "bar", "c", "e");
assertActive(rm, false, "a", "b", "d", "f");
}
Aggregations