use of com.enonic.xp.app.ApplicationKey in project xp by enonic.
the class ApplicationServiceImplTest method start_application.
@Test
public void start_application() throws Exception {
final Bundle bundle = deployAppBundle("app1");
applicationRegistry.installApplication(bundle);
final ApplicationKey applicationKey = ApplicationKey.from("app1");
assertEquals(Bundle.INSTALLED, bundle.getState());
this.service.startApplication(applicationKey, true);
assertEquals(Bundle.ACTIVE, bundle.getState());
verify(this.eventPublisher, times(1)).publish(Mockito.argThat(new ApplicationEventMatcher(ApplicationClusterEvents.start(applicationKey))));
verify(this.eventPublisher, times(1)).publish(Mockito.argThat(new ApplicationEventMatcher(ApplicationClusterEvents.started(applicationKey))));
}
use of com.enonic.xp.app.ApplicationKey in project xp by enonic.
the class ApplicationServiceImplTest method configuration_comes_last.
@Test
public void configuration_comes_last() throws Exception {
final ApplicationKey key = ApplicationKey.from("myapp");
final Bundle bundle = deployAppBundle("myapp");
applicationRegistry.installApplication(bundle);
final Application app = service.getInstalledApplication(key);
applicationRegistry.configureApplication(bundle, ConfigBuilder.create().add("a", "b").build());
assertEquals(ConfigBuilder.create().add("a", "b").build(), app.getConfig());
}
use of com.enonic.xp.app.ApplicationKey in project xp by enonic.
the class IconLoader method toResourceKey.
private static ResourceKey toResourceKey(final MacroKey macroKey, final String ext, final String path) {
final ApplicationKey appKey = macroKey.getApplicationKey();
final String localName = macroKey.getName();
return ResourceKey.from(appKey, path + "/" + localName + "/" + localName + "." + ext);
}
use of com.enonic.xp.app.ApplicationKey in project xp by enonic.
the class ContentServiceImplTest_findByApplicationKey method test.
@Test
public void test() throws Exception {
final ApplicationKey applicationKey1 = ApplicationKey.from("app:key1");
final ApplicationKey applicationKey2 = ApplicationKey.from("app:key2");
final Content site1 = createSite("a", SiteConfigs.from(SiteConfig.create().application(applicationKey1).config(new PropertyTree()).build()));
final Content site1_2 = createSite("b", SiteConfigs.from(SiteConfig.create().application(applicationKey1).config(new PropertyTree()).build(), SiteConfig.create().application(applicationKey2).config(new PropertyTree()).build()));
final Content site2 = createSite("c", SiteConfigs.from(SiteConfig.create().application(applicationKey2).config(new PropertyTree()).build()));
assertEquals(Contents.from(site1, site1_2).getIds(), contentService.findByApplicationKey(applicationKey1).getIds());
assertEquals(Contents.from(site1_2, site2).getIds(), contentService.findByApplicationKey(applicationKey2).getIds());
}
use of com.enonic.xp.app.ApplicationKey in project xp by enonic.
the class LocaleScriptBean method getPreferredLocale.
private String getPreferredLocale(final List<String> localeTags, final String[] bundleNames) {
if (localeTags == null || localeTags.isEmpty()) {
return null;
}
final ApplicationKey applicationKey = getApplication();
final List<Locale> locales = localeTags.stream().map(Locale::forLanguageTag).collect(toList());
final Locale preferredLocale = this.localeService.get().getSupportedLocale(locales, applicationKey, bundleNames);
return preferredLocale == null ? null : preferredLocale.toLanguageTag();
}
Aggregations