示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpHttpClientAndRuntimeData()
        public virtual void setUpHttpClientAndRuntimeData()
        {
            client    = HttpClients.createDefault();
            reqConfig = RequestConfig.custom().setConnectTimeout(3 * 60 * 1000).setSocketTimeout(10 * 60 * 1000).build();

            ProcessDefinition mockDefinition = MockProvider.createMockDefinition();

            runtimeServiceMock = mock(typeof(RuntimeService));
            when(processEngine.RuntimeService).thenReturn(runtimeServiceMock);

            mockInstantiationBuilder = mock(typeof(ProcessInstantiationBuilder));
            when(mockInstantiationBuilder.setVariables(any(typeof(System.Collections.IDictionary)))).thenReturn(mockInstantiationBuilder);
            when(mockInstantiationBuilder.businessKey(anyString())).thenReturn(mockInstantiationBuilder);
            when(mockInstantiationBuilder.caseInstanceId(anyString())).thenReturn(mockInstantiationBuilder);
            when(runtimeServiceMock.createProcessInstanceById(anyString())).thenReturn(mockInstantiationBuilder);

            ProcessInstanceWithVariables resultInstanceWithVariables = MockProvider.createMockInstanceWithVariables();

            when(mockInstantiationBuilder.executeWithVariablesInReturn(anyBoolean(), anyBoolean())).thenReturn(resultInstanceWithVariables);

            ProcessDefinitionQuery processDefinitionQueryMock = mock(typeof(ProcessDefinitionQuery));

            when(processDefinitionQueryMock.processDefinitionKey(MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY)).thenReturn(processDefinitionQueryMock);
            when(processDefinitionQueryMock.withoutTenantId()).thenReturn(processDefinitionQueryMock);
            when(processDefinitionQueryMock.latestVersion()).thenReturn(processDefinitionQueryMock);
            when(processDefinitionQueryMock.singleResult()).thenReturn(mockDefinition);

            RepositoryService repositoryServiceMock = mock(typeof(RepositoryService));

            when(processEngine.RepositoryService).thenReturn(repositoryServiceMock);
            when(repositoryServiceMock.createProcessDefinitionQuery()).thenReturn(processDefinitionQueryMock);
        }