Search in sources :

Example 1 with ApplicationInvalidator

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

the class ApplicationServiceImplTest method configuration_comes_twice.

@Test
public void configuration_comes_twice() throws Exception {
    final ApplicationKey key = ApplicationKey.from("myapp");
    final Bundle bundle = deployAppBundle("myapp");
    applicationRegistry.installApplication(bundle);
    final Application app = service.getInstalledApplication(key);
    final ApplicationInvalidator mock = mock(ApplicationInvalidator.class);
    applicationRegistry.addInvalidator(mock);
    applicationRegistry.configureApplication(bundle, ConfigBuilder.create().add("a", "b").build());
    applicationRegistry.configureApplication(bundle, ConfigBuilder.create().add("c", "d").build());
    assertEquals(ConfigBuilder.create().add("c", "d").build(), app.getConfig());
}
Also used : ApplicationKey(com.enonic.xp.app.ApplicationKey) Bundle(org.osgi.framework.Bundle) Application(com.enonic.xp.app.Application) ApplicationInvalidator(com.enonic.xp.app.ApplicationInvalidator) Test(org.junit.jupiter.api.Test)

Example 2 with ApplicationInvalidator

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

the class ApplicationServiceImplTest method configuration_comes_twice_invalidators_called.

@Test
public void configuration_comes_twice_invalidators_called() throws Exception {
    final ApplicationKey key = ApplicationKey.from("myapp");
    final Bundle bundle = deployAppBundle("myapp");
    applicationRegistry.installApplication(bundle);
    service.getInstalledApplication(key);
    final ApplicationInvalidator mock = mock(ApplicationInvalidator.class);
    applicationRegistry.addInvalidator(mock);
    applicationRegistry.configureApplication(bundle, ConfigBuilder.create().add("a", "b").build());
    applicationRegistry.configureApplication(bundle, ConfigBuilder.create().add("c", "d").build());
    verify(mock, times(1)).invalidate(eq(key), eq(ApplicationInvalidationLevel.FULL));
}
Also used : ApplicationKey(com.enonic.xp.app.ApplicationKey) Bundle(org.osgi.framework.Bundle) ApplicationInvalidator(com.enonic.xp.app.ApplicationInvalidator) Test(org.junit.jupiter.api.Test)

Aggregations

ApplicationInvalidator (com.enonic.xp.app.ApplicationInvalidator)2 ApplicationKey (com.enonic.xp.app.ApplicationKey)2 Test (org.junit.jupiter.api.Test)2 Bundle (org.osgi.framework.Bundle)2 Application (com.enonic.xp.app.Application)1