use of com.enonic.xp.core.impl.app.resolver.ApplicationUrlResolver 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);
}
use of com.enonic.xp.core.impl.app.resolver.ApplicationUrlResolver in project xp by enonic.
the class ApplicationFactoryTest method createUrlResolver_dev_with_source.
@Test
public void createUrlResolver_dev_with_source() throws Exception {
final Bundle bundle = deploy("app1", true, true);
final ApplicationUrlResolver resolver = new ApplicationFactory(RunMode.DEV).createUrlResolver(bundle);
assertNotNull(resolver);
assertTrue(resolver instanceof MultiApplicationUrlResolver);
}
use of com.enonic.xp.core.impl.app.resolver.ApplicationUrlResolver 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);
}
use of com.enonic.xp.core.impl.app.resolver.ApplicationUrlResolver 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);
}
use of com.enonic.xp.core.impl.app.resolver.ApplicationUrlResolver in project xp by enonic.
the class ApplicationImplTest method testApplication.
@Test
public void testApplication() throws Exception {
final Bundle bundle = deployBundle();
final ApplicationUrlResolver urlResolver = Mockito.mock(ApplicationUrlResolver.class);
final Application application = new ApplicationBuilder().bundle(bundle).urlResolver(urlResolver).build();
assertEquals("myapplication", application.getKey().toString());
assertEquals("1.0.0", application.getVersion().toString());
assertEquals("myapplication", application.getDisplayName());
assertEquals("http://enonic.com/path/to/application", application.getUrl());
assertEquals("Enonic AS", application.getVendorName());
assertEquals("http://enonic.com", application.getVendorUrl());
assertEquals(bundle, application.getBundle());
assertTrue(application.getModifiedTime().getEpochSecond() > 0);
assertFalse(application.isStarted());
assertTrue(ApplicationBundleUtils.isApplication(bundle));
assertNotNull(application.getClassLoader());
assertEquals("[1.2.0,2.0.0)", application.getSystemVersion());
assertEquals("2.0.0", application.getMaxSystemVersion());
assertEquals("1.2.0", application.getMinSystemVersion());
application.getFiles();
Mockito.verify(urlResolver, Mockito.times(1)).findFiles();
application.resolveFile("a/b.txt");
Mockito.verify(urlResolver, Mockito.times(1)).findUrl("a/b.txt");
bundle.start();
assertTrue(application.isStarted());
}
Aggregations