Skip to content
Snippets Groups Projects
Select Git revision
  • v1.4.0
  • master default protected
  • gitkeep
  • dev protected
  • Issue/2353-dropShapeFix
  • Issue/2583-treeBug
  • Hotfix/2562-organizations
  • Issue/2464-invalidateMeta
  • Issue/2484-filterExtracted
  • Issue/2309-docs
  • Issue/2462-removeTraces
  • Hotfix/2459-EncodingPath
  • Hotfix/2452-linkedDeletion
  • Issue/2328-noFailOnLog
  • Issue/1792-newMetadataStructure
  • v2.5.2-Hotfix2365
  • Hotfix/2365-targetClassWorks
  • Issue/2269-niceKpiParser
  • Issue/2295-singleOrganizationFix
  • Issue/1953-owlImports
  • Hotfix/2087-efNet6
  • v2.9.0
  • v2.8.2
  • v2.8.1
  • v2.8.0
  • v2.7.2
  • v2.7.1
  • v2.7.0
  • v2.6.2
  • v2.6.1
  • v2.6.0
  • v2.5.3
  • v2.5.2
  • v2.5.1
  • v2.5.0
  • v2.4.1
  • v2.4.0
  • v2.3.0
  • v2.2.0
  • v2.1.0
  • v2.0.0
41 results

MetadataTests.cs

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    MetadataTests.cs 2.92 KiB
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Coscine.Configuration;
    using Coscine.Metadata.Models;
    using NUnit.Framework;
    using VDS.RDF;
    using VDS.RDF.Parsing;
    
    namespace Coscine.Metadata.Tests
    {
        [TestFixture]
        public class MetadataTests
        {
    
            private readonly IConfiguration _configuration = new ConsulConfiguration();
    
            private RdfStoreConnector _rdfStoreConnector;
    
            private const string _testUriPrefix = "http://test.de";
    
            //private string _shapeGraph = File.ReadAllText("Metadata.Tests/TestFiles/radar_shape.ttl");
            //private string _dataGraph = File.ReadAllText("Metadata.Tests/TestFiles/radar_input.ttl");
    
            private void RemoveTestGraphs()
            {
                foreach (var grapUri in _rdfStoreConnector.ListGraphs())
                {
                    if (grapUri.ToString().StartsWith(_testUriPrefix))
                    {
                        _rdfStoreConnector.DeleteGraph(grapUri);
                    }
                }
            }
    
            private void AddTestGraphs()
            {
    
            }
    
            [OneTimeSetUp]
            public void Init()
            {
                _rdfStoreConnector = new RdfStoreConnector(_configuration.GetStringAndWait("coscine/local/virtuoso/additional/url"));
                RemoveTestGraphs();
                AddTestGraphs();
            }
    
            [OneTimeTearDown]
            public void Cleanup()
            {
                RemoveTestGraphs();
            }
    
            [Test]
            public void HasGraphTest()
            {
                Assert.IsTrue(_rdfStoreConnector.HasGraph("http://www.openlinksw.com/schemas/virtrdf#"));
                Assert.IsTrue(_rdfStoreConnector.HasGraph("http://localhost:8890/DAV/"));
                Assert.IsFalse(_rdfStoreConnector.HasGraph("https://test.de/fdgdhjklö/"));
            }
    
            [Test]
            public void GetGraphTest()
            {
                Assert.IsFalse(_rdfStoreConnector.GetGraph("http://www.openlinksw.com/schemas/virtrdf#").IsEmpty);
                Assert.IsFalse(_rdfStoreConnector.GetGraph("http://localhost:8890/DAV/").IsEmpty);
                // Returns an empty graph, if the graph does not exists
                Assert.IsTrue(_rdfStoreConnector.GetGraph("https://test.de/fdgdhjklö/").IsEmpty);