public async Task QueueTrigger_BindToTriggerMetadata_Succeeds()
        {
            string inputQueueMessage = Guid.NewGuid().ToString();
            //Clear queue
            await StorageHelpers.ClearQueue(Constants.OutputBindingQueueNameMetadata);

            await StorageHelpers.ClearQueue(Constants.InputBindingQueueNameMetadata);

            //Set up and trigger
            await StorageHelpers.CreateQueue(Constants.OutputBindingQueueNameMetadata);

            string expectedQueueMessage = await StorageHelpers.InsertIntoQueue(Constants.InputBindingQueueNameMetadata, inputQueueMessage);

            //Verify
            var queueMessage = await StorageHelpers.ReadFromQueue(Constants.OutputBindingQueueNameMetadata);

            Assert.Contains(expectedQueueMessage, queueMessage);
        }
        public async Task QueueTrigger_QueueOutput_Succeeds()
        {
            string expectedQueueMessage = Guid.NewGuid().ToString();
            //Clear queue
            await StorageHelpers.ClearQueue(Constants.OutputBindingQueueName);

            await StorageHelpers.ClearQueue(Constants.InputBindingQueueName);

            //Set up and trigger
            await StorageHelpers.CreateQueue(Constants.OutputBindingQueueName);

            await StorageHelpers.InsertIntoQueue(Constants.InputBindingQueueName, expectedQueueMessage);

            //Verify
            var queueMessage = await StorageHelpers.ReadFromQueue(Constants.OutputBindingQueueName);

            Assert.Equal(expectedQueueMessage, queueMessage);
        }
        public async Task QueueTrigger_QueueOutput_POJO_Succeeds()
        {
            string expectedQueueMessage = Guid.NewGuid().ToString();
            //Clear queue
            await StorageHelpers.ClearQueue(Constants.OutputBindingQueueNamePOJO);

            await StorageHelpers.ClearQueue(Constants.InputBindingQueueNamePOJO);

            //Set up and trigger
            await StorageHelpers.CreateQueue(Constants.OutputBindingQueueNamePOJO);

            JObject testData = new JObject();

            testData["id"] = expectedQueueMessage;
            await StorageHelpers.InsertIntoQueue(Constants.InputBindingQueueNamePOJO, testData.ToString());

            //Verify
            var queueMessage = await StorageHelpers.ReadFromQueue(Constants.OutputBindingQueueNamePOJO);

            Assert.Contains(expectedQueueMessage, queueMessage);
        }
Beispiel #4
0
        public async Task KafkaTriggerAndOutputString_Succeeds()
        {
            string expectedEventId = Guid.NewGuid().ToString();

            try
            {
                // Send Message to the Kafka Cluster using Kafka Output
                await SetupQueue(Constants.OutputStringOneKafkaQueueName);

                Assert.True(await Utilities.InvokeHttpTrigger("HttpTriggerAndKafkaOutput", $"?&message={expectedEventId}", System.Net.HttpStatusCode.OK, expectedEventId));
                // Verify
                var queueMessage = await StorageHelpers.ReadFromQueue(Constants.OutputStringOneKafkaQueueName);

                Assert.Contains(expectedEventId, queueMessage);
            }
            finally
            {
                // Clear queue
                await StorageHelpers.ClearQueue(Constants.OutputStringOneKafkaQueueName);
            }
        }
        public async Task EventHubTriggerAndOutputBinaryOne_Succeeds()
        {
            string expectedEventId = Guid.NewGuid().ToString();

            try
            {
                await SetupQueue(Constants.OutputBinaryOneQueueName);

                await EventHubsHelpers.SendMessagesAsync(expectedEventId, Constants.InputBinaryOneEventHubQueueName, Constants.EventHubsConnectionStringSenderSetting2);

                //Verify
                var queueMessage = await StorageHelpers.ReadFromQueue(Constants.OutputBinaryOneQueueName);

                Assert.Contains(expectedEventId, queueMessage);
            }
            finally
            {
                //Clear queue
                await StorageHelpers.ClearQueue(Constants.OutputEventHubQueueName);
            }
        }
Beispiel #6
0
        public async Task serviceBusQueueBatchTrigger_Succeeds()
        {
            string expectedEventId = Guid.NewGuid().ToString();

            try
            {
                // Send Message to the Service bus queue
                await SetupQueue(Constants.serviceBusTopicBatchTriggerQueueName);

                await ServiceBusHelpers.SendMessagesAsync(expectedEventId, Constants.serviceBusTopicBatchTriggerServiceBusName, Constants.ServiceBusConnectionStringSetting);

                // Verify
                var queueMessage = await StorageHelpers.ReadFromQueue(Constants.serviceBusTopicBatchTriggerQueueName);

                Assert.Contains(expectedEventId, queueMessage);
            }
            finally
            {
                // Clear queue
                await StorageHelpers.ClearQueue(Constants.serviceBusTopicBatchTriggerQueueName);
            }
        }
Beispiel #7
0
        public async Task EventHubTriggerAndOutputString_Succeeds()
        {
            string expectedEventId = Guid.NewGuid().ToString();

            try
            {
                await SetupQueue(Constants.OutputEventHubQueueName);

                // Need to setup EventHubs: test-input-java and test-output-java
                await EventHubsHelpers.SendMessagesAsync(expectedEventId, Constants.InputEventHubName);

                //Verify
                var queueMessage = await StorageHelpers.ReadFromQueue(Constants.OutputEventHubQueueName);

                Assert.Contains(expectedEventId, queueMessage);
            }
            finally
            {
                //Clear queue
                await StorageHelpers.ClearQueue(Constants.OutputEventHubQueueName);
            }
        }
        public async Task EventHubTriggerAndOutputJSON_Succeeds()
        {
            string expectedEventId = Guid.NewGuid().ToString();

            try
            {
                await SetupQueue(Constants.OutputJsonEventHubQueueName);

                // Need to setup EventHubs: test-inputjson-java and test-outputjson-java
                await EventHubsHelpers.SendJSONMessagesAsync(expectedEventId, Constants.EventHubsConnectionStringSenderSetting);

                //Verify
                var queueMessage = await StorageHelpers.ReadFromQueue(Constants.OutputJsonEventHubQueueName);

                JObject json = JObject.Parse(queueMessage);
                Assert.Contains(expectedEventId, json["value"].ToString());
            }
            finally
            {
                //Clear queue
                await StorageHelpers.ClearQueue(Constants.OutputJsonEventHubQueueName);
            }
        }
Beispiel #9
0
        public async Task TestEventGridOutputBinding()
        {
            /* Testing EventGrid output binding
             *
             * EventGrid function `EventGridOutputBindingJava` is
             * triggered using the http trigger, passing in a guid to it, and an
             * event is sent to EventGrid. It forwards the event to queue and we
             * read the queue contents.
             *
             * Verify that the following event grid and queue are created:
             *  - Constants.EventGridOutputBindingTopicUriSetting (Azure Devops will have the information for this).
             *  - Constants.EventGridStorageOutputBindingQueueName
             *
             *  Also verify that the queue is subscribed to the events in that eventgrid.
             */

            string expectedEventId = Guid.NewGuid().ToString();

            try
            {
                // clearing up queue for event grid to send event to.
                await SetupQueue(Constants.EventGridStorageOutputBindingQueueName);

                Assert.True(await Utilities.InvokeHttpTrigger("EventGridOutputBindingJava",
                                                              $"?&testuuid={expectedEventId}", HttpStatusCode.OK, null));

                var queueMessage = await StorageHelpers.ReadFromQueue(
                    Constants.EventGridStorageOutputBindingQueueName);

                Assert.Contains(expectedEventId, queueMessage);
            }
            finally
            {
                // Clear queue for next run
                await StorageHelpers.ClearQueue(Constants.EventGridStorageOutputBindingQueueName);
            }
        }