-
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.
Lookups now check for a single Catalogue and extract only Core column…
…s if so Fixes #692
- Loading branch information
Showing
7 changed files
with
121 additions
and
6 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
57 changes: 57 additions & 0 deletions
57
Rdmp.Core.Tests/Curation/Integration/BundledLookupTableTests.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,57 @@ | ||
// Copyright (c) The University of Dundee 2018-2019 | ||
// 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; | ||
using Rdmp.Core.Curation.Data; | ||
using Rdmp.Core.DataExport.DataExtraction.UserPicks; | ||
using Tests.Common; | ||
|
||
namespace Rdmp.Core.Tests.Curation.Integration | ||
{ | ||
public class BundledLookupTableTests : UnitTests | ||
{ | ||
[Test] | ||
public void TestLookupGetDataTableFetchSql() | ||
{ | ||
var l = WhenIHaveA<Lookup>(); | ||
var t =l.PrimaryKey.TableInfo; | ||
|
||
var bundle = new BundledLookupTable(t); | ||
Assert.AreEqual("select * from [MyDb]..[ChildTable]", bundle.GetDataTableFetchSql()); | ||
} | ||
[Test] | ||
public void TestLookupGetDataTableFetchSql_WithCatalogue() | ||
{ | ||
var l = WhenIHaveA<Lookup>(); | ||
var t = l.PrimaryKey.TableInfo; | ||
|
||
var engineer = new ForwardEngineerCatalogue(t, t.ColumnInfos); | ||
engineer.ExecuteForwardEngineering(out var cata,out _, out var eis); | ||
|
||
var bundle = new BundledLookupTable(t); | ||
Assert.AreEqual(@" | ||
SELECT | ||
ChildCol, | ||
Desc | ||
FROM | ||
ChildTable", bundle.GetDataTableFetchSql()); | ||
|
||
|
||
// ei 1 is suplemental now | ||
eis[1].ExtractionCategory = ExtractionCategory.Supplemental; | ||
eis[1].SaveToDatabase(); | ||
|
||
Assert.AreEqual(@" | ||
SELECT | ||
ChildCol | ||
FROM | ||
ChildTable", bundle.GetDataTableFetchSql()); | ||
} | ||
} | ||
} |
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