-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8174431
commit 1ccff50
Showing
5 changed files
with
51 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.IO; | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace COLID.Scheduler.Common.Constants | ||
{ | ||
public static class Metadata | ||
{ | ||
public const string Author = "https://pid.bayer.com/kos/19050/author"; | ||
private static readonly string _basePath = Path.GetFullPath("appsettings.json"); | ||
private static readonly string _filePath = _basePath.Substring(0, _basePath.Length - 16); | ||
private static IConfigurationRoot _configuration = new ConfigurationBuilder() | ||
.SetBasePath(_filePath) | ||
.AddJsonFile("appsettings.json") | ||
.Build(); | ||
public static readonly string _serviceUrl = _configuration.GetValue<string>("ServiceUrl"); | ||
|
||
public const string LastChangeUser = "https://pid.bayer.com/kos/19050/lastChangeUser"; | ||
public static readonly string Author = _serviceUrl + "kos/19050/author"; | ||
|
||
public const string DataSteward = "https://pid.bayer.com/kos/19050/hasDataSteward"; | ||
public static readonly string LastChangeUser = _serviceUrl + "kos/19050/lastChangeUser"; | ||
|
||
public const string ContactPerson = "https://pid.bayer.com/kos/19050/hasContactPerson"; | ||
public static readonly string DataSteward = _serviceUrl + "kos/19050/hasDataSteward"; | ||
|
||
public const string ChangeRequester = "https://pid.bayer.com/kos/19050/546454"; | ||
public static readonly string ContactPerson = _serviceUrl + "kos/19050/hasContactPerson"; | ||
|
||
public const string ConsumerGroup = "https://pid.bayer.com/kos/19050#hasConsumerGroup"; | ||
public static readonly string ChangeRequester = _serviceUrl + "kos/19050/546454"; | ||
|
||
public const string InformationClassification = "https://pid.bayer.com/kos/19050/hasInformationClassification"; | ||
public static readonly string ConsumerGroup = _serviceUrl + "kos/19050#hasConsumerGroup"; | ||
|
||
public static readonly string InformationClassification = _serviceUrl + "kos/19050/hasInformationClassification"; | ||
|
||
public const string W3Type = "http://www/w3/org/1999/02/22-rdf-syntax-ns#type"; | ||
|
||
public const string LifecyleStatus = "https://pid.bayer.com/kos/19050/hasLifecycleStatus"; | ||
public static readonly string LifecyleStatus = _serviceUrl + "kos/19050/hasLifecycleStatus"; | ||
|
||
public static readonly string ConsumerGroupContact = _serviceUrl + "kos/19050/hasConsumerGroupContactPerson"; | ||
|
||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text; | ||
using COLID.Scheduler.Common.DataModels; | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace UnitTests.Builder | ||
{ | ||
public class ContactBuilder | ||
{ | ||
private ContactDto _contact = new ContactDto(); | ||
|
||
private static readonly string _basePath = Path.GetFullPath("appsettings.json"); | ||
private static readonly string _filePath = _basePath.Substring(0, _basePath.Length - 16); | ||
private static IConfigurationRoot _configuration = new ConfigurationBuilder() | ||
.SetBasePath(_filePath) | ||
.AddJsonFile("appsettings.json") | ||
.Build(); | ||
public static readonly string _serviceUrl = _configuration.GetValue<string>("ServiceUrl"); | ||
public ContactBuilder() | ||
{ | ||
} | ||
|
@@ -21,7 +29,7 @@ public ContactDto Build() | |
public ContactBuilder GenerateSampleData() | ||
{ | ||
WithEmailAddress("[email protected]"); | ||
WithTypeUri(new Uri("https://pid.bayer.com/kos/19050/hasContactPerson")); | ||
WithTypeUri(new Uri(_serviceUrl + "kos/19050/hasContactPerson")); | ||
WithTypeLabel("Contact Person"); | ||
IsTechnical(false); | ||
return this; | ||
|
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 |
---|---|---|
@@ -1,13 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text; | ||
using COLID.Scheduler.Common.DataModels; | ||
using Microsoft.Extensions.Configuration; | ||
using UnitTests.Builder; | ||
using COLID.Scheduler.Common.Constants; | ||
|
||
namespace UnitTests | ||
{ | ||
public static class TestData | ||
{ | ||
private static readonly string _basePath = Path.GetFullPath("appsettings.json"); | ||
private static readonly string _filePath = _basePath.Substring(0, _basePath.Length - 16); | ||
private static IConfigurationRoot _configuration = new ConfigurationBuilder() | ||
.SetBasePath(_filePath) | ||
.AddJsonFile("appsettings.json") | ||
.Build(); | ||
public static readonly string _serviceUrl = _configuration.GetValue<string>("ServiceUrl"); | ||
public static AdUserDto GenerateAdUser(bool enabled = true) | ||
{ | ||
var id = Guid.NewGuid().ToString(); | ||
|
@@ -18,7 +28,7 @@ public static AdUserDto GenerateAdUser(bool enabled = true) | |
public static ColidEntryContactsDto GenerateColidEntryContacts(string colidEntryLabel, IEnumerable<ContactDto> contacts) | ||
{ | ||
return new ColidEntryContactBuilder() | ||
.WithPidUri($"https://pid.bayer.com/{Guid.NewGuid()}") | ||
.WithPidUri($"{_serviceUrl}{Guid.NewGuid()}") | ||
.WithLabel(colidEntryLabel) | ||
.WithContacts(contacts) | ||
.WithConsumerGroupContact(GenerateContactConsumerGroupAdmin()) | ||
|
@@ -45,7 +55,7 @@ public static ContactDto GenerateContactConsumerGroupAdmin() | |
{ | ||
return new ContactBuilder() | ||
.WithEmailAddress("[email protected]") | ||
.WithTypeUri("https://pid.bayer.com/kos/19050/hasConsumerGroupContactPerson") | ||
.WithTypeUri(Metadata.ConsumerGroupContact) | ||
.WithTypeLabel("Contact Person") | ||
.Build(); | ||
} | ||
|
@@ -54,7 +64,7 @@ public static ContactDto GenerateContactContactPerson(string email) | |
{ | ||
return new ContactBuilder() | ||
.WithEmailAddress(email) | ||
.WithTypeUri("https://pid.bayer.com/kos/19050/hasContactPerson") | ||
.WithTypeUri(Metadata.ContactPerson) | ||
.WithTypeLabel("Contact Person") | ||
.IsTechnical(false) | ||
.Build(); | ||
|
@@ -64,7 +74,7 @@ public static ContactDto GenerateContactLastChangeUser(string email) | |
{ | ||
return new ContactBuilder() | ||
.WithEmailAddress(email) | ||
.WithTypeUri("https://pid.bayer.com/kos/19050/lastChangeUser") | ||
.WithTypeUri(Metadata.LastChangeUser) | ||
.WithTypeLabel("Last Change User") | ||
.IsTechnical(true) | ||
.Build(); | ||
|
@@ -74,7 +84,7 @@ public static ContactDto GenerateContactAuthor(string email) | |
{ | ||
return new ContactBuilder() | ||
.WithEmailAddress(email) | ||
.WithTypeUri("https://pid.bayer.com/kos/19050/author") | ||
.WithTypeUri(Metadata.Author) | ||
.WithTypeLabel("Author") | ||
.IsTechnical(true) | ||
.Build(); | ||
|
@@ -84,7 +94,7 @@ public static ContactDto GenerateContactDataSteward(string email) | |
{ | ||
return new ContactBuilder() | ||
.WithEmailAddress(email) | ||
.WithTypeUri("https://pid.bayer.com/kos/19050/hasDataSteward") | ||
.WithTypeUri(Metadata.DataSteward) | ||
.WithTypeLabel("Data Steward") | ||
.IsTechnical(false) | ||
.Build(); | ||
|