Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpRuntimeData()
        public virtual void setUpRuntimeData()
        {
            when(processEngine.ExternalTaskService).thenReturn(externalTaskService);

            lockedExternalTaskMock = MockProvider.createMockLockedExternalTask();
            when(externalTaskService.fetchAndLock(anyInt(), any(typeof(string)), any(typeof(Boolean)))).thenReturn(fetchTopicBuilder);

            when(fetchTopicBuilder.topic(any(typeof(string)), anyLong())).thenReturn(fetchTopicBuilder);

            when(fetchTopicBuilder.variables(anyListOf(typeof(string)))).thenReturn(fetchTopicBuilder);

            when(fetchTopicBuilder.enableCustomObjectDeserialization()).thenReturn(fetchTopicBuilder);

            // for authentication
            when(processEngine.IdentityService).thenReturn(identityServiceMock);

            IList <Group> groupMocks = MockProvider.createMockGroups();

            groupIds = setupGroupQueryMock(groupMocks);

            IList <Tenant> tenantMocks = Collections.singletonList(MockProvider.createMockTenant());

            tenantIds = setupTenantQueryMock(tenantMocks);

            (new FetchAndLockContextListener()).contextInitialized(mock(typeof(ServletContextEvent), RETURNS_DEEP_STUBS));
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void initMocks()
        public virtual void initMocks()
        {
            when(processEngine.IdentityService).thenReturn(identityService);
            when(processEngine.ExternalTaskService).thenReturn(externalTaskService);
            when(processEngine.Name).thenReturn("default");

            when(externalTaskService.fetchAndLock(anyInt(), any(typeof(string)), any(typeof(Boolean)))).thenReturn(fetchTopicBuilder);
            when(fetchTopicBuilder.topic(any(typeof(string)), anyLong())).thenReturn(fetchTopicBuilder);
            when(fetchTopicBuilder.variables(anyListOf(typeof(string)))).thenReturn(fetchTopicBuilder);
            when(fetchTopicBuilder.enableCustomObjectDeserialization()).thenReturn(fetchTopicBuilder);

            doNothing().when(handler).suspend(anyLong());
            doReturn(processEngine).when(handler).getProcessEngine(any(typeof(FetchAndLockRequest)));

            lockedExternalTaskMock = MockProvider.createMockLockedExternalTask();
        }
Esempio n. 3
0
        public virtual ExternalTaskQueryBuilder buildQuery(ProcessEngine processEngine)
        {
            ExternalTaskQueryBuilder fetchBuilder = processEngine.ExternalTaskService.fetchAndLock(MaxTasks, WorkerId, UsePriority);

            if (Topics != null)
            {
                foreach (FetchExternalTaskTopicDto topicDto in Topics)
                {
                    ExternalTaskQueryTopicBuilder topicFetchBuilder = fetchBuilder.topic(topicDto.TopicName, topicDto.LockDuration);

                    if (!string.ReferenceEquals(topicDto.BusinessKey, null))
                    {
                        topicFetchBuilder = topicFetchBuilder.businessKey(topicDto.BusinessKey);
                    }

                    if (!string.ReferenceEquals(topicDto.ProcessDefinitionId, null))
                    {
                        topicFetchBuilder.processDefinitionId(topicDto.ProcessDefinitionId);
                    }

                    if (topicDto.ProcessDefinitionIdIn != null)
                    {
                        topicFetchBuilder.processDefinitionIdIn(topicDto.ProcessDefinitionIdIn);
                    }

                    if (!string.ReferenceEquals(topicDto.ProcessDefinitionKey, null))
                    {
                        topicFetchBuilder.processDefinitionKey(topicDto.ProcessDefinitionKey);
                    }

                    if (topicDto.ProcessDefinitionKeyIn != null)
                    {
                        topicFetchBuilder.processDefinitionKeyIn(topicDto.ProcessDefinitionKeyIn);
                    }

                    if (topicDto.Variables != null)
                    {
                        topicFetchBuilder = topicFetchBuilder.variables(topicDto.Variables);
                    }

                    if (topicDto.ProcessVariables != null)
                    {
                        topicFetchBuilder = topicFetchBuilder.processInstanceVariableEquals(topicDto.ProcessVariables);
                    }

                    if (topicDto.DeserializeValues)
                    {
                        topicFetchBuilder = topicFetchBuilder.enableCustomObjectDeserialization();
                    }

                    if (topicDto.LocalVariables)
                    {
                        topicFetchBuilder = topicFetchBuilder.localVariables();
                    }

                    if (TRUE.Equals(topicDto.WithoutTenantId))
                    {
                        topicFetchBuilder = topicFetchBuilder.withoutTenantId();
                    }

                    if (topicDto.TenantIdIn != null)
                    {
                        topicFetchBuilder = topicFetchBuilder.tenantIdIn(topicDto.TenantIdIn);
                    }

                    fetchBuilder = topicFetchBuilder;
                }
            }

            return(fetchBuilder);
        }