use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationFactoryTest method create_app.
@Test
public void create_app() throws Exception {
final Bundle bundle = deploy("app1", true, false);
final Application app = new ApplicationFactory(RunMode.PROD).create(bundle);
assertNotNull(app);
assertNull(app.getConfig());
}
use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationClusterEventListenerTest method start.
@Test
void start() {
final Application application = mock(Application.class);
final ApplicationKey appKey = ApplicationKey.from("appKey");
when(application.getKey()).thenReturn(appKey);
this.applicationClusterEventListener.onEvent(Event.create(ApplicationClusterEvents.EVENT_TYPE).localOrigin(false).value(ApplicationClusterEvents.EVENT_TYPE_KEY, ApplicationClusterEvents.START).value(ApplicationClusterEvents.APPLICATION_KEY_PARAM, appKey).build());
verify(this.applicationService, times(1)).startApplication(appKey, false);
}
use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationClusterEventListenerTest method installed.
@Test
void installed() {
final Node node = Node.create().name("myNode").id(NodeId.from("myNodeId")).parentPath(NodePath.ROOT).build();
final Application application = mock(Application.class);
when(application.getKey()).thenReturn(ApplicationKey.from("appKey"));
when(applicationService.installStoredApplication(eq(node.id()), any())).thenReturn(application);
this.applicationClusterEventListener.onEvent(Event.create(ApplicationClusterEvents.EVENT_TYPE).localOrigin(false).value(ApplicationClusterEvents.NODE_ID_PARAM, node.id()).value(ApplicationClusterEvents.EVENT_TYPE_KEY, ApplicationClusterEvents.INSTALLED).build());
verify(this.applicationService, times(1)).installStoredApplication(node.id(), ApplicationInstallationParams.create().start(false).triggerEvent(false).build());
}
use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationClusterEventListenerTest method stop.
@Test
void stop() {
final Application application = mock(Application.class);
final ApplicationKey appKey = ApplicationKey.from("appKey");
when(application.getKey()).thenReturn(appKey);
this.applicationClusterEventListener.onEvent(Event.create(ApplicationClusterEvents.EVENT_TYPE).localOrigin(false).value(ApplicationClusterEvents.EVENT_TYPE_KEY, ApplicationClusterEvents.STOP).value(ApplicationClusterEvents.APPLICATION_KEY_PARAM, appKey).build());
verify(this.applicationService, times(1)).stopApplication(appKey, false);
}
use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationServiceImplTest method install_stored_application_denied.
@Test
public void install_stored_application_denied() throws Exception {
when(appFilterService.accept(any(ApplicationKey.class))).thenReturn(false);
final Node node = Node.create().id(NodeId.from("myNodeId")).name("myBundle").parentPath(ApplicationRepoServiceImpl.APPLICATION_PATH).build();
final String bundleName = "my-bundle";
when(this.repoService.getApplicationSource(node.id())).thenReturn(createBundleSource(bundleName));
final Application application = this.service.installStoredApplication(node.id());
assertNull(application);
}
Aggregations