コード例 #1
0
        static void ObserverTest()
        {
            //create a subject
            MyTopic topic = new MyTopic();

            //create observers
            IObserver obj1 = new MyTopicSubscriber(name: "Obj1");
            IObserver obj2 = new MyTopicSubscriber(name: "Obj2");
            IObserver obj3 = new MyTopicSubscriber(name: "Obj3");

            //register them
            topic.register(obj1);
            topic.register(obj2);
            topic.register(obj3);

            //attach observer to subject
            obj1.setSubjet(topic);
            obj2.setSubjet(topic);
            obj3.setSubjet(topic);

            //check if any update is available
            obj1.update();

            //now send message to subject
            topic.postMessage("New Message");
        }
コード例 #2
0
 //Inserting data
 public void Insert(MyTopic newcontact)
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         dbConn.RunInTransaction(() =>
         {
             dbConn.Insert(newcontact);
         });
     }
 }
コード例 #3
0
ファイル: mytopics.cs プロジェクト: xiongeee/BBX
 protected override void ShowPage()
 {
     this.pagetitle = "用户控制面板";
     if (this.userid == -1)
     {
         base.AddErrLine("你尚未登录");
         return;
     }
     this.user = Users.GetUserInfo(this.userid);
     //this.topiccount = Topics.GetTopicsCountbyUserId(this.userid, false);
     this.topiccount  = MyTopic.FindCountByUid(userid);
     this.pagecount   = ((this.topiccount % 16 == 0) ? (this.topiccount / 16) : (this.topiccount / 16 + 1));
     this.pagecount   = ((this.pagecount == 0) ? 1 : this.pagecount);
     this.pageid      = ((this.pageid < 1) ? 1 : this.pageid);
     this.pageid      = ((this.pageid > this.pagecount) ? this.pagecount : this.pageid);
     this.topics      = Topics.GetTopicsByUserId(this.userid, this.pageid, 16, 600, this.config.Hottopic);
     this.pagenumbers = Utils.GetPageNumbers(this.pageid, this.pagecount, "mytopics.aspx", 8);
 }
コード例 #4
0
        public PubsubGameBoardQueue(
            IOptions <PubsubGameBoardQueueOptions> options,
            ILogger <PubsubGameBoardQueue> logger)
        {
            _options      = options;
            _logger       = logger;
            _publisherApi = PublisherServiceApiClient.Create();
            var subscriberApi = SubscriberServiceApiClient.Create();

            _publisherClient = PublisherClient.Create(MyTopic,
                                                      new[] { _publisherApi });
            _subscriberClient = SubscriberClient.Create(MySubscription,
                                                        new[] { subscriberApi }, new SubscriberClient.Settings()
            {
                StreamAckDeadline = TimeSpan.FromMinutes(1)
            });

            // Create the Topic and Subscription.
            try
            {
                _publisherApi.CreateTopic(MyTopic);
                _logger.LogInformation("Created {0}.", MyTopic.ToString());
            }
            catch (RpcException e)
                when(e.Status.StatusCode == StatusCode.AlreadyExists)
                {
                    // Already exists.  That's fine.
                }

            try
            {
                subscriberApi.CreateSubscription(MySubscription, MyTopic,
                                                 pushConfig: null, ackDeadlineSeconds: 10);
                _logger.LogInformation("Created {0}.",
                                       MySubscription.ToString());
            }
            catch (RpcException e)
                when(e.Status.StatusCode == StatusCode.AlreadyExists)
                {
                    // Already exists.  That's fine.
                }
        }
コード例 #5
0
ファイル: MainViewModel.cs プロジェクト: SebDev2I/Forum
 public void InitializeListMessage()
 {
     _Messages.Clear();
     if (MyTopic != null)
     {
         MyTopic.GetListMessagesByTopic();
         if (MyTopic.ListMessagesByTopic.Count == 0)
         {
             HasMessage = false;
         }
         else
         {
             HasMessage = true;
         }
         foreach (Message item in MyTopic.ListMessagesByTopic)
         {
             _Messages.Add(item);
         }
     }
 }
コード例 #6
0
ファイル: InvalidData.cs プロジェクト: shizhexu/opensplice
        private void runTests()
        {
            MyTopic userData;
            InstanceHandle writer1ID = InstanceHandle.Nil;
            InstanceHandle writer2ID = InstanceHandle.Nil;
            
            /**
             * @addtogroup group_dds1290
             *
             * \b Test \b ID: \b sacs_invalid_data_001
             *
             * \b Test \b Objectives:
             *
             * Initialization step for the main test purpose; in next testcase
             * the id of W1 is determined through this sent sample.
             *
             * \b Test \b Procedure:
             *
             * \e Action
             *
             * Write a data sample (with key 1) with writer W1 as an initialization
             * step of the main test goal. This write also registers the instance.
             *
             * \e Result
             * It is expected that the sample is successfully written. \n
             * If a failure occurs, the test fails, this is reported and no further testing is performed
             */
            /*--------------------------------------------------------------------------*/
            tfw.TestStart  ("sacs_invalid_data_001","invalid_data","write data");
            tfw.TestTitle  ("write a sample with writer W1, which immediately also registers the instance.");
            tfw.TestPurpose("Initialization step for the main test purpose, should not fail.");
            /*--------------------------------------------------------------------------*/
    
            if(proceed == true){
                result = ReturnCode.Ok;
                userData = new MyTopic();
    
                if(userData != null){
                    time.Sec++;
                    userData.long_1 = 1;
                    userData.str = "str";
                    userData.strArr = new string[3];
                    userData.strArr[0] = "strArr0";
                    userData.strArr[1] = "strArr1";
                    userData.strArr[2] = "strArr2";
                    userData.strUBSeq = new string[1];
                    userData.strUBSeq[0] = "strUBSeq0";
                    userData.strBSeq = new string[1];
                    userData.strBSeq[0] = "strBSeq0";
    
                    result = writer1.WriteWithTimestamp(userData, InstanceHandle.Nil, time);
    
                    if(result == ReturnCode.Ok){
                        tfw.TestResult("sample successfully written", "sample successfully written", TestVerdict.Pass, TestVerdict.Pass);
                    } else {
                        tfw.TestResult("sample successfully written", "sample NOT successfully written", TestVerdict.Pass, TestVerdict.Fail);
                        proceed = false;
                    }
                } else {
                    tfw.TestResult("sample successfully written", "could not allocate sample", TestVerdict.Pass, TestVerdict.Fail);
                    proceed = false;
                }
            } else {
                tfw.TestResult("OK", "Unresolved", TestVerdict.Pass, TestVerdict.Unresolved);
            }
    
            tfw.TestFinish();
            /**
             * @addtogroup group_dds1290
             *
             * \b Test \b ID: \b sacs_invalid_data_002
             *
             * \b Test \b Objectives:
             *
             * Determine writer W1's ID.
             *
             * \b Test \b Procedure:
             *
             * \e Action
             *
             * The reader takes the sample to determine writer W1's ID.
             *
             * \e Result
             * If the take is successful, the sample is checked to see if it matches
             * the written sample. Then writer W1's ID is recorded for later matching purposes.
             */
            /*--------------------------------------------------------------------------*/
            tfw.TestStart  ("sacs_invalid_data_002","invalid_data","take data");
            tfw.TestTitle  ("take data with the reader.");
            tfw.TestPurpose("determine writer W1's ID.");
            /*--------------------------------------------------------------------------*/
    
            if(proceed == true){
                result = reader.Take(
                        ref sampleSeq,
                        ref infoSeq,
                        Length.Unlimited,
                        SampleStateKind.NotRead,
                        ViewStateKind.Any,
                        InstanceStateKind.Alive);
    
                if(result == ReturnCode.Ok){
                    if(sampleSeq.Length == 1){
                        if(infoSeq[0].ValidData == true){
                            if(sampleSeq[0].long_1 == 1 ){
                                writer1ID = infoSeq[0].PublicationHandle;
                                tfw.TestResult("take sample contains the correct data", "take sample contains the correct data", TestVerdict.Pass, TestVerdict.Pass);
                            } else {
                                tfw.TestResult("take sample success", "take sample returned OK, but the sample's contents were incorrect", TestVerdict.Pass, TestVerdict.Fail);
                            }
                        } else {
                            tfw.TestResult("take sample is valid", "take sample is invalid", TestVerdict.Pass, TestVerdict.Fail);
                        }
                    } else {
                        string msg;
                        if(sampleSeq.Length > 1){
                            msg = "more than 1 sample taken";
                        } else {
                            msg = "less than 1 sample taken";
                        }
                        tfw.TestResult("1 sample successfully taken", msg, TestVerdict.Pass, TestVerdict.Fail);
                    }
                    reader.ReturnLoan(ref sampleSeq, ref infoSeq);
    
                } else {
                    reportResultCode(result);
                    tfw.TestResult("take sample success", "take sample did not return OK", TestVerdict.Pass, TestVerdict.Fail);
                }
            } else {
                tfw.TestResult("OK", "Unresolved", TestVerdict.Pass, TestVerdict.Unresolved);
            }
    
            tfw.TestFinish();
    
            /**
             * @addtogroup group_dds1290
             *
             * \b Test \b ID: \b sacs_invalid_data_003
             *
             * \b Test \b Objectives:
             *
             * Initialization step for the main test purpose; in next testcase
             * the id of W2 is determined through this sent sample.
             *
             *
             * \b Test \b Procedure:
             *
             * \e Action
             *
             * Write a data sample (with key 2) with writer W2 as an initialization
             * step of the main test goal. This write implicitly also registers the instance.
             *
             * \e Result
             * It is expected that the sample is successfully written. \n
             * If a failure occurs, the test fails, this is reported and no further testing is performed
             */
            /*--------------------------------------------------------------------------*/
            tfw.TestStart  ("sacs_invalid_data_003","invalid_data","write data");
            tfw.TestTitle  ("write a sample with writer W2, which immediately also registers the instance.");
            tfw.TestPurpose("Initialization step for the main test purpose, should not fail.");
            /*--------------------------------------------------------------------------*/
    
            if(proceed == true){
                result = ReturnCode.Ok;
                userData = new MyTopic();
    
                if(userData != null){
                    time.Sec++;
                    userData.long_1 = 2;
                    userData.str = "str";
                    userData.strArr[0] = "strArr0";
                    userData.strArr[1] = "strArr1";
                    userData.strArr[2] = "strArr2";
                    userData.strUBSeq = new string[0];
                    userData.strBSeq = new string[0];
    
                    result = writer2.WriteWithTimestamp(userData, InstanceHandle.Nil, time);
    
                    if(result == ReturnCode.Ok){
                        tfw.TestResult("sample successfully written", "sample successfully written", TestVerdict.Pass, TestVerdict.Pass);
                    } else {
                        tfw.TestResult("sample successfully written", "sample NOT successfully written", TestVerdict.Pass, TestVerdict.Fail);
                        proceed = false;
                    }
                } else {
                    tfw.TestResult("sample successfully written", "could not allocate sample", TestVerdict.Pass, TestVerdict.Fail);
                    proceed = false;
                }
            } else {
                tfw.TestResult("OK", "Unresolved", TestVerdict.Pass, TestVerdict.Unresolved);
            }
    
            tfw.TestFinish();
    
            /**
             * @addtogroup group_dds1290
             *
             * \b Test \b ID: \b sacs_invalid_data_004
             *
             * \b Test \b Objectives:
             *
             * Determine writer W2's ID.
             *
             * \b Test \b Procedure:
             *
             * \e Action
             *
             * The reader takes the sample to determine writer W2's ID.
             *
             * \e Result
             * If the take is successful, the sample is checked to see if it matches
             * the written sample. Then writer W2's ID is recorded for later matching purposes.
             */
            /*--------------------------------------------------------------------------*/
            tfw.TestStart  ("sacs_invalid_data_004","invalid_data","take data");
            tfw.TestTitle  ("take data with the reader.");
            tfw.TestPurpose("determine writer W2's ID.");
            /*--------------------------------------------------------------------------*/
    
            if(proceed == true){
                result = reader.Take(
                        ref sampleSeq,
                        ref infoSeq,
                        Length.Unlimited,
                        SampleStateKind.NotRead,
                        ViewStateKind.Any,
                        InstanceStateKind.Any);
    
                if(result == ReturnCode.Ok){
                    if(sampleSeq.Length == 1){
                        if(infoSeq[0].ValidData == true){
                            if(sampleSeq[0].long_1 == 2 ){
                                writer2ID = infoSeq[0].PublicationHandle;
                                if(writer1ID != writer2ID){
                                    tfw.TestResult("take sample contains the correct data", "take sample contains the correct data", TestVerdict.Pass, TestVerdict.Pass);
                                } else {
                                    tfw.TestResult("writer2ID differs from writer1ID", "writer1ID and writer2ID are equal", TestVerdict.Pass, TestVerdict.Fail);
                                }
                            } else {
                                tfw.TestResult("take sample success", "take sample returned OK, but the sample's contents were incorrect", TestVerdict.Pass, TestVerdict.Fail);
                            }
                        } else {
                            tfw.TestResult("take sample is valid", "take sample is invalid", TestVerdict.Pass, TestVerdict.Fail);
                        }
                    } else {
                        string msg;
                        if(sampleSeq.Length > 1){
                            msg = "more than 1 sample taken";
                        } else {
                            msg = "less than 1 sample taken";
                        }
                        tfw.TestResult("1 sample successfully taken", msg, TestVerdict.Pass, TestVerdict.Fail);
                    }
    
                    reader.ReturnLoan(ref sampleSeq, ref infoSeq);
                } else {
                    reportResultCode(result);
                    tfw.TestResult("take sample success", "take sample did not return OK", TestVerdict.Pass, TestVerdict.Fail);
                }
            } else {
                tfw.TestResult("OK", "Unresolved", TestVerdict.Pass, TestVerdict.Unresolved);
            }
    
            tfw.TestFinish();
    
            /**
             * @addtogroup group_dds1290
             *
             * \b Test \b ID: \b sacs_invalid_data_005
             *
             * \b Test \b Objectives:
             *
             * Check validity of sampleinfo data when a invalid sample is sent after a
             * dispose.
             *
             * \b Test \b Procedure:
             *
             * \e Action
             *
             * Dispose sample 1 with writer W2, check the invalid sample received
             * by the reader from which writer it came and its source_timestamp.
             *
             * \e Result
             * It is expected that the publication_handle of the dispose sample points to writer W2. \n
             * If a failure occurs, the test fails.
             */
            /*--------------------------------------------------------------------------*/
            tfw.TestStart  ("sacs_invalid_data_005","invalid_data","dispose data");
            tfw.TestTitle  ("dispose sample 1 with writer W2, check publication_handle and source timestamp");
            tfw.TestPurpose("The publication_handle and source timestamp should be that of writer W2.");
            /*--------------------------------------------------------------------------*/
    
            if(proceed == true){
                result = ReturnCode.Ok;
                userData = new MyTopic();
    
                if(userData != null){
                    time.Sec++;
                    int expectedSec = time.Sec;
                    userData.long_1 = 1;
                    userData.str = "str";
                    userData.strArr[0] = "strArr0";
                    userData.strArr[1] = "strArr1";
                    userData.strArr[2] = "strArr2";
                    userData.strUBSeq = new string[0];
                    userData.strBSeq = new string[0];
    
                    result = writer2.DisposeWithTimestamp(userData, InstanceHandle.Nil, time);
    
                    if(result == ReturnCode.Ok){
                        result = reader.Take(
                                ref sampleSeq,
                                ref infoSeq,
                                Length.Unlimited,
                                SampleStateKind.NotRead,
                                ViewStateKind.Any,
                                InstanceStateKind.Any);
    
                        if(result == ReturnCode.Ok){
                            if(sampleSeq.Length == 1){
                                if(sampleSeq[0].long_1 == 1){
                                    if(infoSeq[0].ValidData == false){
                                        if(infoSeq[0].InstanceState == InstanceStateKind.NotAliveDisposed){
                                            if(infoSeq[0].PublicationHandle == writer2ID){
                                                if(infoSeq[0].SourceTimestamp.Sec == expectedSec
                                                        && infoSeq[0].SourceTimestamp.NanoSec == 0){
                                                    tfw.TestResult("publication_handle and source time stamp are correct", "publication_handle and source time stamp are correct", TestVerdict.Pass, TestVerdict.Pass);
                                                } else {
                                                    tfw.TestResult("source time stamp is correct", "source time stamp is incorrect", TestVerdict.Pass, TestVerdict.Fail);
                                                }
                                            } else {
                                                tfw.TestResult("publication_handle is correct", "incorrect publication_handle", TestVerdict.Pass, TestVerdict.Fail);
                                            }
                                        } else {
                                            tfw.TestResult("instance_state is disposed", "instance_state is NOT disposed", TestVerdict.Pass, TestVerdict.Fail);
                                        }
                                    } else {
                                        tfw.TestResult("take sample success", "expected invalid data, received valid data", TestVerdict.Pass, TestVerdict.Fail);
                                    }
                                } else {
                                    tfw.TestResult("take sample success", "sample contains incorrect data", TestVerdict.Pass, TestVerdict.Fail);
                                }
                            } else {
                                tfw.TestResult("take sample success", "incorrect amount of data taken", TestVerdict.Pass, TestVerdict.Fail);
                            }
                            reader.ReturnLoan(ref sampleSeq, ref infoSeq);
                        } else {
                            reportResultCode(result);
                            tfw.TestResult("take sample success", "take did not return OK", TestVerdict.Pass, TestVerdict.Fail);
                        }
                    } else {
                        tfw.TestResult("sample successfully written", "sample NOT successfully written", TestVerdict.Pass, TestVerdict.Fail);
                        proceed = false;
                    }
                } else {
                    tfw.TestResult("sample successfully written", "could not allocate sample", TestVerdict.Pass, TestVerdict.Fail);
                    proceed = false;
                }
            } else {
                tfw.TestResult("OK", "Unresolved", TestVerdict.Pass, TestVerdict.Unresolved);
            }
    
            tfw.TestFinish();
    
            /**
             * @addtogroup group_dds1290
             *
             * \b Test \b ID: \b sacs_invalid_data_006
             *
             * \b Test \b Objectives:
             *
             * Check validity of sampleinfo data when a invalid sample is sent after an
             * unregister.
             *
             * \b Test \b Procedure:
             *
             * \e Action
             *
             * First register (via write) and then unregister sample 2 with writer W1,
             * check the invalid sample received by the reader from which writer
             * it came and its source_timestamp. After the first register of W1, unregister
             * W2 on sample 2, so that only W1 is registered for this instance.
             *
             * \e Result
             * It is expected that the publication_handle of the unregister sample points to writer W2. \n
             * If a failure occurs, the test fails.
             */
            /*--------------------------------------------------------------------------*/
            tfw.TestStart  ("sacs_invalid_data_006","invalid_data","dispose data");
            tfw.TestTitle  ("unregister sample 2 with writer W1, check publication_handle and source timestamp");
            tfw.TestPurpose("The publication_handle and source timestamp should be that of writer W1.");
            /*--------------------------------------------------------------------------*/
    
            if(proceed == true){
                int expectedSec = -1;
                result = ReturnCode.Ok;
                userData = new MyTopic();
    
                if(userData != null){
                    time.Sec++;
    
                    userData.long_1 = 2;
                    userData.str = "str";
                    userData.strArr[0] = "strArr0";
                    userData.strArr[1] = "strArr1";
                    userData.strArr[2] = "strArr2";
                    userData.strUBSeq = new string[0];
                    userData.strBSeq = new string[0];
    
                    result = writer1.WriteWithTimestamp(userData, InstanceHandle.Nil, time);
    
                    if(result == ReturnCode.Ok){
                        time.Sec++;
    
                        result = writer2.UnregisterInstanceWithTimestamp(userData, InstanceHandle.Nil, time);
                        if(result == ReturnCode.Ok){
                            /* reader take */
                            result = reader.Take(
                                            ref sampleSeq, ref infoSeq, 
                                            Length.Unlimited,
                                            SampleStateKind.Any,
                                            ViewStateKind.Any,
                                            InstanceStateKind.Any);
                            if(result == ReturnCode.Ok){
                                time.Sec++;
                                expectedSec = time.Sec;
    
                                reader.ReturnLoan(ref sampleSeq, ref infoSeq);
    
                                userData.long_1 = 2;
                                result = writer1.UnregisterInstanceWithTimestamp(userData, InstanceHandle.Nil, time);
                                if(result != ReturnCode.Ok){
                                    reportResultCode(result);
                                    tfw.TestMessage(TestMessage.Error, "unregister did not return OK");
                                    proceed = false;
                                }
    
                            } else {
                                reportResultCode(result);
                                tfw.TestMessage(TestMessage.Error, "take did not return OK");
                                proceed = false;
                            }
                        } else {
                            reportResultCode(result);
                            tfw.TestMessage(TestMessage.Error, "unregister of sample 2 by writer 2 did not return OK");
                            proceed = false;
                        }
                    } else {
                        reportResultCode(result);
                        tfw.TestMessage(TestMessage.Error, "write did not return OK");
                        proceed = false;
                    }
    
                    if(proceed == true){
                        if(result == ReturnCode.Ok){
                            result = reader.Take(
                                    ref sampleSeq,
                                    ref infoSeq,
                                    Length.Unlimited,
                                    SampleStateKind.Any,
                                    ViewStateKind.Any,
                                    InstanceStateKind.Any);
    
                            if(result == ReturnCode.Ok){
                                if(sampleSeq.Length == 1){
                                    if(sampleSeq[0].long_1 == 2){
                                        if(infoSeq[0].ValidData == false){
                                            if(infoSeq[0].InstanceState == InstanceStateKind.NotAliveNoWriters){
                                                if(infoSeq[0].PublicationHandle == writer1ID){
                                                    if(expectedSec >= 0 && infoSeq[0].SourceTimestamp.Sec == expectedSec
                                                            && infoSeq[0].SourceTimestamp.NanoSec == 0){
                                                        tfw.TestResult("publication_handle and source time stamp are correct", "publication_handle and source time stamp are correct", TestVerdict.Pass, TestVerdict.Pass);
                                                    } else {
                                                        tfw.TestResult("source time stamp is correct", "source time stamp is incorrect", TestVerdict.Pass, TestVerdict.Fail);
                                                    }
                                                } else {
                                                    tfw.TestResult("publication_handle is correct", "incorrect publication_handle", TestVerdict.Pass, TestVerdict.Fail);
                                                }
                                            } else {
                                                tfw.TestResult("instance_state is disposed", "instance_state is NOT disposed", TestVerdict.Pass, TestVerdict.Fail);
                                            }
                                        } else {
                                            tfw.TestResult("take sample success", "expected invalid data, received valid data", TestVerdict.Pass, TestVerdict.Fail);
                                        }
                                    } else {
                                        tfw.TestResult("take sample success", "sample contains incorrect data", TestVerdict.Pass, TestVerdict.Fail);
                                    }
                                } else {
                                    tfw.TestResult("take sample success", "incorrect amount of data taken", TestVerdict.Pass, TestVerdict.Fail);
                                }
                                reader.ReturnLoan(ref sampleSeq, ref infoSeq);
                            } else {
                                reportResultCode(result);
                                tfw.TestResult("take sample success", "take did not return OK", TestVerdict.Pass, TestVerdict.Fail);
                            }
                        } else {
                            reportResultCode(result);
                            tfw.TestResult("sample successfully written", "sample NOT successfully written", TestVerdict.Pass, TestVerdict.Fail);
                            proceed = false;
                        }
                    } else {
                        reportResultCode(result);
                        tfw.TestResult("sample successfully written", "preliminary step failed", TestVerdict.Pass, TestVerdict.Fail);
                        proceed = false;
                    }
                } else {
                    tfw.TestResult("sample successfully written", "could not allocate sample", TestVerdict.Pass, TestVerdict.Fail);
                    proceed = false;
                }
            } else {
                tfw.TestResult("OK", "Unresolved", TestVerdict.Pass, TestVerdict.Unresolved);
            }
    
            tfw.TestFinish();
    
//            /**
//             * @addtogroup group_dds1290
//             *
//             * \b Test \b ID: \b sacs_invalid_data_007
//             *
//             * \b Test \b Objectives:
//             *
//             * Check validity of sampleinfo data when invalid samples are caused by a
//             * call to dispose_all_data.
//             *
//             * \b Test \b Procedure:
//             *
//             * \e Action
//             *
//             * First write sample 2 and 3 with writer W1, then check the invalid samples
//             * received by the reader, from which writer it came, and its source_timestamp.
//             *
//             * \e Result
//             * It is expected that the publication_handles of the dispose_all samples are NIL,
//             * and that the timestamp should be the bigger than the current time just before
//             * the dispose_all_data event was performed.\n
//             * If a failure occurs, the test fails.
//             */
//            /*--------------------------------------------------------------------------*/
//            tfw.TestStart  ("sacs_invalid_data_007","invalid_data","dispose_all_data");
//            tfw.TestTitle  ("dispose samples 2 and 3 with dispose_all_data, check publication_handle and source timestamp");
//            tfw.TestPurpose("The publication_handle be NIL, the timestamp >= current time just before dispose_all");
//            /*--------------------------------------------------------------------------*/
//    
//            if(proceed == true){
//                result = ReturnCode.Ok;
//                userData = new MyTopic();
//    
//                if(userData != null){
//                    time.Sec++;
//    
//                    userData.long_1 = 2;
//                    userData.str = "str";
//                    userData.strArr[0] = "strArr0";
//                    userData.strArr[1] = "strArr1";
//                    userData.strArr[2] = "strArr2";
//                    userData.strUBSeq = new string[0];
//                    userData.strBSeq = new string[0];
//    
//                    result = writer1.write_w_timestamp(userData, InstanceHandle.Nil, time);
//                    if(result == ReturnCode.Ok){
//                        userData.long_1 = 3;
//                        time.Sec++;
//                        result = writer1.write_w_timestamp(userData, InstanceHandle.Nil, time);
//        
//                        if(result == ReturnCode.Ok){
//                            /* reader take */
//                            result = reader.Take(
//                                            sampleSeq, 
//                                            infoSeq, 
//                                            LENGTH_UNLIMITED, 
//                                            ANY_SAMPLE_STATE, 
//                                            ANY_VIEW_STATE, 
//                                            ANY_INSTANCE_STATE);
//                            if(result == ReturnCode.Ok){
//                                Time_tHolder tHolder = new Time_tHolder();
//        
//                                if (sampleSeq.Length != 2 || sampleSeq[0].long_1 != 2 || sampleSeq[1].long_1 != 3)
//                                {
//                                    proceed = false;
//                                    tfw.TestMessage(TestMessage.Error, "Take for valid samples did not return the correct samples.");
//                                }
//                                reader.ReturnLoan(sampleSeq, infoSeq);
//        
//                                participant.get_current_time(tHolder);
//                                time = tHolder;
//                                result = topic.dispose_all_data();
//                                if(result != ReturnCode.Ok){
//                                    reportResultCode(result);
//                                    tfw.TestMessage(TestMessage.Error, "unregister did not return OK");
//                                    proceed = false;
//                                }
//        
//                            } else {
//                                reportResultCode(result);
//                                tfw.TestMessage(TestMessage.Error, "take did not return OK");
//                                proceed = false;
//                            }
//                        } else {
//                            reportResultCode(result);
//                            tfw.TestMessage(TestMessage.Error, "2nd write did not return OK");
//                            proceed = false;
//                        }
//                    } else {
//                        reportResultCode(result);
//                        tfw.TestMessage(TestMessage.Error, "1st write did not return OK");
//                        proceed = false;
//                    }
//    
//                    if(proceed == true){
//                        /* Sleep for 5 seconds to give spliced the time to dispose the samples. */
//                        Thread.sleep(5000);
//                        if(result == ReturnCode.Ok){
//                            result = reader.Take(
//                                    sampleSeq,
//                                    infoSeq,
//                                    LENGTH_UNLIMITED,
//                                    ANY_SAMPLE_STATE,
//                                    ANY_VIEW_STATE,
//                                    NOT_ALIVE_DISPOSED_INSTANCE_STATE);
//    
//                            if(result == ReturnCode.Ok){
//                                if(sampleSeq.Length == 2){
//                                    if(sampleSeq[0].long_1 == 2 && sampleSeq[1].long_1 == 3){
//                                        if(infoSeq[0].ValidData == false && infoSeq[1].ValidData == false){
//                                            if(infoSeq[0].InstanceState == NOT_ALIVE_DISPOSED_INSTANCE_STATE &&
//                                                    infoSeq[1].InstanceState == NOT_ALIVE_DISPOSED_INSTANCE_STATE){
//                                                if(infoSeq[0].PublicationHandle == InstanceHandle.Nil &&
//                                                        infoSeq[1].PublicationHandle == InstanceHandle.Nil){
//                                                    if(timeCompare(time, infoSeq[0].SourceTimestamp) > 0 &&
//                                                            infoSeq[0].SourceTimestamp.Sec == infoSeq[1].SourceTimestamp.Sec &&
//                                                            infoSeq[0].SourceTimestamp.NanoSec == infoSeq[1].SourceTimestamp.NanoSec) {
//                                                        tfw.TestResult("publication_handles and source time stamps are correct", "publication_handles and source time stamps are correct", TestVerdict.Pass, TestVerdict.Pass);
//                                                    } else {
//                                                        tfw.TestResult("source time stamps are correct", "source time stamps are incorrect", TestVerdict.Pass, TestVerdict.Fail);
//                                                    }
//                                                } else {
//                                                    tfw.TestResult("publication_handles are correct", "incorrect publication_handles", TestVerdict.Pass, TestVerdict.Fail);
//                                                }
//                                            } else {
//                                                tfw.TestResult("instance_state is disposed", "instance_state is NOT disposed", TestVerdict.Pass, TestVerdict.Fail);
//                                            }
//                                        } else {
//                                            tfw.TestResult("take sample success", "expected invalid data, received valid data", TestVerdict.Pass, TestVerdict.Fail);
//                                        }
//                                    } else {
//                                        tfw.TestResult("take sample success", "samples contain incorrect data", TestVerdict.Pass, TestVerdict.Fail);
//                                    }
//                                } else {
//                                    tfw.TestResult("take sample success", "incorrect amount of data taken", TestVerdict.Pass, TestVerdict.Fail);
//                                }
//                                reader.ReturnLoan(sampleSeq, infoSeq);
//                            } else {
//                                reportResultCode(result);
//                                tfw.TestResult("take sample success", "take did not return OK", TestVerdict.Pass, TestVerdict.Fail);
//                            }
//                        } else {
//                            reportResultCode(result);
//                            tfw.TestResult("sample successfully written", "sample NOT successfully written", TestVerdict.Pass, TestVerdict.Fail);
//                            proceed = false;
//                        }
//                    } else {
//                        reportResultCode(result);
//                        tfw.TestResult("sample successfully written", "preliminary step failed", TestVerdict.Pass, TestVerdict.Fail);
//                        proceed = false;
//                    }
//                } else {
//                    tfw.TestResult("sample successfully written", "could not allocate sample", TestVerdict.Pass, TestVerdict.Fail);
//                    proceed = false;
//                }
//            } else {
//                tfw.TestResult("OK", "Unresolved", TestVerdict.Pass, TestVerdict.Unresolved);
//            }
//    
//            tfw.TestFinish();
//    
        }