Package org.auraframework.impl.javascript.controller

Examples of org.auraframework.impl.javascript.controller.JavascriptControllerDef


        // we can get all definitions the button depends on
        List<DefDescriptor<ControllerDef>> controllerDescs = componentDef.getControllerDefDescriptors();
        assertEquals(1, controllerDescs.size());
        DefDescriptor<ControllerDef> controllerDesc = controllerDescs.get(0);
        assertEquals("js://ui.button", controllerDesc.toString());
        JavascriptControllerDef controllerDef = (JavascriptControllerDef) controllerDesc.getDef();
        String controllerDefFileName = controllerDef.getLocation().getFileName();
        assertTrue(controllerDefFileName, controllerDefFileName.endsWith("/ui/button/buttonController.js"));
        // we can use getBundle to get all descriptors in the bundle
        List<DefDescriptor<?>> bundleDescs = componentDef.getBundle();
        assertEquals(3, bundleDescs.size());
        assertTrue(bundleDescs.contains(controllerDesc));
View Full Code Here


                .getInstance("js://test.testDuplicateJSController",
                        ControllerDef.class);
        Source<?> source = getJavascriptSourceLoader().getSource(descriptor);
        Definition controller = parser.parse(descriptor, source);
        assertTrue(controller instanceof JavascriptControllerDef);
        JavascriptControllerDef obj = (JavascriptControllerDef) controller;
        Map<String, JavascriptActionDef> controllerActions = obj
                .getActionDefs();
        assertTrue(controllerActions.containsKey("functionName"));
        // If we have more than one controller function with same name, the
        // later one will replace the previous one
        assertTrue(controllerActions.size() == 1);
View Full Code Here

        // STEP 2:
        // 2.1:Verify the CONTROLLERDEF object
        assertTrue(controller instanceof JavascriptControllerDef);
        // Convert from a generic controller to a Javascript type controller
        JavascriptControllerDef obj = (JavascriptControllerDef) controller;
        // Step 4: Verify properties of JavascriptRenderDef Object
        // OBject that is to be verified: Qualified name,
        assertEquals("unexpected qualifiedName of controller",
                "js://test.testJSController", obj.getDescriptor()
                        .getQualifiedName());

        serializeAndGoldFile(controller, "_JSControllerDef");

        // 2.2: Should be able to create an instance of the client action on
        // the server side, but it's a pseudo action
        try {
            obj.createAction("newAction", new HashMap<String, Object>());
            fail("Should not be able to create an instance of the client action on the server side");
        } catch (Exception e) {// Expect a definition not found Exception
            checkExceptionFull(e, DefinitionNotFoundException.class,
                    "No ACTION named js://test.testJSController/ACTION$newAction found");
        }
        JavascriptPseudoAction action = (JavascriptPseudoAction) obj.createAction("functionName1", null);
        assertEquals(State.ERROR, action.getState());

        // 2.3 Extract the action defs and verify each of them in Step 3
        // Get all the actions defined in the Javascript
        Map<String, JavascriptActionDef> controllerActions = obj
                .getActionDefs();

        // STEP 3:
        // 3.1: Verify the number of ACTIONDEF objects is 2
        assertTrue(controllerActions.size() == 2);
View Full Code Here

        Definition controller = parser.parse(descriptor, source);
        // STEP 2:
        // 2.1:Verify the CONTROLLERDEF object
        assertTrue(controller instanceof JavascriptControllerDef);
        // Convert from a generic controller to a Javascript type controller
        JavascriptControllerDef obj = (JavascriptControllerDef) controller;
        // Get all the actions defined in the Javascript
        Map<String, JavascriptActionDef> controllerActions = obj
                .getActionDefs();

        // STEP 3:
        // 3.1: Verify the number of ACTIONDEF objects
        assertTrue(controllerActions.size() == 1);
View Full Code Here

TOP

Related Classes of org.auraframework.impl.javascript.controller.JavascriptControllerDef

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.