Package javax.resource.spi.work

Examples of javax.resource.spi.work.Work


    }

    @Test
    public void untracksWorkOnStartWorkException() throws Exception
    {
        final Work work = mock(Work.class);

        doThrow(new WorkException()).when(delegateWorkManager).startWork(Matchers.<Work>any());

        try
        {
View Full Code Here


    }

    @Test
    public void untracksWorkOnStartRuntimeException() throws Exception
    {
        final Work work = mock(Work.class);

        doThrow(new RuntimeException()).when(delegateWorkManager).startWork(Matchers.<Work>any());

        try
        {
View Full Code Here

    }

    @Test
    public void untracksWorkOnStartExecutionException() throws Exception
    {
        final Work work = mock(Work.class);
        doThrow(new RuntimeException()).when(work).run();

        final ArgumentCaptor<Work> argument = ArgumentCaptor.forClass(Work.class);
        doAnswer(new Answer()
        {
View Full Code Here

    }

    @Test
    public void startsParameterizedWork() throws WorkException
    {
        final Work work = mock(Work.class);
        long startTimeout = 0;
        ExecutionContext execContext = mock(ExecutionContext.class);
        WorkListener workListener = mock(WorkListener.class);

        doAnswer(new Answer()
        {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable
            {
                work.run();
                return null;
            }
        }).when(delegateWorkManager).startWork(Matchers.<Work>any(), eq(startTimeout), eq(execContext), Matchers.<WorkListener>any());

        trackingWorkManager.startWork(work, startTimeout, execContext, workListener);
View Full Code Here

    }

    @Test
    public void wrapsWorkListenerOnParameterizedStartWork() throws WorkException
    {
        final Work work = mock(Work.class);
        long startTimeout = 0;
        ExecutionContext execContext = mock(ExecutionContext.class);
        WorkListener workListener = mock(WorkListener.class);
        WorkListener wrappedWorkListener = mock(WorkListener.class);
View Full Code Here

    }

    @Test
    public void tracksParameterizedWorkStart() throws Exception
    {
        final Work work = mock(Work.class);
        long startTimeout = 0;
        ExecutionContext execContext = mock(ExecutionContext.class);
        WorkListener workListener = mock(WorkListener.class);

        final ArgumentCaptor<Work> argument = ArgumentCaptor.forClass(Work.class);
View Full Code Here

    }

    @Test
    public void untracksWorkOnParameterizedStartWorkException() throws Exception
    {
        final Work work = mock(Work.class);
        long startTimeout = 0;
        ExecutionContext execContext = mock(ExecutionContext.class);
        WorkListener workListener = mock(WorkListener.class);

        doThrow(new WorkException()).when(delegateWorkManager).startWork(Matchers.<Work>any(), eq(startTimeout), eq(execContext), Matchers.<WorkListener>any());
View Full Code Here

    }

    @Test
    public void untracksWorkOnParameterizedStartRuntimeException() throws Exception
    {
        final Work work = mock(Work.class);
        long startTimeout = 0;
        ExecutionContext execContext = mock(ExecutionContext.class);
        WorkListener workListener = mock(WorkListener.class);

        doThrow(new RuntimeException()).when(delegateWorkManager).startWork(Matchers.<Work>any(), eq(startTimeout), eq(execContext), Matchers.<WorkListener>any());
View Full Code Here

    }

    @Test
    public void untracksWorkOnParameterizedStartExecutionException() throws Exception
    {
        final Work work = mock(Work.class);
        long startTimeout = 0;
        ExecutionContext execContext = mock(ExecutionContext.class);
        WorkListener workListener = mock(WorkListener.class);

        doThrow(new RuntimeException()).when(work).run();
View Full Code Here

    }

    @Test
    public void schedulesWork() throws WorkException
    {
        final Work work = mock(Work.class);

        doAnswer(new Answer()
        {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable
            {
                work.run();
                return null;
            }
        }).when(delegateWorkManager).scheduleWork(Matchers.<Work>any());

        trackingWorkManager.scheduleWork(work);
View Full Code Here

TOP

Related Classes of javax.resource.spi.work.Work

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.