-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/rdmp 117 multiple loads per catalogue (#1754)
* basic db objects * fix typo * working db linkage * working build * add sql update * update sql * update tests * update sql * update create sql * update sql * update sql * update class * fix extra space * attempt to fix tests * remove linkage * fix typo * add test case * attempt image fix * fix up image * add missing file * add changelog * interim * interim * tidy up code * fix build * icons * rename icon file (#1755) * working icon * update create sql * update patch * add patch * working patches * add basic tests * tidy up code * add go * attempt to fix patch * tidy up code * remove true equal true check * tidy up from review * update migration * remove dupe file (#1774) * fix build * interim sql * update patch * fix sql patch * update patch id * update patch id * fix bad merge * tidy up code * tidy up code --------- Co-authored-by: James A Sutherland <j.a.sutherland@dundee.ac.uk>
- Loading branch information
Showing
39 changed files
with
404 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
Rdmp.Core.Tests/Curation/Integration/LoadMetadataLinkageTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright (c) The University of Dundee 2024-2024 | ||
// This file is part of the Research Data Management Platform (RDMP). | ||
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>. | ||
using NUnit.Framework; | ||
using Rdmp.Core.Curation.Data; | ||
using Rdmp.Core.Curation.Data.DataLoad; | ||
using System.Linq; | ||
using Tests.Common; | ||
|
||
namespace Rdmp.Core.Tests.Curation.Integration; | ||
|
||
public class LoadMetadataLinkageTests: DatabaseTests | ||
{ | ||
[Test] | ||
public void BasicLoadMetadataLinkage() | ||
{ | ||
var loadMetadata = new LoadMetadata(CatalogueRepository); | ||
var catalogue = new Catalogue(CatalogueRepository, "catalogue"); | ||
loadMetadata.LinkToCatalogue(catalogue); | ||
Assert.That(catalogue.LoadMetadatas().Length, Is.EqualTo(1)); | ||
Assert.That(catalogue.LoadMetadatas().First(), Is.EqualTo(loadMetadata)); | ||
Assert.That(loadMetadata.GetAllCatalogues().ToArray().Length, Is.EqualTo(1)); | ||
} | ||
|
||
[Test] | ||
public void BasicLoadMetadataLinkageUnlink() | ||
{ | ||
var loadMetadata = new LoadMetadata(CatalogueRepository); | ||
var catalogue = new Catalogue(CatalogueRepository, "catalogue"); | ||
loadMetadata.LinkToCatalogue(catalogue); | ||
Assert.That(catalogue.LoadMetadatas().Length, Is.EqualTo(1)); | ||
Assert.That(catalogue.LoadMetadatas().First(), Is.EqualTo(loadMetadata)); | ||
loadMetadata.UnlinkFromCatalogue(catalogue); | ||
Assert.That(catalogue.LoadMetadatas().Length, Is.EqualTo(0)); | ||
Assert.That(loadMetadata.GetAllCatalogues().ToArray().Length , Is.EqualTo(0)); | ||
} | ||
|
||
[Test] | ||
public void BasicLoadMetadataLinkage_Multiple() | ||
{ | ||
var loadMetadata = new LoadMetadata(CatalogueRepository); | ||
var catalogue = new Catalogue(CatalogueRepository, "catalogue"); | ||
var catalogue2 = new Catalogue(CatalogueRepository, "catalogue2"); | ||
loadMetadata.LinkToCatalogue(catalogue); | ||
loadMetadata.LinkToCatalogue(catalogue2); | ||
Assert.That(catalogue.LoadMetadatas().Length, Is.EqualTo(1)); | ||
Assert.That(catalogue.LoadMetadatas().First(), Is.EqualTo(loadMetadata)); | ||
Assert.That(catalogue2.LoadMetadatas().Length, Is.EqualTo(1)); | ||
Assert.That(catalogue2.LoadMetadatas().First(), Is.EqualTo(loadMetadata)); | ||
Assert.That(loadMetadata.GetAllCatalogues().ToArray().Length, Is.EqualTo(2)); | ||
} | ||
|
||
[Test] | ||
public void BasicLoadMetadataLinkage_MultipleUnlink() | ||
{ | ||
var loadMetadata = new LoadMetadata(CatalogueRepository); | ||
var catalogue = new Catalogue(CatalogueRepository, "catalogue"); | ||
var catalogue2 = new Catalogue(CatalogueRepository, "catalogue2"); | ||
loadMetadata.LinkToCatalogue(catalogue); | ||
loadMetadata.LinkToCatalogue(catalogue2); | ||
loadMetadata.UnlinkFromCatalogue(catalogue2); | ||
Assert.That(catalogue.LoadMetadatas().Length, Is.EqualTo(1)); | ||
Assert.That(catalogue.LoadMetadatas().First(), Is.EqualTo(loadMetadata)); | ||
Assert.That(catalogue2.LoadMetadatas().Length, Is.EqualTo(0)); | ||
Assert.That(catalogue2.LoadMetadatas(), Is.Empty); | ||
Assert.That(loadMetadata.GetAllCatalogues().ToArray().Length, Is.EqualTo(1)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.