Package org.auraframework.util.javascript.directive

Examples of org.auraframework.util.javascript.directive.DirectiveParser


    public void testJSSourceWithIfDirective() throws Exception {
        File file = getResourceFile("/testdata/javascript/testIfDirective_positive.js");
        DirectiveBasedJavascriptGroup jg = new DirectiveBasedJavascriptGroup("testDummy", file.getParentFile(),
                file.getName(), ImmutableList.<DirectiveType<?>> of(DirectiveTypes.ifType),
                EnumSet.of(JavascriptGeneratorMode.TESTING));
        DirectiveParser dp = new DirectiveParser(jg, jg.getStartFile());
        dp.parseFile();
        goldFileText(dp.generate(JavascriptGeneratorMode.TESTING), "_test.js");
        goldFileText(dp.generate(JavascriptGeneratorMode.PRODUCTION), "_prod.js");
    }
View Full Code Here


        getResourceFile("/testdata/javascript/includeDirective/testCommonInclude_commonstuff.js");
        DirectiveBasedJavascriptGroup jg = new DirectiveBasedJavascriptGroup("testDummy",
                getResourceFile("/testdata/"), "javascript/includeDirective/testCommonInclude.js",
                ImmutableList.<DirectiveType<?>> of(DirectiveTypes.includeType),
                EnumSet.of(JavascriptGeneratorMode.TESTING));
        DirectiveParser dp = new DirectiveParser(jg, jg.getStartFile());
        dp.parseFile();
        goldFileText(dp.generate(JavascriptGeneratorMode.TESTING), ".js");

    }
View Full Code Here

    public void testIncludeNonExistingFile() throws Exception {
        File file = getResourceFile("/testdata/javascript/includeDirective/testIncludeNonExistingFile.js");
        DirectiveBasedJavascriptGroup jg = new DirectiveBasedJavascriptGroup("testDummy", file.getParentFile(),
                file.getName(), ImmutableList.<DirectiveType<?>> of(DirectiveTypes.includeType),
                EnumSet.of(JavascriptGeneratorMode.TESTING));
        DirectiveParser dp = new DirectiveParser(jg, jg.getStartFile());
        try {
            dp.parseFile();
            fail("Should have failed processing a non-existing file");
        } catch (IOException expected) {
            assertTrue("Add File function failed because of an unexpected error message",
                expected.getMessage().startsWith("File did not exist or was not a valid, acceptable file"));
        }
View Full Code Here

        getResourceFile("/testdata/javascript/includeDirective/nestedInclude/testIncludeDirective3.js");
        DirectiveBasedJavascriptGroup jg = new DirectiveBasedJavascriptGroup("testDummy",
                getResourceFile("/testdata/"), "javascript/includeDirective/testIncludeDirective.js",
                ImmutableList.<DirectiveType<?>> of(DirectiveTypes.includeType, DirectiveTypes.ifType),
                EnumSet.of(JavascriptGeneratorMode.TESTING));
        DirectiveParser dp = new DirectiveParser(jg, jg.getStartFile());
        dp.parseFile();
        goldFileText(dp.generate(JavascriptGeneratorMode.TESTING), "_test.js");
        goldFileText(dp.generate(JavascriptGeneratorMode.AUTOTESTING), "_auto.js");
    }
View Full Code Here

     * @userStory a07B0000000FDWP
     */
    public void testCompressionOfAuraJavascriptGroup() throws Exception {
        AuraJavascriptGroup js = new AuraJavascriptGroup();
        Set<JavascriptGeneratorMode> jsModes = js.getJavascriptGeneratorModes();
        DirectiveParser parser = new DirectiveParser(js, js.getStartFile());
        parser.parseFile();

        StringBuffer errorTxt = new StringBuffer();
        // Have to do it for All modes because each mode has specific settings
        // for comments and such
        for (JavascriptGeneratorMode mode : jsModes) {
            if (mode.getJavascriptWriter() != null) {
                String jsContents = parser.generate(mode);
                List<JavascriptProcessingError> errors = mode.getJavascriptWriter().compress(jsContents,
                        new StringWriter(), js.getStartFile().getName());
                for (JavascriptProcessingError e : errors) {
                    errorTxt.append(e.toString());
                }
View Full Code Here

    @Override
    public void processDirective(DirectiveBasedJavascriptGroup group) throws IOException {
        // get the file, group will do validation
        String relativeFile = path.replace('.', File.separatorChar) + ".js";
        this.include = group.addFile(relativeFile);
        includedParser = new DirectiveParser(group, include);
        includedParser.parseFile();
    }
View Full Code Here

TOP

Related Classes of org.auraframework.util.javascript.directive.DirectiveParser

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.