Examples of IncludeDef


Examples of org.auraframework.def.IncludeDef

    public void testEmpty() throws Exception {
        String code = "";
        StringSource<IncludeDef> source = new StringSource<>(descriptor, code, null, null);
        JavascriptIncludeDefHandler handler = new JavascriptIncludeDefHandler(descriptor, source);
        IncludeDef def = handler.getDefinition();
        def.validateDefinition();
        assertEquals(code, def.getCode().trim());
    }
View Full Code Here

Examples of org.auraframework.def.IncludeDef

    public void testFunction() throws Exception {
        String code = "function(){return 'anything'}";
        StringSource<IncludeDef> source = new StringSource<>(descriptor, code, null, null);
        JavascriptIncludeDefHandler handler = new JavascriptIncludeDefHandler(descriptor, source);
        IncludeDef def = handler.getDefinition();
        def.validateDefinition();
        assertEquals(code, def.getCode().trim());
    }
View Full Code Here

Examples of org.auraframework.def.IncludeDef

    public void testOtherJsButNotJson() throws Exception {
        String code = "var something = 'borrowed'";
        StringSource<IncludeDef> source = new StringSource<>(descriptor, code, null, null);
        JavascriptIncludeDefHandler handler = new JavascriptIncludeDefHandler(descriptor, source);
        IncludeDef def = handler.getDefinition();
        def.validateDefinition();
        assertEquals(code, def.getCode().trim());
    }
View Full Code Here

Examples of org.auraframework.def.IncludeDef

    // TODO: should output well-formed code
    public void _testInvalidTryToBreakOut() throws Exception {
        String code = "}) alert('watch out')";
        StringSource<IncludeDef> source = new StringSource<>(descriptor, code, null, null);
        JavascriptIncludeDefHandler handler = new JavascriptIncludeDefHandler(descriptor, source);
        IncludeDef def = handler.getDefinition();
        try {
            def.validateDefinition();
            fail("Invalid breaking JS wasn't validated");
        } catch (InvalidDefinitionException t) {
            String message = t.getMessage();
            assertTrue("Unexpected message: " + t,
                    message.contains("$JsonStreamParseException: Expected ',' or '}', got FUNCTION_ARGS_END"));
View Full Code Here

Examples of org.auraframework.def.IncludeDef

    public void testExtraHarmless() throws Exception {
        String code = "function(){return 66;}";
        // source will have an extra curly brace at the end
        StringSource<IncludeDef> source = new StringSource<>(descriptor, code + "}", null, null);
        JavascriptIncludeDefHandler handler = new JavascriptIncludeDefHandler(descriptor, source);
        IncludeDef def = handler.getDefinition();
        def.validateDefinition();
        // we only read in 1 object, so this is actually okay, and we get a well-formed object anyways
        assertEquals(code, def.getCode().trim());
    }
View Full Code Here

Examples of org.auraframework.def.IncludeDef

    // TODO: should output well-formed code
    public void _testUnClosed() throws Exception {
        String code = "function(){return 66;";
        StringSource<IncludeDef> source = new StringSource<>(descriptor, code, null, null);
        JavascriptIncludeDefHandler handler = new JavascriptIncludeDefHandler(descriptor, source);
        IncludeDef def = handler.getDefinition();
        try {
            def.validateDefinition();
            fail("Invalid unclosed JS wasn't validated");
        } catch (InvalidDefinitionException t) {
            String message = t.getMessage();
            assertTrue("Unexpected message: " + t,
                    message.contains("$JsonStreamParseException: Expected ',' or '}', got FUNCTION_ARGS_END"));
View Full Code Here

Examples of org.auraframework.def.IncludeDef

        }
    }

    @Override
    public void validateReferences() throws QuickFixException {
        IncludeDef includeDef = includeDescriptor.getDef();
        includeDef.validateDefinition();
        if (imports != null) {
            for (DefDescriptor<IncludeDef> imported : imports) {
                imported.getDef().validateDefinition();
                imported.getDef().validateReferences();
            }
View Full Code Here

Examples of org.tubo.configuration.def.IncludeDef

        //
        // iterate all elements
        for(Iterator it=includeDefs.iterator(); it.hasNext();) {
            //
            // obtains current element
            IncludeDef includeDef = (IncludeDef)it.next();
            //
            // if this include as bean proceced on previus step (remember is recursive), then leave this.
            if (!includeDef.isLoaded())  {
                //
                // obtain resource
                String resource = includeDef.getResource();
                //
                // mark this include like loaded (because if not enter in infinite loop)
                includeDef.setLoaded(true);
                //
                // append this resource to configuration
                config = append(resource, config);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.