Search in sources :

Example 1 with ApplicationKeys

use of com.enonic.xp.app.ApplicationKeys in project xp by enonic.

the class ApplicationServiceImplTest method get_application_keys.

@Test
public void get_application_keys() throws Exception {
    final Bundle bundle1 = deployAppBundle("app1");
    final Bundle bundle2 = deployAppBundle("app2");
    deployAppBundle("noapp");
    applicationRegistry.installApplication(bundle1);
    applicationRegistry.installApplication(bundle2);
    final ApplicationKeys result = this.service.getInstalledApplicationKeys();
    assertNotNull(result);
    assertEquals(2, result.getSize());
    assertTrue(result.contains(ApplicationKey.from("app1")));
    assertTrue(result.contains(ApplicationKey.from("app2")));
}
Also used : ApplicationKeys(com.enonic.xp.app.ApplicationKeys) Bundle(org.osgi.framework.Bundle) Test(org.junit.jupiter.api.Test)

Example 2 with ApplicationKeys

use of com.enonic.xp.app.ApplicationKeys in project xp by enonic.

the class StyleDescriptorServiceImplTest method getByApplications.

@Test
public void getByApplications() {
    final ApplicationKeys appKeys = ApplicationKeys.from("myapp1", "myapp2");
    final StyleDescriptors descriptors = this.service.getByApplications(appKeys);
    assertNotNull(descriptors);
    assertEquals(2, descriptors.getSize());
}
Also used : ApplicationKeys(com.enonic.xp.app.ApplicationKeys) StyleDescriptors(com.enonic.xp.style.StyleDescriptors) Test(org.junit.jupiter.api.Test)

Example 3 with ApplicationKeys

use of com.enonic.xp.app.ApplicationKeys in project xp by enonic.

the class HtmlLinkProcessor method getStyleDescriptors.

private StyleDescriptors getStyleDescriptors(final PortalRequest portalRequest) {
    final ImmutableList.Builder<ApplicationKey> applicationKeyList = new ImmutableList.Builder<ApplicationKey>().add(SYSTEM_APPLICATION_KEY);
    if (portalRequest != null) {
        final Site site = portalRequest.getSite();
        if (site != null) {
            final ImmutableSet<ApplicationKey> siteApplicationKeySet = site.getSiteConfigs().getApplicationKeys();
            applicationKeyList.addAll(siteApplicationKeySet);
        }
    }
    final ApplicationKeys applicationKeys = ApplicationKeys.from(applicationKeyList.build());
    return styleDescriptorService.getByApplications(applicationKeys);
}
Also used : Site(com.enonic.xp.site.Site) ApplicationKey(com.enonic.xp.app.ApplicationKey) ApplicationKeys(com.enonic.xp.app.ApplicationKeys) ImmutableList(com.google.common.collect.ImmutableList)

Aggregations

ApplicationKeys (com.enonic.xp.app.ApplicationKeys)3 Test (org.junit.jupiter.api.Test)2 ApplicationKey (com.enonic.xp.app.ApplicationKey)1 Site (com.enonic.xp.site.Site)1 StyleDescriptors (com.enonic.xp.style.StyleDescriptors)1 ImmutableList (com.google.common.collect.ImmutableList)1 Bundle (org.osgi.framework.Bundle)1