public void ParseTest() { var project = new ProcessJsonReader().Parse(Content); var dependencies = new Dependency("com.forcam.na.common-modules", "common-modules.library", "11.3"); var expected = new Project("?.oee-manual-sequence", "erp-process", "?", new List <Dependency> { dependencies }); Assert.AreEqual(project, expected); }
public ProcessOperations( PomReader pomReader, BpmnReader bpmnReader, FfdReader ffdReader, ProcessFlowJsonReader processFlowJsonReader, ProcessJsonReader processJsonReader, StatusTableReader statusTableReader) { PomReader = pomReader; BpmnReader = bpmnReader; FfdReader = ffdReader; ProcessFlowJsonReader = processFlowJsonReader; ProcessJsonReader = processJsonReader; StatusTableReader = statusTableReader; }
public void VerifyFlow(VerificationResult result, DirectoryInfo projectDir, Dependency flow, Project project) { var pom = "pom.xml"; var flowName = flow.ArtifactId.ToLower(); var bpmn = flowName + ".bpmn"; var ffd = flowName + ".ffd"; var flowsJson = flowName + ".json"; var processJson = flowName + "_process.json"; var operationStatus = "operation-status.fdt"; var workplaceStatus = "workplace-status.fdt"; Project pomResult = null; List <LogicComponent> flows = null; if (!File.Exists(Path.Combine(projectDir.FullName, pom))) { result.Error(flowName + " " + pom + " is missing"); } else { var pomPath = Path.Combine(projectDir.FullName, pom); pomResult = PomReader.Parse(File.ReadAllText(pomPath)); result.ProvideDependency(pom, pomResult); result.ProvideFlow(pomPath, new FlowConfiguration(pomResult.GroupId, pomResult.ArtifactId, pomResult.Version, "", "")); foreach (var dependency in pomResult.Dependencies) { result.RequireDependency(pomPath, dependency); } } if (!File.Exists(Path.Combine(projectDir.FullName, bpmn))) { result.Error(flowName + " " + bpmn + " is missing"); } else { var bpmnResult = BpmnReader.Parse(File.ReadAllText(Path.Combine(projectDir.FullName, bpmn))); foreach (var components in bpmnResult.LogicComponents) { if (IgnoreComponent(components)) { continue; } result.RequireLogicComponent(bpmn, components); } flows = bpmnResult.LogicComponents; if (pomResult != null && !bpmnResult.Project.ArtifactId.Equals(pomResult.ArtifactId)) { result.Error(bpmn + " artifact ID doesn't match pom artifact ID"); } foreach (var dependency in bpmnResult.Project.Dependencies) { result.RequireDependency(bpmn, dependency); } } if (!File.Exists(Path.Combine(projectDir.FullName, ffd))) { result.Error(flowName + " " + ffd + " is missing"); } else { var flowResult = FfdReader.Parse(File.ReadAllText(Path.Combine(projectDir.FullName, ffd))); foreach (var components in flowResult.LogicComponents) { if (IgnoreComponent(components)) { continue; } result.RequireLogicComponent(ffd, components); } if (pomResult != null && !flowResult.Project.ArtifactId.Equals(pomResult.ArtifactId)) { result.Error(ffd + " artifact ID doesn't match pom artifact ID"); } foreach (var dependency in flowResult.Project.Dependencies) { result.RequireDependency(ffd, dependency); } } if (!File.Exists(Path.Combine(projectDir.FullName, flowsJson))) { result.Error(flowName + " " + flowsJson + " is missing"); } else { var flowResult = ProcessFlowJsonReader.Parse(File.ReadAllText(Path.Combine(projectDir.FullName, flowsJson))); foreach (var components in flowResult.LogicComponents) { result.RequireLogicComponent(bpmn, components); } if (flows != null) { foreach (var missMatch in flows .Where(f => !flowResult.LogicComponents.Contains(f)) .Where(m => !m.Name.EndsWith("status"))) { result.Error(bpmn + " doesn't match " + missMatch); } } foreach (var dependency in flowResult.Project.Dependencies) { result.RequireDependency(flowsJson, dependency); } } if (!File.Exists(Path.Combine(projectDir.FullName, processJson))) { result.Error(flowName + " " + processJson + " is missing"); } else { var projectResult = ProcessJsonReader.Parse(File.ReadAllText(Path.Combine(projectDir.FullName, processJson))); if (pomResult != null && !projectResult.ArtifactId.Equals(pomResult.ArtifactId)) { result.Error(processJson + " artifact ID doesn't match pom artifact ID"); } foreach (var dependency in projectResult.Dependencies) { result.RequireDependency(processJson, dependency); } } if (flowName == "core-process") { if (!File.Exists(Path.Combine(projectDir.FullName, workplaceStatus))) { result.Error(flowName + " " + workplaceStatus + " is missing"); } else { var statusTable = StatusTableReader.Parse(File.ReadAllText(Path.Combine(projectDir.FullName, workplaceStatus))); foreach (var status in statusTable) { result.RequireStatusDefinition(workplaceStatus, status); } } if (File.Exists(Path.Combine(projectDir.FullName, operationStatus))) { var statusTable = StatusTableReader.Parse(File.ReadAllText(Path.Combine(projectDir.FullName, operationStatus))); foreach (var status in statusTable) { result.RequireStatusDefinition(workplaceStatus, status); } } } }