Ejemplo n.º 1
0
        public void TestSpawnCommandOutput()
        {
            Utils.CleanContext();
            Utils.GenerateSourceFile("input1", "{05D6BCFA-B1FE-4AD1-920F-0352A6DEC02D}");
            Utils.GenerateSourceFile("input2", "{B9D01D6C-4048-4814-A2DF-9D317A492B10}");

            var builder = Utils.CreateBuilder(true);
            var command = new InputOutputTestCommand {
                Delay = 100, Source = new ObjectUrl(UrlType.File, Utils.GetSourcePath("input1")), OutputUrl = "/db/url1"
            };

            command.CommandsToSpawn.Add(new InputOutputTestCommand {
                Delay = 100, Source = new ObjectUrl(UrlType.File, Utils.GetSourcePath("input2")), OutputUrl = "/db/url2"
            });
            CommandBuildStep step = builder.Root.Add(command);

            builder.Run(Builder.Mode.Build);
            builder.WriteIndexFile(false);

            var indexMap = ContentIndexMap.Load(VirtualFileSystem.ApplicationDatabaseIndexPath);

            indexMap.UseTransaction = true;
            indexMap.LoadNewValues();

            ObjectId outputId;
            bool     objectIdFound = indexMap.TryGetValue("/db/url2", out outputId);

            Assert.True(objectIdFound);
        }
Ejemplo n.º 2
0
        public void TestInputDependencies()
        {
            Utils.CleanContext();
            Utils.GenerateSourceFile("input1", "{A7246DF6-3A68-40E2-BA58-6C9A0EFF552B}");
            Utils.GenerateSourceFile("inputDeps", "{8EE7A4BC-88E1-4CC8-B03F-1E6EA8B23955}");

            var builder  = Utils.CreateBuilder(false);
            var inputDep = new ObjectUrl(UrlType.File, Utils.GetSourcePath("inputDeps"));
            var command  = new InputOutputTestCommand {
                Delay = 100, Source = new ObjectUrl(UrlType.File, Utils.GetSourcePath("input1")), OutputUrl = "/db/url1"
            };

            command.InputDependencies.Add(inputDep);
            CommandBuildStep step = builder.Root.Add(command);

            builder.Run(Builder.Mode.Build);

            var indexMap = ContentIndexMap.Load(VirtualFileSystem.ApplicationDatabaseIndexPath);

            indexMap.UseTransaction = true;
            indexMap.LoadNewValues();

            ObjectId inputDepId;
            bool     inputDepFound = step.Result.InputDependencyVersions.TryGetValue(inputDep, out inputDepId);

            Assert.True(inputDepFound);
        }
Ejemplo n.º 3
0
        public void TestRemoteSpawnCommandOutput()
        {
            Utils.CleanContext();
            Utils.GenerateSourceFile("input1", "{BB42A922-ED1B-4837-98D2-189EFAF6BF42}");
            Utils.GenerateSourceFile("input2", "{8B212FA9-5F0D-4D29-A68B-01D87FF04AF4}");

            var builder = Utils.CreateBuilder(false);
            var command = new InputOutputTestCommand {
                Delay = 100, Source = new ObjectUrl(UrlType.File, Utils.GetSourcePath("input1")), OutputUrl = "/db/url1", ExecuteRemotely = true
            };

            command.CommandsToSpawn.Add(new InputOutputTestCommand {
                Delay = 100, Source = new ObjectUrl(UrlType.File, Utils.GetSourcePath("input2")), OutputUrl = "/db/url2"
            });
            CommandBuildStep step = builder.Root.Add(command);

            builder.Run(Builder.Mode.Build);
            builder.WriteIndexFile(false);

            Assert.That(step.SpawnedSteps.Count(), Is.EqualTo(1));

            var indexMap = AssetIndexMap.Load(VirtualFileSystem.ApplicationDatabaseIndexPath);

            indexMap.UseTransaction = true;
            indexMap.LoadNewValues();

            ObjectId outputId;
            bool     objectIdFound = indexMap.TryGetValue("/db/url2", out outputId);

            Assert.IsTrue(objectIdFound);
            Assert.That(step.SpawnedSteps.First().Result.OutputObjects[new ObjectUrl(UrlType.ContentLink, "/db/url2")], Is.EqualTo(outputId));
        }