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 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); } }
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 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)); }
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 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); }
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); } } }
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()); }