Skip to content

Commit

Permalink
Remove write from TestReadNextInstance
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmorato committed Dec 18, 2024
1 parent 38e2f61 commit 5c91b11
Showing 1 changed file with 45 additions and 34 deletions.
79 changes: 45 additions & 34 deletions Tests/OpenDDSharp.UnitTest/DataReaderCDRTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -640,10 +640,9 @@ public void TestGetLivelinessChangedStatus()
Assert.IsNotNull(dataWriter);

// Wait for discovery
var found = writer.WaitForSubscriptions(1, 1000);
var found = reader.WaitForPublications(1, 5_000);
Assert.IsTrue(found);

found = reader.WaitForPublications(1, 1000);
found = writer.WaitForSubscriptions(1, 5_000);
Assert.IsTrue(found);

// Assert liveliness in the writer
Expand Down Expand Up @@ -1024,7 +1023,9 @@ public void TestWaitForHistoricalData()
TestHelper.CreateWaitSetThread(evt, statusCondition);

// Wait for discovery
var found = reader.WaitForPublications(1, 5000);
var found = reader.WaitForPublications(1, 5_000);
Assert.IsTrue(found);
found = writer.WaitForSubscriptions(1, 5_000);
Assert.IsTrue(found);

// OpenDDS Issue: Wait for historical data is not actually implemented. It returns always ReturnCode.Ok
Expand Down Expand Up @@ -1256,7 +1257,9 @@ public void TestRead()
var dataWriter = new TestIncludeDataWriter(writer);

// Wait for discovery
var found = reader.WaitForPublications(1, 5000);
var found = reader.WaitForPublications(1, 5_000);
Assert.IsTrue(found);
found = writer.WaitForSubscriptions(1, 5_000);
Assert.IsTrue(found);

// Write an instance a wait for acknowledgment
Expand Down Expand Up @@ -1384,7 +1387,9 @@ public void TestTake()
var dataWriter = new TestIncludeDataWriter(writer);

// Wait for discovery
var found = reader.WaitForPublications(1, 5000);
var found = reader.WaitForPublications(1, 5_000);
Assert.IsTrue(found);
found = writer.WaitForSubscriptions(1, 5_000);
Assert.IsTrue(found);

// Write an instance a wait for acknowledgment
Expand Down Expand Up @@ -1540,7 +1545,9 @@ public void TestReadInstance()
var dataWriter = new TestIncludeDataWriter(writer);

// Wait for discovery
var found = reader.WaitForPublications(1, 5000);
var found = reader.WaitForPublications(1, 5_000);
Assert.IsTrue(found);
found = writer.WaitForSubscriptions(1, 5_000);
Assert.IsTrue(found);

// Write two samples of three different instances
Expand Down Expand Up @@ -1687,7 +1694,9 @@ public void TestTakeInstance()
var dataWriter = new TestIncludeDataWriter(writer);

// Wait for discovery
var found = reader.WaitForPublications(1, 5000);
var found = reader.WaitForPublications(1, 5_000);
Assert.IsTrue(found);
found = writer.WaitForSubscriptions(1, 5_000);
Assert.IsTrue(found);

// Write two samples of three different instances
Expand Down Expand Up @@ -1849,31 +1858,31 @@ public void TestReadNextInstance()
found = writer.WaitForSubscriptions(1, 5_000);
Assert.IsTrue(found);

// Write two samples of three different instances
for (short i = 1; i <= 3; i++)
{
evt.Reset();
TestHelper.CreateWaitSetThread(evt, statusCondition);

result = dataWriter.Write(new TestInclude { Id = i.ToString() });
Assert.AreEqual(ReturnCode.Ok, result);

result = dataWriter.WaitForAcknowledgments(duration);
Assert.AreEqual(ReturnCode.Ok, result);

Assert.IsTrue(evt.Wait(1_500));

evt.Reset();
TestHelper.CreateWaitSetThread(evt, statusCondition);

result = dataWriter.Write(new TestInclude { Id = i.ToString(), ShortField = i });
Assert.AreEqual(ReturnCode.Ok, result);

result = dataWriter.WaitForAcknowledgments(duration);
Assert.AreEqual(ReturnCode.Ok, result);

Assert.IsTrue(evt.Wait(1_500));
}
// // Write two samples of three different instances
// for (short i = 1; i <= 3; i++)
// {
// evt.Reset();
// TestHelper.CreateWaitSetThread(evt, statusCondition);
//
// result = dataWriter.Write(new TestInclude { Id = i.ToString() });
// Assert.AreEqual(ReturnCode.Ok, result);
//
// result = dataWriter.WaitForAcknowledgments(duration);
// Assert.AreEqual(ReturnCode.Ok, result);
//
// Assert.IsTrue(evt.Wait(1_500));
//
// evt.Reset();
// TestHelper.CreateWaitSetThread(evt, statusCondition);
//
// result = dataWriter.Write(new TestInclude { Id = i.ToString(), ShortField = i });
// Assert.AreEqual(ReturnCode.Ok, result);
//
// result = dataWriter.WaitForAcknowledgments(duration);
// Assert.AreEqual(ReturnCode.Ok, result);
//
// Assert.IsTrue(evt.Wait(1_500));
// }

// Read next instance with the simplest overload
var data = new List<TestInclude>();
Expand Down Expand Up @@ -2389,7 +2398,9 @@ public void TestLookupInstance()
var dataWriter = new TestIncludeDataWriter(writer);

// Wait for discovery
var found = writer.WaitForSubscriptions(1, 1000);
var found = reader.WaitForPublications(1, 5_000);
Assert.IsTrue(found);
found = writer.WaitForSubscriptions(1, 5_000);
Assert.IsTrue(found);

// Lookup for a non-existing instance
Expand Down

0 comments on commit 5c91b11

Please sign in to comment.