Package org.auraframework.impl.root.parser

Examples of org.auraframework.impl.root.parser.XMLParser


        ComponentDef cd = parser.parse(descriptor, source);
        assertNotNull(cd);
    }

    public void testAttributeDefRefParsingWithChildtag() throws Exception {
        XMLParser parser = XMLParser.getInstance();
        DefDescriptor<ComponentDef> descriptor = DefDescriptorImpl.getInstance("test:fakeparser", ComponentDef.class);
        StringSource<ComponentDef> source = new StringSource<>(descriptor,
                "<aura:component><aura:set attribute='header'><aura:foo/></aura:set></aura:component>", "myID",
                Format.XML);
        ComponentDef cd = parser.parse(descriptor, source);
        assertNotNull(cd);
    }
View Full Code Here


    public void testGetHandledTag() {
        assertEquals("aura:application", cdHandler.getHandledTag());
    }

    public void testDuplicateAttributeNames() throws Exception {
        XMLParser parser = XMLParser.getInstance();
        DefDescriptor<ApplicationDef> descriptor = DefDescriptorImpl.getInstance("test:fakeparser",
                ApplicationDef.class);
        StringSource<ApplicationDef> source = new StringSource<>(descriptor,
                "<aura:application><aura:attribute name=\"implNumber\" type=\"String\"/>"
                        + "<aura:attribute name=\"implNumber\" type=\"String\"/></aura:application>", "myID",
                Format.XML);
        ApplicationDef ad = parser.parse(descriptor, source);
        try {
            ad.validateDefinition();
            fail("Should have thrown Exception. Two attributes with the same name cannot exist");
        } catch (Exception e) {
            checkExceptionContains(e, InvalidDefinitionException.class,
View Full Code Here

    public InterfaceDefHandlerTest(String name) {
        super(name);
    }

    public void testInterfaceDefHandler() throws Exception {
        XMLParser parser = XMLParser.getInstance();
        DefDescriptor<InterfaceDef> descriptor = DefDescriptorImpl.getInstance("test:fakeparser", InterfaceDef.class);
        StringSource<InterfaceDef> source = new StringSource<>(
                descriptor,
                "<aura:interface><aura:attribute name='mystring' type='String'/><aura:registerevent name='click' type='aura:click' description='The Description'/></aura:interface>",
                "myID", Format.XML);
        InterfaceDef def = parser.parse(descriptor, source);
        assertEquals(1, def.getAttributeDefs().size());
        assertTrue(def.getAttributeDefs().containsKey(DefDescriptorImpl.getInstance("mystring", AttributeDef.class)));
        assertEquals(1, def.getRegisterEventDefs().size());
        assertNotNull(def.getRegisterEventDefs().get("click"));
    }
View Full Code Here

        assertEquals(1, def.getRegisterEventDefs().size());
        assertNotNull(def.getRegisterEventDefs().get("click"));
    }

    public void testInterfaceDefHandlerWithExtension() throws Exception {
        XMLParser parser = XMLParser.getInstance();
        DefDescriptor<InterfaceDef> descriptor = DefDescriptorImpl.getInstance("test:fakeparser", InterfaceDef.class);
        StringSource<InterfaceDef> source = new StringSource<>(descriptor,
                "<aura:interface extends='aura:testinterfaceparent'></aura:interface>", "myID", Format.XML);
        InterfaceDef def = parser.parse(descriptor, source);
        assertEquals(1, def.getExtendsDescriptors().size());
        assertEquals("testinterfaceparent", def.getExtendsDescriptors().iterator().next().getName());
    }
View Full Code Here

        assertEquals(1, def.getExtendsDescriptors().size());
        assertEquals("testinterfaceparent", def.getExtendsDescriptors().iterator().next().getName());
    }

    public void testInterfaceDefHandlerWithInvalidChildTag() throws Exception {
        XMLParser parser = XMLParser.getInstance();
        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

        }
    }

    public void testInterfaceDefHandlerWithTextBetweenTag() throws Exception {
        XMLParser parser = XMLParser.getInstance();
        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

TOP

Related Classes of org.auraframework.impl.root.parser.XMLParser

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.