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);
            }
        }
        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);
            }
        }
        public void GetRepository()
        {
            RepositoriesConfigMockService repositoriesConfigMockService = new RepositoriesConfigMockService();
            repositoryController          repositoryController          = new repositoryController(repositoriesConfigMockService);
            List <RepositoryConfig>       listaRepositorios             = (List <RepositoryConfig>)(((OkObjectResult)repositoryController.GetRepository()).Value);

            Assert.True(listaRepositorios.Count > 0);
        }
        public void DeleteConfigRepository()
        {
            RepositoriesConfigMockService repositoriesConfigMockService = new RepositoriesConfigMockService();
            repositoryController          repositoryController          = new repositoryController(repositoriesConfigMockService);
            RepositoryConfig repositoryConfig = ((List <RepositoryConfig>)(((OkObjectResult)repositoryController.GetRepository()).Value))[0];

            repositoryController.DeleteRepository(repositoryConfig.RepositoryConfigID);
            repositoryConfig = (RepositoryConfig)(((OkObjectResult)repositoryController.GetRepository(repositoryConfig.RepositoryConfigID)).Value);
            Assert.Null(repositoryConfig);
        }
        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));
        }
예제 #6
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);
        }
        public void GetRepositoryByID()
        {
            RepositoriesConfigMockService repositoriesConfigMockService = new RepositoriesConfigMockService();
            repositoryController          repositoryController          = new repositoryController(repositoriesConfigMockService);
            List <RepositoryConfig>       listaRepositorios             = (List <RepositoryConfig>)(((OkObjectResult)repositoryController.GetRepository()).Value);

            if (listaRepositorios.Count > 0)
            {
                RepositoryConfig repositoryConfig        = listaRepositorios[0];
                RepositoryConfig repositoryConfigGetByID = (RepositoryConfig)(((OkObjectResult)repositoryController.GetRepository(repositoryConfig.RepositoryConfigID)).Value);
                Assert.True(repositoryConfig.Name.Equals(repositoryConfigGetByID.Name));
            }
        }
        public void ModifyConfigRepository()
        {
            RepositoriesConfigMockService repositoriesConfigMockService = new RepositoriesConfigMockService();
            repositoryController          repositoryController          = new repositoryController(repositoriesConfigMockService);
            RepositoryConfig repositoryConfig = ((List <RepositoryConfig>)(((OkObjectResult)repositoryController.GetRepository()).Value))[0];
            Random           random           = new Random();
            string           newName          = "updatedRepository_" + random.NextDouble();

            repositoryConfig.Name = newName;
            repositoryController.ModifyRepositoryConfig(repositoryConfig);
            RepositoryConfig updatedrepositoryConfig = (RepositoryConfig)(((OkObjectResult)repositoryController.GetRepository(repositoryConfig.RepositoryConfigID)).Value);

            Assert.True(updatedrepositoryConfig.Name.Equals(newName));
        }
        public void AddConfigRepository()
        {
            RepositoriesConfigMockService repositoriesConfigMockService = new RepositoriesConfigMockService();
            repositoryController          repositoryController          = new repositoryController(repositoriesConfigMockService);
            RepositoryConfig repositoryConfigToAdd = new RepositoryConfig
            {
                Name       = "Un repositorio para configurarlos a todos",
                Url        = "config\\repository",
                OauthToken = "12weq1"
            };
            Guid             identifierAdded  = (Guid)(((OkObjectResult)repositoryController.AddConfigRepository(repositoryConfigToAdd)).Value);
            RepositoryConfig repositoryConfig = (RepositoryConfig)(((OkObjectResult)repositoryController.GetRepository(identifierAdded)).Value);

            Assert.True(repositoryConfigToAdd.Name.Equals(repositoryConfig.Name));
        }
        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);
        }
예제 #11
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);
                }
            }
        }