コード例 #1
0
        public void ConnectToLocalCloud(Uri keystoneServer, string username, string password, string tenantName)
        {
            CancellationTokenSource tokenSource = new CancellationTokenSource();

            System.Diagnostics.Trace.WriteLine("[Test started] !!!");

            Assert.DoesNotThrow(() =>
            {
                var tsk = keystone.GetToken(keystoneServer, username, password, tenantName, tokenSource.Token);
                KeystoneResponse response = tsk.Result;

                response.Access.ServiceCatalog.AsParallel().ForAll(x => System.Diagnostics.Trace.WriteLine("Endpoint name: " + x.Name));
            });
        }
コード例 #2
0
        public void TestDesirialization()
        {
            StreamReader reader  = File.OpenText("rawData.txt");
            string       rawData = reader.ReadToEnd();

            DataContractJsonSerializer deSerializer = new DataContractJsonSerializer(typeof(KeystoneResponse));

            try
            {
                MemoryStream     mStream  = new MemoryStream(Encoding.Unicode.GetBytes(rawData));
                KeystoneResponse response = deSerializer.ReadObject(mStream) as KeystoneResponse;
                System.Diagnostics.Trace.WriteLine("here");
            }
            catch (Exception exp_gen)
            {
                System.Diagnostics.Trace.WriteLine("Exception: " + exp_gen.ToString());
            }
        }