Package org.apache.geronimo.xbeans.javaee6

Examples of org.apache.geronimo.xbeans.javaee6.WebAppDocument


            webApp = WebAppType.Factory.newInstance();
        } else {
            try {
                specDD = JarUtils.readAll(specDDUrl);
                XmlObject parsed = XmlBeansUtil.parse(specDD);
                WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed);
                webApp = webAppDoc.getWebApp();
                WebDeploymentValidationUtils.validateWebApp(webApp);
            } catch (XmlException e) {
                throw new DeploymentException("Error parsing web.xml for " + bundle.getSymbolicName(), e);
            } catch (Exception e) {
                throw new DeploymentException("Error reading web.xml for " + bundle.getSymbolicName(), e);
View Full Code Here


            specDD = JarUtils.readAll(specDDUrl);

            // we found web.xml, if it won't parse that's an error.
            XmlObject parsed = XmlBeansUtil.parse(specDD);

            WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed);
            webApp = webAppDoc.getWebApp();
            WebDeploymentValidationUtils.validateWebApp(webApp);
        } catch (XmlException e) {
            // Output the target path in the error to make it clearer to the user which webapp
            // has the problem.  The targetPath is used, as moduleFile may have an unhelpful
            // value such as C:\geronimo-1.1\var\temp\geronimo-deploymentUtil22826.tmpdir
View Full Code Here

            webApp = WebAppType.Factory.newInstance();
        } else {
            try {
                specDD = JarUtils.readAll(specDDUrl);
                XmlObject parsed = XmlBeansUtil.parse(specDD);
                WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed);
                webApp = webAppDoc.getWebApp();
                WebDeploymentValidationUtils.validateWebApp(webApp);
            } catch (XmlException e) {
                throw new DeploymentException("Error parsing web.xml for " + bundle.getSymbolicName(), e);
            } catch (Exception e) {
                throw new DeploymentException("Error reading web.xml for " + bundle.getSymbolicName(), e);
View Full Code Here

            // on the J2ee management object
            specDD = JarUtils.readAll(specDDUrl);

            // we found web.xml, if it won't parse that's an error.
            XmlObject parsed = XmlBeansUtil.parse(specDD);
            WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed);
            webApp = webAppDoc.getWebApp();
            WebDeploymentValidationUtils.validateWebApp(webApp);
        } catch (XmlException e) {
            // Output the target path in the error to make it clearer to the user which webapp
            // has the problem.  The targetPath is used, as moduleFile may have an unhelpful
            // value such as C:\geronimo-1.1\var\temp\geronimo-deploymentUtil22826.tmpdir
View Full Code Here

        //
        // 1. resource-ref
        //
        URL srcXML = classLoader.getResource("annotation/empty-web-src.xml");
        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
        WebAppDocument webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
        WebAppType webApp = webAppDoc.getWebApp();
        AnnotatedWebApp annotatedWebApp = new AnnotatedWebApp(webApp);
        ResourceAnnotationHelper.processAnnotations(annotatedWebApp, classFinder, ResourceRefBuilder.ResourceRefProcessor.INSTANCE);
        URL expectedXML = classLoader.getResource("annotation/resource-ref-expected.xml");
        XmlObject expected = XmlObject.Factory.parse(expectedXML);
        log.debug("[@Resource <resource-ref> Source XML] " + '\n' + webApp.toString() + '\n');
View Full Code Here

    }

    public void testContextRootWithoutPlanButWebApp() throws Exception {

        WebAppDocument webAppDocument = WebAppDocument.Factory.newInstance();
        WebAppType webAppType = webAppDocument.addNewWebApp();
        webAppType.setId("myId");

        URL war = classLoader.getResource("deployables/war2.war");
        assertTrue(war != null);
        JarFile dummyFile = new JarFile(new File(war.getFile()));
View Full Code Here

    }

    private WebAppType getWebApp(JarFile dummyFile) throws IOException, XmlException {
        URL specDDUrl = JarUtils.createJarURL(dummyFile, "WEB-INF/web.xml");
        XmlObject parsed = XmlBeansUtil.parse(specDDUrl, getClass().getClassLoader());
        WebAppDocument webAppDoc = (WebAppDocument) parsed.changeType(WebAppDocument.type);
        return webAppDoc.getWebApp();
    }
View Full Code Here

        //
        // 2. env-entry
        //
        URL srcXML = classLoader.getResource("annotation/empty-web-src.xml");
        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
        WebAppDocument webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
        WebAppType webApp = webAppDoc.getWebApp();
        AnnotatedWebApp annotatedWebApp = new AnnotatedWebApp(webApp);
        ResourceAnnotationHelper.processAnnotations(annotatedWebApp, classFinder, EnvironmentEntryBuilder.EnvEntryRefProcessor.INSTANCE);
        URL expectedXML = classLoader.getResource("annotation/env-entry-expected.xml");
        XmlObject expected = XmlObject.Factory.parse(expectedXML);
        log.debug("[@Resource <env-entry> Source XML] " + '\n' + webApp.toString() + '\n');
        log.debug("[@Resource <env-entry> Expected XML]" + '\n' + expected.toString() + '\n');
        List problems = new ArrayList();
        boolean ok = compareXmlObjects(webApp, expected, problems);
        assertTrue("Differences: " + problems, ok);
        //
        // 3. service-ref
        //
        srcXML = classLoader.getResource("annotation/empty-web-src.xml");
        xmlObject = XmlObject.Factory.parse(srcXML, options);
        webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
        webApp = webAppDoc.getWebApp();
        annotatedWebApp = new AnnotatedWebApp(webApp);
        ResourceAnnotationHelper.processAnnotations(annotatedWebApp, classFinder, SwitchingServiceRefBuilder.ServiceRefProcessor.INSTANCE);
        expectedXML = classLoader.getResource("annotation/service-ref-expected.xml");
        expected = XmlObject.Factory.parse(expectedXML);
        log.debug("[@Resource <service-ref> Source XML] " + '\n' + webApp.toString() + '\n');
View Full Code Here

    private XmlOptions options = new XmlOptions();


    public void testParsing() throws Exception {
        URL srcXml = classLoader.getResource("security/web1.xml");
        WebAppDocument webAppDoc = WebAppDocument.Factory.parse(srcXml, options);
        WebAppType webAppType = webAppDoc.getWebApp();
        SpecSecurityBuilder builder = new SpecSecurityBuilder(webAppType);
        ComponentPermissions permissions = builder.buildSpecSecurityConfig();
        PermissionCollection unchecked = permissions.getUncheckedPermissions();
        assertTrue(unchecked.implies(new WebResourcePermission("/login.do", "!")));
        assertTrue(unchecked.implies(new WebResourcePermission("/foo", "!")));
View Full Code Here

     * HTTPMethod "all" handling
     * @throws Exception
     */
    public void testAllMethodsConstraint() throws Exception {
        URL srcXml = classLoader.getResource("security/web2.xml");
        WebAppDocument webAppDoc = WebAppDocument.Factory.parse(srcXml, options);
        WebAppType webAppType = webAppDoc.getWebApp();
        SpecSecurityBuilder builder = new SpecSecurityBuilder(webAppType);
        ComponentPermissions permissions = builder.buildSpecSecurityConfig();
        Permission p = new WebResourcePermission("/Test/Foo", "GET,POST");
        assertTrue(implies(p, permissions, "Admin"));
        assertFalse(implies(new WebResourcePermission("/Test", ""), permissions, null));
View Full Code Here

TOP

Related Classes of org.apache.geronimo.xbeans.javaee6.WebAppDocument

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.