Package org.auraframework.def

Examples of org.auraframework.def.ActionDef


            this.state = state;
        }
    };

    public void testId() {
        ActionDef def = Mockito.mock(ActionDef.class);
        Action test = new MyAction(null, def, null);

        assertEquals("id should be initialized to null", null, test.getId());
        test.setId("a");
        assertEquals("setId should work the first time.", "a", test.getId());
View Full Code Here


        test.setId(null);
        assertEquals("setId should work a third time.", null, test.getId());
    }

    private Action getActionWithId(String id) {
        ActionDef def = Mockito.mock(ActionDef.class);
        Action test = new MyAction(null, def, null);
        test.setId(id);
        return test;
    }
View Full Code Here

        test.setId(id);
        return test;
    }

    public void testActions() {
        ActionDef def = Mockito.mock(ActionDef.class);
        Action test = new MyAction(null, def, null);

        List<Action> actions = test.getActions();
        assertNotNull("Actions should never be null", actions);
        assertEquals("Actions should empty", 0, actions.size());
View Full Code Here

        assertEquals("Action 'c' should be first", "c", actions.get(2).getId());
        assertEquals("Action 'd' should be first", "d", actions.get(3).getId());
    }

    public void testState() {
        ActionDef def = Mockito.mock(ActionDef.class);
        MyAction test = new MyAction(null, def, null);

        assertEquals("state should be initialized to new", Action.State.NEW, test.getState());
        test.setState(Action.State.RUNNING);
        assertEquals("state should be able to change", Action.State.RUNNING, test.getState());
View Full Code Here

        test.setState(Action.State.RUNNING);
        assertEquals("state should be able to change", Action.State.RUNNING, test.getState());
    }

    public void testStorable() {
        ActionDef def = Mockito.mock(ActionDef.class);
        Action test = new MyAction(null, def, null);

        assertEquals("isStorable should be initialized to false", false, test.isStorable());
        test.setStorable();
        assertEquals("isStorable should change on setStorable", true, test.isStorable());
View Full Code Here

        assertEquals("isStorable should not change on second setStorable", true, test.isStorable());
        assertEquals("id should change on second setStorable", "s", test.getId());
    }

    public void testDescriptor() {
        ActionDef def = Mockito.mock(ActionDef.class);
        Action test = new MyAction(null, def, null);
        @SuppressWarnings("unchecked")
        DefDescriptor<ActionDef> expectedDesc = Mockito.mock(DefDescriptor.class);
        Mockito.when(def.getDescriptor()).thenReturn(expectedDesc);

        assertSame("descriptor should work", expectedDesc, test.getDescriptor());
    }
View Full Code Here

        assertSame("descriptor should work", expectedDesc, test.getDescriptor());
    }

    public void testParams() {
        Map<String, Object> params = Maps.newHashMap();
        ActionDef def = Mockito.mock(ActionDef.class);
        Action test = new MyAction(null, def, params);
        LoggingContext.KeyValueLogger logger = Mockito.mock(LoggingContext.KeyValueLogger.class);

        assertSame("params should be initialized", params, test.getParams());

        params.put("a", "b");
        test.logParams(logger);
        // logable values of null should avoid calls to the logger.
        Mockito.verifyNoMoreInteractions(logger);

        Mockito.when(def.getLoggableParams()).thenReturn(Lists.newArrayList("a", "b"));
        test.logParams(logger);
        Mockito.verify(logger, Mockito.times(1)).log("a", "b");
        Mockito.verify(logger, Mockito.times(1)).log("b", "null");
        Mockito.verifyNoMoreInteractions(logger);
View Full Code Here

        // params of null should avoid calls to the logger.
        Mockito.verifyNoMoreInteractions(logger);
    }

    public void testInstanceStack() {
        ActionDef def = Mockito.mock(ActionDef.class);
        Action test = new MyAction(null, def, null);
        InstanceStack iStack = test.getInstanceStack();
        assertEquals("Instance stack should be initialized without action ID as path", "/*[0]", iStack.getPath());
        assertEquals("Subsequent calls to getInstanceStack should return same InstanceStack", iStack,
                test.getInstanceStack());
View Full Code Here

    /**
     * Verify we can set an Id after we get an InstaceStack. Used to threw Exception, now valid.
     */
    public void testSetIdWithInstanceStackSet() {
        ActionDef def = Mockito.mock(ActionDef.class);
        Action test = new MyAction(null, def, null);
        test.getInstanceStack();
        test.setId("newId");
    }
View Full Code Here

        Map<String, ActionDef> flattened = Maps.newHashMap();

        for (DefDescriptor<ControllerDef> delegate : componentDef.getControllerDefDescriptors()) {
            ControllerDef c = delegate.getDef();
            for (Map.Entry<String, ? extends ActionDef> e : c.getActionDefs().entrySet()) {
                ActionDef a = flattened.get(e.getKey());
                if (a != null) {
                    // TODO: server and client actions by same name, map needs
                    // key on action type
                } else {
                    flattened.put(e.getKey(), e.getValue());
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.