Package org.auraframework.throwable.quickfix

Examples of org.auraframework.throwable.quickfix.InvalidDefinitionException


    @Override
    public void validateDefinition() throws QuickFixException {

        if (descriptor == null && name == null || descriptor != null && name != null) {
            throw new InvalidDefinitionException(
                    "aura:handler must specify one and only one of name=\"…\" or event=\"…\"", getLocation());
        }

        if (action == null) {
            throw new InvalidDefinitionException("aura:handler missing attribute: action=\"…\"", getLocation());
        }
    }
View Full Code Here


                type = defService.getDefDescriptor("aura://Boolean", TypeDef.class);
            } else if (val instanceof Number) {
                // Number
                type = defService.getDefDescriptor("aura://Decimal", TypeDef.class);
            } else {
                throw new InvalidDefinitionException("Invalid value type in model definition.", getLocation());
            }

            JavascriptValueDef value = new JavascriptValueDef(key, type, val, location);
            memberMap.put(key, value);
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    protected <T> T getValue(Object object, Class<T> retClass) throws QuickFixException {
        if (object != null && Model.class.equals(retClass)) {
            if (!(object instanceof Map)) {
                throw new InvalidDefinitionException(
                        "Mock Model expects a map of property names to Answers.", getLocation());
            }
            Map<String, Object> properties = Maps.newHashMap();
            Map<?, ?> propMap = (Map<?, ?>) object;
            for (Object key : propMap.keySet()) {
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    protected <T> T getValue(Object object, Class<T> retClass) throws QuickFixException {
        if (object != null && ComponentConfig.class.equals(retClass)) {
            if (!(object instanceof Map)) {
                throw new InvalidDefinitionException("Mock Provider expects (descriptor and/or attributes) or (configProvider)", getLocation());
            }
            ComponentConfig config;
           
            String configProvider = (String)((Map<?, ?>) object).get("configProvider");
            //If a config provider is specified, defer provide until later
View Full Code Here

                            mockProvider = configProvider.substring("java://".length());
                        }
                        try{
                            Class<?> providerClass = Class.forName(mockProvider);
                            if(!ComponentConfigProvider.class.isAssignableFrom(providerClass)){
                                throw new InvalidDefinitionException("Class specified as configProvider should implement ComponentConfigProvider", getLocation());
                            }
                            ComponentConfigProvider provider = (ComponentConfigProvider)providerClass.newInstance();
                            config = provider.provide();
                        }catch(ClassNotFoundException e){
                            throw new InvalidDefinitionException("Could not locate class specified as configProvider:"+configProvider, getLocation());
                        }catch(IllegalAccessException e){
                            throw new InvalidDefinitionException("Constructor is inaccessible for "+ configProvider, getLocation());
                        }catch (InstantiationException ie) {
                            throw new InvalidDefinitionException("Cannot instantiate " + configProvider, getLocation());
                        }
                      return (T)config;
                    }
                };
            }else{
                return super.getAnswer(object, retClass);
            }
        }
        throw new InvalidDefinitionException("Mock answer must specify either 'value' or 'error'", getLocation());
    }
View Full Code Here

     */
    @Override
    public void validateDefinition() throws QuickFixException {
        super.validateDefinition();
        if (renderer == null) {
            throw new InvalidDefinitionException("Renderer must implement the Renderer interface.", location);
        }
    }
View Full Code Here

            List<Class<? extends Renderer>> interfaces = AuraUtil.findInterfaces(rendererClass, Renderer.class);
            if (!interfaces.isEmpty()) {
                try {
                    rendererInstance = (Renderer) rendererClass.newInstance();
                } catch (InstantiationException ie) {
                    setParseError(new InvalidDefinitionException("Cannot instantiate " + getLocation(), getLocation()));
                } catch (IllegalAccessException iae) {
                    setParseError(new InvalidDefinitionException("Constructor is inaccessible for " + getLocation(),
                            getLocation()));
                } catch (RuntimeException e) {
                    setParseError(new InvalidDefinitionException("Cannot instantiate " + getLocation(), getLocation(),
                            e));
                }
            } else {
                rendererInstance = null;
            }
View Full Code Here

        for (DefDescriptor<ControllerDef> desc : getTargetDescriptor().getDef().getControllerDefDescriptors()) {
            if ("java".equals(desc.getPrefix())) {
                return desc.getDef();
            }
        }
        throw new InvalidDefinitionException("Unable to locate the server controller", getLocation());
    }
View Full Code Here

        throw new InvalidDefinitionException("Unable to locate the server controller", getLocation());
    }

    @Override
    protected Invocation getDefaultInvocation() throws QuickFixException {
        throw new InvalidDefinitionException("A mock action must specify the name of the action", getLocation());
    }
View Full Code Here

    protected Invocation getInvocation(Object object) throws QuickFixException {
        if (object instanceof Map) {
            Map<?, ?> methodMap = (Map<?, ?>) object;
            String name = (String) methodMap.get("name");
            if (name == null) {
                throw new InvalidDefinitionException("A mock action must specify the name of the action", getLocation());
            }
            String typeStr = (String) methodMap.get("type");
            Class<?> type = Object.class;
            if (typeStr != null) {
                try {
View Full Code Here

TOP

Related Classes of org.auraframework.throwable.quickfix.InvalidDefinitionException

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.