Search in sources :

Example 1 with BundleApplicationUrlResolver

use of com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver in project xp by enonic.

the class ApplicationFactoryTest method createUrlResolver_prod.

@Test
public void createUrlResolver_prod() throws Exception {
    final Bundle bundle = deploy("app1", true, false);
    final ApplicationUrlResolver resolver = new ApplicationFactory(RunMode.PROD).createUrlResolver(bundle);
    assertNotNull(resolver);
    assertTrue(resolver instanceof BundleApplicationUrlResolver);
}
Also used : MultiApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.MultiApplicationUrlResolver) BundleApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver) ApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.ApplicationUrlResolver) Bundle(org.osgi.framework.Bundle) TinyBundle(org.ops4j.pax.tinybundles.core.TinyBundle) BundleApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver) Test(org.junit.jupiter.api.Test)

Example 2 with BundleApplicationUrlResolver

use of com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver in project xp by enonic.

the class ApplicationFactory method createUrlResolver.

ApplicationUrlResolver createUrlResolver(final Bundle bundle) {
    final ApplicationUrlResolver bundleUrlResolver = new BundleApplicationUrlResolver(bundle);
    if (this.runMode != RunMode.DEV) {
        return bundleUrlResolver;
    }
    final List<String> sourcePaths = ApplicationHelper.getSourcePaths(bundle);
    if (sourcePaths.isEmpty()) {
        return bundleUrlResolver;
    }
    final ApplicationUrlResolver classLoaderUrlResolver = createClassLoaderUrlResolver(sourcePaths);
    return new MultiApplicationUrlResolver(classLoaderUrlResolver, bundleUrlResolver);
}
Also used : MultiApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.MultiApplicationUrlResolver) BundleApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver) ApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.ApplicationUrlResolver) ClassLoaderApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.ClassLoaderApplicationUrlResolver) BundleApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver) MultiApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.MultiApplicationUrlResolver)

Example 3 with BundleApplicationUrlResolver

use of com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver in project xp by enonic.

the class ApplicationFactoryTest method createUrlResolver_dev_no_source.

@Test
public void createUrlResolver_dev_no_source() throws Exception {
    final Bundle bundle = deploy("app1", true, false);
    final ApplicationUrlResolver resolver = new ApplicationFactory(RunMode.DEV).createUrlResolver(bundle);
    assertNotNull(resolver);
    assertTrue(resolver instanceof BundleApplicationUrlResolver);
}
Also used : MultiApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.MultiApplicationUrlResolver) BundleApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver) ApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.ApplicationUrlResolver) Bundle(org.osgi.framework.Bundle) TinyBundle(org.ops4j.pax.tinybundles.core.TinyBundle) BundleApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver) Test(org.junit.jupiter.api.Test)

Aggregations

ApplicationUrlResolver (com.enonic.xp.core.impl.app.resolver.ApplicationUrlResolver)3 BundleApplicationUrlResolver (com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver)3 MultiApplicationUrlResolver (com.enonic.xp.core.impl.app.resolver.MultiApplicationUrlResolver)3 Test (org.junit.jupiter.api.Test)2 TinyBundle (org.ops4j.pax.tinybundles.core.TinyBundle)2 Bundle (org.osgi.framework.Bundle)2 ClassLoaderApplicationUrlResolver (com.enonic.xp.core.impl.app.resolver.ClassLoaderApplicationUrlResolver)1