public void Ping() {
     using(var xdsProxy = new XmlDataServiceClient()) {
         var resultString = xdsProxy.Ping();
         Assert.IsNotEmpty(resultString);
         Assert.IsTrue(resultString.Contains("Ping"));
     }
 }
Esempio n. 2
0
 public void Ping()
 {
     using (var xdsProxy = new XmlDataServiceClient()) {
         var resultString = xdsProxy.Ping();
         Assert.IsNotEmpty(resultString);
         Assert.IsTrue(resultString.Contains("Ping"));
     }
 }
        public override XdsResponseDocument ExecuteXmlDataManager(XdsRequestDocument requestDocument) {
            var adapter = XmlDataTool.ResolveXmlDataManagerAdapter(ProductName);
            var requestBytes = adapter.RequestSerializer.Serialize(requestDocument);

            using(var xdsProxy = new XmlDataServiceClient()) {
                var responseBytes = xdsProxy.Execute(requestBytes, ProductName, false);
                return adapter.ResponseSerializer.Deserialize(responseBytes);
            }
        }
Esempio n. 4
0
        public override XdsResponseDocument ExecuteXmlDataManager(XdsRequestDocument requestDocument)
        {
            var adapter      = XmlDataTool.ResolveXmlDataManagerAdapter(ProductName);
            var requestBytes = adapter.RequestSerializer.Serialize(requestDocument);

            using (var xdsProxy = new XmlDataServiceClient()) {
                var responseBytes = xdsProxy.Execute(requestBytes, ProductName, false);
                return(adapter.ResponseSerializer.Deserialize(responseBytes));
            }
        }
        public void PingAsync() {
            // WCF 의 Async 방식 (Begin, End 방식)
            var xdsProxy = new XmlDataServiceClient();

            xdsProxy.BeginPing(ar => {
                                   var proxy = (XmlDataServiceClient)ar.AsyncState;
                                   var resultString = proxy.EndPing(ar);
                                   Assert.IsNotEmpty(resultString);
                                   Assert.IsTrue(resultString.Contains("Ping"));
                                   Console.WriteLine("Result=" + resultString);
                                   proxy.Close();
                               },
                               xdsProxy);
        }
Esempio n. 6
0
        public void PingAsync()
        {
            // WCF 의 Async 방식 (Begin, End 방식)
            var xdsProxy = new XmlDataServiceClient();

            xdsProxy.BeginPing(ar => {
                var proxy        = (XmlDataServiceClient)ar.AsyncState;
                var resultString = proxy.EndPing(ar);
                Assert.IsNotEmpty(resultString);
                Assert.IsTrue(resultString.Contains("Ping"));
                Console.WriteLine("Result=" + resultString);
                proxy.Close();
            },
                               xdsProxy);
        }
        public void PingAsync2() {
            using(var xdsProxy = new XmlDataServiceClient()) {
                var reset = new AutoResetEvent(false);
                xdsProxy.PingAsync();

                xdsProxy.PingCompleted += (s, e) => {
                                              var resultString = e.Result;
                                              Assert.IsNotEmpty(resultString);
                                              Assert.IsTrue(resultString.Contains("Ping"));
                                              Console.WriteLine("Result=" + resultString);
                                              reset.Set();
                                          };

                reset.WaitOne();
            }
        }
Esempio n. 8
0
        public void PingAsync2()
        {
            using (var xdsProxy = new XmlDataServiceClient()) {
                var reset = new AutoResetEvent(false);
                xdsProxy.PingAsync();

                xdsProxy.PingCompleted += (s, e) => {
                    var resultString = e.Result;
                    Assert.IsNotEmpty(resultString);
                    Assert.IsTrue(resultString.Contains("Ping"));
                    Console.WriteLine("Result=" + resultString);
                    reset.Set();
                };

                reset.WaitOne();
            }
        }
Esempio n. 9
0
        private static void VerifyXmlDataServiceAsync(XdsRequestDocument xdsRequest, string productName, bool?compress,
                                                      bool?security)
        {
            var waitHandle   = new AutoResetEvent(false);
            var serializer   = GetSerializer(compress, security);
            var requestBytes = serializer.Serialize(xdsRequest.ConvertToBytes());

            var proxy = new XmlDataServiceClient();

            if (security.GetValueOrDefault(false))
            {
                // IAsyncResult를 반환받아서 필요할 때 기다리게 할 수도 있지만, 테스트를 위해 Synchronous하게 동작하게 한다.
                proxy.BeginExecuteSecurity(requestBytes, productName, compress.GetValueOrDefault(false),
                                           (ar) => {
                    var proxy2        = (XmlDataServiceClient)ar.AsyncState;
                    var responseBytes = proxy2.EndExecuteSecurity(ar);
                    var xdsResponse   =
                        ((byte[])serializer.Deserialize(responseBytes)).ConvertToXdsResponseDocument();

                    Assert.IsNotNull(xdsResponse);
                    Assert.IsFalse(xdsResponse.HasError);
                    Assert.IsTrue(xdsResponse.Responses.Count > 0);
                    proxy2.Close();
                },
                                           proxy);
            }
            else
            {
                // IAsyncResult를 반환받아서 필요할 때 기다리게 할 수도 있지만, 테스트를 위해 Synchronous하게 동작하게 한다.
                proxy.BeginExecute(requestBytes, productName, compress.GetValueOrDefault(false),
                                   (ar) => {
                    var proxy2        = (XmlDataServiceClient)ar.AsyncState;
                    var responseBytes = proxy2.EndExecute(ar);
                    var xdsResponse   =
                        ((byte[])serializer.Deserialize(responseBytes)).ConvertToXdsResponseDocument();

                    Assert.IsNotNull(xdsResponse);
                    Assert.IsFalse(xdsResponse.HasError);
                    Assert.IsTrue(xdsResponse.Responses.Count > 0);
                    proxy2.Close();
                },
                                   proxy);
            }
        }
        private static void VerifyXmlDataService(XdsRequestDocument xdsRequest, string productName, bool? compress,
                                                 bool? security) {
            using(var xdsProxy = new XmlDataServiceClient()) {
                var serializer = GetSerializer(compress, security);
                var requestBytes = serializer.Serialize(xdsRequest.ConvertToBytes());

                var responseBytes = security.GetValueOrDefault(false)
                                        ? xdsProxy.ExecuteSecurity(requestBytes, productName, compress.GetValueOrDefault(false))
                                        : xdsProxy.Execute(requestBytes, productName, compress.GetValueOrDefault(false));

                Assert.IsNotNull(responseBytes);

                var xdsResponse = ((byte[])serializer.Deserialize(responseBytes)).ConvertToXdsResponseDocument();

                Assert.IsNotNull(xdsResponse);
                Assert.IsFalse(xdsResponse.HasError);

                Assert.IsTrue(xdsResponse.Responses.Count > 0);
            }
        }
Esempio n. 11
0
        private static void VerifyXmlDataService(XdsRequestDocument xdsRequest, string productName, bool?compress,
                                                 bool?security)
        {
            using (var xdsProxy = new XmlDataServiceClient()) {
                var serializer   = GetSerializer(compress, security);
                var requestBytes = serializer.Serialize(xdsRequest.ConvertToBytes());

                var responseBytes = security.GetValueOrDefault(false)
                                        ? xdsProxy.ExecuteSecurity(requestBytes, productName, compress.GetValueOrDefault(false))
                                        : xdsProxy.Execute(requestBytes, productName, compress.GetValueOrDefault(false));

                Assert.IsNotNull(responseBytes);

                var xdsResponse = ((byte[])serializer.Deserialize(responseBytes)).ConvertToXdsResponseDocument();

                Assert.IsNotNull(xdsResponse);
                Assert.IsFalse(xdsResponse.HasError);

                Assert.IsTrue(xdsResponse.Responses.Count > 0);
            }
        }
        private static void VerifyXmlDataServiceAsync(XdsRequestDocument xdsRequest, string productName, bool? compress,
                                                      bool? security) {
            var waitHandle = new AutoResetEvent(false);
            var serializer = GetSerializer(compress, security);
            var requestBytes = serializer.Serialize(xdsRequest.ConvertToBytes());

            var proxy = new XmlDataServiceClient();

            if(security.GetValueOrDefault(false)) {
                // IAsyncResult를 반환받아서 필요할 때 기다리게 할 수도 있지만, 테스트를 위해 Synchronous하게 동작하게 한다.
                proxy.BeginExecuteSecurity(requestBytes, productName, compress.GetValueOrDefault(false),
                                           (ar) => {
                                               var proxy2 = (XmlDataServiceClient)ar.AsyncState;
                                               var responseBytes = proxy2.EndExecuteSecurity(ar);
                                               var xdsResponse =
                                                   ((byte[])serializer.Deserialize(responseBytes)).ConvertToXdsResponseDocument();

                                               Assert.IsNotNull(xdsResponse);
                                               Assert.IsFalse(xdsResponse.HasError);
                                               Assert.IsTrue(xdsResponse.Responses.Count > 0);
                                               proxy2.Close();
                                           },
                                           proxy);
            }
            else {
                // IAsyncResult를 반환받아서 필요할 때 기다리게 할 수도 있지만, 테스트를 위해 Synchronous하게 동작하게 한다.
                proxy.BeginExecute(requestBytes, productName, compress.GetValueOrDefault(false),
                                   (ar) => {
                                       var proxy2 = (XmlDataServiceClient)ar.AsyncState;
                                       var responseBytes = proxy2.EndExecute(ar);
                                       var xdsResponse =
                                           ((byte[])serializer.Deserialize(responseBytes)).ConvertToXdsResponseDocument();

                                       Assert.IsNotNull(xdsResponse);
                                       Assert.IsFalse(xdsResponse.HasError);
                                       Assert.IsTrue(xdsResponse.Responses.Count > 0);
                                       proxy2.Close();
                                   },
                                   proxy);
            }
        }