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());
}