use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationResourceTest method install_url_not_allowed_protocol.
@Test
public void install_url_not_allowed_protocol() throws Exception {
Application application = createApplication("ftp://enonic.jar");
Mockito.when(this.applicationService.installGlobalApplication(new URL(application.getUrl()))).thenReturn(application);
String jsonString = request().path("app/installUrl").entity("{\"URL\":\"" + application.getUrl() + "\"}", MediaType.APPLICATION_JSON_TYPE).post().getAsString();
assertEquals("{\"applicationInstalledJson\":null,\"failure\":\"Illegal protocol: ftp\"}", jsonString);
}
use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationResourceTest method install_invalid_url.
@Test
public void install_invalid_url() throws Exception {
Application application = createApplication("invalid url");
String jsonString = request().path("app/installUrl").entity("{\"URL\":\"" + application.getUrl() + "\"}", MediaType.APPLICATION_JSON_TYPE).post().getAsString();
assertEquals("{\"applicationInstalledJson\":null,\"failure\":\"Failed to upload application from invalid url\"}", jsonString);
}
use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationResourceTest method test_start_application.
@Test
public void test_start_application() throws Exception {
final Application application = createApplication();
request().path("app/start").entity("{\"key\": \"" + application.getKey() + "\" }", MediaType.APPLICATION_JSON_TYPE).post();
final InOrder inOrder = Mockito.inOrder(applicationService);
inOrder.verify(this.applicationService).startApplication(application.getKey(), true);
inOrder.verifyNoMoreInteractions();
}
Aggregations