@@ -114,7 +114,8 @@ public void TestBasicAckEventHandlerRecovery()
114
114
CloseAndWaitForRecovery ( ) ;
115
115
Assert . IsTrue ( Model . IsOpen ) ;
116
116
117
- WithTemporaryNonExclusiveQueue ( Model , ( m , q ) => m . BasicPublish ( "" , q , null , encoding . GetBytes ( "" ) ) ) ;
117
+ byte [ ] mb = RandomMessageBody ( ) ;
118
+ WithTemporaryNonExclusiveQueue ( Model , ( m , q ) => m . BasicPublish ( "" , q , null , mb ) ) ;
118
119
Wait ( latch ) ;
119
120
}
120
121
@@ -989,7 +990,8 @@ internal void AssertQueueRecovery(IModel m, string q, bool exclusive)
989
990
m . QueueDeclarePassive ( q ) ;
990
991
QueueDeclareOk ok1 = m . QueueDeclare ( q , false , exclusive , false , null ) ;
991
992
Assert . AreEqual ( ok1 . MessageCount , 0 ) ;
992
- m . BasicPublish ( "" , q , null , encoding . GetBytes ( "" ) ) ;
993
+ byte [ ] mb = RandomMessageBody ( ) ;
994
+ m . BasicPublish ( "" , q , null , mb ) ;
993
995
Assert . IsTrue ( WaitForConfirms ( m ) ) ;
994
996
QueueDeclareOk ok2 = m . QueueDeclare ( q , false , exclusive , false , null ) ;
995
997
Assert . AreEqual ( ok2 . MessageCount , 1 ) ;
@@ -1024,11 +1026,20 @@ internal void CloseAndWaitForRecovery()
1024
1026
1025
1027
internal void CloseAndWaitForRecovery ( AutorecoveringConnection conn )
1026
1028
{
1029
+ System . Console . WriteLine ( "@@@@@@@@ CloseAndWaitForRecovery START" ) ;
1027
1030
ManualResetEventSlim sl = PrepareForShutdown ( conn ) ;
1028
1031
ManualResetEventSlim rl = PrepareForRecovery ( conn ) ;
1032
+ System . Console . WriteLine ( "@@@@@@@@ CloseAndWaitForRecovery Closing Connection START" ) ;
1029
1033
CloseConnection ( conn ) ;
1034
+ System . Console . WriteLine ( "@@@@@@@@ CloseAndWaitForRecovery Closing Connection DONE" ) ;
1035
+
1036
+ System . Console . WriteLine ( "@@@@@@@@ CloseAndWaitForRecovery Shutdown Wait START" ) ;
1030
1037
Wait ( sl ) ;
1038
+ System . Console . WriteLine ( "@@@@@@@@ CloseAndWaitForRecovery Shutdown Wait DONE" ) ;
1039
+
1040
+ System . Console . WriteLine ( "@@@@@@@@ CloseAndWaitForRecovery Recovery Wait START" ) ;
1031
1041
Wait ( rl ) ;
1042
+ System . Console . WriteLine ( "@@@@@@@@ CloseAndWaitForRecovery Recovery Wait DONE" ) ;
1032
1043
}
1033
1044
1034
1045
internal void CloseAndWaitForShutdown ( AutorecoveringConnection conn )
@@ -1083,9 +1094,10 @@ internal void TestDelayedBasicAckNackAfterChannelRecovery(TestBasicConsumer1 con
1083
1094
AutorecoveringConnection publishingConn = CreateAutorecoveringConnection ( ) ;
1084
1095
IModel publishingModel = publishingConn . CreateModel ( ) ;
1085
1096
1097
+ byte [ ] mb = RandomMessageBody ( ) ;
1086
1098
for ( int i = 0 ; i < n ; i ++ )
1087
1099
{
1088
- publishingModel . BasicPublish ( "" , q , null , encoding . GetBytes ( "" ) ) ;
1100
+ publishingModel . BasicPublish ( "" , q , null , mb ) ;
1089
1101
}
1090
1102
1091
1103
Wait ( latch , TimeSpan . FromSeconds ( 20 ) ) ;
@@ -1157,7 +1169,6 @@ public class TestBasicConsumer1 : DefaultBasicConsumer
1157
1169
{
1158
1170
private readonly Action _action ;
1159
1171
private readonly ManualResetEventSlim _latch ;
1160
- private ushort _counter = 0 ;
1161
1172
1162
1173
public TestBasicConsumer1 ( IModel model , ManualResetEventSlim latch , Action fn )
1163
1174
: base ( model )
@@ -1176,19 +1187,21 @@ public override void HandleBasicDeliver(string consumerTag,
1176
1187
{
1177
1188
try
1178
1189
{
1179
- if ( deliveryTag == 7 && _counter < 10 )
1190
+ System . Console . WriteLine ( "@@@@@@@@ HandleBasicDeliver deliveryTag: {0}" , deliveryTag ) ;
1191
+
1192
+ if ( deliveryTag == 5 )
1180
1193
{
1181
1194
_action ( ) ;
1182
1195
}
1183
- if ( _counter == 9 )
1196
+
1197
+ if ( deliveryTag == 6 )
1184
1198
{
1185
1199
_latch . Set ( ) ;
1186
1200
}
1187
- PostHandleDelivery ( deliveryTag ) ;
1188
1201
}
1189
1202
finally
1190
1203
{
1191
- _counter += 1 ;
1204
+ PostHandleDelivery ( deliveryTag ) ;
1192
1205
}
1193
1206
}
1194
1207
0 commit comments