use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor in project deltaspike by apache.
the class ViewConfigPathTest method testNamesWizard12.
@Test
public void testNamesWizard12() {
this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step1.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step2.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step3.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step4.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step5.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step6.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard12.Step7.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
ViewConfigDescriptor viewConfigDescriptor;
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step1.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/w12/step1.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step2.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/step2.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step3.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/w12/step3.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step4.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/w12/w12b/step4.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step5.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/w12b/step5.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step6.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/w12/w12b/step6.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard12.Step7.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/w12/w12b/step7.xhtml", viewConfigDescriptor.getViewId());
}
use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor in project deltaspike by apache.
the class ViewConfigPathTest method testNamesWizard13.
@Test
public void testNamesWizard13() {
this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step1.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step2.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step3.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step4.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step5.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step6.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard13.Step7.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
ViewConfigDescriptor viewConfigDescriptor;
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step1.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/w13a/step1.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step2.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/step2.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step3.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/w13a/step3.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step4.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/w13a/w13b/step4.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step5.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/w13b/step5.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step6.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/w13a/w13b/step6.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard13.Step7.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/w13a/w13b/step7.xhtml", viewConfigDescriptor.getViewId());
}
use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor in project deltaspike by apache.
the class ViewConfigTest method testSimpleViewConfigWithExplicitPageMetaData.
@Test
public void testSimpleViewConfigWithExplicitPageMetaData() {
this.viewConfigExtension.addPageDefinition(SimplePageConfig002.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig002.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/simplePageConfig002.xhtml", viewConfigDescriptor.getViewId());
Assert.assertEquals(SimplePageConfig002.class, viewConfigDescriptor.getConfigClass());
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());
}
use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor in project deltaspike by apache.
the class ViewConfigTest method testNestedViewConfig.
@Test
public void testNestedViewConfig() {
this.viewConfigExtension.addPageDefinition(Pages.Index.class);
this.viewConfigExtension.addPageDefinition(Pages.Home.class);
this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
ConfigDescriptor configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.class);
Assert.assertNotNull(configDescriptor);
Assert.assertNotNull(configDescriptor.getConfigClass());
Assert.assertEquals(Pages.class, configDescriptor.getConfigClass());
Assert.assertNotNull(configDescriptor.getMetaData());
Assert.assertEquals(1, configDescriptor.getMetaData().size());
Assert.assertEquals("/pages/", ((Folder) configDescriptor.getMetaData().iterator().next()).name());
configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.class);
Assert.assertNotNull(configDescriptor);
Assert.assertNotNull(configDescriptor.getConfigClass());
Assert.assertEquals(Pages.Admin.class, configDescriptor.getConfigClass());
Assert.assertNotNull(configDescriptor.getMetaData());
Assert.assertEquals(1, configDescriptor.getMetaData().size());
Assert.assertEquals("/pages/admin/", ((Folder) configDescriptor.getMetaData().iterator().next()).name());
ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Index.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/index.xhtml", viewConfigDescriptor.getViewId());
Assert.assertEquals(Pages.Index.class, viewConfigDescriptor.getConfigClass());
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(View.NavigationMode.FORWARD, ((View) viewConfigDescriptor.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.EXCLUDE, (viewConfigDescriptor.getMetaData(View.class).iterator().next()).viewParams());
Assert.assertEquals("index", (viewConfigDescriptor.getMetaData(View.class).iterator().next()).name());
Assert.assertEquals(View.Extension.XHTML, (viewConfigDescriptor.getMetaData(View.class).iterator().next()).extension());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Home.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/home.xhtml", viewConfigDescriptor.getViewId());
Assert.assertEquals(Pages.Home.class, viewConfigDescriptor.getConfigClass());
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(View.NavigationMode.FORWARD, ((View) viewConfigDescriptor.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.EXCLUDE, (viewConfigDescriptor.getMetaData(View.class).iterator().next()).viewParams());
Assert.assertEquals("home", (viewConfigDescriptor.getMetaData(View.class).iterator().next()).name());
Assert.assertEquals(View.Extension.XHTML, (viewConfigDescriptor.getMetaData(View.class).iterator().next()).extension());
ConfigDescriptor folderDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.class);
Assert.assertNotNull(folderDescriptor);
Assert.assertEquals("/pages/admin/", folderDescriptor.getPath());
Assert.assertEquals(Pages.Admin.class, folderDescriptor.getConfigClass());
Assert.assertNotNull(folderDescriptor.getMetaData());
Assert.assertEquals(1, folderDescriptor.getMetaData().size());
Assert.assertEquals("/pages/admin/", ((Folder) folderDescriptor.getMetaData().iterator().next()).name());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Index.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/admin/index.xhtml", viewConfigDescriptor.getViewId());
Assert.assertEquals(Pages.Admin.Index.class, viewConfigDescriptor.getConfigClass());
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(View.NavigationMode.FORWARD, ((View) viewConfigDescriptor.getMetaData().iterator().next()).navigation());
Assert.assertEquals(View.ViewParameterMode.EXCLUDE, (viewConfigDescriptor.getMetaData(View.class).iterator().next()).viewParams());
Assert.assertEquals("index", (viewConfigDescriptor.getMetaData(View.class).iterator().next()).name());
Assert.assertEquals(View.Extension.XHTML, (viewConfigDescriptor.getMetaData(View.class).iterator().next()).extension());
}
use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor in project deltaspike by apache.
the class ViewConfigTest method testMetaDataInheritanceInViewConfig.
@Test
public void testMetaDataInheritanceInViewConfig() {
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);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
ConfigDescriptor<?> configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.class);
Assert.assertNotNull(configDescriptor);
Assert.assertNotNull(configDescriptor.getConfigClass());
Assert.assertEquals(Pages.class, configDescriptor.getConfigClass());
Assert.assertNotNull(configDescriptor.getMetaData());
Assert.assertEquals(2, configDescriptor.getMetaData().size());
Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());
Assert.assertEquals("/pages/", configDescriptor.getMetaData(Folder.class).iterator().next().name());
Assert.assertEquals(View.NavigationMode.REDIRECT, configDescriptor.getMetaData(View.class).iterator().next().navigation());
Assert.assertEquals(View.ViewParameterMode.EXCLUDE, configDescriptor.getMetaData(View.class).iterator().next().viewParams());
Assert.assertEquals(View.Extension.XHTML, configDescriptor.getMetaData(View.class).iterator().next().extension());
Assert.assertEquals("", configDescriptor.getMetaData(View.class).iterator().next().name());
configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.class);
Assert.assertNotNull(configDescriptor);
Assert.assertNotNull(configDescriptor.getConfigClass());
Assert.assertEquals(Pages.Admin.class, configDescriptor.getConfigClass());
Assert.assertNotNull(configDescriptor.getMetaData());
Assert.assertEquals(2, configDescriptor.getMetaData().size());
Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());
Assert.assertEquals("/pages/admin/", configDescriptor.getMetaData(Folder.class).iterator().next().name());
Assert.assertEquals(1, configDescriptor.getMetaData(View.class).size());
Assert.assertEquals(View.NavigationMode.REDIRECT, configDescriptor.getMetaData(View.class).iterator().next().navigation());
Assert.assertEquals(View.ViewParameterMode.EXCLUDE, configDescriptor.getMetaData(View.class).iterator().next().viewParams());
//the following is correct because it's @View at the folder level:
Assert.assertEquals("", configDescriptor.getMetaData(View.class).iterator().next().name());
Assert.assertEquals("/pages/", configDescriptor.getMetaData(View.class).iterator().next().basePath());
Assert.assertEquals("xhtml", configDescriptor.getMetaData(View.class).iterator().next().extension());
configDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.Statistics.class);
Assert.assertNotNull(configDescriptor);
Assert.assertNotNull(configDescriptor.getConfigClass());
Assert.assertEquals(Pages.Admin.Statistics.class, configDescriptor.getConfigClass());
Assert.assertNotNull(configDescriptor.getMetaData());
Assert.assertEquals(2, configDescriptor.getMetaData().size());
Assert.assertEquals(1, configDescriptor.getMetaData(Folder.class).size());
Assert.assertEquals("/pages/admin/statistics/", configDescriptor.getMetaData(Folder.class).iterator().next().name());
//TODO update uc004 with these lines
Assert.assertEquals(1, configDescriptor.getMetaData(View.class).size());
Assert.assertEquals(View.NavigationMode.REDIRECT, configDescriptor.getMetaData(View.class).iterator().next().navigation());
Assert.assertEquals(View.ViewParameterMode.INCLUDE, configDescriptor.getMetaData(View.class).iterator().next().viewParams());
//the following is correct because it's @View at the folder level:
Assert.assertEquals("", configDescriptor.getMetaData(View.class).iterator().next().name());
Assert.assertEquals("/pages/admin/", configDescriptor.getMetaData(View.class).iterator().next().basePath());
Assert.assertEquals("xhtml", configDescriptor.getMetaData(View.class).iterator().next().extension());
ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Index.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/index.xhtml", viewConfigDescriptor.getViewId());
Assert.assertEquals(Pages.Index.class, viewConfigDescriptor.getConfigClass());
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());
Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());
Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());
Assert.assertEquals("index", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());
Assert.assertEquals("xhtml", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Statistics.Index.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/admin/statistics/index.xhtml", viewConfigDescriptor.getViewId());
Assert.assertEquals(Pages.Admin.Statistics.Index.class, viewConfigDescriptor.getConfigClass());
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());
Assert.assertEquals(View.ViewParameterMode.INCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());
Assert.assertEquals("index", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());
Assert.assertEquals("xhtml", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Statistics.Home.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/admin/statistics/home.xhtml", viewConfigDescriptor.getViewId());
Assert.assertEquals(Pages.Admin.Statistics.Home.class, viewConfigDescriptor.getConfigClass());
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());
Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());
Assert.assertEquals("home", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());
Assert.assertEquals("xhtml", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Index.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/admin/index.xhtml", viewConfigDescriptor.getViewId());
Assert.assertEquals(Pages.Admin.Index.class, viewConfigDescriptor.getConfigClass());
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());
Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());
Assert.assertEquals("index", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());
Assert.assertEquals("xhtml", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Home.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/admin/home.xhtml", viewConfigDescriptor.getViewId());
Assert.assertEquals(Pages.Admin.Home.class, viewConfigDescriptor.getConfigClass());
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());
Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());
Assert.assertEquals("home", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());
Assert.assertEquals("xhtml", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());
}
Aggregations