Package org.auraframework.system

Examples of org.auraframework.system.Location


                def.hashCode() == def2.hashCode());
    }

    public void testHashCodeWithDifferentLocations() {
        DefDescriptor<EventDef> desc = DefDescriptorImpl.getInstance("fake:event", EventDef.class);
        EventDefImpl def = vendor.makeEventDef(desc, EventType.COMPONENT, null, new Location("filename1", 5, 5, 0),
                null);
        EventDefImpl def2 = vendor.makeEventDef(desc, EventType.COMPONENT, null, new Location("filename1", 6, 6, 0),
                null);
        assertFalse("Hash code should have been different due to different locations",
                def.hashCode() == def2.hashCode());
    }
View Full Code Here


        return inVar;
    }

    @AuraEnabled
    public static void throwExceptionNoLineNums() {
        Location loc = new Location("test-filename", 123456789);
        AuraRuntimeException e = new AuraRuntimeException("throwExceptionNoLineNums", loc);
        throw e;
    }
View Full Code Here

        throw e;
    }

    @AuraEnabled
    public static void throwExceptionWithLineNums() {
        Location loc = new Location("test-filename", 4444, 55555, 123456789);
        AuraRuntimeException e = new AuraRuntimeException("throwExceptionNoLineNums", loc);
        throw e;
    }
View Full Code Here

        ModelDef def = javaModelDefDesc.getDef();
        assertNotNull(def);
        Model model = def.newInstance();
        ValueDef vd = def.getMemberByName("nextThing");

        PropertyReferenceImpl refNextThing = new PropertyReferenceImpl("nextThing", new Location("test", 0));
        assertNotNull("Unable to find value def for 'nextThing'", vd);
        assertEquals("nextThing", model.getValue(refNextThing));

        vd = def.getMemberByName("firstThing");
        PropertyReferenceImpl refFirstThing = new PropertyReferenceImpl("firstThing", new Location("test", 1));
        assertNotNull("Unable to find value def for 'firstThing'", vd);
        assertEquals("firstThingDefault", model.getValue(refFirstThing));
    }
View Full Code Here

                "java://org.auraframework.impl.java.model.TestModel", ModelDef.class);
        ModelDef mDef = javaModelDefDesc.getDef();
        assertNotNull(mDef);
        Model model = mDef.newInstance();
        try {
            model.getValue(new PropertyReferenceImpl("fooBar", new Location("test", 0)));
            fail("Model should not be able to getValue of a non existing property.");
        } catch (Exception e) {
            checkExceptionStart(e, AuraExecutionException.class, "TestModel: no such property: fooBar",
                    javaModelDefDesc.getName());
        }
        try {
            model.getValue(new PropertyReferenceImpl("firstThi", new Location("test", 0)));
            fail("Model.getValue() on partial matches of property names should not be successful.");
        } catch (Exception e) {
            checkExceptionStart(e, AuraExecutionException.class, "TestModel: no such property: firstThi",
                    javaModelDefDesc.getName());
        }
View Full Code Here

        super(name);
    }

    public void testComponentAttributeMap() throws Exception {
        Component cmp = vendor.makeComponent("test:child1", "meh");
        AttributeDefRef adr = vendor.makeAttributeDefRef("attr", "some value", new Location("meh", 0));
        cmp.getAttributes().set(Collections.singleton(adr));

        assertEquals(1, cmp.getAttributes().size());

        assertEquals("some value", cmp.getAttributes().getExpression("attr"));

        try {
            AttributeDefRef adr2 = vendor.makeAttributeDefRef("badAttr", "blubber", new Location("meh", 0));
            cmp.getAttributes().set(Collections.singleton(adr2));
            fail("Should have thrown AuraException(Attribute not Defined)");
        } catch (AttributeNotFoundException expected) {
        }
    }
View Full Code Here

    cmp.reinitializeModel();
        assertEquals("some other value", cmp.getModel().getValue(propRef));
    }

  private void setAttribute(Component cmp, String name, String value) throws QuickFixException {
    AttributeDefRef adr = vendor.makeAttributeDefRef(name, value, new Location("meh", 0));
        AttributeSet attributes = cmp.getAttributes();
    attributes.set(Collections.singleton(adr));
  }
View Full Code Here

        Object actual = buildDefinition().getDescriptor();
        assertEquals(this.descriptor, actual);
    }

    public void testGetLocation() throws Exception {
        Location actual = buildDefinition().getLocation();
        assertEquals(this.location, actual);
    }
View Full Code Here

        ComponentDef cd = parser.parse(descriptor, source);
        try {
            cd.validateDefinition();
            fail("Parsing invalid source should throw exception");
        } catch (InvalidDefinitionException e) {
            Location location = e.getLocation();
            assertTrue("Wrong filename.", location.getFileName().endsWith("parserInvalid.cmp"));
            assertEquals(19, location.getLine());
            assertEquals(5, location.getColumn());
        }
    }
View Full Code Here

        ComponentDef cd = parser.parse(descriptor, source);
        try {
            cd.validateDefinition();
            fail("Parsing invalid source should throw exception");
        } catch (AuraException e) {
            Location location = e.getLocation();
            assertTrue("Wrong filename.", location.getFileName().endsWith("parserFragment.cmp"));
            checkExceptionContains(e, InvalidDefinitionException.class,
                    "Expected start tag <aura:component> but found aura:parent");
            assertEquals(18, location.getLine());
        }
    }
View Full Code Here

TOP

Related Classes of org.auraframework.system.Location

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.