Package org.auraframework.def

Examples of org.auraframework.def.ControllerDef


       
      //jvd doesn't matter that much for triggering QFE, as we only used it as the Object param
        JavaValueDef jvd = new JavaValueDef("tvdQFE", JavaValueDefDesc, null);
        Map<String, Object> args = new HashMap<>();
        args.put("keya", jvd);
      ControllerDef controller = getJavaController("java://org.auraframework.impl.java.controller.TestControllerOnlyForJavaControllerTest");
      
      //we actually catch the QFE in JavaAction.getArgs(), then wrap it up with AuraUnhandledException
      String errorMsg = "org.auraframework.impl.java.controller.JavaControllerTest$TestQuickFixException: new quick fix exception";
      checkFailAction(controller, "customErrorParam", args, State.ERROR, AuraUnhandledException.class,
          errorMsg);
View Full Code Here


            fail("Expected DefinitionNotFoundException");
        } catch (DefinitionNotFoundException e) {
            assertEquals(String.format("No CONTROLLER named java://goats found : [%s]", dd.getQualifiedName()),
                    e.getMessage());
        }
        ControllerDef controller = getJavaController("java://org.auraframework.impl.java.controller.TestController");
        Map<String, Object> empty = new HashMap<>();
        try {
            controller.createAction("imNotHere", empty);
            fail("Should not be able to create JavaAction when method does not exist in Controller class");
        } catch (DefinitionNotFoundException e) {
            assertEquals(
                    "No ACTION named java://org.auraframework.impl.java.controller.TestController/ACTION$imNotHere found",
                    e.getMessage());
View Full Code Here

                InvalidDefinitionException.class, "Duplicate action appendStrings",
                "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

        assertEquals("java://org.auraframework.impl.java.controller.TestController/ACTION$getString", subDef
                .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

    /**
     * Tests to verify the APIs on Action to mark actions as storable.
     */
    public void testStorable() throws Exception {
        ControllerDef controller = getJavaController("java://org.auraframework.impl.java.controller.TestController");
        Action freshAction = controller.createAction("getString", null);

        assertTrue("Expected an instance of JavaAction", freshAction instanceof JavaAction);
        JavaAction action = (JavaAction) freshAction;
        assertFalse("Actions should not be storable by default.", action.isStorable());
        action.run();
        assertFalse("isStorabel should not change values after action execution.", action.isStorable());

        Action storableAction = controller.createAction("getString", null);
        action = (JavaAction) storableAction;
        action.setStorable();
        assertTrue("Failed to mark a action as storable.", action.isStorable());
        action.run();
        assertTrue("Storable action was unmarked during execution", action.isStorable());
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

        assertTrue("ActionDefs should be backgroundable with BackgroundAction annotation",
                ((JavaActionDef) actionDef).isBackground());
    }

    public void testSerialize() throws Exception {
        ControllerDef controller = getJavaController("java://org.auraframework.impl.java.controller.ParallelActionTestController");
        serializeAndGoldFile(controller);
    }
View Full Code Here

    /**
     * Tests to verify the logging of params
     */
    public void testParamLogging() throws Exception {
        ControllerDef controller = getJavaController("java://org.auraframework.impl.java.controller.JavaTestController");
        JavaAction nonLoggableStringAction = (JavaAction) controller.createAction("getString", null);
        JavaAction nonLoggableIntAction = (JavaAction) controller.createAction("getInt", null);
        JavaAction loggableStringAction = (JavaAction) controller.createAction("getLoggableString",
                Collections.singletonMap("param", (Object) "bar"));
        JavaAction loggableIntAction = (JavaAction) controller.createAction("getLoggableString",
                Collections.singletonMap("param", (Object) 1));
        JavaAction loggableNullAction = (JavaAction) controller.createAction("getLoggableString",
                Collections.singletonMap("param", null));
        TestLogger testLogger = new TestLogger();

        nonLoggableStringAction.logParams(testLogger);
        assertNull("Key should not have been logged", testLogger.key);
View Full Code Here

        assertEquals("Value was not logged", "null", testLogger.value);
    }

    @ThreadHostileTest("TestLoggingAdapter not thread-safe")
    public void testParamLogging_NoParams() throws Exception {
        ControllerDef controller = getJavaController("java://org.auraframework.impl.java.controller.TestController");
        Map<String, Object> params = Maps.newHashMap();
        Action nonLoggableStringAction = controller.createAction("getString", params);
        List<Map<String, Object>> logs = runActionsAndReturnLogs(Lists.newArrayList(nonLoggableStringAction));
        assertEquals(1, logs.size());
        assertTrue(
                "Failed to log a server action",
                logs.get(0).containsKey(
View Full Code Here

TOP

Related Classes of org.auraframework.def.ControllerDef

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.