From: Hwankyu Jhun Date: Mon, 29 Mar 2021 06:18:01 +0000 (+0900) Subject: [Applications.ComponentBased][TCSACR-406][Update testcase] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb4aa0fd3c55246051c8ecf17d17a6bc6589dcd8;p=test%2Ftct%2Fcsharp%2Fapi.git [Applications.ComponentBased][TCSACR-406][Update testcase] Adds: - WaitForPort_CHECK() - Send_CHECK_WITH_IOEXCEPTION() - SendAndReceive_CHECK_WITH_IOEXCEPTION() - SendAndReceiveAsync_CHECK_WITHOUT_EXCEPTION() - SendAndReceiveAsync_CHECK_WITH_ARUMENTEXCEPTION() - SendAndReceiveAsync_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION() - SendAndReceiveAsync_CHECK_WITH_IOEXCEPTION() - RequestReceived_CHECK() - ComponentTask_INIT() - Start_CHECK_RUNNING() - Stop_CHECK_RUNNING() - IsRunning_CHECK() - Port_GET() - Sender_GET() - Request_GET() - IsReplyRequested_CHECK() - Reply_SET_AND_GET() Removes: - OnRequestEvent_CHECK() - OnSyncRequestEvent_CHECK() Changes: - ComponentPort_INIT() - ComponentPort_INIT_WITH_NULL_AND_CHECK_ARGUMENTEXCEPTION() - ComponentPort_INIT_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION() - ComponentPort_INIT_AND_CHECK_IOEXCEPTION() - SendSync_CHECK_WITHOUT_EXCEPTION() => SendAndReceive_CHECK_WITHOUT_EXCEPTION - SendSync_CHECK_WITHOUT_EXCEPTION() => SendAndReceive_CHECK_WITH_ARGUMENTEXCEPTION() - SendSync_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION() => SendAndReceive_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION() Change-Id: I7571bc0dac759f25d0d1d5fca3e19c035cc12a2e Signed-off-by: Hwankyu Jhun --- diff --git a/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/code/ComponentPortTest/ComponentPortTest/ComponentPortTest.csproj b/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/code/ComponentPortTest/ComponentPortTest/ComponentPortTest.csproj index 0da868b..306e554 100755 --- a/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/code/ComponentPortTest/ComponentPortTest/ComponentPortTest.csproj +++ b/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/code/ComponentPortTest/ComponentPortTest/ComponentPortTest.csproj @@ -19,7 +19,7 @@ - + Runtime diff --git a/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/code/ComponentPortTest/ComponentPortTest/Port.cs b/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/code/ComponentPortTest/ComponentPortTest/Port.cs deleted file mode 100755 index dbe9e2f..0000000 --- a/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/code/ComponentPortTest/ComponentPortTest/Port.cs +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using Tizen.Applications.ComponentBased; - -namespace ServicePort -{ - public sealed class Port : ComponentPort - { - public Port(string name) : base(name) - { - Log.Info("Port(): " + PortName); - } - - protected override void OnRequestEvent(string sender, object request) - { - Log.Info("OnRequestEvent() sender: " + sender); - if (request.GetType() == typeof(Request)) - { - var req = (Request)request; - Log.Info("Command: " + req.Command + " Sequence: " + req.Sequence + " Message: " + req.Message); - - if (req.Command == "OnRequestEvent_CHECK") - { - Service.SendMessage(0); - } - } - else if (request.GetType() == typeof(Response)) - { - var res = (Response)request; - Log.Info("Command: " + res.Command + " Sequence: " + res.Sequence + " Result: " + res.Result); - } - } - - protected override object OnSyncRequestEvent(string sender, object request) - { - Log.Info("OnSyncRequestEvent() sender: " + sender); - Response res; - if (request.GetType() == typeof(Request)) - { - var req = (Request)request; - Log.Info("Command: " + req.Command + " Sequence: " + req.Sequence + " Message: " + req.Message); - - if (req.Command == "OnSyncRequestEvent_CHECK") - { - Service.SendMessage(0); - } - - res = new Response(req.Command, req.Sequence, 0); - } - else - { - Log.Error("Invalid request"); - res = new Response("Unknown", -1, -1); - } - - return res; - } - } - -} diff --git a/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/code/ComponentPortTest/ComponentPortTest/Service.cs b/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/code/ComponentPortTest/ComponentPortTest/Service.cs index fe7a201..177cd1f 100755 --- a/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/code/ComponentPortTest/ComponentPortTest/Service.cs +++ b/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/code/ComponentPortTest/ComponentPortTest/Service.cs @@ -15,8 +15,8 @@ */ using System; -using System.Threading; using Tizen.Applications; +using Tizen.Applications.ComponentBased; using Tizen.Applications.ComponentBased.Common; using Tizen.Applications.Messages; @@ -24,45 +24,75 @@ namespace ServicePort { public class Service : ServiceComponent { - private Thread _thread; - private Port _port; - private Port _dummyPort; - private Thread _dummyThread; + private ComponentTask _task; + private ComponentTask _dummyTask; private int _sequence = 0; private static string _command = string.Empty; private static string _caller = string.Empty; private static string _remotePortName = string.Empty; private static MessagePort _messagePort; - private void ThreadMethod() + private void OnMessageRecevied(object sender, MessageReceivedEventArgs args) { - Log.Info("ThreadMethod()"); - _port.WaitForEvent(); + Log.Info(""); } - private void DummyThreadMethod() + private void OnRequestReceived(object sender, RequestEventArgs args) { - Log.Info("DummyThreadMethod()"); - _dummyPort.WaitForEvent(); - } + Log.Info("OnRequestReceived() Sender: " + args.Sender); + var request = args.Request; + if (request.GetType() == typeof(Request)) + { + var req = (Request)request; + Log.Info("Command: " + req.Command + " Sequence: " + req.Sequence + " Message: " + req.Message); - private void OnMessageRecevied(object sender, MessageReceivedEventArgs args) - { - Log.Info(""); + if (req.Command == "RequestReceived_CHECK" || + req.Command == "Sender_GET" || + req.Command == "Request_GET") + { + SendMessage(0); + } + + if (args.IsReplyRequested) + { + args.Reply = new Response(req.Command, req.Sequence, 0); + if (req.Command == "IsReplyRequested_CHECK") + { + SendMessage(0); + } + else if (req.Command == "Reply_SET_AND_GET") + { + var reply = (Response)args.Reply; + SendMessage(reply.Result); + } + } + } + else if (request.GetType() == typeof(Response)) + { + var res = (Response)request; + Log.Info("Command: " + res.Command + " Sequence: " + res.Sequence + " Result: " + res.Result); + } + else + { + Log.Warn("Invalid request"); + if (args.IsReplyRequested) + { + args.Reply = new Response("Unknown", -1, -1); + } + } } public override bool OnCreate() { Log.Info("OnCreate()"); - _port = new Port("ServicePort"); - _port.AddPrivilege("http://tizen.org/privilege/appmanager.launch"); - _thread = new Thread(new ThreadStart(ThreadMethod)); - _thread.Start(); + _task = new ComponentTask(new ComponentPort("ServicePort")); + _task.Port.AddPrivilege("http://tizen.org/privilege/appmanager.launch"); + _task.Port.RequestReceived += OnRequestReceived; + _task.Start(); - _dummyPort = new Port("DummyPort"); - _dummyPort.AddPrivilege("http://tizen.org/privilege/datasharing"); - _dummyThread = new Thread(new ThreadStart(DummyThreadMethod)); - _dummyThread.Start(); + _dummyTask = new ComponentTask(new ComponentPort("DummyPort")); + _dummyTask.Port.AddPrivilege("http://tizen.org/privilege/datasharing"); + _dummyTask.Start(); _messagePort = new MessagePort("ServicePort", false); _messagePort.MessageReceived += OnMessageRecevied; @@ -99,7 +129,7 @@ namespace ServicePort Log.Info("END"); } - private void HandleCommand() + private async void HandleCommand() { Log.Info("START"); if (_command == "Send_CHECK_WITHOUT_EXCEPTION") @@ -107,7 +137,7 @@ namespace ServicePort try { var request = new Request(_command, _sequence++, _caller); - _port.Send(_port.PortName, 5000, request); + _task.Port.Send(_task.Port.PortName, 5000, request); SendMessage(0); } catch @@ -116,12 +146,12 @@ namespace ServicePort SendMessage(-1); } } - else if (_command == "SendSync_CHECK_WITHOUT_EXCEPTION") + else if (_command == "SendAndReceive_CHECK_WITHOUT_EXCEPTION") { try { var request = new Request(_command, _sequence++, _caller); - var response = (Response)_port.SendSync(_port.PortName, 5000, request); + var response = (Response)_task.Port.SendAndReceive(_task.Port.PortName, 5000, request); SendMessage(0); } catch @@ -130,12 +160,13 @@ namespace ServicePort SendMessage(-1); } } - else if (_command == "OnSyncRequestEvent_CHECK") + else if (_command == "SendAndReceiveAsync_CHECK_WITHOUT_EXCEPTION") { try { var request = new Request(_command, _sequence++, _caller); - var response = (Response)_port.SendSync(_port.PortName, 5000, request); + await _task.Port.SendAndReceiveAsync(_task.Port.PortName, 5000, request); + SendMessage(0); } catch { @@ -143,12 +174,12 @@ namespace ServicePort SendMessage(-1); } } - else if (_command == "OnRequestEvent_CHECK") + else if (_command == "RequestReceived_CHECK") { try { var request = new Request(_command, _sequence++, _caller); - _port.Send(_port.PortName, 5000, request); + var response = (Response)_task.Port.SendAndReceive(_task.Port.PortName, 5000, request); } catch { @@ -161,7 +192,7 @@ namespace ServicePort try { var request = new Request(_command, _sequence++, _caller); - _port.Send(_dummyPort.PortName, 5000, request); + _task.Port.Send(_dummyTask.Port.PortName, 5000, request); SendMessage(-1); } catch (UnauthorizedAccessException) @@ -170,12 +201,54 @@ namespace ServicePort SendMessage(0); } } - else if (_command == "SendSync_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION") + else if (_command == "Send_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION") + { + try + { + var request = new Request(_command, _sequence++, _caller); + _task.Port.Send("", 5000, request); + SendMessage(-1); + } + catch (ArgumentException) + { + Log.Error("Failed to send request"); + SendMessage(0); + } + } + else if (_command == "SendAndReceive_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION") + { + try + { + var request = new Request(_command, _sequence++, _caller); + var response = (Response)_task.Port.SendAndReceive(_dummyTask.Port.PortName, 5000, request); + SendMessage(-1); + } + catch (UnauthorizedAccessException) + { + Log.Error("Failed to send request"); + SendMessage(0); + } + } + else if (_command == "SendAndReceive_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION") + { + try + { + var request = new Request(_command, _sequence++, _caller); + var response = (Response)_task.Port.SendAndReceive("", 5000, request); + SendMessage(-1); + } + catch (ArgumentException) + { + Log.Error("Failed to send request"); + SendMessage(0); + } + } + else if (_command == "SendAndReceiveAsync_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION") { try { var request = new Request(_command, _sequence++, _caller); - var response = (Response)_port.SendSync(_dummyPort.PortName, 5000, request); + await _task.Port.SendAndReceiveAsync(_dummyTask.Port.PortName, 5000, request); SendMessage(-1); } catch (UnauthorizedAccessException) @@ -184,6 +257,46 @@ namespace ServicePort SendMessage(0); } } + else if (_command == "SendAndReceiveAsync_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION") + { + try + { + var request = new Request(_command, _sequence++, _caller); + await _task.Port.SendAndReceiveAsync("", 5000, request); + SendMessage(-1); + } + catch (ArgumentException) + { + Log.Error("Failed to send request"); + SendMessage(0); + } + } + else if (_command == "Sender_GET" || _command == "Request_GET") + { + try + { + var request = new Request(_command, _sequence++, _caller); + _task.Port.Send(_task.Port.PortName, 5000, request); + } + catch + { + Log.Error("Failed to send request"); + SendMessage(-1); + } + } + else if (_command == "IsReplyRequested_CHECK" || _command == "Reply_SET_AND_GET") + { + try + { + var request = new Request(_command, _sequence++, _caller); + var response = (Response)_task.Port.SendAndReceive(_task.Port.PortName, 5000, request); + } + catch + { + Log.Error("Failed to send request"); + SendMessage(-1); + } + } Log.Info("END"); } @@ -214,10 +327,31 @@ namespace ServicePort { Log.Info("OnDestroy()"); base.OnDestroy(); - _port.Cancel(); - _thread.Join(); - _dummyPort.Cancel(); - _dummyThread.Join(); + if (_dummyTask != null) + { + _dummyTask.Stop(); + _dummyTask.Port?.Dispose(); + _dummyTask = null; + } + + if (_task != null) + { + _task.Stop(); + if (_task.Port != null) + { + _task.Port.RequestReceived -= OnRequestReceived; + _task.Port.Dispose(); + } + _task = null; + } + + if (_messagePort != null) + { + _messagePort.StopListening(); + _messagePort.MessageReceived -= OnMessageRecevied; + _messagePort.Dispose(); + _messagePort = null; + } } } } diff --git a/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/org.tizen.example.ComponentPortTest-1.0.0.tpk b/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/org.tizen.example.ComponentPortTest-1.0.0.tpk index 4f67d24..ed128b8 100755 Binary files a/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/org.tizen.example.ComponentPortTest-1.0.0.tpk and b/tct-suite-vs/Resource/Tizen.Applications.ComponentBased.ComponentPort.Tests/org.tizen.example.ComponentPortTest-1.0.0.tpk differ diff --git a/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/Tizen.Applications.ComponentBased.ComponentPort.Tests.csproj b/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/Tizen.Applications.ComponentBased.ComponentPort.Tests.csproj index 717469e..c21fb5d 100755 --- a/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/Tizen.Applications.ComponentBased.ComponentPort.Tests.csproj +++ b/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/Tizen.Applications.ComponentBased.ComponentPort.Tests.csproj @@ -27,7 +27,7 @@ - + Runtime diff --git a/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/testcase/TSComponentPort.cs b/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/testcase/TSComponentPort.cs index f4f1948..fe0fdbb 100755 --- a/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/testcase/TSComponentPort.cs +++ b/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/testcase/TSComponentPort.cs @@ -19,11 +19,11 @@ using System; using System.Threading; using System.Threading.Tasks; using System.Timers; -using Tizen.Applications; using Tizen.Applications.Messages; using Timer = System.Timers.Timer; -namespace Tizen.Applications.ComponentBased.Tests { +namespace Tizen.Applications.ComponentBased.Tests +{ [TestFixture] [Description("Tizen.Applications.ComponentBased.ComponentPort Tests")] @@ -31,7 +31,7 @@ namespace Tizen.Applications.ComponentBased.Tests { { private const string LogTag = "ComponentPort.Tests"; private MessagePort _messagePort; - private TestPort _port; + private ComponentPort _port; private Timer _timer; private Thread _thread; private uint _count; @@ -39,22 +39,6 @@ namespace Tizen.Applications.ComponentBased.Tests { private int _receivedResult; private bool _received; - public class TestPort : ComponentPort - { - public TestPort(string portName) : base(portName) - { - } - - protected override void OnRequestEvent(string sender, object request) - { - } - - protected override object OnSyncRequestEvent(string sender, object request) - { - return null; - } - } - void OnMessageReceived(object sender, MessageReceivedEventArgs e) { Log.Info(LogTag, "START sender: " + sender); @@ -90,7 +74,7 @@ namespace Tizen.Applications.ComponentBased.Tests { _receivedResult = -1; _received = false; - _port = new TestPort("Test"); + _port = new ComponentPort("Test"); _count = 0; } @@ -104,9 +88,13 @@ namespace Tizen.Applications.ComponentBased.Tests { _port?.Dispose(); _port = null; - _messagePort?.StopListening(); - _messagePort?.Dispose(); - _messagePort = null; + if (_messagePort != null) + { + _messagePort.MessageReceived -= OnMessageReceived; + _messagePort.StopListening(); + _messagePort.Dispose(); + _messagePort = null; + } } private void SendLaunchRequest(string command) @@ -147,7 +135,7 @@ namespace Tizen.Applications.ComponentBased.Tests { public void ComponentPort_INIT() { Log.Info(LogTag, "START"); - var testPort = new TestPort("Test2"); + var testPort = new ComponentPort("Test2"); Assert.IsInstanceOf(testPort, "Should be an instance of ComponentPort"); Assert.IsNotNull(testPort, "testPort should not be null"); testPort?.Dispose(); @@ -164,14 +152,14 @@ namespace Tizen.Applications.ComponentBased.Tests { public void ComponentPort_INIT_WITH_NULL_AND_CHECK_ARGUMENTEXCEPTION() { Log.Info(LogTag, "START"); - try - { - var testPort = new TestPort(null); - Assert.Fail("Should throw ArgumentException"); + try + { + var testPort = new ComponentPort(null); + Assert.Fail("Should throw ArgumentException"); } catch (ArgumentException) - { - Assert.Pass("ArgumentException: Pass"); + { + Assert.Pass("ArgumentException: Pass"); } Log.Info(LogTag, "END"); } @@ -186,14 +174,14 @@ namespace Tizen.Applications.ComponentBased.Tests { public void ComponentPort_INIT_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION() { Log.Info(LogTag, "START"); - try - { - var testPort = new TestPort(""); - Assert.Fail("Should throw ArgumentException"); + try + { + var testPort = new ComponentPort(""); + Assert.Fail("Should throw ArgumentException"); } catch (ArgumentException) - { - Assert.Pass("ArgumentException: Pass"); + { + Assert.Pass("ArgumentException: Pass"); } Log.Info(LogTag, "END"); } @@ -208,15 +196,15 @@ namespace Tizen.Applications.ComponentBased.Tests { public void ComponentPort_INIT_AND_CHECK_IOEXCEPTION() { Log.Info(LogTag, "START"); - try - { - var testPort = new TestPort("Test"); - Assert.Fail("Should throw IOException"); + try + { + var testPort = new ComponentPort("Test"); + Assert.Fail("Should throw IOException"); + } + catch (global::System.IO.IOException) + { + Assert.Pass("IOException: Pass"); } - catch (global::System.IO.IOException) - { - Assert.Pass("IOException: Pass"); - } Log.Info(LogTag, "END"); } @@ -289,19 +277,35 @@ namespace Tizen.Applications.ComponentBased.Tests { public void AddPrivilege_CHECK_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION() { Log.Info(LogTag, "START"); - try - { + try + { _port.AddPrivilege(""); - Assert.Fail("Should throw ArgumentException"); + Assert.Fail("Should throw ArgumentException"); } catch (ArgumentException) - { + { Log.Error(LogTag, "ArgumentException occurs"); - Assert.Pass("ArgumentException: Pass"); + Assert.Pass("ArgumentException: Pass"); } Log.Info(LogTag, "END"); } + [Test] + [Category("P1")] + [Description("Test : Wait for port")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.WaitForPort M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task WaitForPort_CHECK() + { + Log.Info(LogTag, "START"); + /// If the target port is not ready, WaitForPort() will not be finished until the port is ready. + await ComponentPort.WaitForPort("Test"); + Assert.Pass("Test Port exists"); + Log.Info(LogTag, "END"); + } + private void Timeout(object sender, ElapsedEventArgs args) { _count++; @@ -443,119 +447,237 @@ namespace Tizen.Applications.ComponentBased.Tests { } [Test] + [Category("P2")] + [Description("Test : Send a request asynchronously")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.Send M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task Send_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION() + { + Log.Info(LogTag, "START"); + _thread = new Thread(() => SetTimer(new ElapsedEventHandler(CheckReceivedMessage))); + _thread.Start(); + + SendLaunchRequest("Send_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION"); + await Task.Delay(4000); + + _timer.Stop(); + _thread.Join(); + + Assert.AreEqual(_receivedCommand, "Send_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION", "Recevied Command should be 'Send_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION'"); + Assert.AreEqual(_receivedResult, 0, "Recevied Result should be '0'"); + Log.Info(LogTag, "END"); + } + + [Test] [Category("P1")] - [Description("Test : Send a request synchronously")] - [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.SendSync M")] + [Description("Test : Send a request and receive a response synchronously")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.SendAndReceive M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] - public async Task SendSync_CHECK_WITHOUT_EXCEPTION() + public async Task SendAndReceive_CHECK_WITHOUT_EXCEPTION() { Log.Info(LogTag, "START"); _thread = new Thread(() => SetTimer(new ElapsedEventHandler(CheckReceivedMessage))); _thread.Start(); - SendLaunchRequest("SendSync_CHECK_WITHOUT_EXCEPTION"); + SendLaunchRequest("SendAndReceive_CHECK_WITHOUT_EXCEPTION"); await Task.Delay(8000); _timer.Stop(); _thread.Join(); - Assert.AreEqual(_receivedCommand, "SendSync_CHECK_WITHOUT_EXCEPTION", "Recevied Command should be 'SendSync_CHECK_WITHOUT_EXCEPTION'"); + Assert.AreEqual(_receivedCommand, "SendAndReceive_CHECK_WITHOUT_EXCEPTION", "Recevied Command should be 'SendAndReceive_CHECK_WITHOUT_EXCEPTION'"); Assert.AreEqual(_receivedResult, 0, "Recevied Result should be '0'"); Log.Info(LogTag, "END"); } [Test] [Category("P1")] - [Description("Test : Send a request synchronously")] - [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.SendSync M")] + [Description("Test : Send a request and receive a response synchronously")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.SendAndReceive M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] - public void SendSync_CHECK_WITH_ARUMENTEXCEPTION() + public void SendAndReceive_CHECK_WITH_ARUMENTEXCEPTION() { Log.Info(LogTag, "START"); try { - var res = _port.SendSync("ServicePort", 5000, null); - Assert.Fail(); + var res = _port.SendAndReceive("ServicePort", 5000, null); + Assert.Fail("DO NOT COME HERE"); } catch (ArgumentException) { - Assert.Pass(); + Assert.Pass("ArgumentException: Pass"); } Log.Info(LogTag, "END"); } [Test] [Category("P2")] - [Description("Test : Send a request synchronously")] - [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.SendSync M")] + [Description("Test : Send a request and receive a response synchronously")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.SendAndReceive M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task SendAndReceive_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION() + { + Log.Info(LogTag, "START"); + _thread = new Thread(() => SetTimer(new ElapsedEventHandler(CheckReceivedMessage))); + _thread.Start(); + + SendLaunchRequest("SendAndReceive_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION"); + await Task.Delay(4000); + + _timer.Stop(); + _thread.Join(); + + Assert.AreEqual(_receivedCommand, "SendAndReceive_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION", "Recevied Command should be 'SendAndReceive_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION'"); + Assert.AreEqual(_receivedResult, 0, "Recevied Result should be '0'"); + Log.Info(LogTag, "END"); + } + + [Test] + [Category("P2")] + [Description("Test : Send a request and receive a response synchronously")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.SendAndReceive M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] - public async Task SendSync_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION() + public async Task SendAndReceive_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION() { Log.Info(LogTag, "START"); _thread = new Thread(() => SetTimer(new ElapsedEventHandler(CheckReceivedMessage))); _thread.Start(); - SendLaunchRequest("SendSync_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION"); + SendLaunchRequest("SendAndReceive_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION"); await Task.Delay(4000); _timer.Stop(); _thread.Join(); - Assert.AreEqual(_receivedCommand, "SendSync_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION", "Recevied Command should be 'SendSync_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION'"); + Assert.AreEqual(_receivedCommand, "SendAndReceive_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION", "Recevied Command should be 'SendAndReceive_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION'"); Assert.AreEqual(_receivedResult, 0, "Recevied Result should be '0'"); Log.Info(LogTag, "END"); } [Test] [Category("P1")] - [Description("Test : OnSyncRequestEvent")] - [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.OnSyncRequestEvent E")] + [Description("Test : Send a request and receive a response asynchronously")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.SendAndReceiveAsync M")] [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task SendAndReceiveAsync_CHECK_WITHOUT_EXCEPTION() + { + Log.Info(LogTag, "START"); + _thread = new Thread(() => SetTimer(new ElapsedEventHandler(CheckReceivedMessage))); + _thread.Start(); + + SendLaunchRequest("SendAndReceiveAsync_CHECK_WITHOUT_EXCEPTION"); + await Task.Delay(8000); + + _timer.Stop(); + _thread.Join(); + + Assert.AreEqual(_receivedCommand, "SendAndReceiveAsync_CHECK_WITHOUT_EXCEPTION", "Recevied Command should be 'SendAndReceiveAsync_CHECK_WITHOUT_EXCEPTION'"); + Assert.AreEqual(_receivedResult, 0, "Recevied Result should be '0'"); + Log.Info(LogTag, "END"); + } + + [Test] + [Category("P1")] + [Description("Test : Send a request and receive a response asynchronously")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.SendAndReceiveAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task SendAndReceiveAsync_CHECK_WITH_ARUMENTEXCEPTION() + { + Log.Info(LogTag, "START"); + try + { + var result = await _port.SendAndReceiveAsync(null, 0, null); + Assert.Fail("DO NOT COME HERE"); + } + catch (ArgumentException) + { + Assert.Pass("ArgumentException: Pass"); + } + Log.Info(LogTag, "END"); + } + + [Test] + [Category("P2")] + [Description("Test : Send a request and receive a response asynchronously")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.SendAndReceiveAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task SendAndReceiveAsync_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION() + { + Log.Info(LogTag, "START"); + _thread = new Thread(() => SetTimer(new ElapsedEventHandler(CheckReceivedMessage))); + _thread.Start(); + + SendLaunchRequest("SendAndReceiveAsync_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION"); + await Task.Delay(4000); + + _timer.Stop(); + _thread.Join(); + + Assert.AreEqual(_receivedCommand, "SendAndReceiveAsync_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION", "Recevied Command should be 'SendAndReceiveAsync_CHECK_WITH_UNAUTHORIZEDACCESSEXCEPTION'"); + Assert.AreEqual(_receivedResult, 0, "Recevied Result should be '0'"); + Log.Info(LogTag, "END"); + } + + [Test] + [Category("P2")] + [Description("Test : Send a request and receive a response asynchronously")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.SendAndReceiveAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] - public async Task OnSyncRequestEvent_CHECK() + public async Task SendAndReceiveAsync_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION() { Log.Info(LogTag, "START"); _thread = new Thread(() => SetTimer(new ElapsedEventHandler(CheckReceivedMessage))); _thread.Start(); - SendLaunchRequest("OnSyncRequestEvent_CHECK"); + SendLaunchRequest("SendAndReceiveAsync_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION"); await Task.Delay(4000); _timer.Stop(); _thread.Join(); - Assert.AreEqual(_receivedCommand, "OnSyncRequestEvent_CHECK", "Recevied Command should be 'OnSyncRequestEvent_CHECK'"); + Assert.AreEqual(_receivedCommand, "SendAndReceiveAsync_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION", "Recevied Command should be 'SendAndReceiveAsync_WITH_EMPTYSTRING_AND_CHECK_ARGUMENTEXCEPTION'"); Assert.AreEqual(_receivedResult, 0, "Recevied Result should be '0'"); Log.Info(LogTag, "END"); } [Test] [Category("P1")] - [Description("Test : OnRequestEvent")] - [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.OnRequestEvent E")] + [Description("Test : RequestReceived event handler")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentPort.RequestReceived E")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "EVL")] [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] - public async Task OnRequestEvent_CHECK() + public async Task RequestReceived_CHECK() { Log.Info(LogTag, "START"); _thread = new Thread(() => SetTimer(new ElapsedEventHandler(CheckReceivedMessage))); _thread.Start(); - SendLaunchRequest("OnRequestEvent_CHECK"); + SendLaunchRequest("RequestReceived_CHECK"); await Task.Delay(4000); _timer.Stop(); _thread.Join(); - Assert.AreEqual(_receivedCommand, "OnRequestEvent_CHECK", "Recevied Command should be 'OnRequestEvent_CHECK'"); + Assert.AreEqual(_receivedCommand, "RequestReceived_CHECK", "Recevied Command should be 'RequestReceived_CHECK'"); Assert.AreEqual(_receivedResult, 0, "Recevied Result should be '0'"); Log.Info(LogTag, "END"); } diff --git a/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/testcase/TSComponentTask.cs b/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/testcase/TSComponentTask.cs new file mode 100755 index 0000000..a444c8e --- /dev/null +++ b/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/testcase/TSComponentTask.cs @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using System.Threading.Tasks; +using Tizen.Applications; +using Tizen.Applications.ComponentBased; + +namespace Tizen.Applications.ComponentBased.Tests +{ + [TestFixture] + [Description("Tizen.Applications.ComponentBased.ComponentTask Tests")] + public class ComponentTaskTests + { + private static string LogTag = "ComponentPort.Tests"; + private ComponentTask _task; + private ComponentPort _port; + + private void OnRequestReceived(object sender, RequestEventArgs args) + { + } + + [SetUp] + public void Init() + { + Log.Info(LogTag, "Preconditions for each TEST"); + _port = new ComponentPort("TestTask"); + _port.RequestReceived += OnRequestReceived; + _task = new ComponentTask(_port); + } + + [TearDown] + public void Destroy() + { + Log.Info(LogTag, "Postconditions for each TEST"); + if (_task != null) + { + if (_task.IsRunning) + _task.Stop(); + + _task = null; + } + + if (_port != null) + { + _port.RequestReceived -= OnRequestReceived; + _port.Dispose(); + _port = null; + } + } + + [Test] + [Category("P1")] + [Description("Test : ComponentTask method initialization")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentTask.ComponentTask C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public void ComponentTask_INIT() + { + Log.Info(LogTag, "START"); + var testTask = new ComponentTask(new ComponentPort("Task")); + Assert.IsInstanceOf(testTask, "Should be an instance of ComponentTask"); + Assert.IsNotNull(testTask, "testPort should not be null"); + Log.Info(LogTag, "END"); + } + + [Test] + [Category("P1")] + [Description("Test : Starts the task.")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentTask.Start M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task Start_CHECK_RUNNING() + { + Log.Info(LogTag, "START"); + _task.Start(); + // To wait until the main loop is running properly, the delay is needed. + await Task.Delay(1000); + + Assert.AreEqual(true, _task.IsRunning, "task should be running"); + Log.Info(LogTag, "END"); + } + + [Test] + [Category("P1")] + [Description("Test : Stops the task.")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentTask.Stop M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task Stop_CHECK_RUNNING() + { + Log.Info(LogTag, "START"); + _task.Start(); + // To wait until the main loop is running properly, the delay is needed. + await Task.Delay(1000); + + _task.Stop(); + Assert.AreEqual(false, _task.IsRunning, "task should not be running"); + Log.Info(LogTag, "END"); + } + + [Test] + [Category("P1")] + [Description("Test : property IsRunning of ComponentTask")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentTask.IsRunning A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task IsRunning_CHECK() + { + Log.Info(LogTag, "START"); + _task.Start(); + // To wait until the main loop is running properly, the delay is needed. + await Task.Delay(1000); + Assert.AreEqual(true, _task.IsRunning, "The task should be running"); + + _task.Stop(); + Assert.AreEqual(false, _task.IsRunning, "The task should not be running") ; + Log.Info(LogTag, "END"); + } + + [Test] + [Category("P1")] + [Description("Test : property Port of ComponentTask")] + [Property("SPEC", "Tizen.Applications.ComponentBased.ComponentTask.Port A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public void Port_GET() + { + Log.Info(LogTag, "START"); + var port = _task.Port; + Assert.IsInstanceOf(port, "Should be an instance of ComponentPort"); + Assert.IsNotNull(port, "testPort should not be null"); + Assert.AreEqual(port, _port, "Should be equal to port"); + Log.Info(LogTag, "END"); + } + } +} diff --git a/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/testcase/TSRequestEventArgs.cs b/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/testcase/TSRequestEventArgs.cs new file mode 100755 index 0000000..a43fdec --- /dev/null +++ b/tct-suite-vs/Tizen.Applications.ComponentBased.ComponentPort.Tests/testcase/TSRequestEventArgs.cs @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using System; +using System.Threading; +using System.Threading.Tasks; +using System.Timers; +using Timer = System.Timers.Timer; +using Tizen.Applications.Messages; + +namespace Tizen.Applications.ComponentBased.Tests +{ + + [TestFixture] + [Description("Tizen.Applications.ComponentBased.RequestEventArgs Tests")] + public class RequestEventArgsTests + { + private const string LogTag = "ComponentPort.Tests"; + private MessagePort _messagePort; + private string _receivedCommand; + private int _receivedResult; + private bool _received; + private Timer _timer; + private Thread _thread; + + void OnMessageReceived(object sender, MessageReceivedEventArgs e) + { + Log.Info(LogTag, "START sender: " + sender); + try + { + _receivedCommand = e.Message.GetItem("command"); + _receivedResult = int.Parse(e.Message.GetItem("result")); + Log.Info(LogTag, "Command: " + _receivedCommand + " Result: " + _receivedResult); + _received = true; + } + catch (ArgumentException) + { + Log.Error(LogTag, "ArgumentException occurs"); + } + catch (InvalidOperationException) + { + Log.Error(LogTag, "InvalidOperationException occurs"); + } + Log.Info(LogTag, "END"); + } + + [SetUp] + public void Init() + { + Log.Info(LogTag, "Preconditions for each TEST"); + SendLaunchRequest("wakeup"); + + _messagePort = new MessagePort("ComponentPort.Tests", false); + _messagePort.MessageReceived += OnMessageReceived; + _messagePort.Listen(); + + _receivedCommand = string.Empty; + _receivedResult = -1; + _received = false; + } + + [TearDown] + public void Destroy() + { + Log.Info(LogTag, "Postconditions for each TEST"); + _timer = null; + _thread = null; + + if (_messagePort != null) + { + _messagePort.MessageReceived -= OnMessageReceived; + _messagePort.StopListening(); + _messagePort.Dispose(); + _messagePort = null; + } + } + + private void SendLaunchRequest(string command) + { + Log.Info(LogTag, "START command: " + command); + AppControl appControl = new AppControl(); + appControl.ApplicationId = "org.tizen.example.ComponentPortTest"; + appControl.ComponentId = "Service"; + appControl.ExtraData.Add("command", command); + appControl.ExtraData.Add("caller", Application.Current.ApplicationInfo.ApplicationId); + appControl.ExtraData.Add("message-port", "ComponentPort.Tests"); + try + { + AppControl.SendLaunchRequest(appControl); + } + catch (ArgumentNullException) + { + Log.Error(LogTag, "ArgumentNullException occurs"); + } + catch (InvalidOperationException) + { + Log.Error(LogTag, "InvalidOperationException occurs"); + } + catch (TimeoutException) + { + Log.Error(LogTag, "TimeoutException occurs"); + } + Log.Info(LogTag, "END"); + } + + private void SetTimer(ElapsedEventHandler handler) + { + Log.Info(LogTag, "SetTimer()"); + _timer = new Timer(5 * 100); + _timer.Elapsed += handler; + _timer.Start(); + } + + private void CheckReceivedMessage(object sender, ElapsedEventArgs args) + { + Log.Info(LogTag, "START"); + if (_received) + { + Log.Info(LogTag, "MessageReceived"); + _timer.Stop(); + } + Log.Info(LogTag, "END"); + } + + [Test] + [Category("P1")] + [Description("Test : property Sender of RequestEventArgs")] + [Property("SPEC", "Tizen.Applications.ComponentBased.RequestEventArgs.Sender A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task Sender_GET() + { + Log.Info(LogTag, "START"); + _thread = new Thread(() => SetTimer(new ElapsedEventHandler(CheckReceivedMessage))); + _thread.Start(); + + SendLaunchRequest("Sender_GET"); + await Task.Delay(4000); + + _timer.Stop(); + _thread.Join(); + + Assert.AreEqual(_receivedCommand, "Sender_GET", "Recevied Command should be 'Sender_GET'"); + Assert.AreEqual(_receivedResult, 0, "Recevied Result should be '0'"); + Log.Info(LogTag, "END"); + } + + [Test] + [Category("P1")] + [Description("Test : property Request of RequestEventArgs")] + [Property("SPEC", "Tizen.Applications.ComponentBased.RequestEventArgs.Request A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task Request_GET() + { + Log.Info(LogTag, "START"); + _thread = new Thread(() => SetTimer(new ElapsedEventHandler(CheckReceivedMessage))); + _thread.Start(); + + SendLaunchRequest("Request_GET"); + await Task.Delay(4000); + + _timer.Stop(); + _thread.Join(); + + Assert.AreEqual(_receivedCommand, "Request_GET", "Recevied Command should be 'Request_GET'"); + Assert.AreEqual(_receivedResult, 0, "Recevied Result should be '0'"); + Log.Info(LogTag, "END"); + } + + [Test] + [Category("P1")] + [Description("Test : property IsReplyRequested of RequestEventArgs")] + [Property("SPEC", "Tizen.Applications.ComponentBased.RequestEventArgs.IsReplyRequested A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task IsReplyRequested_CHECK() + { + Log.Info(LogTag, "START"); + _thread = new Thread(() => SetTimer(new ElapsedEventHandler(CheckReceivedMessage))); + _thread.Start(); + + SendLaunchRequest("IsReplyRequested_CHECK"); + await Task.Delay(4000); + + _timer.Stop(); + _thread.Join(); + + Assert.AreEqual(_receivedCommand, "IsReplyRequested_CHECK", "Recevied Command should be 'IsReplyRequested_CHECK'"); + Assert.AreEqual(_receivedResult, 0, "Recevied Result should be '0'"); + Log.Info(LogTag, "END"); + } + + [Test] + [Category("P1")] + [Description("Test : property Reply of RequestEventArgs")] + [Property("SPEC", "Tizen.Applications.ComponentBased.RequestEventArgs.Reply A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] + public async Task Reply_SET_AND_GET() + { + Log.Info(LogTag, "START"); + _thread = new Thread(() => SetTimer(new ElapsedEventHandler(CheckReceivedMessage))); + _thread.Start(); + + SendLaunchRequest("Reply_SET_AND_GET"); + await Task.Delay(4000); + + _timer.Stop(); + _thread.Join(); + + Assert.AreEqual(_receivedCommand, "Reply_SET_AND_GET", "Recevied Command should be 'Reply_SET_AND_GET'"); + Assert.AreEqual(_receivedResult, 0, "Recevied Result should be '0'"); + Log.Info(LogTag, "END"); + } + } +}