public AddmlDefinitionParserTest()
        {
            var       workingDirectory = new WorkingDirectory(new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "\\..\\..\\TestData\\noark3\\"));
            AddmlInfo addml            = AddmlUtil.ReadFromFile(workingDirectory.Root().WithFile("noark_3_arkivuttrekk_med_prosesser.xml").FullName);

            _parser = new AddmlDefinitionParser(addml, workingDirectory);
        }
Esempio n. 2
0
        public AddmlDefinitionParserTest()
        {
            var workingDirectory =
                new WorkingDirectory(new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/TestData/noark3"));
            AddmlInfo addml = AddmlUtil.ReadFromFile(workingDirectory.Root().WithFile("noark_3_arkivuttrekk_med_prosesser.xml").FullName);

            _parser = new AddmlDefinitionParser(addml, workingDirectory, new StatusEventHandler());
        }
        private static AddmlDefinitionParser SetupParser(string archiveDirectory)
        {
            var workingDirectory =
                new WorkingDirectory(new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + archiveDirectory));
            AddmlInfo addml = AddmlUtil.ReadFromFile(workingDirectory.Root().WithFile("addml.xml").FullName);

            return(new AddmlDefinitionParser(addml, workingDirectory, new StatusEventHandler()));
        }
Esempio n. 4
0
 private void CopyDiasMetsXsdToRootDirectory(WorkingDirectory workingDirectory)
 {
     using (Stream xsdAsStream = ResourceUtil.GetResourceAsStream(ArkadeConstants.DiasMetsXsdResource))
     {
         string targetFile = workingDirectory.Root().WithFile(ArkadeConstants.DiasMetsXsdFileName).FullName;
         using (FileStream fileStream = File.Create(targetFile))
         {
             xsdAsStream.CopyTo(fileStream);
         }
     }
 }
        private static void CopyXsdFiles(WorkingDirectory workingDirectory)
        {
            CopyXsdFile(
                ArkadeConstants.DiasMetsXsdResource,
                ArkadeConstants.DiasMetsXsdFileName,
                workingDirectory.Root()
                );

            CopyXsdFile(
                ArkadeConstants.DiasPremisXsdResource,
                ArkadeConstants.DiasPremisXsdFileName,
                workingDirectory.AdministrativeMetadata()
                );

            CopyXsdFile(
                ArkadeConstants.AddmlXsdResource,
                ArkadeConstants.AddmlXsdFileName,
                workingDirectory.AdministrativeMetadata()
                );
        }
Esempio n. 6
0
        public TestSession NewSession(ArchiveFile archiveFile)
        {
            ReadingArchiveStartedEvent();
            _log.Information(
                $"Building new TestSession from file [archiveType: {archiveFile.ArchiveType}] [directory: {archiveFile.File.FullName}]");
            Uuid uuid = Uuid.Of(Path.GetFileNameWithoutExtension(archiveFile.File.Name));

            ArchiveInformationEvent(archiveFile.File.FullName, archiveFile.ArchiveType, uuid);

            WorkingDirectory workingDirectory = WorkingDirectory.FromUuid(uuid);

            TarExtractionStartedEvent();
            _compressionUtility.ExtractFolderFromArchive(archiveFile.File, workingDirectory.Root().DirectoryInfo());
            TarExtractionFinishedEvent(workingDirectory);

            TestSession testSession = NewSession(workingDirectory, archiveFile.ArchiveType, uuid);

            ReadingArchiveFinishedEvent();
            return(testSession);
        }
        public void ShouldReturnTestSuiteFromTests()
        {
            var             workingDirectory = new WorkingDirectory(ArkadeConstants.GetArkadeWorkDirectory(), new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "\\..\\..\\TestData\\noark3\\"));
            AddmlInfo       addml            = AddmlUtil.ReadFromFile(workingDirectory.Root().WithFile("noark_3_arkivuttrekk_med_prosesser.xml").FullName);
            AddmlDefinition addmlDefinition  = new AddmlDefinitionParser(addml, workingDirectory).GetAddmlDefinition();

            var testSession = new TestSession(new Archive(ArchiveType.Noark3, Uuid.Random(), workingDirectory));

            testSession.AddmlDefinition = addmlDefinition;

            var       addmlDatasetTestEngine = new AddmlDatasetTestEngine(new FlatFileReaderFactory(), new AddmlProcessRunner(), new StatusEventHandler());
            TestSuite testSuite = addmlDatasetTestEngine.RunTestsOnArchive(testSession);


            testSuite.Should().NotBeNull();
            testSuite.TestRuns.Should().NotBeNullOrEmpty();

            List <TestRun> analyseFindMinMaxValues = testSuite.TestRuns
                                                     .Where(run => run.TestName == AnalyseFindMinMaxValues.Name)
                                                     .ToList();

            analyseFindMinMaxValues.Count.Should().Be(1);
        }