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

        if (!(o instanceof ViewConfigDescriptor))
        {
            return false;
        }

        ViewConfigDescriptor that = (ViewConfigDescriptor) o;

        if (!viewId.equals(that.getViewId()))
        {
            return false;
        }

        return true;
View Full Code Here

        if(this.logger.isLoggable(Level.INFO))
        {
            this.logger.info(pageDefinitionClass.getName() + " will be used as page-definition.");
        }

        ViewConfigDescriptor newEntry = createViewConfigDescriptor(pageDefinitionClass);

        if(newEntry != null)
        {
            ViewConfigDescriptor existingDescriptor = ViewConfigCache.getViewConfigDescriptor(newEntry.getViewConfig());

            if(existingDescriptor instanceof EditableViewConfigDescriptor
                    && ((EditableViewConfigDescriptor)existingDescriptor).isPartialViewConfig())
            {
                //in this case the alternative view-controller approach which just adds page-beans was invoked before
                //-> we just have to use the page bean of the existing entry

                //here we have a simple-entry!   (which just contains page-bean definitions)
                for(PageBeanDescriptor pageBeanDescriptor : existingDescriptor.getPageBeanDescriptors())
                {
                    //add page-beans to the real entry
                    if(newEntry instanceof EditableViewConfigDescriptor)
                    {
                        ((EditableViewConfigDescriptor)newEntry).addPageBean(pageBeanDescriptor.getBeanClass());
View Full Code Here

            this.logger.info(annotatedType.getJavaClass().getName() + " will be used as page-bean.");
        }

        for(Class<? extends ViewConfig> viewConfigClass : view.value())
        {
            ViewConfigDescriptor viewConfigDescriptor = ViewConfigCache.getViewConfigDescriptor(viewConfigClass);

            if(viewConfigDescriptor == null)
            {
                ViewConfigDescriptor entry = createViewConfigDescriptor(viewConfigClass);

                if(entry != null)
                {
                    if(entry instanceof EditableViewConfigDescriptor)
                    {
                        ((EditableViewConfigDescriptor)entry).addPageBean(annotatedType.getJavaClass());
                        ((EditableViewConfigDescriptor)entry).setPartialViewConfig(true);
                    }

                    ViewConfigCache.addViewConfigDescriptor(entry.getViewId(), entry);
                }
            }
            else
            {
                if(viewConfigDescriptor instanceof EditableViewConfigDescriptor)
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.