コード例 #1
0
        public void TestGetBulk()
        {
            int maxIterations = 10000;
            ObixResult <XElement> xmlResult = null;
            Uri signupUri = client.LobbyUri.Concat("signUp");

            progressWnd = new CProgressWnd("Invoking obix reads");
            wndThread   = new Thread(() => {
                progressWnd.ShowDialog();
            });

            wndThread.SetApartmentState(ApartmentState.STA);
            wndThread.Start();

            progressWnd.ProgressMaximumValue = maxIterations;

            TestConnect();
            Assert.IsNotNull(client, "Client is not initialized.");
            Assert.IsTrue(client.IsConnected, "Client is not connected.");

            Uri u = client.LobbyUri.Concat("about/");

            for (int i = 0; i <= maxIterations; i++)
            {
                xmlResult = client.ReadUriXml(u);
                progressWnd.Increment();
            }

            // Assert.IsTrue(xmlResult.ResultSucceeded, "Could not get lobby contract for iteration " + i);

            progressWnd.RunOnUIThread(() => {
                progressWnd.Hide();
            });
        }
コード例 #2
0
        public void TestWatchBulk()
        {
            int                   maxIterations = 10000;
            List <string>         watchUriList  = new List <string>(maxIterations);
            ObixResult <XElement> xmlResult     = null;

            progressWnd = new CProgressWnd("Creating watch objects");
            wndThread   = new Thread(() => {
                progressWnd.ShowDialog();
            });

            wndThread.SetApartmentState(ApartmentState.STA);
            wndThread.Start();

            progressWnd.ProgressMaximumValue = maxIterations;

            TestConnect();
            Assert.IsNotNull(client, "Client is not initialized.");
            Assert.IsTrue(client.IsConnected, "Client is not connected.");

            Uri u = client.LobbyUri.Concat("about/");

            for (int i = 0; i <= maxIterations; i++)
            {
                xmlResult = client.InvokeUriXml(client.LobbyUri.Concat("watchService/make/"), null);
                Assert.IsTrue(xmlResult.ResultSucceeded, "Could not add watch for iteration " + i);
                watchUriList.Add(xmlResult.Result.ObixHref());
                progressWnd.Increment();
            }
            progressWnd.Hide();

            progressWnd = new CProgressWnd("Deleting watch objects");
            wndThread   = new Thread(() => {
                progressWnd.ShowDialog();
            });

            wndThread.SetApartmentState(ApartmentState.STA);
            wndThread.Start();

            progressWnd.ProgressMaximumValue = watchUriList.Count;

            for (int i = 0; i < watchUriList.Count; i++)
            {
                string watchUri  = watchUriList[i];
                Uri    deleteUri = client.LobbyUri.Concat(watchUri).Concat("delete/");
                xmlResult = client.InvokeUriXml(deleteUri, null);

                progressWnd.Increment();
                Assert.IsTrue(xmlResult.ResultSucceeded, "Could not add watch for URI " + deleteUri.ToString());
            }

            progressWnd.RunOnUIThread(() => {
                progressWnd.Hide();
            });
        }
コード例 #3
0
        public void TestDeviceBulk()
        {
            int maxDevices = 10000;
            ObixResult <XElement> xmlResult = null;
            XElement sampleDevice           = null;
            Uri      signupUri = client.LobbyUri.Concat("signUp");

            progressWnd = new CProgressWnd("Posting oBIX devices");
            wndThread   = new Thread(() => {
                progressWnd.ShowDialog();
            });

            wndThread.SetApartmentState(ApartmentState.STA);
            wndThread.Start();

            progressWnd.ProgressMaximumValue = maxDevices;

            TestConnect();
            Assert.IsNotNull(client, "Client is not initialized.");
            Assert.IsTrue(client.IsConnected, "Client is not connected.");

            for (int i = 0; i <= maxDevices; i++)
            {
                sampleDevice = CreateTestDevice();
                Assert.IsNotNull(sampleDevice, "TestDeviceWrite failed to create a sample device oBIX object.");

                xmlResult = client.InvokeUriXml(signupUri, sampleDevice);
                Assert.IsTrue(xmlResult.ResultSucceeded, string.Format("Device signup to href {0} failed with result {1}.", signupUri, xmlResult));
                progressWnd.Increment();
            }

            progressWnd.RunOnUIThread(() => {
                progressWnd.Hide();
            });

            wndThread.Join();
        }
コード例 #4
0
        public void TestGetBulk() {
            int maxIterations = 10000;
            ObixResult<XElement> xmlResult = null;
            Uri signupUri = client.LobbyUri.Concat("signUp");

            progressWnd = new CProgressWnd("Invoking obix reads");
            wndThread = new Thread(() => {
                progressWnd.ShowDialog();
            });

            wndThread.SetApartmentState(ApartmentState.STA);
            wndThread.Start();

            progressWnd.ProgressMaximumValue = maxIterations;

            TestConnect();
            Assert.IsNotNull(client, "Client is not initialized.");
            Assert.IsTrue(client.IsConnected, "Client is not connected.");

            Uri u = client.LobbyUri.Concat("about/");

            for (int i = 0; i <= maxIterations; i++) {
                xmlResult = client.ReadUriXml(u);
                progressWnd.Increment();
            }

            // Assert.IsTrue(xmlResult.ResultSucceeded, "Could not get lobby contract for iteration " + i);
            
            progressWnd.RunOnUIThread(() => {
                progressWnd.Hide();
            });
        }
コード例 #5
0
        public void TestWatchBulk() {
            int maxIterations = 10000;
            List<string> watchUriList = new List<string>(maxIterations);
            ObixResult<XElement> xmlResult = null;
            
            progressWnd = new CProgressWnd("Creating watch objects");
            wndThread = new Thread(() => {
                progressWnd.ShowDialog();
            });

            wndThread.SetApartmentState(ApartmentState.STA);
            wndThread.Start();

            progressWnd.ProgressMaximumValue = maxIterations;

            TestConnect();
            Assert.IsNotNull(client, "Client is not initialized.");
            Assert.IsTrue(client.IsConnected, "Client is not connected.");

            Uri u = client.LobbyUri.Concat("about/");

            for (int i = 0; i <= maxIterations; i++) {
                xmlResult = client.InvokeUriXml(client.LobbyUri.Concat("watchService/make/"), null);
                Assert.IsTrue(xmlResult.ResultSucceeded, "Could not add watch for iteration " + i);
                watchUriList.Add(xmlResult.Result.ObixHref());
                progressWnd.Increment();
            }
            progressWnd.Hide();

            progressWnd = new CProgressWnd("Deleting watch objects");
            wndThread = new Thread(() => {
                progressWnd.ShowDialog();
            });

            wndThread.SetApartmentState(ApartmentState.STA);
            wndThread.Start();

            progressWnd.ProgressMaximumValue = watchUriList.Count;

            for (int i = 0; i < watchUriList.Count; i++) {
                string watchUri = watchUriList[i];
                Uri deleteUri = client.LobbyUri.Concat(watchUri).Concat("delete/");
                xmlResult = client.InvokeUriXml(deleteUri, null);

                progressWnd.Increment();
                Assert.IsTrue(xmlResult.ResultSucceeded, "Could not add watch for URI " + deleteUri.ToString());
            }

            progressWnd.RunOnUIThread(() => {
                progressWnd.Hide();
            });
        }
コード例 #6
0
        public void TestDeviceBulk() {
            int maxDevices = 10000;
            ObixResult<XElement> xmlResult = null;
            XElement sampleDevice = null;
            Uri signupUri = client.LobbyUri.Concat("signUp");

            progressWnd = new CProgressWnd("Posting oBIX devices");
            wndThread = new Thread(() => {
                progressWnd.ShowDialog();
            });

            wndThread.SetApartmentState(ApartmentState.STA);
            wndThread.Start();

            progressWnd.ProgressMaximumValue = maxDevices;

            TestConnect();
            Assert.IsNotNull(client, "Client is not initialized.");
            Assert.IsTrue(client.IsConnected, "Client is not connected.");

            for (int i = 0; i <= maxDevices; i++) {
                sampleDevice = CreateTestDevice();
                Assert.IsNotNull(sampleDevice, "TestDeviceWrite failed to create a sample device oBIX object.");

                xmlResult = client.InvokeUriXml(signupUri, sampleDevice);
                Assert.IsTrue(xmlResult.ResultSucceeded, string.Format("Device signup to href {0} failed with result {1}.", signupUri, xmlResult));
                progressWnd.Increment();
            }

            progressWnd.RunOnUIThread(() => {
                progressWnd.Hide();
            });

            wndThread.Join();
        }