@@ -0,0 +1,2487 @@
+package io.digdag.core.agent;%0A%0Aimport com.google.common.collect.ImmutableList;%0Aimport io.digdag.core.queue.TaskQueueServerManager;%0Aimport io.digdag.core.workflow.WorkflowExecutor;%0Aimport io.digdag.spi.ImmutableTaskQueueLock;%0Aimport io.digdag.spi.TaskQueueClient;%0Aimport io.digdag.spi.TaskQueueLock;%0Aimport io.digdag.spi.TaskRequest;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0Aimport java.util.List;%0A%0Aimport static org.junit.Assert.*;%0Aimport static org.mockito.Matchers.eq;%0Aimport static org.mockito.Mockito.doReturn;%0Aimport static org.mockito.Mockito.mock;%0A%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class InProcessTaskServerApiTest%0A%7B%0A    @Mock TaskQueueServerManager taskQueueServerManager;%0A    @Mock WorkflowExecutor workflowExecutor;%0A    @Mock TaskQueueClient taskQueueClient;%0A    private InProcessTaskServerApi taskServerApi;%0A%0A    @Before%0A    public void setUp()%0A    %7B%0A        taskServerApi = new InProcessTaskServerApi(taskQueueServerManager, workflowExecutor);%0A    %7D%0A%0A    @Test%0A    public void lockSharedAgentTasks()%0A    %7B%0A        TaskQueueLock taskQueueLock0 = mock(TaskQueueLock.class);%0A        doReturn(%2210%22).when(taskQueueLock0).getUniqueName();%0A%0A        TaskQueueLock taskQueueLock1 = mock(TaskQueueLock.class);%0A        doReturn(%22unknown%22).when(taskQueueLock1).getUniqueName();%0A%0A        TaskQueueLock taskQueueLock2 = mock(TaskQueueLock.class);%0A        doReturn(%221%22).when(taskQueueLock2).getUniqueName();%0A%0A        TaskQueueLock taskQueueLock3 = mock(TaskQueueLock.class);%0A        doReturn(null).when(taskQueueLock3).getUniqueName();%0A%0A        TaskQueueLock taskQueueLock4 = mock(TaskQueueLock.class);%0A        doReturn(%225%22).when(taskQueueLock4).getUniqueName();%0A%0A        ImmutableList%3CTaskQueueLock%3E taskQueueLocks =%0A                ImmutableList.of(taskQueueLock0, taskQueueLock1, taskQueueLock2, taskQueueLock3, taskQueueLock4);%0A%0A        int expectedCount = 42;%0A        AgentId expectedAgentId = AgentId.of(%22Hello%22);%0A%0A        doReturn(taskQueueLocks).when(taskQueueClient)%0A                .lockSharedAgentTasks(%0A                        eq(expectedCount),%0A                        eq(expectedAgentId),%0A                        )%0A        doReturn(taskQueueClient).when(taskQueueServerManager).getInProcessTaskQueueClient();%0A%0A        List%3CTaskRequest%3E taskRequests = taskServerApi.lockSharedAgentTasks(10, AgentId.of(%22hello%22), 42, 1234);%0A    %7D%0A%7D%0A

Add InProcessTaskServerApiTest