use of com.enonic.xp.app.ApplicationKey in project xp by enonic.
the class ApplicationServiceImplTest method start_missing_application.
@Test
public void start_missing_application() {
final ApplicationKey applicationKey = ApplicationKey.from("app1");
this.service.startApplication(applicationKey, true);
verify(this.eventPublisher, times(1)).publish(Mockito.argThat(new ApplicationEventMatcher(ApplicationClusterEvents.start(applicationKey))));
verifyNoMoreInteractions(this.eventPublisher);
}
use of com.enonic.xp.app.ApplicationKey in project xp by enonic.
the class ApplicationServiceImplTest method stop_application_no_triggerEvent.
@Test
public void stop_application_no_triggerEvent() throws Exception {
final Bundle bundle = deployAppBundle("app1");
applicationRegistry.installApplication(bundle);
bundle.start();
assertEquals(Bundle.ACTIVE, bundle.getState());
final ApplicationKey applicationKey = ApplicationKey.from("app1");
this.service.stopApplication(applicationKey, false);
assertEquals(Bundle.RESOLVED, bundle.getState());
verify(this.eventPublisher, never()).publish(Mockito.argThat(new ApplicationEventMatcher(ApplicationClusterEvents.stop(applicationKey))));
verify(this.eventPublisher, never()).publish(Mockito.argThat(new ApplicationEventMatcher(ApplicationClusterEvents.stopped(applicationKey))));
}
use of com.enonic.xp.app.ApplicationKey in project xp by enonic.
the class ApplicationServiceImplTest method install_stored_applications.
@Test
public void install_stored_applications() throws Exception {
final String bundleName1 = "my-bundle1";
final String bundleName2 = "my-bundle2";
ApplicationKey applicationKey1 = ApplicationKey.from(bundleName1);
ApplicationKey applicationKey2 = ApplicationKey.from(bundleName2);
when(appFilterService.accept(applicationKey2)).thenReturn(false);
final Node node1 = Node.create().id(NodeId.from("myNodeId1")).name("myBundle1").parentPath(ApplicationRepoServiceImpl.APPLICATION_PATH).build();
final Node node2 = Node.create().id(NodeId.from("myNodeId2")).name("myBundle2").parentPath(ApplicationRepoServiceImpl.APPLICATION_PATH).build();
when(this.repoService.getApplications()).thenReturn(Nodes.from(node1, node2));
when(this.repoService.getApplicationSource(node1.id())).thenReturn(createBundleSource(bundleName1));
when(this.repoService.getApplicationSource(node2.id())).thenReturn(createBundleSource(bundleName2));
this.service.installAllStoredApplications(ApplicationInstallationParams.create().triggerEvent(false).build());
assertFalse(this.service.isLocalApplication(applicationKey1));
assertNotNull(this.service.getInstalledApplication(applicationKey1));
assertNull(this.service.getInstalledApplication(applicationKey2));
verifyInstalledEvents(node1, never());
verifyStartedEvent(applicationKey1, never());
}
use of com.enonic.xp.app.ApplicationKey in project xp by enonic.
the class ApplicationServiceImplTest method stop_application.
@Test
public void stop_application() throws Exception {
final Bundle bundle = deployAppBundle("app1");
applicationRegistry.installApplication(bundle);
bundle.start();
assertEquals(Bundle.ACTIVE, bundle.getState());
final ApplicationKey applicationKey = ApplicationKey.from("app1");
this.service.stopApplication(applicationKey, true);
assertEquals(Bundle.RESOLVED, bundle.getState());
verify(this.eventPublisher, times(1)).publish(Mockito.argThat(new ApplicationEventMatcher(ApplicationClusterEvents.stop(applicationKey))));
verify(this.eventPublisher, times(1)).publish(Mockito.argThat(new ApplicationEventMatcher(ApplicationClusterEvents.stopped(applicationKey))));
}
use of com.enonic.xp.app.ApplicationKey in project xp by enonic.
the class ApplicationServiceImplTest method configuration_comes_first.
@Test
public void configuration_comes_first() throws Exception {
final ApplicationKey key = ApplicationKey.from("myapp");
final Bundle bundle = deployAppBundle("myapp");
applicationRegistry.configureApplication(bundle, ConfigBuilder.create().add("a", "b").build());
final Application app = service.getInstalledApplication(key);
assertEquals(ConfigBuilder.create().add("a", "b").build(), app.getConfig());
}
Aggregations