Skip to content

Commit

Permalink
don't throw exception when there are no pages in a web app
Browse files Browse the repository at this point in the history
This reverts commit fdf0e65.

# Conflicts:
#	components/org.wso2.carbon.uiserver/src/main/java/org/wso2/carbon/uiserver/internal/deployment/AppCreator.java
#	components/org.wso2.carbon.uiserver/src/test/java/org/wso2/carbon/uiserver/internal/deployment/AppCreatorTest.java
  • Loading branch information
this committed Dec 19, 2017
1 parent 37e45fa commit 7544811
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ private static SortedSet<Page> createPages(AppReference appReference) {
List<Page> pages = appReference.getPageReferences().stream()
.map(AppCreator::createPage)
.collect(Collectors.toList());
if (pages.isEmpty()) {
throw new AppCreationException("App '" + appReference.getName() + "' does not contains any pages.");
}

// TODO: 10/13/17 remove following workaround after adding support for URI patterns with * in UriPatten class
if ((pages.size() == 1) && (pages.get(0).getUriPatten().matches("/index"))) {
final Page indexPage = pages.get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.wso2.carbon.uiserver.api.App;
import org.wso2.carbon.uiserver.internal.exception.AppCreationException;
import org.wso2.carbon.uiserver.internal.io.reference.ArtifactAppReference;
import org.wso2.carbon.uiserver.internal.reference.AppReference;

Expand All @@ -39,7 +38,8 @@ public class AppCreatorTest {
public Object[][] appReferences() {
return new Object[][]{
{new ArtifactAppReference(Paths.get("src/test/resources/apps/full-app/"))},
{new ArtifactAppReference(Paths.get("src/test/resources/apps/minimal-app/"))}
{new ArtifactAppReference(Paths.get("src/test/resources/apps/minimal-app/"))},
{new ArtifactAppReference(Paths.get("src/test/resources/apps/empty-app/"))}
};
}

Expand All @@ -48,11 +48,4 @@ public void testCreateApp(AppReference appReference) {
App app = AppCreator.createApp(appReference, "/test");
Assert.assertNotNull(app);
}

@Test
public void testCreateAppWithEmptyDirectory() {
AppReference appReference = new ArtifactAppReference(Paths.get("src/test/resources/apps/empty-app/"));
Assert.assertThrows(AppCreationException.class,
() -> AppCreator.createApp(appReference, "/test"));
}
}

0 comments on commit 7544811

Please sign in to comment.