コード例 #1
0
        public void DataValidate()
        {
            ShapesConfigMockService       shapesConfigMockService       = new ShapesConfigMockService();
            RepositoriesConfigMockService repositoriesConfigMockService = new RepositoriesConfigMockService();
            ConfigSparql configSparql = new ConfigSparql();

            configSparql.Endpoint = "";
            etlController etlController = new etlController(repositoriesConfigMockService, shapesConfigMockService, configSparql);

            var stream = new MemoryStream();
            var writer = new StreamWriter(stream);

            writer.Write(rdfFile);
            writer.Flush();
            stream.Position = 0;
            var         file   = new FormFile(stream, 0, stream.Length, null, "rdf.xml");
            ShapeReport report = (ShapeReport)((OkObjectResult)etlController.dataValidate(file, new Guid("390cde26-b39d-41c8-89e0-b87c207d8cf2"))).Value;

            if (!report.conforms && report.results.Count > 0)
            {
                Assert.True(true);
            }
            else
            {
                Assert.True(false);
            }
        }
コード例 #2
0
        public void DataValidateValidationFileKO()
        {
            etlController etlController = new etlController(null, null, null, null, null, null, null, null);

            var stream = new MemoryStream();
            var writer = new StreamWriter(stream);

            writer.Write(rdfFile);
            writer.Flush();
            stream.Position = 0;
            var file = new FormFile(stream, 0, stream.Length, null, "rdf.xml");

            var stream2 = new MemoryStream();
            var writer2 = new StreamWriter(stream2);

            writer2.Write(validationFileKO);
            writer2.Flush();
            stream2.Position = 0;
            var         file2  = new FormFile(stream2, 0, stream2.Length, null, "validationKO.xml");
            ShapeReport report = (ShapeReport)((OkObjectResult)etlController.dataValidate(file, file2)).Value;

            if (!report.conforms && report.results.Count > 0)
            {
                Assert.True(true);
            }
            else
            {
                Assert.True(false);
            }
        }
コード例 #3
0
        public void DataPublishError()
        {
            ShapesConfigMockService       shapesConfigMockService       = new ShapesConfigMockService();
            RepositoriesConfigMockService repositoriesConfigMockService = new RepositoriesConfigMockService();
            ConfigSparql configSparql = new ConfigSparql();

            configSparql.Endpoint = "";
            etlController etlController = new etlController(repositoriesConfigMockService, shapesConfigMockService, configSparql);

            try
            {
                var response = etlController.dataPublish(null);
                if (response is BadRequestObjectResult)
                {
                    Assert.True(true);
                }
                else
                {
                    Assert.True(false);
                }
            }
            catch (Exception)
            {
                Assert.True(true);
            }
        }
コード例 #4
0
        public void TestListSets()
        {
            ShapesConfigMockService       shapesConfigMockService       = new ShapesConfigMockService();
            RepositoriesConfigMockService repositoriesConfigMockService = new RepositoriesConfigMockService();
            etlController     etlController = new etlController(repositoriesConfigMockService, shapesConfigMockService, null);
            FileContentResult resultesponse = (FileContentResult)etlController.ListSets(new Guid("5efac0ad-ec4e-467d-bbf5-ce3f64edb46a"));
            string            respuesta     = Encoding.Default.GetString(resultesponse.FileContents);
            XDocument         respuestaXML  = XDocument.Parse(respuesta.Substring(respuesta.IndexOf("<OAI-PMH ")));
            XNamespace        nameSpace     = respuestaXML.Root.GetDefaultNamespace();
            string            ListSets      = respuestaXML.Root.Element(nameSpace + "ListSets").ToString();

            Assert.True(!string.IsNullOrEmpty(ListSets));
        }
コード例 #5
0
        public void GetOntology()
        {
            ShapesConfigMockService       shapesConfigMockService       = new ShapesConfigMockService();
            RepositoriesConfigMockService repositoriesConfigMockService = new RepositoriesConfigMockService();
            ConfigSparql configSparql = new ConfigSparql(null);

            configSparql.Endpoint = "";
            DiscoverItemMockService discoverItemService = new DiscoverItemMockService();
            etlController           etlController       = new etlController(discoverItemService, repositoriesConfigMockService, shapesConfigMockService, configSparql, null, null, null, null);

            etlController.GetOntology();
            Assert.True(true);
        }
コード例 #6
0
        public void DataPublish()
        {
            ShapesConfigMockService       shapesConfigMockService       = new ShapesConfigMockService();
            RepositoriesConfigMockService repositoriesConfigMockService = new RepositoriesConfigMockService();
            ConfigSparql configSparql = new ConfigSparql();

            configSparql.Endpoint = "";
            etlController etlController = new etlController(repositoriesConfigMockService, shapesConfigMockService, configSparql);

            var stream = new MemoryStream();
            var writer = new StreamWriter(stream);

            writer.Write(rdfFile);
            writer.Flush();
            stream.Position = 0;
            var file = new FormFile(stream, 0, stream.Length, null, "rdf.xml");

            etlController.dataPublish(file);
            Assert.True(true);
        }
コード例 #7
0
        public void GetHash()
        {
            ShapesConfigMockService       shapesConfigMockService       = new ShapesConfigMockService();
            RepositoriesConfigMockService repositoriesConfigMockService = new RepositoriesConfigMockService();
            ConfigSparql configSparql = new ConfigSparql(null);

            configSparql.Endpoint = "";
            DiscoverItemMockService discoverItemService = new DiscoverItemMockService();
            etlController           etlController       = new etlController(discoverItemService, repositoriesConfigMockService, shapesConfigMockService, configSparql, null, null, null, null);

            using (SHA256 sha256Hash = SHA256.Create())
            {
                string ontologyFile = File.ReadAllText("Config/Ontology/roh-v2.owl");
                var    response     = etlController.GetHash(sha256Hash, ontologyFile);
                if (response != null)
                {
                    Assert.True(true);
                }
            }
        }
コード例 #8
0
        public IActionResult ExampleError()
        {
            etlController etlController = new etlController(null, null, null, null, null, null, null);

            var stream = new MemoryStream();
            var writer = new StreamWriter(stream);

            writer.Write(rdfFile);
            writer.Flush();
            stream.Position = 0;
            var file = new FormFile(stream, 0, stream.Length, null, "rdf.xml");

            var stream2 = new MemoryStream();
            var writer2 = new StreamWriter(stream2);

            writer2.Write(validationFileKO);
            writer2.Flush();
            stream2.Position = 0;
            var         file2  = new FormFile(stream2, 0, stream2.Length, null, "validationKO.xml");
            ShapeReport report = (ShapeReport)((OkObjectResult)etlController.dataValidate(file, file2)).Value;

            return(Ok());
        }