Package org.auraframework.instance

Examples of org.auraframework.instance.Event


    public TestModelToAttachEvents() throws Exception {
        Map<String, Object> attributes = new HashMap<>();
        attributes.put("strParam", "Go 49ers!");
        // Adding an event whose definition is in the client because of the
        // handler.
        Event evt = Aura.getInstanceService().getInstance("test:applicationEvent", EventDef.class, attributes);
        Aura.getContextService().getCurrentContext().addClientApplicationEvent(evt);
        // Adding an event that was not preloaded and without a handler. So the
        // definition is not in the client.
        evt = Aura.getInstanceService().getInstance("handleEventTest:unHandledEvent", EventDef.class, null);
        Aura.getContextService().getCurrentContext().addClientApplicationEvent(evt);
View Full Code Here


    @AuraEnabled
    public static String getDataAndOneEvent() throws Exception {
        Map<String, Object> attributes = new HashMap<>();
        attributes.put("strAttr", "Go Giants!");
        Event evt = Aura.getInstanceService().getInstance("handleEventTest:applicationEvent", EventDef.class,
                attributes);
        Aura.getContextService().getCurrentContext().addClientApplicationEvent(evt);
        return "Attached handleEventsTest:applicationEvent to response";
    }
View Full Code Here

    @AuraEnabled
    public static Component getDataAndThreeEvents() throws Exception {
        // Another event whose definition was preloaded
        Map<String, Object> attributes = new HashMap<>();
        attributes.put("strAttr", "Go Raiders!");
        Event evt = Aura.getInstanceService().getInstance("preloadTest:applicationEvent", EventDef.class, attributes);
        Aura.getContextService().getCurrentContext().addClientApplicationEvent(evt);
        // Attach one event whose's definition was loaded because of the handler
        // specification
        // Another event whose definition is not known to the client
        return Aura.getInstanceService().getInstance("handleEventTest:attachEventsInModel", ComponentDef.class);
View Full Code Here

        return Aura.getInstanceService().getInstance("handleEventTest:attachEventsInModel", ComponentDef.class);
    }

    @AuraEnabled
    public static String getCyclicEvent() throws Exception {
        Event evt = Aura.getInstanceService().getInstance("handleEventTest:cyclicEvent", EventDef.class, null);
        Aura.getContextService().getCurrentContext().addClientApplicationEvent(evt);
        return "Doesn't really matter";
    }
View Full Code Here

    @AuraEnabled
    public static String getDupEvents() throws Exception {
        Map<String, Object> attributes = new HashMap<>();
        attributes.put("strAttr", "Posey");
        Event evt = Aura.getInstanceService().getInstance("handleEventTest:dupEvent", EventDef.class, attributes);
        Aura.getContextService().getCurrentContext().addClientApplicationEvent(evt);

        attributes.put("strAttr", "Sandavol");
        evt = Aura.getInstanceService().getInstance("handleEventTest:dupEvent", EventDef.class, attributes);
        Aura.getContextService().getCurrentContext().addClientApplicationEvent(evt);
View Full Code Here

    @AuraEnabled
    public static String getEventChain() throws Exception {
        Map<String, Object> attributes = new HashMap<>();
        attributes.put("pandaAttr", "Pablo");
        Event evt = Aura.getInstanceService().getInstance("handleEventTest:chainEvent", EventDef.class, attributes);
        Aura.getContextService().getCurrentContext().addClientApplicationEvent(evt);
        return "Attached handleEventsTest:chainEvent to response";
    }
View Full Code Here

        assertEquals("Should not be accepting null objects as events.", 0, lc.getClientEvents().size());
        Aura.getContextService().endContext();

        // Adding multiple contexts
        lc = Aura.getContextService().startContext(Mode.UTEST, Format.JSON, Authentication.AUTHENTICATED);
        Event evt1 = Aura.getInstanceService().getInstance("markup://aura:applicationEvent", EventDef.class, null);
        lc.addClientApplicationEvent(evt1);
        Event evt2 = Aura.getInstanceService().getInstance("markup://aura:connectionLost", EventDef.class, null);
        lc.addClientApplicationEvent(evt2);
        List<Event> evnts = lc.getClientEvents();
        assertEquals("Found unexpected number of events on context", 2, evnts.size());
        assertEquals("markup://aura:applicationEvent", evnts.get(0).getDescriptor().getQualifiedName());
        assertEquals("markup://aura:connectionLost", evnts.get(1).getDescriptor().getQualifiedName());
        Aura.getContextService().endContext();

        // Adding same event again should not cause an error, same event can be
        // fired with different parameters.
        lc = Aura.getContextService().startContext(Mode.UTEST, Format.JSON, Authentication.AUTHENTICATED);
        Event evt3 = Aura.getInstanceService().getInstance("markup://handleEventTest:applicationEvent", EventDef.class,
                null);
        lc.addClientApplicationEvent(evt3);
        Event evt3_dup = Aura.getInstanceService().getInstance("markup://handleEventTest:applicationEvent",
                EventDef.class, null);
        lc.addClientApplicationEvent(evt3_dup);
        assertEquals("Failed to add same event twice.", 2, evnts.size());
        Aura.getContextService().endContext();

        // Verify component events are not acceptable
        lc = Aura.getContextService().startContext(Mode.UTEST, Format.JSON, Authentication.AUTHENTICATED);
        Event evt4 = Aura.getInstanceService().getInstance("markup://handleEventTest:event", EventDef.class, null);
        try {
            lc.addClientApplicationEvent(evt4);
            fail("Component events should not be allowed to be fired from server.");
        } catch (Exception e) {
            assertEquals("markup://handleEventTest:event is not an Application event. "
View Full Code Here

TOP

Related Classes of org.auraframework.instance.Event

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.