Exemplo n.º 1
0
        private async Task DeployTestBpmnFilesAsync(FileInfo bpmnFile)
        {
            try {
                var httpClient = this.CreateHttpClient();

                var bpmnFileContent = File.ReadAllText(bpmnFile.FullName);
                var identity        = DummyIdentity.Create();

                var importPayload = new {
                    name = bpmnFile.Name.Replace(bpmnFile.Extension, ""),
                    xml  = bpmnFileContent,
                    overwriteExisting = true
                };

                var jsonImportPayload = JsonConvert.SerializeObject(importPayload);

                var response = await httpClient.PostAsync("api/deployment/v1/import_process_model", new StringContent(jsonImportPayload, Encoding.UTF8, "application/json"));

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    throw new Exception($"ProcessEngine Rest API returned status {response.StatusCode}.");
                }
            } catch (Exception unknownException) {
                throw new Exception($"Cannot deploy BPMN file for base URL '{this.processEngineRestApiUrl}'. See inner exception for details.", unknownException);
            }
        }
Exemplo n.º 2
0
        public ProcessEngineClientFixture()
        {
            this.DefaultIdentity = DummyIdentity.Create();

            CreateProcessEngineClient();
            DeploySampleBpmns();
        }