public void FixtureSetUp()
 {
     var brokerAdmin = new RabbitBrokerAdmin();
     brokerAdmin.StartupTimeout = 10000;
     brokerAdmin.StartBrokerApplication();
     this.brokerIsRunning = BrokerRunning.IsRunningWithEmptyQueues(queue);
 }
        public void FixtureSetUp()
        {
            this.BeforeFixtureSetUp();

            // Eventually add some kind of logic here to start up the broker if it is not running.
            this.AfterFixtureSetUp();

            try
            {
                if (environment.IsActive())
                {
                    // Set up broker admin for non-root user
                    this.brokerAdmin = BrokerTestUtils.GetRabbitBrokerAdmin(); // "rabbit@LOCALHOST", 5672);
                    this.brokerAdmin.StartNode();
                }
            }
            catch (Exception ex)
            {
                Logger.Error("An error occurred during SetUp", ex);
                Assert.Fail("An error occurred during SetUp.");
            }

            if (!this.brokerIsRunning.Apply())
            {
                Assert.Ignore("Rabbit broker is not running. Ignoring integration test fixture.");
            }
        }
 public void FixtureTearDown()
 {
     BeforeFixtureTearDown();
     var brokerAdmin = new RabbitBrokerAdmin();
     brokerAdmin.StopBrokerApplication();
     brokerAdmin.StopNode();
     AfterFixtureTearDown();
 }
 public void FixtureSetUp()
 {
     BeforeFixtureSetUp();
     var brokerAdmin = new RabbitBrokerAdmin();
     brokerAdmin.StartupTimeout = 10000;
     brokerAdmin.StartBrokerApplication();
     AfterFixtureSetUp();
 }
 public void Init()
 {
     environment.Apply();
     this.brokerAdmin = BrokerTestUtils.GetRabbitBrokerAdmin(NODE_NAME);
     var status = this.brokerAdmin.GetStatus();
     if (!status.IsRunning)
     {
         this.brokerAdmin.StartBrokerApplication();
     }
 }
示例#6
0
        public void Init()
        {
            environment.Apply();
            this.brokerAdmin = BrokerTestUtils.GetRabbitBrokerAdmin(NODE_NAME);
            var status = this.brokerAdmin.GetStatus();

            if (!status.IsRunning)
            {
                this.brokerAdmin.StartBrokerApplication();
            }
        }
示例#7
0
 public void SetUp()
 {
     try
     {
         if (environment.IsActive())
         {
             // Set up broker admin for non-root user
             this.brokerAdmin = BrokerTestUtils.GetRabbitBrokerAdmin(); // "rabbit@LOCALHOST", 5672);
             this.brokerAdmin.StartNode();
         }
     }
     catch (Exception ex)
     {
         Logger.Error("An error occurred during SetUp", ex);
         Assert.Fail("An error occurred during SetUp.");
     }
 }
 public void SetUp()
 {
     try
     {
         if (environment.IsActive())
         {
             // Set up broker admin for non-root user
             this.brokerAdmin = BrokerTestUtils.GetRabbitBrokerAdmin(); // "rabbit@LOCALHOST", 5672);
             this.brokerAdmin.StartNode();
         }
     }
     catch (Exception ex)
     {
         Logger.Error("An error occurred during SetUp", ex);
         Assert.Fail("An error occurred during SetUp.");
     }
 }
示例#9
0
        public static void GlobalFixtureSetup()
        {
            StartFederationProxy();
            StartAlternativePortProxy();

            Environment.SetEnvironmentVariable("RABBITMQ_SERVER", @"..\..\..\..\RabbitMQServer");
            Environment.SetEnvironmentVariable("RABBITMQ_SERVER_START_ARGS", "-setcookie RogerIntegrationTests");

            Broker = new RabbitBrokerAdmin(cookie: "RogerIntegrationTests") {StartupTimeout = 10000};
            BrokerHttp = new ResbitClient(Constants.HostName);

            TryStartBroker();

            EnsureBrokerRunning();

            SetupSecondaryVirtualHost();

            SetupFederationExchanges();
        }
示例#10
0
        public void IntegrationTestsUserCrudWithModuleAdapter()
        {
            try
            {
                var adapter = new Dictionary <string, string>();

                // Switch two functions with identical inputs!
                adapter.Add("rabbit_auth_backend_internal%add_user", "rabbit_auth_backend_internal%change_password");
                adapter.Add("rabbit_auth_backend_internal%change_password", "rabbit_auth_backend_internal%add_user");
                this.brokerAdmin.ModuleAdapter = adapter;

                var users = this.brokerAdmin.ListUsers();
                if (users.Contains("joe"))
                {
                    this.brokerAdmin.DeleteUser("joe");
                }

                Thread.Sleep(1000);
                this.brokerAdmin.ChangeUserPassword("joe", "sales");
                Thread.Sleep(1000);
                this.brokerAdmin.AddUser("joe", "trader");
                Thread.Sleep(1000);
                users = this.brokerAdmin.ListUsers();
                if (users.Contains("joe"))
                {
                    Thread.Sleep(1000);
                    this.brokerAdmin.DeleteUser("joe");
                }
            }
            catch (Exception ex)
            {
                Logger.Error("An error occurred", ex);
                throw;
            }
            finally
            {
                // Need to ensure that we reset the module adapter that we swizzled with above, otherwise our other tests will be unreliable.
                this.brokerAdmin = BrokerTestUtils.GetRabbitBrokerAdmin();
            }
        }
        public void FixtureSetUp()
        {
            NamespaceParserRegistry.RegisterParser(typeof(RabbitNamespaceHandler));

            try
            {
                if (environment.IsActive())
                {
                    // Set up broker admin for non-root user
                    this.brokerAdmin = BrokerTestUtils.GetRabbitBrokerAdmin(); // "rabbit@LOCALHOST", 5672);
                    this.brokerAdmin.StartNode();
                }
            }
            catch (Exception ex)
            {
                Logger.Error("An error occurred during SetUp", ex);
                Assert.Fail("An error occurred during SetUp.");
            }

            if (!this.brokerIsRunning.Apply())
            {
                Assert.Ignore("Rabbit broker is not running. Ignoring integration test fixture.");
            }
        }
 public void SetUp()
 {
     connectionFactory = new SingleConnectionFactory();
     brokerAdmin = new RabbitBrokerAdmin(connectionFactory);
 }
示例#13
0
 /// <summary>
 /// Gets the rabbit broker admin.
 /// </summary>
 /// <param name="nodeName">Name of the node.</param>
 /// <param name="port">The port.</param>
 /// <returns></returns>
 /// Convenience factory for a {@link RabbitBrokerAdmin} instance that will usually start and stop cleanly on all
 /// systems.
 /// @param nodeName the name of the node
 /// @param port the port to listen on
 /// @return a {@link RabbitBrokerAdmin} instance
 /// <remarks></remarks>
 public static RabbitBrokerAdmin GetRabbitBrokerAdmin(string nodeName, int port)
 {
     var brokerAdmin = new RabbitBrokerAdmin(nodeName, port);
     brokerAdmin.RabbitLogBaseDirectory = "target/rabbitmq/log";
     brokerAdmin.RabbitMnesiaBaseDirectory = "target/rabbitmq/mnesia";
     brokerAdmin.StartupTimeout = 10000L;
     return brokerAdmin;
 }
 public void SetUp()
 {
     //if (environment.isActive())
     //{
     // Set up broker admin for non-root user
     this.brokerAdmin = BrokerTestUtils.GetRabbitBrokerAdmin(); //"rabbit@LOCALHOST", 5672);
     this.brokerAdmin.StartBrokerApplication();
     //panic.setBrokerAdmin(brokerAdmin);
     // }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageListenerBrokerInterruptionIntegrationTests"/> class. 
        /// </summary>
        /// <remarks>
        /// </remarks>
        public MessageListenerBrokerInterruptionIntegrationTests()
        {
            var directory = new DirectoryInfo("target/rabbitmq");
            if (directory.Exists)
            {
                directory.Delete(true);
            }

            logger.Debug("Setting up broker");
            this.brokerAdmin = BrokerTestUtils.GetRabbitBrokerAdmin();

            // panic.setBrokerAdmin(brokerAdmin);
            if (environment.IsActive())
            {
                this.brokerAdmin.StartupTimeout = 10000;
                this.brokerAdmin.StartNode();
            }

            this.brokerIsRunning = BrokerRunning.IsRunningWithEmptyQueues(this.queue);
            this.brokerIsRunning.Port = BrokerTestUtils.GetAdminPort();
        }
        public void IntegrationTestsUserCrudWithModuleAdapter()
        {
            try
            {
                var adapter = new Dictionary<string, string>();

                // Switch two functions with identical inputs!
                adapter.Add("rabbit_auth_backend_internal%add_user", "rabbit_auth_backend_internal%change_password");
                adapter.Add("rabbit_auth_backend_internal%change_password", "rabbit_auth_backend_internal%add_user");
                this.brokerAdmin.ModuleAdapter = adapter;

                var users = this.brokerAdmin.ListUsers();
                if (users.Contains("joe"))
                {
                    this.brokerAdmin.DeleteUser("joe");
                }

                Thread.Sleep(1000);
                this.brokerAdmin.ChangeUserPassword("joe", "sales");
                Thread.Sleep(1000);
                this.brokerAdmin.AddUser("joe", "trader");
                Thread.Sleep(1000);
                users = this.brokerAdmin.ListUsers();
                if (users.Contains("joe"))
                {
                    Thread.Sleep(1000);
                    this.brokerAdmin.DeleteUser("joe");
                }
            }
            catch (Exception ex)
            {
                Logger.Error("An error occurred", ex);
                throw;
            }
            finally
            {
                // Need to ensure that we reset the module adapter that we swizzled with above, otherwise our other tests will be unreliable.
                this.brokerAdmin = BrokerTestUtils.GetRabbitBrokerAdmin();
            }
        }