public override Test.Framework.TestResult Run() { DDS.GuardCondition condition; DDS.WaitSet waitset; Test.Framework.TestResult result; Condition1.GuardConditionWaitset threadedWaitset; DDS.ReturnCode rc; string expResult = "StatusCondition test succeeded."; result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict .Pass, Test.Framework.TestVerdict.Fail); condition = new DDS.GuardCondition(); waitset = new DDS.WaitSet(); waitset.AttachCondition(condition); DDS.ICondition[] activeConditions = new DDS.ICondition[0]; rc = waitset.Wait(ref activeConditions, new DDS.Duration(3, 0)); if (rc != DDS.ReturnCode.Timeout) { result.Result = "WaitSet.Wait failed."; return(result); } if (activeConditions.Length > 0) { result.Result = "WaitSet.Wait returned condition where it shouldn't."; return(result); } threadedWaitset = new test.sacs.Condition1.GuardConditionWaitset(this, waitset); threadedWaitset.Start(); condition.SetTriggerValue(true); try { threadedWaitset.Join(); } catch (System.Exception e) { System.Console.WriteLine(e); } if (!threadedWaitset.Succeeded()) { result.Result = "GuardCondition trigger does not work properly."; return(result); } result.Result = expResult; result.Verdict = Test.Framework.TestVerdict.Pass; return(result); }
public override Test.Framework.TestResult Run() { DDS.GuardCondition condition; DDS.WaitSet waitset; Test.Framework.TestResult result; Condition1.GuardConditionWaitset threadedWaitset; DDS.ReturnCode rc; string expResult = "StatusCondition test succeeded."; result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict .Pass, Test.Framework.TestVerdict.Fail); condition = new DDS.GuardCondition(); waitset = new DDS.WaitSet(); waitset.AttachCondition(condition); DDS.ICondition[] activeConditions = new DDS.ICondition[0]; rc = waitset.Wait(ref activeConditions, new DDS.Duration(3, 0)); if (rc != DDS.ReturnCode.Timeout) { result.Result = "WaitSet.Wait failed."; return result; } if (activeConditions.Length > 0) { result.Result = "WaitSet.Wait returned condition where it shouldn't."; return result; } threadedWaitset = new test.sacs.Condition1.GuardConditionWaitset(this, waitset); threadedWaitset.Start(); condition.SetTriggerValue(true); try { threadedWaitset.Join(); } catch (System.Exception e) { System.Console.WriteLine(e); } if (!threadedWaitset.Succeeded()) { result.Result = "GuardCondition trigger does not work properly."; return result; } result.Result = expResult; result.Verdict = Test.Framework.TestVerdict.Pass; return result; }
public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase) { Test.Framework.TestResult result = null; //DDS.DomainParticipantFactory.Instance; DDS.GuardCondition condition1 = new DDS.GuardCondition(); DDS.GuardCondition condition2 = new DDS.GuardCondition(); DDS.GuardCondition condition3 = new DDS.GuardCondition(); testCase.RegisterObject("condition1", condition1); testCase.RegisterObject("condition2", condition2); testCase.RegisterObject("condition3", condition3); // TODO: JLS, should one of these TestVerdicts be Fail? result = new Test.Framework.TestResult("creation of 3 GuardCondions is succesfull" , "succesfully created 3 GuardConditions", Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Pass); return(result); }
public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase) { Test.Framework.TestResult result = null; //DDS.DomainParticipantFactory.Instance; DDS.GuardCondition condition1 = new DDS.GuardCondition(); DDS.GuardCondition condition2 = new DDS.GuardCondition(); DDS.GuardCondition condition3 = new DDS.GuardCondition(); testCase.RegisterObject("condition1", condition1); testCase.RegisterObject("condition2", condition2); testCase.RegisterObject("condition3", condition3); // TODO: JLS, should one of these TestVerdicts be Fail? result = new Test.Framework.TestResult("creation of 3 GuardCondions is succesfull" , "succesfully created 3 GuardConditions", Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Pass); return result; }
public override Test.Framework.TestResult Run() { Test.Framework.TestResult result; Test.Framework.TestVerdict expVerdict = Test.Framework.TestVerdict.Pass; string expResult = "Resolving GuardCondition succeeded."; DDS.ICondition[] holder = null; DDS.ReturnCode[] resultCode = new DDS.ReturnCode[] { DDS.ReturnCode.Error, DDS.ReturnCode.Error, DDS.ReturnCode.Error }; DDS.ReturnCode ddsReturnCode; bool continueTesting = true; DDS.GuardCondition condition1 = (DDS.GuardCondition)ResolveObject("condition1"); DDS.GuardCondition condition2 = (DDS.GuardCondition)ResolveObject("condition2"); DDS.GuardCondition condition3 = (DDS.GuardCondition)ResolveObject("condition3"); DDS.WaitSet waitset = new DDS.WaitSet(); resultCode[0] = waitset.AttachCondition(condition1); resultCode[1] = waitset.AttachCondition(condition2); resultCode[2] = waitset.AttachCondition(condition3); if (resultCode[0] != 0 || resultCode[1] != 0 || resultCode[2] != 0) { result = new Test.Framework.TestResult("attached guardconditions to a waitset", "attach_condition returned RETCODE: " + resultCode[0] + " " + resultCode[1] + " " + resultCode[2], expVerdict, Test.Framework.TestVerdict.Fail); continueTesting = false; } else { result = new Test.Framework.TestResult(expResult, "get_conditions returned RETCODE_OK" , expVerdict, Test.Framework.TestVerdict.Pass); } if (continueTesting) { ddsReturnCode = waitset.GetConditions(ref holder); if (ddsReturnCode != DDS.ReturnCode.Ok) { result = new Test.Framework.TestResult(expResult, "get_conditions returned RETCODE: " + ddsReturnCode, expVerdict, Test.Framework.TestVerdict.Fail); } else { result = new Test.Framework.TestResult(expResult, "get_conditions returned RETCODE_OK" , expVerdict, Test.Framework.TestVerdict.Pass); } if (holder.Length != 3) { result = new Test.Framework.TestResult(expResult, "Did not resolve 3 GuardCondition objects" , expVerdict, Test.Framework.TestVerdict.Fail); } else { if ((holder[0] != condition1) && (holder[1] != condition1) && (holder[2] != condition1)) { result = new Test.Framework.TestResult(expResult, "Resolved GuardCondition objects not OK (1)" , expVerdict, Test.Framework.TestVerdict.Fail); return(result); } if ((holder[0] != condition2) && (holder[1] != condition2) && (holder[2] != condition2)) { result = new Test.Framework.TestResult(expResult, "Resolved GuardCondition objects not OK (2)" , expVerdict, Test.Framework.TestVerdict.Fail); return(result); } if ((holder[0] != condition3) && (holder[1] != condition3) && (holder[2] != condition3)) { result = new Test.Framework.TestResult(expResult, "Resolved GuardCondition objects not OK (3)" , expVerdict, Test.Framework.TestVerdict.Fail); return(result); } result = new Test.Framework.TestResult(expResult, "Resolved 3 GuardCondition objects" , expVerdict, Test.Framework.TestVerdict.Pass); } } return(result); }