public void CreateQueue_withDefaults_Cleanup() { if (!TestConfig.Run_MiscTests) { Assert.Inconclusive(); } AuthToken at = new AuthToken(Properties.Settings.Default.ManageKey, Properties.Settings.Default.ServiceNamespace); Queues q = new Queues(at); q.Delete("qWithDefaults"); }
public void CreateQueue_byCustomDefinitionFail() { if (!TestConfig.Run_MiscTests) { Assert.Inconclusive(); } AuthToken at = new AuthToken(Properties.Settings.Default.ManageKey, Properties.Settings.Default.ServiceNamespace); Queues q = new Queues(at); QueueDefinition qd = new QueueDefinition("qFromCustomDef"); //qd.MaxDeliveryCount = 10; // This should FAIL! qd.LockDuration = new TimeSpan(0, 0, 5); qd.MaxSizeInMegabytes = 5120; qd.DeadLetteringOnMessageExpiration = false; qd.DefaultMessageTimeToLive = new TimeSpan(0, 0, 30); qd.DuplicateDetectionHistoryTimeWindow = new TimeSpan(0, 0, 15); try { q.Create("qFromCustomDefFail", qd); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.ToString()); if (!ex.Message.Contains("You must set a MaxDeliveryCount.") && !ex.Message.Contains("MaxDeliveryCount cannot be null.")) { Assert.Fail("Expected Exception Message Unexpected."); } throw ex; } }
public void Get_QueueDescription() { if (!TestConfig.Run_MiscTests) { Assert.Inconclusive(); } AuthToken at = new AuthToken(Properties.Settings.Default.ManageKey, Properties.Settings.Default.ServiceNamespace); Queues q = new Queues(at); q.GetDescription("authin"); }
public static List<Response> PeekQueue(AuthToken at, string queueName) { try { return new List<Response>(); } catch (Exception ex) { throw ex; } }
public static byte[] FromSubscription(AuthToken at, string topicName, string subscriptionName, string messageId) { try { return new byte[0]; } catch (Exception ex) { throw ex; } }
/// <summary> /// Gets a single item at the top of the subscription queue. /// Queue item IS NOT deleted upon receipt. /// </summary> /// <param name="at">typeof(AuthToken)</param> /// <param name="topicName">Topic name.</param> /// <param name="subscriptionName">Subscription name.</param> /// <param name="confirmDelete"></param> /// <returns>Array of bytes received fromt the Azure Service Bus response.</returns> public static byte[] FromSubscription(AuthToken at, string topicName, string subscriptionName, bool confirmDelete) { try { return new byte[0]; } catch (Exception ex) { throw ex; } }
public static byte[] FromQueue(AuthToken at, string queueName) { try { return new byte[0]; } catch (Exception ex) { throw ex; } }
public static bool ToTopic(AuthToken at, string topicName, string messageData) { try { throw new NotImplementedException(); //return true; } catch (Exception ex) { throw ex; //return false; } }
public void CreateQueue_byCustomDefinition() { if (!TestConfig.Run_MiscTests) { Assert.Inconclusive(); } AuthToken at = new AuthToken(Properties.Settings.Default.ManageKey, Properties.Settings.Default.ServiceNamespace); Queues q = new Queues(at); QueueDefinition qd = new QueueDefinition("qFromCustomDef"); qd.MaxDeliveryCount = 10; qd.LockDuration = new TimeSpan(0, 0, 5); qd.MaxSizeInMegabytes = 5120; qd.DeadLetteringOnMessageExpiration = false; qd.DefaultMessageTimeToLive = new TimeSpan(0, 0, 30); qd.DuplicateDetectionHistoryTimeWindow = new TimeSpan(0, 0, 15); q.Create("qFromCustomDef", qd); q.Delete("qFromCustomDef"); }
public void Create101Cues() { if (!TestConfig.Run_Create101Cues) { Assert.Inconclusive("Test Skipped."); return; } AuthToken at = new AuthToken(Properties.Settings.Default.ManageKey, Properties.Settings.Default.ServiceNamespace); Queues q = new Queues(at); DateTime startDt = DateTime.Now; Console.WriteLine(String.Format("Create101Cues started @ {0} {1}", startDt.ToLongDateString(), startDt.ToLongTimeString())); List<string> qNames = GenerateQNames; try { foreach (string qName in qNames) { q.Create(qName); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } Console.WriteLine(String.Format("Time Elapsed: {0} seconds", (DateTime.Now - startDt).TotalSeconds)); startDt = DateTime.Now; Console.WriteLine(String.Format("Create101Cues fetching queue list @ {0} {1}", startDt.ToLongDateString(), startDt.ToLongTimeString())); AtomPubFeed apfxml = q.AtomPubList(); List<string> queues = q.NameList(apfxml); string tp = testPrefix; Console.WriteLine(String.Format("Queues Found: {0}", String.Join(",", queues.Select(x => x.Replace(tp, "")).ToArray()))); Console.WriteLine(String.Format("Time Elapsed: {0} seconds", (DateTime.Now - startDt).TotalSeconds)); startDt = DateTime.Now; Console.WriteLine(String.Format("Create101Cues validating queue list @ {0} {1}", startDt.ToLongDateString(), startDt.ToLongTimeString())); foreach (string s in qNames) { if (!queues.Contains(s)) { Assert.Fail(String.Format("Missing queue name: {0}", s)); } } Console.WriteLine(String.Format("Time Elapsed: {0} seconds", (DateTime.Now - startDt).TotalSeconds)); }
public void Create101Cues_Cleanup() { if (!TestConfig.Run_Create101Cues) { return; } AuthToken at = new AuthToken(Properties.Settings.Default.ManageKey, Properties.Settings.Default.ServiceNamespace); Queues q = new Queues(at); DateTime startDt = DateTime.Now; try { Console.WriteLine(String.Format("Create101Cues test cleanup started @ {0} {1}", startDt.ToLongDateString(), startDt.ToLongTimeString())); List<string> qNames = GenerateQNames; foreach (string qName in qNames) { try { q.Delete(qName); } catch { // do nothing, let clean-up complete. } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } finally { Console.WriteLine(String.Format("Time Elapsed: {0} seconds", (DateTime.Now - startDt).TotalSeconds)); } }
public QueuesInit() { at = new AuthToken(Properties.Settings.Default.ManageKey, Properties.Settings.Default.ServiceNamespace); q = new HackishAzure.ServiceBus.REST.Management.Queues(at); }
public static List<Response> PeekSubscription(AuthToken at, string topicName, string subscriptionName) { try { return new List<Response>(); } catch (Exception ex) { throw ex; } }
public void CreateQueue_FromDefinition() { if (!TestConfig.Run_CreateQueueFromDefinition) { Assert.Inconclusive("Test skipped."); return; } AuthToken at = new AuthToken(Properties.Settings.Default.ManageKey, Properties.Settings.Default.ServiceNamespace); Queues q = new Queues(at); #region "Pre-test clean-up" try { q.Delete("qWithDefaults"); q.Delete("qWithDefaults2"); } catch { // Do nothing. } #endregion q.Create("qWithDefaults"); QueueDescription qd = null; int tries = 0; #region "Wait up to 10 seconds for the queue to publish." while (qd == null && tries < 10) { Thread.Sleep(1000); try { var tmp = q.AtomPubList().Entries.Where(x => x.Title == "qwithdefaults"); if (tmp != null) { if (tmp.Count() == 1) { AtomPubFeedEntry ape = tmp.First(); if (ape.Content != null) { if (ape.Content.Value != null) { qd = QueueDescription.DeserializeFrom(ape.Content.Value); } } } } } catch { // Do nothing. } finally { tries += 1; } } #endregion #region "Tried 10 x fail" if (tries == 10 && qd == null) { try { q.Delete("qWithDefaults"); } catch { Console.WriteLine("Failure to create and/or delete could constitute a problem with Azure and/or Service Bus and/or Internet connection."); Console.WriteLine("Could not clean-up: 'qWithDefaults' -- Suggest using Service Bus Explorer to remove this queue if it exists."); // Do nothing. } finally { Assert.Fail("Failed to retreive and/or delete newly created queue: 'qWithDefaults'"); } } #endregion q.Create("qWithDefaults2", new QueueDefinition("qWithDefaults2", qd)); QueueDescription qd2 = null; tries = 0; #region "Wait up to 10 seconds for the queue to publish." while (qd2 == null && tries < 10) { Thread.Sleep(1000); try { var tmp = q.AtomPubList().Entries.Where(x => x.Title == "qwithdefaults2"); if (tmp != null) { if (tmp.Count() == 1) { AtomPubFeedEntry ape = tmp.First(); if (ape.Content != null) { if (ape.Content.Value != null) { qd2 = QueueDescription.DeserializeFrom(ape.Content.Value); } } } } } catch // (Exception ex) { // Do nothing. } finally { tries += 1; } } #endregion #region "Tried 10 x fail" if (tries == 10 && qd2 == null) { try { q.Delete("qWithDefaults"); q.Delete("qWithDefaults2"); } catch { Console.WriteLine("Failure to create and/or delete could constitute a problem with Azure and/or Service Bus and/or Internet connection."); Console.WriteLine("Could not clean-up: 'qWithDefaults' and/or 'qWithDefaults2' -- Suggest using Service Bus Explorer to remove this queue if it exists."); // Do nothing. } finally { Assert.Fail("Failed to retreive and/or delete newly created queues: 'qWithDefaults', 'qWithDefaults2'"); } } #endregion try { QueueDefinition qdc1 = new QueueDefinition("qWithDefaults", qd); QueueDefinition qdc2 = new QueueDefinition("qWithDefaults2", qd2); Assert.AreEqual<QueueDefinition>(qdc1, qdc2); } finally { #region "Cleanup" q.Delete("qWithDefaults"); q.Delete("qWithDefaults2"); #endregion } }