Package org.apache.myfaces.extensions.cdi.jsf.api.config.view

Examples of org.apache.myfaces.extensions.cdi.jsf.api.config.view.ViewConfigDescriptor


    public void testSimpleInterfaceBasedConfigs()
    {
        viewConfigExtension.addPageDefinition(SimpleInterfaceBasedConfigs.Wizards.Registration.Step1.class);
        viewConfigExtension.addPageDefinition(SimpleInterfaceBasedConfigs.Wizards.Order.Step1.class);

        ViewConfigDescriptor registrationConfigEntry = ViewConfigCache.getViewConfigDescriptor(SimpleInterfaceBasedConfigs.Wizards.Registration.Step1.class);
        ViewConfigDescriptor orderConfigEntry = ViewConfigCache.getViewConfigDescriptor(SimpleInterfaceBasedConfigs.Wizards.Order.Step1.class);

        assertEquals(registrationConfigEntry.getViewId(),
                "/pages/wizards/registration/step1.xhtml");
        assertEquals(orderConfigEntry.getViewId(),
                "/pages/wizards/order/step1.xhtml");

        assertEquals(registrationConfigEntry.getNavigationMode(), Page.NavigationMode.DEFAULT);
        assertEquals(orderConfigEntry.getNavigationMode(), Page.NavigationMode.REDIRECT);

        assertTrue(registrationConfigEntry.getAccessDecisionVoters().size() == 0);
        assertEquals(orderConfigEntry.getAccessDecisionVoters().size(), 1);
        assertEquals(orderConfigEntry.getAccessDecisionVoters().iterator().next(), TestAccessDecisionVoter1.class);
    }
View Full Code Here


        assertEquals(ViewConfigCache.getViewConfigDescriptor(NavigationOverriding1.RedirectedPage1.class).getViewId(),
                                                       "/redirectedPage1.xhtml");
        assertEquals(ViewConfigCache.getViewConfigDescriptor(NavigationOverriding1.ForwardedPage1.class).getViewId(),
                                                       "/forwardedPage1.xhtml");

        ViewConfigDescriptor viewConfig =ViewConfigCache.getViewConfigDescriptor(NavigationOverriding1.RedirectedPage1.class);
        assertEquals(viewConfig.getNavigationMode(), NavigationMode.REDIRECT);

        viewConfig = ViewConfigCache.getViewConfigDescriptor(NavigationOverriding1.ForwardedPage1.class);

        assertEquals(viewConfig.getNavigationMode(), NavigationMode.FORWARD);
    }
View Full Code Here

        assertEquals(ViewConfigCache.getViewConfigDescriptor(NavigationOverriding2.RedirectedPage2.class).getViewId(),
                                                       "/redirectedPage2.xhtml");
        assertEquals(ViewConfigCache.getViewConfigDescriptor(NavigationOverriding2.ForwardedPage2.class).getViewId(),
                                                       "/forwardedPage2.xhtml");

        ViewConfigDescriptor viewConfig =ViewConfigCache.getViewConfigDescriptor(NavigationOverriding2.RedirectedPage2.class);
        assertEquals(viewConfig.getNavigationMode(), NavigationMode.REDIRECT);

        viewConfig = ViewConfigCache.getViewConfigDescriptor(NavigationOverriding2.ForwardedPage2.class);

        assertEquals(viewConfig.getNavigationMode(), NavigationMode.FORWARD);
    }
View Full Code Here

    public void testViewConfigWithAccessDecisionVoters()
    {
        viewConfigExtension.addPageDefinition(ViewConfigWithAccessDecisionVoters.Page1.class);
        viewConfigExtension.addPageDefinition(ViewConfigWithAccessDecisionVoters.Page2.class);

        ViewConfigDescriptor viewConfig = ViewConfigCache.getViewConfigDescriptor(ViewConfigWithAccessDecisionVoters.Page1.class);

        assertEquals(viewConfig.getAccessDecisionVoters().size(), 1);

        viewConfig = ViewConfigCache.getViewConfigDescriptor(ViewConfigWithAccessDecisionVoters.Page2.class);

        assertEquals(viewConfig.getAccessDecisionVoters().size(), 2);

        boolean voter2 = false;
        for(Class<? extends AccessDecisionVoter> accessDecisionVoter : viewConfig.getAccessDecisionVoters())
        {
            if(!voter2)
            {
                assertTrue(accessDecisionVoter.equals(TestAccessDecisionVoter2.class));
                voter2 = true;
View Full Code Here

    public void testViewConfigWithSecurityErrorPages()
    {
        viewConfigExtension.addPageDefinition(ViewConfigWithSecurityErrorPages.Page1.class);
        viewConfigExtension.addPageDefinition(ViewConfigWithSecurityErrorPages.Page2.class);

        ViewConfigDescriptor viewConfig = ViewConfigCache.getViewConfigDescriptor(ViewConfigWithSecurityErrorPages.Page1.class);

        assertEquals(((EditableViewConfigDescriptor)viewConfig).getErrorView(), SimpleView.class);

        viewConfig = ViewConfigCache.getViewConfigDescriptor(ViewConfigWithSecurityErrorPages.Page2.class);
        assertEquals(((EditableViewConfigDescriptor)viewConfig).getErrorView(), SimpleViewWithManualName.class);
View Full Code Here

    public void testViewConfigWithViewMetaData()
    {
        viewConfigExtension.addPageDefinition(ViewConfigWithViewMetaData.Page1.class);
        viewConfigExtension.addPageDefinition(ViewConfigWithViewMetaData.Page2.class);

        ViewConfigDescriptor viewConfig = ViewConfigCache.getViewConfigDescriptor(ViewConfigWithViewMetaData.Page1.class);

        assertEquals(viewConfig.getMetaData().size(), 2);

        viewConfig = ViewConfigCache.getViewConfigDescriptor(ViewConfigWithViewMetaData.Page2.class);
        assertEquals(viewConfig.getMetaData().size(), 3);
    }
View Full Code Here

    public void testViewConfigWithViewController()
    {
        viewConfigExtension.addPageDefinition(ViewConfigWithViewController.Page1.class);
        viewConfigExtension.addPageDefinition(ViewConfigWithViewController.Page2.class);

        ViewConfigDescriptor viewConfig = ViewConfigCache.getViewConfigDescriptor(ViewConfigWithViewController.Page1.class);

        List<PageBeanDescriptor> pageBeanDescriptors = viewConfig.getPageBeanDescriptors();
        assertEquals(pageBeanDescriptors.size(), 1);
        assertTrue(pageBeanDescriptors.iterator().next().getBeanClass().equals(TestPageBean2.class));

        viewConfig = ViewConfigCache.getViewConfigDescriptor(ViewConfigWithViewController.Page2.class);

        pageBeanDescriptors = viewConfig.getPageBeanDescriptors();
        assertEquals(pageBeanDescriptors.size(), 2);

        for(PageBeanDescriptor pageBeanDescriptor : pageBeanDescriptors)
        {
            assertTrue(pageBeanDescriptor.getBeanClass().equals(TestPageBean2.class) ||
View Full Code Here

            errorView = inlineErrorView;
        }

        if(errorView == null)
        {
            ViewConfigDescriptor errorPageDescriptor = ViewConfigCache.getDefaultErrorViewConfigDescriptor();

            if(errorPageDescriptor != null)
            {
                errorView = errorPageDescriptor.getViewConfig();
            }
        }

        if(errorView == null)
        {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public ViewConfigDescriptor getErrorViewConfigDescriptor(Class<? extends ViewConfig> viewDefinitionClass)
    {
        ViewConfigDescriptor viewConfigDescriptor = getViewConfigDescriptor(viewDefinitionClass);

        Class<? extends ViewConfig> errorView = null;
        if(viewConfigDescriptor instanceof EditableViewConfigDescriptor)
        {
            errorView = ((EditableViewConfigDescriptor)viewConfigDescriptor).getErrorView();
View Full Code Here

            return;
        }

        String viewId = viewRoot.getViewId();

        ViewConfigDescriptor viewDefinitionEntry = ViewConfigCache.getViewConfigDescriptor(viewId);

        if(viewDefinitionEntry == null)
        {
            return;
        }

        List<PageBeanDescriptor> beanEntries = viewDefinitionEntry.getPageBeanDescriptors();

        for(PageBeanDescriptor beanEntry : beanEntries)
        {
            //resolve bean to trigger @PostConstruct if it isn't scoped
            CodiUtils.getContextualReferenceByName(beanManager, beanEntry.getBeanName(), Object.class);
View Full Code Here

TOP

Related Classes of org.apache.myfaces.extensions.cdi.jsf.api.config.view.ViewConfigDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.