Execute() публичный Метод

Configures a Sorter{T} and executes it.
public Execute ( Summer.Batch.Core.StepContribution contribution, Summer.Batch.Core.Scope.Context.ChunkContext chunkContext ) : RepeatStatus
contribution Summer.Batch.Core.StepContribution ignored
chunkContext Summer.Batch.Core.Scope.Context.ChunkContext ignored
Результат RepeatStatus
Пример #1
0
        public void TestSort17Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort17t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort17.txt");

            var sortTasklet = new SortTasklet
            {
                SortCard = "8,2,ZD,A",
                Outrec = "1:1,7,11:8,2",
                Separator = "\r\n",
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort17.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #2
0
        public void TestSort14Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort14t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort14.txt");

            var sortTasklet = new SortTasklet
            {
                Outrec = "(1,8,ZD,M3,LENGTH=12,9,8,ZD,M5,LENGTH=12,17,8,ZD,M20,LENGTH=12)",
                Encoding = Cp1047,
                RecordLength = 24,
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort14.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #3
0
        public void TestSort15Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort15t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort15.txt");

            var sortTasklet = new SortTasklet
            {
                SortCard = "(250,3,CH,A,628,09,CH,A,1,10,CH,A)",
                Include = "(609,4,CH,GT,C'0100',AND,920,4,PD,NE,+0)",
                Encoding = Cp1047,
                RecordLength = 2500,
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort15.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #4
0
        public void TestSort12Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort12t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort12.txt");

            var sortTasklet = new SortTasklet
            {
                Include = "1,10,CH,EQ,C'INCLUDE '",
                Separator = "\r\n",
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort12.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #5
0
        public void TestSort13Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort13t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort13.txt");

            var sortTasklet = new SortTasklet
            {
                Outrec = "(1,8,5X,11,6,PD,M4,LENGTH=15,5X,31,7,PD,EDIT=(SI,III,III,IIT.TTT),SIGNS=(,-),5X,41,5,PD,EDIT=(TT-TT-TTTT))",
                Encoding = Cp1047,
                RecordLength = 45,
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort13.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #6
0
        public void TestSort1Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort1t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort1.txt");
            var sortTasklet = new SortTasklet
            {
                Separator = "\r\n",
                HeaderSize = 1,
                SortCard = "FORMAT=CH,FIELDS=(1,25,A,26,10,ZD,D)",
                Omit = "(36,1,ZD,EQ,5)",
                Input = new List<IResource>
                {
                    new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort1a.txt")),
                    new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort1b.txt"))
                },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #7
0
        public void TestSort11Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort11t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort11.txt");

            var sortTasklet = new SortTasklet
            {
                SortCard = "5,20,CH,A,33,4,PD,A",
                Sum = "25,8,ZD",
                Encoding = Cp1047,
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort11.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #8
0
        public void TestSort8Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort8t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort8.txt");

            var sortTasklet = new SortTasklet
            {
                Separator = "\r\n",
                SortCard = "(7,10,CH,A)",
                Sum = "FIELDS=(23,11,34,11,45,11,56,11),FORMAT=ZD",
                Omit = "(04,03,CH,EQ,C'555')",
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort8.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #9
0
        public void TestSort9Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort9t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort9.txt");

            var sortTasklet = new SortTasklet
            {
                RecordLength = 5,
                SortCard = "3,5,PD,A",
                Sum = "1,2,PD",
                Omit = "(3,5,PD,GE,300000)",
                Inrec = "(X'001C',1,5)",
                Encoding = Cp1047,
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort9.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #10
0
        public void TestSort5Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort5t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort5.txt");

            var sortTasklet = new SortTasklet
            {
                Separator = "\n",
                SortCard = "1,6,CH,A",
                Omit = "75,7,CH,EQ,C'       '",
                Outrec = "26,6,75,7,82,40,2X,228,80,681,4,11X",
                Encoding = Cp1252,
                SortEncoding = Cp1147,
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort5.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #11
0
        public void TestSort7Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort7t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort7.txt");

            var sortTasklet = new SortTasklet
            {
                RecordLength = 2,
                SortCard = "(1,2,ZD,A)",
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort7.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #12
0
        public void TestSort4Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort4t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort4.txt");

            var sortTasklet = new SortTasklet
            {
                Separator = "\n",
                SortCard = "(1,23,CH,A)",
                Inrec = "5,6,300,3,12,14,60,40,11,1,X,141,3,22X",
                Encoding = Cp1252,
                SortEncoding = Cp1147,
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort4.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #13
0
        public void TestSort3Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort3t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort3.txt");

            var sortTasklet = new SortTasklet
            {
                Separator = "\n",
                SortCard = "9,2,CH,A,259,6,CH,D,17,3,CH,A,296,1,CH,D",
                Sum = "233,12,ZD",
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort3.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #14
0
        public void TestSort2Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort2t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort2.txt");

            var sortTasklet = new SortTasklet
            {
                Separator = "\n",
                Include = "(1,2,CH,EQ,C'99',AND,22,1,CH,EQ,C'&')",
                SortEncoding = Encoding.GetEncoding("IBM01147"),
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort2.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #15
0
        // TIMING : 10:38:13.2660 Info 14 (SortTasklet.cs:128) Total sort time: 142,82s (CPU = Intel I7 - 3770 @3.40Ghz)
        // for the given 1.17 Go file
        public void BenchTest()
        {
            var output = new FileInfo(@"Q:\temp\bench\output.csv");
            var input = new FileInfo(@"Q:\temp\bench\input.csv");

            var sortTasklet = new SortTasklet
            {
                SortCard = "1,5,CH,A,7,4,CH,A",
                Separator = "\r\n",
                HeaderSize = 1,
                Input = new List<IResource> { new FileSystemResource(input) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            output.Refresh();
            Assert.AreEqual(input.Length, output.Length);
        }
Пример #16
0
        public void TestSort10Tasklet()
        {
            var output = new FileInfo(@"TestData\Sort\Output\sort10t.txt");
            var expected = new FileInfo(@"TestData\Sort\Expected\sort10.txt");

            var sortTasklet = new SortTasklet
            {
                SortCard = "1,2,FI,A,3,2,BI,D",
                Sum = "3,2,BI",
                Omit = "1,2,FI,LT,0",
                Outrec = "X,1,4",
                RecordLength = 4,
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\sort10.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected.OpenRead(), output.OpenRead()));
        }
Пример #17
0
        public void TestHexadecimalFilterCriteriaSort()
        {

            var output = new FileInfo(@"TestData\Sort\Input\customSort\sort_test_out2.txt");


            var sortTasklet = new SortTasklet
            {
                Separator = "\n",
                SortCard = "(121,14,CH,A)",
                Include = "75,2,BI,NE,X'5244'",
                Encoding = Cp1252,
                SortEncoding = Cp1147,
                Input = new List<IResource> { new FileSystemResource(new FileInfo(@"TestData\Sort\Input\customSort\sort_test_in.txt")) },
                Output = new FileSystemResource(output)
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

        }
Пример #18
0
        public void TestSort18Tasklet()
        {
            var input = new FileInfo(@"TestData\Sort\Input\sort18.txt");
            var output1 = new FileInfo(@"TestData\Sort\Output\sort18-1.txt");
            var output2 = new FileInfo(@"TestData\Sort\Output\sort18-2.txt");
            var output3 = new FileInfo(@"TestData\Sort\Output\sort18-3.txt");
            var expected1 = new FileInfo(@"TestData\Sort\Expected\sort18-1.txt");
            var expected2 = new FileInfo(@"TestData\Sort\Expected\sort18-2.txt");
            var expected3 = new FileInfo(@"TestData\Sort\Expected\sort18-3.txt");

            var sortTasklet = new SortTasklet
            {
                SortCard = "31,9,ZD,D,40,9,ZD,A",
                Outfils = "INCLUDE=(49,2,CH,EQ,C'01'),OUTREC=(15,10,25,6);INCLUDE=(49,2,CH,EQ,C'02'),OUTREC=(1,4,31,9);INCLUDE=(49,2,CH,EQ,C'03'),OUTREC=(5,10,40,9)",
                Separator = "\r\n",
                Input = new List<IResource> { new FileSystemResource(input) },
                Output = new List<IResource>
                {
                    new FileSystemResource(output1),
                    new FileSystemResource(output2),
                    new FileSystemResource(output3)
                }
            };

            sortTasklet.Execute(new StepContribution(new StepExecution("sort", new JobExecution(1))), null);

            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected1.OpenRead(), output1.OpenRead()));
            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected2.OpenRead(), output2.OpenRead()));
            Assert.IsTrue(TestHelper.TestHelper.ContentEquals(expected3.OpenRead(), output3.OpenRead()));
        }