示例#1
0
 public void it_exists_afterwards()
 {
     TestConfigFactory.CreateNamespaceManager(TestConfigFactory.CreateMessagingFactory())
     .ExistsAsync(address.QueueDescription)
     .Result
     .ShouldBeTrue();
 }
示例#2
0
        public void given_a_messaging_factory()
        {
            mf = TestConfigFactory.CreateMessagingFactory();
            var nm = TestConfigFactory.CreateNamespaceManager(mf);

            nm.TopicExists("my.topic.here").ShouldBeFalse();
        }
示例#3
0
        public void theres_a_namespace_manager_available()
        {
            var mf = TestConfigFactory.CreateMessagingFactory();

            nm = TestConfigFactory.CreateNamespaceManager(mf);

            _formatter = new AzureServiceBusMessageNameFormatter();
        }
示例#4
0
        public void nsm_mf_and_topic()
        {
            var tp = TestConfigFactory.CreateTokenProvider();
            var mf = TestConfigFactory.CreateMessagingFactory(tp);
            var nm = TestConfigFactory.CreateNamespaceManager(mf, tp);

            topic = nm.TryCreateTopic(mf, "sample-topic").Result;
            topic.ShouldNotBeNull();
        }
示例#5
0
        public void when_I_place_a_message_in_the_queue()
        {
            message = TestDataFactory.AMessage();
            var mf = TestConfigFactory.CreateMessagingFactory();

            nm = TestConfigFactory.CreateNamespaceManager(mf);
            nm.TryCreateQueue("test-queue").Wait();
            t = mf.CreateQueueClient("test-queue");
            t.Send(new BrokeredMessage(message));
        }
示例#6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeEach void setPartitionSize() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void SetPartitionSize()
        {
            System.setProperty("luceneSchemaIndex.maxPartitionSize", _docsPerPartition.ToString());

            Factory <IndexWriterConfig> configFactory = new TestConfigFactory();

            _index = LuceneSchemaIndexBuilder.create(_descriptor, Config.defaults()).withFileSystem(_fileSystem).withIndexRootFolder(new File(_testDir.directory("uniquenessVerification"), "index")).withWriterConfig(configFactory).withDirectoryFactory(DirectoryFactory.PERSISTENT).build();

            _index.create();
            _index.open();
        }
示例#7
0
        public void nsm_mf_and_topic()
        {
            var tp = TestConfigFactory.CreateTokenProvider();
            var mf = TestConfigFactory.CreateMessagingFactory(tp);

            desc = new QueueDescriptionImpl("to-be-drained");
            nm   = TestConfigFactory.CreateNamespaceManager(mf, tp);

            client = mf.NewSenderAsync(nm, desc).Result;

            // sanity checks; I can now place a message in the queue
            client.Send(new BrokeredMessage(new A("My Contents", new byte[] { 1, 2, 3 })));
        }
        public int AddTest(
            int TestSetId,
            int TestConfigId,
            string[] Additional         = default(string[]),
            bool RemoveTestOnUpdateFail = default(bool))
        {
            int result = 0;

            try
            {
                if (!Connect(ServerUrl, Username, Password, Domain, Project))
                {
                    return(0);
                }

                //Get the test ID from the config factory
                TestConfigFactory TestConfigFact = tdc.TestConfigFactory;

                TestConfig TestConfig = TestConfigFact[TestConfigId];

                int TestId = TestConfig.TestId;

                //API provides no way to add a specific test configuration to the test set
                //Instead we will add the test to the test set then remove the unneeded instances

                TestSetFactory TSFact  = tdc.TestSetFactory;
                TestSet        TestSet = TSFact[TestSetId];

                TSTestFactory TSTestFact = TestSet.TSTestFactory;

                //Capture the starting list of tests in the test set
                List StartingTestList = TSTestFact.NewList("");
                System.Collections.Generic.List <int> StartingTestInstanceList = new List <int>();

                foreach (TSTest testInstance in StartingTestList)
                {
                    StartingTestInstanceList.Add(int.Parse(testInstance.ID));
                }

                //Add the test to the test set
                TSTestFact.AddItem(TestId);

                //Capture the new list of tests in the test set
                List EndingTestList = TSTestFact.NewList("");
                System.Collections.Generic.List <int> EndingTestInstanceList = new List <int>();

                foreach (TSTest testInstance in EndingTestList)
                {
                    EndingTestInstanceList.Add(int.Parse(testInstance.ID));
                }


                //Remove added tests that we don't want
                TSTest     tempInstance, addedTestInstance = null;
                TestConfig tempConfig;

                foreach (int testInstanceId in EndingTestInstanceList)
                {
                    if (!StartingTestInstanceList.Contains(testInstanceId))
                    {
                        tempInstance = TSTestFact[testInstanceId];
                        tempConfig   = tempInstance.TestConfiguration;
                        if (!TestConfigId.Equals(tempConfig.ID))
                        {
                            TSTestFact.RemoveItem(tempInstance.ID);
                        }
                        else
                        {
                            addedTestInstance = tempInstance;
                        }
                    }
                }

                result = int.Parse(addedTestInstance.ID);

                //Set additional field values
                if (Additional != default(string[]))
                {
                    foreach (string fieldPair in Additional)
                    {
                        string[] tempFieldArray = fieldPair.Split(new[] { ";;" }, StringSplitOptions.None);
                        addedTestInstance[tempFieldArray[0]] = tempFieldArray[1];
                    }

                    addedTestInstance.Post();
                }
            }
            catch (COMException ce)
            {
                rr.AddErrorLine(HandleException(ce));
                if (RemoveTestOnUpdateFail && result > 0)
                {
                    TSTestFactory fact = tdc.TSTestFactory;
                    fact.RemoveItem(result);
                    result = 0;
                }
            }

            Disconnect();
            return(result);
        }
示例#9
0
        public void theres_a_namespace_manager_available()
        {
            var mf = TestConfigFactory.CreateMessagingFactory();

            nm = TestConfigFactory.CreateNamespaceManager(mf);
        }
示例#10
0
        public void nsm_mf_and_topic()
        {
            var tp = TestConfigFactory.CreateTokenProvider();

            mf = TestConfigFactory.CreateMessagingFactory(tp);
        }