Beispiel #1
0
 public ProjectOperations(PomReader pomReader, ControllerJsonReader controllerJsonReader, FactoryFrameworkReader factoryFrameworkReader, ProjectJsonReader projectJsonReader)
 {
     PomReader              = pomReader;
     ControllerJsonReader   = controllerJsonReader;
     FactoryFrameworkReader = factoryFrameworkReader;
     ProjectJsonReader      = projectJsonReader;
 }
        public void ParseTest()
        {
            List <FlowConfiguration> result = new ControllerJsonReader().Parse(Content);

            CollectionAssert.AreEqual(new List <FlowConfiguration> {
                new FlowConfiguration("*forcam.ff-rd-07.oee-track-and-trace", "realtime-preprocessing-process", "1.0", "OEE-Track-and-Trace", ""),
                new FlowConfiguration("*forcam.ff-rd-07.rd-overhead-costs", "realtime-main-process", "1.0", "", "<configuration></configuration>\r\n"),
                new FlowConfiguration("*forcam.ff-rd-07.oee-track-and-trace", "recode-process", "1.0", "OEE-Track-and-Trace", "<configuration></configuration>")
            }, result);
        }
Beispiel #3
0
        public void Verify(VerificationResult result, DirectoryInfo workspace, Project project)
        {
            var projectDir = Path.Combine(workspace.FullName, project.FlatName);

            if (!Directory.Exists(projectDir))
            {
                result.Error(project.FlatName + "is missing");
                return;
            }

            var pom = "pom.xml";
            var factoryFramework = "factoryFramework.xml";
            var controllerJson   = project.ArtifactId + "_controller.json";
            var projectJson      = project.ArtifactId + "_project.json";

            if (!File.Exists(Path.Combine(projectDir, projectJson)))
            {
                result.Error("project " + projectJson + " is missing");
            }
            else
            {
                var jsonProject = ProjectJsonReader.Parse(File.ReadAllText(Path.Combine(projectDir, projectJson)));
                if (!jsonProject.ArtifactId.Equals(project.ArtifactId, StringComparison.InvariantCultureIgnoreCase))
                {
                    result.Error("project " + projectJson + " doesn't match project definition");
                }

                if (!jsonProject.DependentLogicLibrary.Version.Equals(project.DependentLogicLibrary.Version))
                {
                    result.Error("project " + projectJson + " has a different logic library version");
                }
            }

            List <FlowConfiguration> flows = null;

            if (!File.Exists(Path.Combine(projectDir, controllerJson)))
            {
                result.Error("project " + controllerJson + " is missing");
            }
            else
            {
                flows = ControllerJsonReader.Parse(File.ReadAllText(Path.Combine(projectDir, controllerJson)));
                foreach (var flow in flows)
                {
                    result.RequireFlow(controllerJson, flow);
                    if (!string.IsNullOrEmpty(flow.BookingType))
                    {
                        result.RequireBookingType(controllerJson, flow.BookingType);
                    }
                }
            }

            if (!File.Exists(Path.Combine(projectDir, factoryFramework)))
            {
                result.Error("project " + factoryFramework + " is missing");
            }
            else
            {
                var factoryResults = FactoryFrameworkReader.Parse(File.ReadAllText(Path.Combine(projectDir, factoryFramework)));
                foreach (var bookingType in factoryResults.BookingTypes)
                {
                    result.ProvideBookingType(factoryFramework, bookingType);
                }

                foreach (var statusDefinition in factoryResults.StatusDefinitions)
                {
                    result.ProvideStatusDefinition(factoryFramework, statusDefinition);
                }

                foreach (var flow in factoryResults.Flows)
                {
                    result.RequireFlow(controllerJson, flow);
                }

                if (flows != null)
                {
                    if (flows.Count != factoryResults.Flows.Count)
                    {
                        result.Error("project " + factoryFramework + " number of flows don't match with " + flows);
                    }

                    foreach (var missMatch in flows.Where(f => !factoryResults.Flows.Contains(f)))
                    {
                        result.Error("project flow doesn't match " + missMatch);
                    }
                }
            }

            if (!File.Exists(Path.Combine(projectDir, pom)))
            {
                result.Error("project " + pom + " is missing");
            }
            else
            {
                var projectPom = PomReader.Parse(new FileInfo(Path.Combine(projectDir, pom)));
                result.ProvideDependency(pom, projectPom);

                foreach (var dependency in projectPom.Dependencies)
                {
                    result.RequireDependency(projectPom.FlatName, dependency);
                }
            }
        }
Beispiel #4
0
        public void IncrementVersion(DirectoryInfo workspace, Project project)
        {
            var projectDir = Path.Combine(workspace.FullName, project.FlatName);

            if (!Directory.Exists(projectDir))
            {
                return;
            }

            var pom            = "pom.xml";
            var controllerJson = project.ArtifactId + "_controller.json";

            if (File.Exists(Path.Combine(projectDir, controllerJson)))
            {
                VersionIncrement.ReplaceFileContent(Path.Combine(projectDir, controllerJson), c => ControllerJsonReader.IncrementVersion(c));
            }

            if (File.Exists(Path.Combine(projectDir, pom)))
            {
                VersionIncrement.ReplaceFileContent(Path.Combine(projectDir, pom), c => PomReader.IncrementVersion(c));
            }
        }