Examples of validateDefinition()


Examples of org.auraframework.def.IncludeDef.validateDefinition()

    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());
    }

    public void testOtherJsButNotJson() throws Exception {
        String code = "var something = 'borrowed'";
View Full Code Here

Examples of org.auraframework.def.IncludeDef.validateDefinition()

    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());
    }

    // TODO: should output well-formed code
    public void _testInvalidTryToBreakOut() throws Exception {
View Full Code Here

Examples of org.auraframework.def.IncludeDef.validateDefinition()

        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.validateDefinition()

        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());
    }

    // TODO: should output well-formed code
View Full Code Here

Examples of org.auraframework.def.IncludeDef.validateDefinition()

        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.validateDefinition()

    }

    @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.auraframework.def.InterfaceDef.validateDefinition()

        DefDescriptor<InterfaceDef> descriptor = DefDescriptorImpl.getInstance("test:fakeparser", InterfaceDef.class);
        StringSource<InterfaceDef> source = new StringSource<>(descriptor,
                "<aura:interface><aura:foo/></aura:interface>", "myID", Format.XML);
        InterfaceDef id = parser.parse(descriptor, source);
        try {
            id.validateDefinition();
            fail("Should have thrown AuraException aura:foo isn't a valid child tag for aura:interface");
        } catch (InvalidDefinitionException e) {

        }
    }
View Full Code Here

Examples of org.auraframework.def.InterfaceDef.validateDefinition()

        DefDescriptor<InterfaceDef> descriptor = DefDescriptorImpl.getInstance("test:fakeparser", InterfaceDef.class);
        StringSource<InterfaceDef> source = new StringSource<>(descriptor,
                "<aura:interface>Invalid text</aura:interface>", "myID", Format.XML);
        InterfaceDef id = parser.parse(descriptor, source);
        try {
            id.validateDefinition();
            fail("Should have thrown AuraException because text is between aura:interface tags");
        } catch (InvalidDefinitionException e) {

        }
    }
View Full Code Here

Examples of org.auraframework.impl.java.renderer.JavaRendererDef.validateDefinition()

        builder.setDescriptor(DefDescriptorImpl.getInstance(
                "java://org.auraframework.impl.renderer.sampleJavaRenderers.TestSimpleRenderer", RendererDef.class));
        JavaRendererDef def = builder.build();

        try {
            def.validateDefinition();
            fail("JavaRendererDef cannot be created if interface not implemented.");
        } catch (Exception e) {
            checkExceptionFull(e, InvalidDefinitionException.class, "Renderer must implement the Renderer interface.");
        }
    }
View Full Code Here

Examples of org.auraframework.impl.root.library.LibraryDefImpl.validateDefinition()

        builder.setDescriptor(libDesc);

        LibraryDefImpl libraryDef = builder.build();

        try {
            libraryDef.validateDefinition();
            fail("LibraryDef requires an IncludeDef");
        } catch (InvalidDefinitionException t) {
            assertExceptionMessage(t, InvalidDefinitionException.class,
                    "aura:library must contain at least one aura:include attribute");
        }
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.