Package org.auraframework.def

Examples of org.auraframework.def.ActionDef


            PropertyReference ref = (PropertyReference) expression;
            ref = ref.getStem();

            ControllerDef controllerDef = getControllerDef();
            ActionDef actionDef = controllerDef.getSubDefinition(ref.toString());
            Action action = Aura.getInstanceService().getInstance(actionDef);

            AuraContext context = Aura.getContextService().getCurrentContext();
            Action previous = context.setCurrentAction(action);
            try {
View Full Code Here


   
    public void testCreatingJavaActionDef(){
        DefDescriptor<ControllerDef> controllerDesc = DefDescriptorImpl.getInstance("java://org.auraframework.impl.java.controller.TestController", ControllerDef.class);
        DefDescriptor<ActionDef> actionDefDesc = SubDefDescriptorImpl.getInstance("getString", controllerDesc, ActionDef.class);
        try{
            ActionDef actionDef = actionDefDesc.getDef();
            assertNotNull(actionDef);
            assertTrue(actionDef instanceof JavaActionDef);
            assertTrue(actionDef.getParameters().isEmpty());
            assertEquals(DefDescriptorImpl.getInstance("java://java.lang.String", TypeDef.class), actionDef.getReturnType());
            assertEquals(ActionType.SERVER,actionDef.getActionType());
        }catch(Exception e){
            fail("Failed to create a valid java actiondef without parameters");
        }
        controllerDesc = DefDescriptorImpl.getInstance("java://org.auraframework.impl.java.controller.TestControllerWithParameters", ControllerDef.class);
        actionDefDesc = SubDefDescriptorImpl.getInstance("sumValues", controllerDesc, ActionDef.class);
        try{
            ActionDef actionDef = actionDefDesc.getDef();
            assertNotNull(actionDef);
            assertEquals(2, actionDef.getParameters().size());
            assertEquals("a", actionDef.getParameters().get(0).getName());
            assertEquals("java://java.lang.Integer", actionDef.getParameters().get(0).getType().toString());
            assertEquals("b", actionDef.getParameters().get(1).getName());
            assertEquals("java://java.lang.Integer", actionDef.getParameters().get(0).getType().toString());
            assertEquals(DefDescriptorImpl.getInstance("java://java.lang.Integer", TypeDef.class), actionDef.getReturnType());
        }catch(Exception e){
            fail("Failed to create a valid java actiondef with parameters");
        }
    }
View Full Code Here

   
    private JavaActionDef getJavaActionDef(String controller, String actionName) throws QuickFixException {
        DefDescriptor<ControllerDef> controllerDesc = DefDescriptorImpl.getInstance(controller,
                ControllerDef.class);
        DefDescriptor<ActionDef> actionDefDesc = SubDefDescriptorImpl.getInstance(actionName, controllerDesc, ActionDef.class);
        ActionDef actionDef = actionDefDesc.getDef();
        assertTrue(actionDef instanceof JavaActionDef);
        return (JavaActionDef)actionDef;
    }
View Full Code Here

                "org.auraframework.impl.java.controller.TestControllerWithDuplicateAction");
    }

    public void testGetSubDefinition() throws Exception {
        ControllerDef controller = getJavaController("java://org.auraframework.impl.java.controller.TestController");
        ActionDef subDef = controller.getSubDefinition("getString");
        assertEquals("SubDefinition is the wrong type", ActionDef.ActionType.SERVER, subDef.getActionType());
        assertEquals("java://org.auraframework.impl.java.controller.TestController/ACTION$getString", subDef
                .getDescriptor().getQualifiedName());
    }
View Full Code Here

                .getDescriptor().getQualifiedName());
    }

    public void testGetNullSubDefinition() throws Exception {
        ControllerDef controller = getJavaController("java://org.auraframework.impl.java.controller.TestController");
        ActionDef subDefNonExistent = controller.getSubDefinition("iDontExist");
        assertNull("Trying to retrieve non-existent subdefiniton should return null", subDefNonExistent);
    }
View Full Code Here

    /**
     * Action without annotation is not backgroundable
     */
    public void testJavaActionDefIsBackgroundWithoutAnnotation() throws Exception {
        ControllerDef controller = getJavaController("java://org.auraframework.impl.java.controller.ParallelActionTestController");
        ActionDef actionDef = controller.getActionDefs().get("executeInForeground");
        assertFalse("ActionDefs should not be backgroundable without BackgroundAction annotation",
                ((JavaActionDef) actionDef).isBackground());
    }
View Full Code Here

    /**
     * Action without annotation is not backgroundable
     */
    public void testJavaActionDefIsBackgroundWithAnnotation() throws Exception {
        ControllerDef controller = getJavaController("java://org.auraframework.impl.java.controller.ParallelActionTestController");
        ActionDef actionDef = controller.getActionDefs().get("executeInBackground");
        assertTrue("ActionDefs should be backgroundable with BackgroundAction annotation",
                ((JavaActionDef) actionDef).isBackground());
    }
View Full Code Here

TOP

Related Classes of org.auraframework.def.ActionDef

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.