use of org.apache.deltaspike.core.spi.config.view.ViewConfigNode in project deltaspike by apache.
the class ViewConfigTest method testMetaDataInheritanceInTree.
@Test
public void testMetaDataInheritanceInTree() {
this.viewConfigExtension.addPageDefinition(Pages.class);
this.viewConfigExtension.addPageDefinition(Pages.Admin.class);
this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.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(1, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(".", ((Folder) node.getMetaData().iterator().next()).name());
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(1, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(Folder.class, node.getMetaData().iterator().next().annotationType());
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());
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 testDuplicatedDefaultErrorViewInMetaDataTree.
@Test
public void testDuplicatedDefaultErrorViewInMetaDataTree() {
this.viewConfigExtension.addPageDefinition(Pages.Index.class);
this.viewConfigExtension.addPageDefinition(Pages.Overview.class);
ViewConfigNode node = this.viewConfigExtension.findNode(Pages.Index.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(0, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Overview.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(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 testMetaDataInheritanceInTree.
@Test
public void testMetaDataInheritanceInTree() {
this.viewConfigExtension.addPageDefinition(Pages.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(3, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(3, node.getMetaData().size());
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.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(1, 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());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Public.class);
Assert.assertNotNull(node);
// Public
Assert.assertNotNull(node.getParent());
// Root
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(Folder.class, node.getMetaData().iterator().next().annotationType());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(Pages.Public.Index.class);
Assert.assertNotNull(node);
// Public
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());
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 testDuplicatedNavigationTargetsInMetaDataTree.
@Test
public void testDuplicatedNavigationTargetsInMetaDataTree() {
this.viewConfigExtension.addPageDefinition(PagesViolation.Index.class);
this.viewConfigExtension.addPageDefinition(PagesViolation.Overview.class);
ViewConfigNode node = this.viewConfigExtension.findNode(PagesViolation.Index.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(0, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(PagesViolation.Overview.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(1, node.getMetaData().size());
Assert.assertEquals(View.class, node.getMetaData().iterator().next().annotationType());
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 testSimpleMetaDataTreeWithViewControllerCallback.
@Test
public void testSimpleMetaDataTreeWithViewControllerCallback() {
this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);
ViewConfigNode node = this.viewConfigExtension.findNode(SimplePageConfig.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());
Assert.assertNotNull(node.getCallbackDescriptors());
// TODO related to the discussion about #getInheritedMetaData (see TODOs in other use-cases)
Assert.assertEquals(0, node.getCallbackDescriptors().size());
}
Aggregations