Package org.eurekastreams.commons.actions.context

Examples of org.eurekastreams.commons.actions.context.ActionContext


    /**
     * Invokes the SUT with a plain ActionContext.
     */
    private void invokeWithPlain()
    {
        final ActionContext originalInnerContext = context.mock(ActionContext.class, "originalInnerContext");
        Serializable result = sut.execute(originalInnerContext, parameters);
        assertSame(results, result);
    }
View Full Code Here


    /**
     * Invokes the SUT with a TaskHandlerActionContext.
     */
    private void invokeWithTaskHandler()
    {
        final ActionContext originalInnerContext = context.mock(ActionContext.class, "originalInnerContext");
        TaskHandlerActionContext originalOuterContext = new TaskHandlerActionContextImpl(originalInnerContext,
                userActionRequests);

        Serializable result = sut.execute(originalOuterContext, parameters);
        assertSame(results, result);
View Full Code Here

            {
                oneOf(mapper).refreshGadgetDefinitionUserCounts();
            }
        });

        sut.execute(new ActionContext()
        {
            private static final long serialVersionUID = 5336352843040807883L;

            @Override
            public Serializable getParams()
View Full Code Here

        final Long activityId = 12L;
        final List<Long> activityIds = new ArrayList<Long>();
        activityIds.add(activityId);

        ActionContext actionContext = new ActionContext()
        {
            private static final long serialVersionUID = 1L;

            @Override
            public Serializable getParams()
View Full Code Here

     * Test.
     */
    @Test
    public void testExecuteBasicContextPrincipal()
    {
        final ActionContext parentContext = new ServiceActionContext(otherParams, principal);
        mockery.checking(new Expectations()
        {
            {
                oneOf(execution).execute(with(new EasyMatcher<PrincipalActionContext>()
                {
                    @Override
                    protected boolean isMatch(final PrincipalActionContext inTestObject)
                    {
                        return inTestObject.getParams() == params && inTestObject.getPrincipal() == principal
                                && inTestObject.getState() != null
                                && inTestObject.getState() != parentContext.getState();
                    }
                }));
                will(returnValue(result));
            }
        });
View Full Code Here

     * Test.
     */
    @Test
    public void testExecuteBasicContextNonPrincipal()
    {
        final ActionContext parentContext = new AsyncActionContext(otherParams);
        mockery.checking(new Expectations()
        {
            {
                oneOf(execution).execute(with(new EasyMatcher<PrincipalActionContext>()
                {
                    @Override
                    protected boolean isMatch(final PrincipalActionContext inTestObject)
                    {
                        return inTestObject.getParams() == params && inTestObject.getPrincipal() == null
                                && inTestObject.getState() != null
                                && inTestObject.getState() != parentContext.getState();
                    }
                }));
                will(returnValue(result));
            }
        });
View Full Code Here

     * Test.
     */
    @Test
    public void testExecuteTaskContextPrincipal()
    {
        final ActionContext parentInnerContext = new ServiceActionContext(otherParams, principal);
        final TaskHandlerActionContext parentContext = new TaskHandlerActionContextImpl(parentInnerContext,
                userActionRequests);
        mockery.checking(new Expectations()
        {
            {
                oneOf(executionTH).execute(with(new EasyMatcher<TaskHandlerActionContext<PrincipalActionContext>>()
                {
                    @Override
                    protected boolean isMatch(final TaskHandlerActionContext<PrincipalActionContext> inTestObject)
                    {
                        PrincipalActionContext inner = inTestObject.getActionContext();
                        return inTestObject.getUserActionRequests() == userActionRequests
                                && inner.getParams() == params && inner.getPrincipal() == principal
                                && inner.getState() != null && inner.getState() != parentInnerContext.getState();
                    }
                }));
                will(returnValue(result));
            }
        });
View Full Code Here

     * Test.
     */
    @Test
    public void testExecuteTaskContextNonPrincipal()
    {
        final ActionContext parentInnerContext = new AsyncActionContext(otherParams);
        final TaskHandlerActionContext parentContext = new TaskHandlerActionContextImpl(parentInnerContext,
                userActionRequests);
        mockery.checking(new Expectations()
        {
            {
                oneOf(executionTH).execute(with(new EasyMatcher<TaskHandlerActionContext<PrincipalActionContext>>()
                {
                    @Override
                    protected boolean isMatch(final TaskHandlerActionContext<PrincipalActionContext> inTestObject)
                    {
                        PrincipalActionContext inner = inTestObject.getActionContext();
                        return inTestObject.getUserActionRequests() == userActionRequests
                                && inner.getParams() == params && inner.getPrincipal() == null
                                && inner.getState() != null && inner.getState() != parentInnerContext.getState();
                    }
                }));
                will(returnValue(result));
            }
        });
View Full Code Here

     *             strategy.
     */
    public Serializable execute(final TaskHandlerActionContext< ? extends ActionContext> inActionContext,
            final Serializable params) throws ExecutionException
    {
        ActionContext inInnerContext = inActionContext.getActionContext();
        boolean hasPrincipalContext = inInnerContext instanceof PrincipalActionContext;
        if (needsPrincipal && !hasPrincipalContext)
        {
            throw new ExecutionException("Incorrect action execution invocation.  "
                    + "Execution requires principal but none was provided on call.");
        }
        ActionContext innerContext = hasPrincipalContext ? new ServiceActionContext(params,
                ((PrincipalActionContext) inInnerContext).getPrincipal()) : new AsyncActionContext(params);

        if (taskHandlerExecution != null)
        {
            TaskHandlerActionContext outerContext = new TaskHandlerActionContextImpl<ActionContext>(innerContext,
View Full Code Here

        {
            throw new ExecutionException("Incorrect action execution invocation.  Execution requires user action "
                    + "request list (TaskHandlerActionContext) but none was provided on call.");
        }

        ActionContext context = hasPrincipalContext ? new ServiceActionContext(params,
                ((PrincipalActionContext) inActionContext).getPrincipal()) : new AsyncActionContext(params);

        return plainExecution.execute(context);
    }
View Full Code Here

TOP

Related Classes of org.eurekastreams.commons.actions.context.ActionContext

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.