Ejemplo n.º 1
0
        public void doAlignmentTest1()
        {
            var rf  = new RunFactory();
            var run = rf.CreateRun(DeconTools.UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var deconToolsResultFile = Path.Combine(FileRefs.ImportedData, "QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_targetedFeatures.txt");

            var importer = new UnlabelledTargetedResultFromTextImporter(deconToolsResultFile);
            var repo     = importer.Import();

            var massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\qcshew_standard_file_allMassTags.txt";
            var mtc         = new TargetCollection();
            var mtimporter  = new MassTagFromTextFileImporter(massTagFile);

            mtc = mtimporter.Import();

            var aligner = new NETAndMassAligner();

            aligner.SetFeaturesToBeAligned(repo.Results);
            aligner.SetReferenceMassTags(mtc.TargetList);

            aligner.Execute(run);

            float testScan = 6005;
            var   testNET1 = run.NetAlignmentInfo.GetNETValueForScan((int)testScan);


            //note - this is Multialign's
            Assert.AreEqual(0.3253423m, (decimal)testNET1);
        }
Ejemplo n.º 2
0
        public void ExportNET_andMass_AlignmentDataTest1()
        {
            var exportNETFilename  = Path.Combine(FileRefs.OutputFolderPath, "exportedNETAlignmentInfo1.txt");
            var exportMassFilename = Path.Combine(FileRefs.OutputFolderPath, "exportedMassAlignmentInfo1.txt");


            var rf  = new RunFactory();
            var run = rf.CreateRun(DeconTools.UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var deconToolsResultFile = Path.Combine(FileRefs.ImportedData, "QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_targetedFeatures.txt");

            var importer = new UnlabelledTargetedResultFromTextImporter(deconToolsResultFile);
            var repo     = importer.Import();

            var massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\qcshew_standard_file_allMassTags.txt";
            var mtc         = new TargetCollection();
            var mtimporter  = new MassTagFromTextFileImporter(massTagFile);

            mtc = mtimporter.Import();

            var aligner = new NETAndMassAligner();

            aligner.SetFeaturesToBeAligned(repo.Results);
            aligner.SetReferenceMassTags(mtc.TargetList);

            aligner.Execute(run);

            var exporter = new NETAlignmentInfoToTextExporter(exportNETFilename);

            exporter.ExportAlignmentInfo(run.AlignmentInfo);

            var massInfoexporter = new MassAlignmentInfoToTextExporter(exportMassFilename);

            massInfoexporter.ExportAlignmentInfo(run.AlignmentInfo);
        }
    public override TargetCollection GetRuntimeBuildList( )
    {
        TargetCollection sc = new TargetCollection();

        sc.Add(@"awscalculobuquesgranelero", "dll");
        return(sc);
    }
Ejemplo n.º 4
0
        public void AddNewTargetNullName()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            targets.AddNewTarget(null);
        }
Ejemplo n.º 5
0
        public void WithInputs(TargetCollection targets, List <int> inputsReceived)
        {
            "Given a target with inputs 1 and 2"
            .x(() => Ensure(ref targets).Add(CreateTarget("default", new[] { 1, 2 }, input => Ensure(ref inputsReceived).Add(input))));

            "When I run the target"
            .x(() => targets.RunAsync(new List <string>(), default, default, default));
Ejemplo n.º 6
0
        public void NotExistentDependencies(TargetCollection targets, TestConsole console, bool anyRan, Exception exception)
        {
            "Given a target"
            .x(() => Ensure(ref targets).Add(CreateTarget("first", () => anyRan = true)));

            "And a second target which depends on the first target and a non-existent target"
            .x(() => targets.Add(CreateTarget("second", new[] { "first", "non-existing" }, () => anyRan = true)));

            "And a third target which depends on the second target and another non-existent target"
            .x(() => targets.Add(CreateTarget("third", new[] { "second", "also-non-existing" }, () => anyRan = true)));

            "When I run the third target"
            .x(async() => exception = await Record.ExceptionAsync(() => targets.RunAsync(new List <string> {
                "third"
            }, console = new TestConsole())));

            "Then the operation fails"
            .x(() => Assert.NotNull(exception));

            "And I am told that the first non-existent target could not be found"
            .x(() => Assert.Contains("non-existing, required by second", exception.Message));

            "And I am told that the second non-existent target could not be found"
            .x(() => Assert.Contains("also-non-existing, required by third", exception.Message));

            "And the other targets are not run"
            .x(() => Assert.False(anyRan));
        }
Ejemplo n.º 7
0
        public void RemoveTargetFromImport()
        {
            Project          p       = GetProjectThatImportsAnotherProject(null, null);
            TargetCollection targets = p.Targets;

            targets.RemoveTarget(GetSpecificTargetFromProject(p, "t2"));
        }
Ejemplo n.º 8
0
        bool DoLast()
        {
            if (Last <= 0)
            {
                return(false);
            }

            Skip  = (int)(TargetCollection.Count(_Query) - Skip - Last);
            First = Last;
            if (Skip >= 0)
            {
                return(false);
            }

            First += Skip;
            if (First <= 0)
            {
                if (Count)
                {
                    WriteObject(0);
                }
                return(true);
            }
            Skip = 0;
            return(false);
        }
Ejemplo n.º 9
0
    public override TargetCollection GetRuntimeBuildList( )
    {
        TargetCollection sc = new TargetCollection();

        sc.Add(@"awscalculartanqueros", "dll");
        return(sc);
    }
    public override TargetCollection GetRuntimeBuildList( )
    {
        TargetCollection sc = new TargetCollection();

        sc.Add(@"awscalcularportavehiculosrorosoap", "dll");
        return(sc);
    }
Ejemplo n.º 11
0
 public void Validate()
 {
     CosmosAccount.Validate();
     StorageAccount.Validate();
     SourceCollection.Validate();
     TargetCollection.Validate();
 }
Ejemplo n.º 12
0
        public void ExistsWhenTargetDoesNotExist()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            Assertion.AssertEquals(false, targets.Exists("tNot"));
        }
Ejemplo n.º 13
0
        public void IsSynchronizedDefault()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            Assertion.AssertEquals(false, targets.IsSynchronized);
        }
Ejemplo n.º 14
0
        public void CountWithNoTargets()
        {
            project.LoadXml(ProjectContentNoTargets);
            TargetCollection targets = project.Targets;

            Assertion.AssertEquals(0, targets.Count);
        }
Ejemplo n.º 15
0
        public void ExistsWhenTargetExists()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            Assertion.AssertEquals(true, targets.Exists("t2"));
        }
Ejemplo n.º 16
0
        public void CountWithImportedTargets()
        {
            string importProjectContents = @" 
                    <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
                        <Target Name='t2'>
                            <Message Text='imported.t2.task' />
                        </Target>
                    <Target Name='t3' />
                    </Project>
                ";

            string projectContents = @" 
                    <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
                        <Target Name='t1'>
                            <Message Text='parent.t1.task' />
                        </Target>
                        <Import Project='import.proj' />
                    </Project>
                ";

            Project          p       = GetProjectThatImportsAnotherProject(importProjectContents, projectContents);
            TargetCollection targets = p.Targets;

            Assertion.AssertEquals(3, targets.Count);
        }
Ejemplo n.º 17
0
        public void NestedDependencies(TargetCollection targets, TestConsole console, List <string> ran)
        {
            "Given a target"
            .x(() => Ensure(ref targets).Add(CreateTarget("first", () => Ensure(ref ran).Add("first"))));

            "And a second target which depends on the first target"
            .x(() => targets.Add(CreateTarget("second", new[] { "first" }, () => Ensure(ref ran).Add("second"))));

            "And a third target which depends on the second target"
            .x(() => targets.Add(CreateTarget("third", new[] { "second" }, () => Ensure(ref ran).Add("third"))));

            "When I run the third target"
            .x(() => targets.RunAsync(new List <string> {
                "third"
            }, console = new TestConsole()));

            "Then all targets are run"
            .x(() => Assert.Equal(3, ran.Count));

            "And the first target is run first"
            .x(() => Assert.Equal("first", ran[0]));

            "And the second target is run second"
            .x(() => Assert.Equal("second", ran[1]));

            "And the third target is run third"
            .x(() => Assert.Equal("third", ran[2]));
        }
Ejemplo n.º 18
0
        public void DependencyOrderWhenParallelAndSkipping(
            TargetCollection targets,
            TestConsole console,
            int clock,
            int buildStartTime,
            int test1StartTime,
            int test2StartTime)
        {
            "Given a target that takes a long time to start up"
            .x(() => Ensure(ref targets).Add(CreateTarget(
                                                 "build",
                                                 () => {
                Thread.Sleep(TimeSpan.FromSeconds(1));         // a weak way to encourage the tests to run first
                buildStartTime = Interlocked.Increment(ref clock);
            })));

            "And a second target which depends on the first target"
            .x(() => targets.Add(CreateTarget("test1", new[] { "build" }, () => test1StartTime = Interlocked.Increment(ref clock))));

            "And a third target which depends on the first target"
            .x(() => targets.Add(CreateTarget("test2", new[] { "build" }, () => test2StartTime = Interlocked.Increment(ref clock))));

            "When I run all the targets with parallelism, skipping dependencies"
            .x(() => targets.RunAsync(new List <string> {
                "--parallel", "--skip-dependencies", "test1", "test2", "build"
            }, console = new TestConsole()));

            "Then the first target is run first"
            .x(() => Assert.Equal(1, buildStartTime));

            "And the other targets are run later"
            .x(() => Assert.Equal(5, test1StartTime + test2StartTime));
        }
Ejemplo n.º 19
0
        public void CopyToSimple()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            object[] array = new object[targets.Count];
            targets.CopyTo(array, 0);

            List <string> listOfTargets = new List <string>();

            foreach (Target t in array)
            {
                listOfTargets.Add(t.Name);
            }

            // This originates in a hashtable, whose ordering is undefined
            // and indeed changes in CLR4
            listOfTargets.Sort();

            Assertion.AssertEquals(targets["t1"].Name, listOfTargets[0]);
            Assertion.AssertEquals(targets["t2"].Name, listOfTargets[1]);
            Assertion.AssertEquals(targets["t3"].Name, listOfTargets[2]);
            Assertion.AssertEquals(targets["t4"].Name, listOfTargets[3]);
            Assertion.AssertEquals(targets["t5"].Name, listOfTargets[4]);
        }
Ejemplo n.º 20
0
        public void ExistsOfImportedTarget()
        {
            Project          p       = GetProjectThatImportsAnotherProject(null, null);
            TargetCollection targets = p.Targets;

            Assertion.AssertEquals(true, targets.Exists("t4"));
        }
Ejemplo n.º 21
0
        public void CopyToNull()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            targets.CopyTo(null, 0);
        }
Ejemplo n.º 22
0
        public void ExistsWhenImportedTargetAndParentTargetHaveSameName()
        {
            string importProjectContents = @" 
                    <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
                        <Target Name='t1'>
                            <Message Text='imported.t2.task' />
                        </Target>
                    </Project>
                ";

            string parentProjectContents = @" 
                    <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
                        <Target Name='t1'>
                            <Message Text='parent.t1.task' />
                        </Target>
                        <Target Name='t2' />
                        <Import Project='import.proj' />
                    </Project>
                ";

            Project          p       = GetProjectThatImportsAnotherProject(importProjectContents, parentProjectContents);
            TargetCollection targets = p.Targets;

            Assertion.AssertEquals(true, targets.Exists("t1"));
        }
Ejemplo n.º 23
0
        public void CountMany()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            Assertion.AssertEquals(5, targets.Count);
        }
Ejemplo n.º 24
0
        public void AddNewTargetEmptyStringName()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            targets.AddNewTarget(String.Empty);
        }
Ejemplo n.º 25
0
    public override TargetCollection GetRuntimeBuildList( )
    {
        TargetCollection sc = new TargetCollection();

        sc.Add(@"home", "dll");
        return(sc);
    }
        public void cannotFindMassTag_test1()
        {
            //
            var testFile      = DeconTools.UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1;
            var peaksTestFile = DeconTools.UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500;
            var massTagFile   = @"\\protoapps\UserData\Slysz\Data\MassTags\QCShew_Formic_MassTags_Bin10_all.txt";


            var run = RunUtilities.CreateAndAlignRun(testFile, peaksTestFile);


            var mtc        = new TargetCollection();
            var mtimporter = new MassTagFromTextFileImporter(massTagFile);

            mtc = mtimporter.Import();

            var testMassTagID = 26523;

            run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 1 select n).First();


            TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters();
            var workflow = new BasicTargetedWorkflow(run, parameters);

            workflow.Execute();

            var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag) as MassTagResult;

            Assert.IsNull(result.IsotopicProfile);
            Assert.IsNull(result.ScanSet);
            Assert.IsNull(result.ChromPeakSelected);

            Assert.IsTrue(result.FailedResult);
            Assert.AreEqual(DeconTools.Backend.Globals.TargetedResultFailureType.ChrompeakNotFoundWithinTolerances, result.FailureType);
        }
Ejemplo n.º 27
0
 void DoDistinct()
 {
     foreach (var it in TargetCollection.Distinct(Distinct, _Query))
     {
         WriteObject(Actor.ToObject(it));
     }
 }
Ejemplo n.º 28
0
        public void AddNewTargetSpecialCharacterName()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            targets.AddNewTarget("%24%40%3b%5c%25");
        }
    public override TargetCollection GetRuntimeBuildList( )
    {
        TargetCollection sc = new TargetCollection();

        sc.Add(@"wwpbaseobjects\seclogin", "dll");
        return(sc);
    }
Ejemplo n.º 30
0
        public void RemoveTargetNull()
        {
            project.LoadXml(ProjectContentSeveralTargets);
            TargetCollection targets = project.Targets;

            targets.RemoveTarget(null);
        }
Ejemplo n.º 31
0
 static Backup()
 {
     if (!File.Exists("targets.json"))
         targets = new TargetCollection();
     else
         targets = TargetCollection.FromJSON(File.ReadAllText("targets.json"));
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Returns a collection of named targets specified in the configuration.
 /// </summary>
 /// <returns>A <see cref="TargetCollection"/> object that contains a list of named targets.</returns>
 /// <remarks>
 /// Unnamed targets (such as those wrapped by other targets) are not returned.
 /// </remarks>
 public TargetCollection GetConfiguredNamedTargets()
 {
     TargetCollection tc = new TargetCollection();
     foreach (Target t in _targets.Values)
     {
         tc.Add(t);
     }
     return tc;
 }