diff --git a/CDP4ServicesDal.Tests/CdpServicesDalTestFixture.cs b/CDP4ServicesDal.Tests/CdpServicesDalTestFixture.cs
index 73c41b1e8..00fbb2e15 100644
--- a/CDP4ServicesDal.Tests/CdpServicesDalTestFixture.cs
+++ b/CDP4ServicesDal.Tests/CdpServicesDalTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// Copyright (c) 2017 RHEA System S.A.
+// Copyright (c) 2017-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
@@ -312,7 +312,7 @@ public async Task Verify_that_multiple_read_requests_can_be_made_in_parallel()
var readresult = await dal.Read(siteDirectory, new CancellationToken());
}
-
+
///
/// Set the credentials property so DAL appears to be open
///
@@ -325,4 +325,4 @@ private void SetDalToBeOpen(CdpServicesDal dal)
credentialsProperty.SetValue(dal, this.credentials);
}
}
-}
+}
\ No newline at end of file
diff --git a/CDP4WspDal.NetCore.Tests/Operations/WSPPostOperationTestFixture.cs b/CDP4WspDal.NetCore.Tests/Operations/WSPPostOperationTestFixture.cs
index e1744e002..2f0d82d4f 100644
--- a/CDP4WspDal.NetCore.Tests/Operations/WSPPostOperationTestFixture.cs
+++ b/CDP4WspDal.NetCore.Tests/Operations/WSPPostOperationTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2015 RHEA S.A.
+//
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.NetCore.Tests/SessionTestFixture.cs b/CDP4WspDal.NetCore.Tests/SessionTestFixture.cs
index 8a62afa20..dc6f0e8b3 100644
--- a/CDP4WspDal.NetCore.Tests/SessionTestFixture.cs
+++ b/CDP4WspDal.NetCore.Tests/SessionTestFixture.cs
@@ -1,6 +1,6 @@
// -------------------------------------------------------------------------------------------------
//
-// Copyright (c) 2015 RHEA System S.A.
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// -------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.NetCore.Tests/WSPDalTestFixture.cs b/CDP4WspDal.NetCore.Tests/WSPDalTestFixture.cs
index cc1faa2f6..d95fc03db 100644
--- a/CDP4WspDal.NetCore.Tests/WSPDalTestFixture.cs
+++ b/CDP4WspDal.NetCore.Tests/WSPDalTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2015 RHEA S.A.
+//
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
@@ -24,7 +24,7 @@ namespace CDP4WspDal.Tests
using CDP4Dal.Operations;
using CDP4WspDal;
using NUnit.Framework;
-
+
using File = System.IO.File;
using Thing = CDP4Common.CommonData.Thing;
@@ -48,7 +48,7 @@ public class WspDalTestFixture
private IterationSetup iterationSetup;
private SiteReferenceDataLibrary siteReferenceDataLibrary;
private ModelReferenceDataLibrary modelReferenceDataLibrary;
-
+
[SetUp]
public void SetUp()
{
@@ -62,7 +62,7 @@ public void SetUp()
this.siteDirectory = new SiteDirectory(Guid.Parse("f13de6f8-b03a-46e7-a492-53b2f260f294"), this.session.Assembler.Cache, this.uri);
var lazySiteDirectory = new Lazy(() => this.siteDirectory);
lazySiteDirectory.Value.Cache.TryAdd(new Tuple(lazySiteDirectory.Value.Iid, null), lazySiteDirectory);
-
+
this.PopulateSiteDirectory();
}
@@ -115,7 +115,7 @@ public async Task VerifyThatOpenReturnsDTOs()
Assert.AreEqual(60, amountOfDtos);
}
-
+
[Test]
public async Task VerifThatAClosedDalCannotBeClosedAgain()
{
@@ -131,7 +131,7 @@ public async Task VerifThatAClosedDalCannotBeClosedAgain()
public async Task VerifyThatIfCredentialsAreNullExceptionIsThrown()
{
var dal = new WspDal();
-
+
Assert.That(async () => await dal.Open(null, new CancellationToken()), Throws.TypeOf());
}
@@ -142,10 +142,10 @@ public async Task VerifyThatIfNotHttpOrHttpsExceptionIsThrown()
var invalidCredentials = new Credentials("John", "a password", uri);
var dal = new WspDal();
-
+
Assert.That(async () => await dal.Open(invalidCredentials, new CancellationToken()), Throws.TypeOf());
}
-
+
[Test]
public async Task VerifyThatIfCredentialsAreNullOnReadExceptionIsThrown()
{
@@ -154,10 +154,10 @@ public async Task VerifyThatIfCredentialsAreNullOnReadExceptionIsThrown()
organizationDto.AddContainer(ClassKind.SiteDirectory, Guid.Parse("eb77f3e1-a0f3-412d-8ed6-b8ce881c0145"));
var dal = new WspDal();
-
+
Assert.That(async () => await dal.Read(organizationDto, new CancellationToken()), Throws.TypeOf());
}
-
+
[Test]
public void VerifyThatWriteThrowsException()
{
@@ -238,7 +238,7 @@ public async Task IntegrationTest()
foreach (var container in topcontainers)
{
- returned = await this.dal.Read(container.Value.ToDto(),this.cancelationTokenSource.Token, attributes);
+ returned = await this.dal.Read(container.Value.ToDto(), this.cancelationTokenSource.Token, attributes);
await assembler.Synchronize(returned);
}
}
@@ -251,7 +251,7 @@ public void VerifyThatWSPPostBodyIsCorrectlyResolves()
var context = "/SiteDirectory/f289023d-41e8-4aaf-aae5-1be1ecf24bac";
var operationContainer = new OperationContainer(context);
-
+
var testDtoOriginal = new CDP4Common.DTO.Alias(iid: Guid.NewGuid(), rev: 1)
{
Content = "content",
@@ -260,7 +260,7 @@ public void VerifyThatWSPPostBodyIsCorrectlyResolves()
};
testDtoOriginal.AddContainer(ClassKind.DomainOfExpertise, domainOfExpertiseIid);
testDtoOriginal.AddContainer(ClassKind.SiteDirectory, siteDirecortoryIid);
-
+
var testDtoModified = new CDP4Common.DTO.Alias(iid: testDtoOriginal.Iid, rev: 1)
{
Content = "content2",
@@ -341,14 +341,14 @@ public void VerifyThatWSPPostBodyIsCorrectlyResolves()
[Category("WSP_dependent")]
public async Task VerifyThatReadIterationWorks()
{
- var dal = new WspDal { Session = this.session};
- var credentials = new Credentials("admin", "pass", new Uri("https://cdp4services-public.rheagroup.com"));
+ var dal = new WspDal { Session = this.session };
+ var credentials = new Credentials("admin", "pass", new Uri("https://cdp4services-public.rheagroup.com"));
var session = new Session(dal, credentials);
-
+
var returned = await dal.Open(credentials, this.cancelationTokenSource.Token);
- session.Assembler.Synchronize(returned);
-
+ await session.Assembler.Synchronize(returned);
+
var siteDir = session.Assembler.RetrieveSiteDirectory();
var modelSetup = siteDir.Model.Single(x => x.ShortName == "LOFT");
var iterationSetup = modelSetup.IterationSetup.First();
@@ -426,13 +426,13 @@ public async Task VerifyThatFileCanBeUploaded()
var commonFileStoreModified = new CDP4Common.DTO.CommonFileStore(commonFileStoreIid, 0);
commonFileStoreModified.File.Add(fileIid);
commonFileStoreModified.AddContainer(ClassKind.EngineeringModel, engineeringModeliid);
-
+
var file = new CDP4Common.DTO.File(Guid.NewGuid(), 0);
file.Owner = domainOfExpertiseIid;
file.FileRevision.Add(fileRevisionIid);
file.AddContainer(ClassKind.CommonFileStore, commonFileStoreIid);
file.AddContainer(ClassKind.EngineeringModel, engineeringModeliid);
-
+
var fileRevision = new CDP4Common.DTO.FileRevision(Guid.NewGuid(), 0);
fileRevision.Name = "testfile";
fileRevision.ContentHash = contentHash;
@@ -441,10 +441,10 @@ public async Task VerifyThatFileCanBeUploaded()
fileRevision.AddContainer(ClassKind.File, fileIid);
fileRevision.AddContainer(ClassKind.CommonFileStore, commonFileStoreIid);
fileRevision.AddContainer(ClassKind.EngineeringModel, engineeringModeliid);
-
+
var context = string.Format("/EngineeringModel/{0}/iteration/{1}", engineeringModeliid, iterationiid);
var operationContainer = new OperationContainer(context);
-
+
var updateCommonFileStoreOperation = new Operation(commonFileStoreOriginal, commonFileStoreModified, OperationKind.Update);
operationContainer.AddOperation(updateCommonFileStoreOperation);
@@ -473,9 +473,45 @@ public void VerifyThatWritingMultipleOperationContainersIsNotSupported()
Assert.Throws(() => dal.Write(operationContainers));
- Assert.Throws(() => dal.Write(operationContainers));
+ Assert.Throws(() => dal.Write(operationContainers));
}
-
+
+ [Test]
+ [Category("WSP_dependent")]
+ public async Task Verify_that_person_can_be_Posted()
+ {
+ var uri = new Uri("http://ocdt-dev.rheagroup.com");
+ var credentials = new Credentials("admin", "Dahubo12", uri);
+
+ var wspdal = new WspDal();
+ var dtos = await wspdal.Open(credentials, this.cancelationTokenSource.Token);
+
+ var siteDirectory = (CDP4Common.DTO.SiteDirectory)dtos.Single(x => x.ClassKind == ClassKind.SiteDirectory);
+
+ var context = siteDirectory.Route;
+ var operationContainer = new OperationContainer(context, siteDirectory.RevisionNumber);
+
+ var person = new CDP4Common.DTO.Person(Guid.NewGuid(), 1);
+ person.ShortName = Guid.NewGuid().ToString();
+ person.Surname = Guid.NewGuid().ToString();
+ person.GivenName = Guid.NewGuid().ToString();
+ person.AddContainer(ClassKind.SiteDirectory, Guid.Parse("eb77f3e1-a0f3-412d-8ed6-b8ce881c0145"));
+
+ var operation1 = new Operation(null, person, OperationKind.Create);
+ operationContainer.AddOperation(operation1);
+
+ var siteDirectoryClone = siteDirectory.DeepClone();
+ siteDirectoryClone.Person.Add(person.Iid);
+ var operation2 = new Operation(siteDirectory, siteDirectoryClone, OperationKind.Update);
+ operationContainer.AddOperation(operation2);
+
+ var result = await wspdal.Write(operationContainer);
+
+ var resultPerson = (CDP4Common.DTO.Person)result.Single(x => x.Iid == person.Iid);
+
+ Assert.NotNull(resultPerson);
+ }
+
///
/// Set the credentials property so DAL appears to be open
///
@@ -501,4 +537,4 @@ private string GetAssemblyDirectory()
return directory;
}
}
-}
+}
\ No newline at end of file
diff --git a/CDP4WspDal.NetCore.Tests/WSPUriQueryAttributeTestFixture.cs b/CDP4WspDal.NetCore.Tests/WSPUriQueryAttributeTestFixture.cs
index b37f31597..e3ff4cf97 100644
--- a/CDP4WspDal.NetCore.Tests/WSPUriQueryAttributeTestFixture.cs
+++ b/CDP4WspDal.NetCore.Tests/WSPUriQueryAttributeTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2015 RHEA S.A.
+//
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.NetCore.Tests/WspCopyOperationHandlerTestFixture.cs b/CDP4WspDal.NetCore.Tests/WspCopyOperationHandlerTestFixture.cs
index f110976f2..25d307a2d 100644
--- a/CDP4WspDal.NetCore.Tests/WspCopyOperationHandlerTestFixture.cs
+++ b/CDP4WspDal.NetCore.Tests/WspCopyOperationHandlerTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// Copyright (c) 2015 RHEA System S.A.
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.NetCore.Tests/WspOperationModifierTestFixture.cs b/CDP4WspDal.NetCore.Tests/WspOperationModifierTestFixture.cs
index 770007800..eb2a0593e 100644
--- a/CDP4WspDal.NetCore.Tests/WspOperationModifierTestFixture.cs
+++ b/CDP4WspDal.NetCore.Tests/WspOperationModifierTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2015 RHEA S.A.
+//
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.NetCore.Tests/WspValueSetOperationCreatorTestFixture.cs b/CDP4WspDal.NetCore.Tests/WspValueSetOperationCreatorTestFixture.cs
index 819b16900..4e635e766 100644
--- a/CDP4WspDal.NetCore.Tests/WspValueSetOperationCreatorTestFixture.cs
+++ b/CDP4WspDal.NetCore.Tests/WspValueSetOperationCreatorTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2015 RHEA S.A.
+//
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.Tests/Helper/StreamHelper.cs b/CDP4WspDal.Tests/Helper/StreamHelper.cs
index 69dd5ce13..78027efc0 100644
--- a/CDP4WspDal.Tests/Helper/StreamHelper.cs
+++ b/CDP4WspDal.Tests/Helper/StreamHelper.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// Copyright (c) 2017 RHEA System S.A.
+// Copyright (c) 2017-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.Tests/Operations/WSPPostOperationTestFixture.cs b/CDP4WspDal.Tests/Operations/WSPPostOperationTestFixture.cs
index e1744e002..2f0d82d4f 100644
--- a/CDP4WspDal.Tests/Operations/WSPPostOperationTestFixture.cs
+++ b/CDP4WspDal.Tests/Operations/WSPPostOperationTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2015 RHEA S.A.
+//
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.Tests/PostOperationTestFixture.cs b/CDP4WspDal.Tests/PostOperationTestFixture.cs
index a67363690..c5b2924ba 100644
--- a/CDP4WspDal.Tests/PostOperationTestFixture.cs
+++ b/CDP4WspDal.Tests/PostOperationTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// Copyright (c) 2017 RHEA System S.A.
+// Copyright (c) 2017-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.Tests/SessionTestFixture.cs b/CDP4WspDal.Tests/SessionTestFixture.cs
index 8a62afa20..dc6f0e8b3 100644
--- a/CDP4WspDal.Tests/SessionTestFixture.cs
+++ b/CDP4WspDal.Tests/SessionTestFixture.cs
@@ -1,6 +1,6 @@
// -------------------------------------------------------------------------------------------------
//
-// Copyright (c) 2015 RHEA System S.A.
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// -------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.Tests/WSPDalTestFixture.cs b/CDP4WspDal.Tests/WSPDalTestFixture.cs
index 73667f755..88e9c6551 100644
--- a/CDP4WspDal.Tests/WSPDalTestFixture.cs
+++ b/CDP4WspDal.Tests/WSPDalTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2015 RHEA S.A.
+//
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
@@ -347,7 +347,7 @@ public async Task VerifyThatReadIterationWorks()
var returned = await dal.Open(credentials, this.cancelationTokenSource.Token);
- session.Assembler.Synchronize(returned);
+ await session.Assembler.Synchronize(returned);
var siteDir = session.Assembler.RetrieveSiteDirectory();
var modelSetup = siteDir.Model.Single(x => x.ShortName == "LOFT");
@@ -537,4 +537,4 @@ private string GetAssemblyDirectory()
return directory;
}
}
-}
+}
\ No newline at end of file
diff --git a/CDP4WspDal.Tests/WSPUriQueryAttributeTestFixture.cs b/CDP4WspDal.Tests/WSPUriQueryAttributeTestFixture.cs
index b37f31597..e3ff4cf97 100644
--- a/CDP4WspDal.Tests/WSPUriQueryAttributeTestFixture.cs
+++ b/CDP4WspDal.Tests/WSPUriQueryAttributeTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2015 RHEA S.A.
+//
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.Tests/WspCopyOperationHandlerTestFixture.cs b/CDP4WspDal.Tests/WspCopyOperationHandlerTestFixture.cs
index f110976f2..25d307a2d 100644
--- a/CDP4WspDal.Tests/WspCopyOperationHandlerTestFixture.cs
+++ b/CDP4WspDal.Tests/WspCopyOperationHandlerTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
//
-// Copyright (c) 2015 RHEA System S.A.
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.Tests/WspOperationModifierTestFixture.cs b/CDP4WspDal.Tests/WspOperationModifierTestFixture.cs
index 770007800..eb2a0593e 100644
--- a/CDP4WspDal.Tests/WspOperationModifierTestFixture.cs
+++ b/CDP4WspDal.Tests/WspOperationModifierTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2015 RHEA S.A.
+//
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------
diff --git a/CDP4WspDal.Tests/WspValueSetOperationCreatorTestFixture.cs b/CDP4WspDal.Tests/WspValueSetOperationCreatorTestFixture.cs
index 819b16900..4e635e766 100644
--- a/CDP4WspDal.Tests/WspValueSetOperationCreatorTestFixture.cs
+++ b/CDP4WspDal.Tests/WspValueSetOperationCreatorTestFixture.cs
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) 2015 RHEA S.A.
+//
+// Copyright (c) 2015-2018 RHEA System S.A.
//
// --------------------------------------------------------------------------------------------------------------------