use of org.apache.deltaspike.core.spi.config.view.ViewConfigNode in project deltaspike by apache.
the class ViewConfigTest method testSimpleMetaDataTreeWithoutMetaData.
@Test
public void testSimpleMetaDataTreeWithoutMetaData() {
this.viewConfigExtension.addPageDefinition(SimplePageConfig001.class);
ViewConfigNode node = this.viewConfigExtension.findNode(SimplePageConfig001.class);
Assert.assertNotNull(node);
Assert.assertNotNull(node.getParent());
Assert.assertNull(node.getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(0, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
}
use of org.apache.deltaspike.core.spi.config.view.ViewConfigNode in project deltaspike by apache.
the class ViewConfigTest method testSimpleMetaDataTreeWithMetaData.
@Test
public void testSimpleMetaDataTreeWithMetaData() {
this.viewConfigExtension.addPageDefinition(SimplePageConfig002.class);
ViewConfigNode node = this.viewConfigExtension.findNode(SimplePageConfig002.class);
Assert.assertNotNull(node);
Assert.assertNotNull(node.getParent());
Assert.assertNull(node.getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
}
use of org.apache.deltaspike.core.spi.config.view.ViewConfigNode in project deltaspike by apache.
the class ViewConfigTest method testMetaDataInheritanceInTree.
@Test
public // TODO discuss if #getInheritedMetaData should be tested as well by exposing the transformed tree for tests
void testMetaDataInheritanceInTree() {
this.viewConfigExtension.addPageDefinition(Pages.Index.class);
this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);
this.viewConfigExtension.addPageDefinition(Pages.Admin.Home.class);
this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Index.class);
this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Home.class);
ViewConfigNode node = this.viewConfigExtension.findNode(Pages.class);
Assert.assertNotNull(node);
// Root
Assert.assertNotNull(node.getParent());
Assert.assertNull(node.getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(2, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(View.NavigationMode.REDIRECT, ((View) node.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());
Assert.assertEquals("", ((View) node.getMetaData().iterator().next()).name());
Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.class);
Assert.assertNotNull(node);
// Admin
Assert.assertNotNull(node.getParent());
// Root
Assert.assertNotNull(node.getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(3, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(0, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.class);
Assert.assertNotNull(node);
// Admin
Assert.assertNotNull(node.getParent());
// Pages
Assert.assertNotNull(node.getParent().getParent());
// Root
Assert.assertNotNull(node.getParent().getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(2, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.INCLUDE, ((View) node.getMetaData().iterator().next()).viewParams());
Assert.assertEquals("", ((View) node.getMetaData().iterator().next()).name());
Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Index.class);
Assert.assertNotNull(node);
// Pages
Assert.assertNotNull(node.getParent());
// Root
Assert.assertNotNull(node.getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(0, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.Index.class);
Assert.assertNotNull(node);
// Statistics
Assert.assertNotNull(node.getParent());
// Admin
Assert.assertNotNull(node.getParent().getParent());
// Pages
Assert.assertNotNull(node.getParent().getParent().getParent());
// Root
Assert.assertNotNull(node.getParent().getParent().getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());
Assert.assertEquals("", ((View) node.getMetaData().iterator().next()).name());
Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.class);
Assert.assertNotNull(node);
// Pages
Assert.assertNotNull(node.getParent());
// Root
Assert.assertNotNull(node.getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(3, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(0, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.Home.class);
Assert.assertNotNull(node);
// Statistics
Assert.assertNotNull(node.getParent());
// Admin
Assert.assertNotNull(node.getParent().getParent());
// Pages
Assert.assertNotNull(node.getParent().getParent().getParent());
// Root
Assert.assertNotNull(node.getParent().getParent().getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(0, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.Index.class);
Assert.assertNotNull(node);
// Admin
Assert.assertNotNull(node.getParent());
// Pages
Assert.assertNotNull(node.getParent().getParent());
// Root
Assert.assertNotNull(node.getParent().getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());
Assert.assertEquals("", ((View) node.getMetaData().iterator().next()).name());
Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.Home.class);
Assert.assertNotNull(node);
// Admin
Assert.assertNotNull(node.getParent());
// Pages
Assert.assertNotNull(node.getParent().getParent());
// Root
Assert.assertNotNull(node.getParent().getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(View.NavigationMode.FORWARD, ((View) node.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());
Assert.assertEquals("", ((View) node.getMetaData().iterator().next()).name());
Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());
Assert.assertNotNull(node.getInheritedMetaData());
// not processed at this point - node was just added
Assert.assertEquals(0, node.getInheritedMetaData().size());
}
use of org.apache.deltaspike.core.spi.config.view.ViewConfigNode in project deltaspike by apache.
the class ViewConfigTest method testMetaDataInheritanceInTree.
@Test
public // TODO discuss if #getInheritedMetaData should be tested as well by exposing the transformed tree for tests
void testMetaDataInheritanceInTree() {
this.viewConfigExtension.addPageDefinition(Pages.Index.class);
this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);
this.viewConfigExtension.addPageDefinition(Pages.Admin.Home.class);
this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Index.class);
this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Home.class);
ViewConfigNode node = this.viewConfigExtension.findNode(Pages.class);
Assert.assertNotNull(node);
// Root
Assert.assertNotNull(node.getParent());
Assert.assertNull(node.getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(2, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(View.NavigationMode.REDIRECT, ((View) node.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());
Assert.assertEquals("", ((View) node.getMetaData().iterator().next()).name());
Assert.assertEquals(View.Extension.JSF, ((View) node.getMetaData().iterator().next()).extension());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.class);
Assert.assertNotNull(node);
// Admin
Assert.assertNotNull(node.getParent());
// Root
Assert.assertNotNull(node.getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(3, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(0, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.class);
Assert.assertNotNull(node);
// Admin
Assert.assertNotNull(node.getParent());
// Pages
Assert.assertNotNull(node.getParent().getParent());
// Root
Assert.assertNotNull(node.getParent().getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(2, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.INCLUDE, ((View) node.getMetaData().iterator().next()).viewParams());
Assert.assertEquals("", ((View) node.getMetaData().iterator().next()).name());
Assert.assertEquals(View.Extension.FACES, ((View) node.getMetaData().iterator().next()).extension());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Index.class);
Assert.assertNotNull(node);
// Pages
Assert.assertNotNull(node.getParent());
// Root
Assert.assertNotNull(node.getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(0, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.Index.class);
Assert.assertNotNull(node);
// Statistics
Assert.assertNotNull(node.getParent());
// Admin
Assert.assertNotNull(node.getParent().getParent());
// Pages
Assert.assertNotNull(node.getParent().getParent().getParent());
// Root
Assert.assertNotNull(node.getParent().getParent().getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());
Assert.assertEquals("", ((View) node.getMetaData().iterator().next()).name());
Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.Home.class);
Assert.assertNotNull(node);
// Statistics
Assert.assertNotNull(node.getParent());
// Admin
Assert.assertNotNull(node.getParent().getParent());
// Pages
Assert.assertNotNull(node.getParent().getParent().getParent());
// Root
Assert.assertNotNull(node.getParent().getParent().getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(0, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.Index.class);
Assert.assertNotNull(node);
// Admin
Assert.assertNotNull(node.getParent());
// Pages
Assert.assertNotNull(node.getParent().getParent());
// Root
Assert.assertNotNull(node.getParent().getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(View.NavigationMode.DEFAULT, ((View) node.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());
Assert.assertEquals("", ((View) node.getMetaData().iterator().next()).name());
Assert.assertEquals(View.Extension.XHTML, ((View) node.getMetaData().iterator().next()).extension());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Admin.Home.class);
Assert.assertNotNull(node);
// Admin
Assert.assertNotNull(node.getParent());
// Pages
Assert.assertNotNull(node.getParent().getParent());
// Root
Assert.assertNotNull(node.getParent().getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(View.NavigationMode.FORWARD, ((View) node.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.DEFAULT, ((View) node.getMetaData().iterator().next()).viewParams());
Assert.assertEquals("", ((View) node.getMetaData().iterator().next()).name());
Assert.assertEquals(View.Extension.DEFAULT, ((View) node.getMetaData().iterator().next()).extension());
Assert.assertNotNull(node.getInheritedMetaData());
// not processed at this point - node was just added
Assert.assertEquals(0, node.getInheritedMetaData().size());
}
use of org.apache.deltaspike.core.spi.config.view.ViewConfigNode in project deltaspike by apache.
the class ViewConfigTest method testMetaDataTreeWithStereotypeMetaData.
@Test
public void testMetaDataTreeWithStereotypeMetaData() {
this.viewConfigExtension.addPageDefinition(Pages.Home.class);
this.viewConfigExtension.addPageDefinition(Pages.Public.Index.class);
ViewConfigNode node = this.viewConfigExtension.findNode(Pages.Home.class);
Assert.assertNotNull(node);
Assert.assertNotNull(node.getParent());
Assert.assertNotNull(node.getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(2, node.getMetaData().size());
Assert.assertEquals(2, node.getMetaData().size());
boolean facesRedirectAnnotationFound = false;
boolean viewAnnotationFound = false;
for (Annotation metaData : node.getMetaData()) {
if (TestFacesRedirect.class.isAssignableFrom(metaData.annotationType())) {
facesRedirectAnnotationFound = true;
} else if (View.class.isAssignableFrom(metaData.annotationType())) {
viewAnnotationFound = true;
}
}
Assert.assertTrue(facesRedirectAnnotationFound);
Assert.assertTrue(viewAnnotationFound);
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
Assert.assertNotNull(node.getCallbackDescriptors());
Assert.assertEquals(0, node.getCallbackDescriptors().size());
node = this.viewConfigExtension.findNode(Pages.Public.class);
Assert.assertNotNull(node);
Assert.assertNotNull(node.getParent());
Assert.assertNotNull(node.getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(1, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(TestFacesRedirect.class, node.getMetaData().iterator().next().annotationType());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
Assert.assertNotNull(node.getCallbackDescriptors());
Assert.assertEquals(0, node.getCallbackDescriptors().size());
node = this.viewConfigExtension.findNode(Pages.Public.Index.class);
Assert.assertNotNull(node);
Assert.assertNotNull(node.getParent());
Assert.assertNotNull(node.getParent().getParent());
Assert.assertNotNull(node.getParent().getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(0, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
Assert.assertNotNull(node.getCallbackDescriptors());
Assert.assertEquals(0, node.getCallbackDescriptors().size());
}
Aggregations