Package org.apache.myfaces.config.element

Examples of org.apache.myfaces.config.element.FacesConfig


        _impl = new DigesterFacesConfigUnmarshallerImpl(null);
    }

    public void testEmptyConfig() throws Exception
    {
        FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
                "empty-config.xml"), "empty-config.xml");
        assertNotNull(cfg);
        assertTrue(cfg.getApplications().isEmpty());
        assertTrue(cfg.getComponents().isEmpty());
        assertTrue(cfg.getConverters().isEmpty());
        assertTrue(cfg.getFactories().isEmpty());
        assertTrue(cfg.getLifecyclePhaseListener().isEmpty());
        assertTrue(cfg.getManagedBeans().isEmpty());
        assertTrue(cfg.getNavigationRules().isEmpty());
        assertTrue(cfg.getRenderKits().isEmpty());
        assertTrue(cfg.getValidators().isEmpty());
    }
View Full Code Here


        assertTrue(cfg.getValidators().isEmpty());
    }

    public void testApplicationConfig() throws Exception
    {
        FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
                "application-config.xml"), "application-config.xml");
        assertNotNull(cfg);
        assertEquals(1, cfg.getApplications().size());
        Application app = cfg.getApplications().get(0);
        assertEquals(2, app.getActionListener().size());
        assertEquals("action-listener1", app.getActionListener().get(0));
        assertEquals("action-listener2", app.getActionListener().get(1));
        assertEquals(1, app.getDefaultRenderkitId().size());
        assertEquals("default-render-kit-id", app.getDefaultRenderkitId()
View Full Code Here

        assertEquals("bb", cfg.getSupportedLocales().get(1));
    }
   
    public void testAbsoluteOrderingConfig() throws Exception
    {
        FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
                "absolute-ordering-config.xml"), "absolute-ordering-config.xml");
        assertNotNull(cfg);
        assertEquals("true", cfg.getMetadataComplete());
        assertEquals("a",cfg.getName());

        List<OrderSlot> orderList = cfg.getAbsoluteOrdering().getOrderList();
       
        assertEquals("b", ((FacesConfigNameSlot) orderList.get(0)).getName());
        assertEquals("c", ((FacesConfigNameSlot) orderList.get(1)).getName());
        assertEquals(org.apache.myfaces.config.impl.digester.elements.ConfigOthersSlot.class, orderList.get(2).getClass());
        assertEquals("d", ((FacesConfigNameSlot) orderList.get(3)).getName());
       
        assertTrue(cfg.getApplications().isEmpty());
        assertTrue(cfg.getComponents().isEmpty());
        assertTrue(cfg.getConverters().isEmpty());
        assertTrue(cfg.getFactories().isEmpty());
        assertTrue(cfg.getLifecyclePhaseListener().isEmpty());
        assertTrue(cfg.getManagedBeans().isEmpty());
        assertTrue(cfg.getNavigationRules().isEmpty());
        assertTrue(cfg.getRenderKits().isEmpty());
        assertTrue(cfg.getValidators().isEmpty());
    }
View Full Code Here

        assertTrue(cfg.getValidators().isEmpty());
    }
   
    public void testOrderingConfig() throws Exception
    {
        FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
                "ordering-config.xml"), "ordering-config.xml");
        assertNotNull(cfg);
        assertEquals("a",cfg.getName());

        List<OrderSlot> orderList = cfg.getOrdering().getBeforeList();       
        assertEquals("b", ((FacesConfigNameSlot) orderList.get(0)).getName());
        assertEquals("c", ((FacesConfigNameSlot) orderList.get(1)).getName());
        assertEquals(org.apache.myfaces.config.impl.digester.elements.ConfigOthersSlot.class, orderList.get(2).getClass());
       
        orderList = cfg.getOrdering().getAfterList();       
        assertEquals("d", ((FacesConfigNameSlot) orderList.get(0)).getName());
       
        assertTrue(cfg.getApplications().isEmpty());
        assertTrue(cfg.getComponents().isEmpty());
        assertTrue(cfg.getConverters().isEmpty());
        assertTrue(cfg.getFactories().isEmpty());
        assertTrue(cfg.getLifecyclePhaseListener().isEmpty());
        assertTrue(cfg.getManagedBeans().isEmpty());
        assertTrue(cfg.getNavigationRules().isEmpty());
        assertTrue(cfg.getRenderKits().isEmpty());
        assertTrue(cfg.getValidators().isEmpty());
    }
View Full Code Here

        assertEquals("value1", facesFlowParameter.getValue());*/
    }
   
    public void testCsrf() throws Exception
    {
        FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
                "csrf-and-contracts.xml"), "csrf-and-contracts.xml");
       
        assertNotNull(cfg);
        assertEquals(2, cfg.getProtectedViewsUrlPatternList().size());
        assertEquals("/files/*.xhtml", cfg.getProtectedViewsUrlPatternList().get(0));
        assertEquals("/files2/*.xhtml", cfg.getProtectedViewsUrlPatternList().get(1));
       
       
    }
View Full Code Here

       
    }
   
    public void testContracts() throws Exception
    {
        FacesConfig cfg = _impl.getFacesConfig(getClass().getResourceAsStream(
                "csrf-and-contracts.xml"), "csrf-and-contracts.xml");
       
        assertNotNull(cfg);

        Application app = cfg.getApplications().get(0);
        assertNotNull(app);
        assertEquals(1, app.getResourceLibraryContractMappings().size());
       
        ContractMapping mapping = app.getResourceLibraryContractMappings().get(0);
        assertEquals("/files/*.xhtml", mapping.getUrlPattern());
View Full Code Here

            if (log.isLoggable(Level.INFO))
            {
                log.info("Reading standard config " + STANDARD_FACES_CONFIG_RESOURCE);
            }
           
            FacesConfig facesConfig = getUnmarshaller(ectx).getFacesConfig(stream, STANDARD_FACES_CONFIG_RESOURCE);
            stream.close();
            return facesConfig;
        }
        catch (IOException e)
        {
View Full Code Here

    @Override
    public FacesConfig getWebAppFacesConfig(ExternalContext ectx)
    {
        try
        {
            FacesConfig webAppConfig = null;
            // web application config
            if (MyfacesConfig.getCurrentInstance(ectx).isValidateXML())
            {
                URL url = ectx.getResource(DEFAULT_FACES_CONFIG);
                if (url != null)
View Full Code Here

                            StreamResult result = new StreamResult(xmlAsWriter);

                            trans.transform(source, result);

                            StringReader xmlReader = new StringReader(xmlAsWriter.toString());
                            FacesConfig facesConfig = getUnmarshaller(ectx).getFacesConfig(
                                xmlReader);
                            facesConfigList.add(facesConfig);
                        }
                        catch (IOException ex)
                        {
View Full Code Here

                            try
                            {
                                URL url = ectx.getResource(filePath);
                                if (url != null)
                                {
                                    FacesConfig fc = parseFacesConfig(ectx, filePath, url);
                                    if (fc != null)
                                    {
                                        configFilesList.add(fc);
                                    }
                                }
                            }
                            catch (MalformedURLException ex)
                            {
                            }
                        }
                    }
                }
            }
            else if (!dirPath.startsWith("/META-INF") && dirPath.endsWith("/"))
            {
                // Look on /<flowName>/<flowName>-flow.xml
                String flowName = dirPath.substring(1, dirPath.length() - 1);
                String filePath = dirPath+flowName+"-flow.xml";
                if (!contextSpecifiedList.contains(filePath))
                {
                    try
                    {
                        URL url = ectx.getResource(filePath);
                        if (url != null)
                        {
                            FacesConfig fc = parseFacesConfig(ectx, filePath, url);
                            if (fc != null)
                            {
                                configFilesList.add(fc);
                            }
                        }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.config.element.FacesConfig

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.