Package org.auraframework.def.DefDescriptor

Examples of org.auraframework.def.DefDescriptor.DefType


        return this.currentBrowser;
    }

    private static Definition parseMock(DefDescriptor<? extends BaseComponentDef> compDesc,
            Map<String, Object> map) throws QuickFixException {
        DefType mockType = DefType.valueOf((String) map.get("type"));
        switch (mockType) {
        case MODEL:
            return new JavascriptMockModelHandler(compDesc, map).getDefinition();
        case ACTION:
            return new JavascriptMockActionHandler(compDesc, map).getDefinition();
View Full Code Here


    public <T extends Instance<D>, D extends Definition> T getInstance(DefDescriptor<D> descriptor,
            Map<String, Object> attributes) throws QuickFixException {

        Aura.getContextService().assertEstablished();

        DefType defType = descriptor.getDefType();

        switch (defType) {
        case APPLICATION:
            return (T) new ApplicationImpl((DefDescriptor<ApplicationDef>) descriptor, attributes);
        case COMPONENT:
View Full Code Here

    @Override
    public <T extends Instance<D>, D extends Definition> T getInstance(D definition, Map<String, Object> attributes)
            throws QuickFixException {
        Aura.getContextService().assertEstablished();

        DefType defType = definition.getDescriptor().getDefType();
        switch (defType) {
        case APPLICATION:
            return (T) new ApplicationImpl((ApplicationDef) definition, attributes);
        default:
            return (T) getInstance(definition.getDescriptor(), attributes);
View Full Code Here

    public <T extends Definition> DefDescriptor<T> getNewObject(String ns, Class<T> clazz, String contents)
            throws IOException {
        String name = getNewName(ns);
        String qualified = null;
        // FIXME: W-2368202
        DefType defType = DefType.getDefType(clazz);
        switch (defType) {
        case CONTROLLER:
        case TESTSUITE:
        case MODEL:
        case RENDERER:
View Full Code Here

    public void testExtendsSelf() {
        DefDescriptor<T> extendsSelf = addSourceAutoCleanup(getDefClass(), "");
        Source<T> source = getSource(extendsSelf);
        source.addOrUpdate(String.format(baseTag,
                "extensible='true' extends='" + extendsSelf.getDescriptorName() + "'", ""));
        DefType defType = DefType.getDefType(this.getDefClass());
        try {
            extendsSelf.getDef();
            fail(defType + " should not be able to extend itself.");
        } catch (QuickFixException e) {
            checkExceptionFull(e, InvalidDefinitionException.class, extendsSelf.getQualifiedName()
View Full Code Here

        DefDescriptor<T> nonExtensible = addSourceAutoCleanup(getDefClass(),
                String.format(baseTag, "", ""));
        DefDescriptor<T> extendsCmp = addSourceAutoCleanup(getDefClass(),
                String.format(baseTag, "extends='" + nonExtensible.getDescriptorName() + "'", ""));

        DefType defType = DefType.getDefType(this.getDefClass());
        try {
            extendsCmp.getDef();
            fail(defType + " should not be able to extend a non-extensible component");
        } catch (QuickFixException e) {
            checkExceptionFull(e, InvalidDefinitionException.class, extendsCmp.getQualifiedName()
View Full Code Here

     */
    public void testExtendsNonExistent() {
        DefDescriptor<T> cmp = addSourceAutoCleanup(getDefClass(),
                String.format(baseTag, "extends='aura:iDontExist'", ""));

        DefType defType = DefType.getDefType(this.getDefClass());
        try {
            cmp.getDef();
            fail(defType + " should throw Exception when extending non-existent component");
        } catch (QuickFixException e) {
            checkExceptionFull(e, DefinitionNotFoundException.class,
View Full Code Here

     */
    public void testExtendsEmpty() {
        DefDescriptor<T> cmp = addSourceAutoCleanup(getDefClass(),
                String.format(baseTag, "extends=''", ""));

        DefType defType = DefType.getDefType(this.getDefClass());
        try {
            cmp.getDef();
            fail(defType + " should throw Exception when extends is empty");
        } catch (QuickFixException e) {
            checkExceptionFull(e, InvalidDefinitionException.class, "QualifiedName is required for descriptors");
View Full Code Here

    public void testAttributeAndeEventNameConflict() {
        DefDescriptor<T> dd = addSourceAutoCleanup(getDefClass(),
                String.format(baseTag, "", "<aura:registerEvent name='dupeAttrEvent' type='test:parentEvent'/>"
                        + "<aura:attribute name='dupeAttrEvent' type='String'/>"));

        DefType defType = DefType.getDefType(this.getDefClass());
        try {
            dd.getDef();
            fail(defType + " should not be able to have attribute and event with same name");
        } catch (QuickFixException e) {
            checkExceptionFull(e, InvalidDefinitionException.class,
View Full Code Here

        AuraContext context = Aura.getContextService().getCurrentContext();
        BaseComponent<?, ?> component = context.getCurrentComponent();

        String desc = (String) component.getAttributes().getValue("descriptor");
        DefType defType = DefType.valueOf(((String) component.getAttributes().getValue("defType")).toUpperCase());
       
        DefDescriptor<? extends Definition> descriptor = null;
        if (defType != DefType.INCLUDE) {
            // Nominal case:
            descriptor = Aura.getDefinitionService().getDefDescriptor(desc, defType.getPrimaryInterface());
        } else {
            // Include case: since included .js files load source differently we have to manually
            // look up the include defs. If there is a usecase for looking up the defs in a non-doc
            // setting, a lookup method should be added to the includeDef class.
            String name = (String) component.getAttributes().getValue("includeDefName");
View Full Code Here

TOP

Related Classes of org.auraframework.def.DefDescriptor.DefType

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.