Пример #1
0
        public static void AssemblyInitialize(TestContext context)
        {
            Ace.Init();

            RtpsDiscovery disc = new RtpsDiscovery(RTPS_DISCOVERY);

            Assert.AreEqual(RTPS_DISCOVERY, disc.Key);
            ParticipantService.Instance.AddDiscovery(disc);
            ParticipantService.Instance.DefaultDiscovery = RTPS_DISCOVERY;
            Assert.AreEqual(RTPS_DISCOVERY, ParticipantService.Instance.DefaultDiscovery);
            ParticipantService.Instance.SetRepoDomain(RTPS_DOMAIN, RTPS_DISCOVERY);
            ParticipantService.Instance.SetRepoDomain(RTPS_OTHER_DOMAIN, RTPS_DISCOVERY);

            InfoRepoDiscovery infoRepo = new InfoRepoDiscovery(INFOREPO_DISCOVERY, "corbaloc::localhost:12345/DCPSInfoRepo");

            ParticipantService.Instance.AddDiscovery(infoRepo);
            infoRepo.BitTransportIp   = "localhost";
            infoRepo.BitTransportPort = 0;
            ParticipantService.Instance.SetRepoDomain(INFOREPO_DOMAIN, INFOREPO_DISCOVERY);

            _supportProcess = new SupportProcessHelper(context);
            _infoProcess    = _supportProcess.SpawnDCPSInfoRepo();
            System.Threading.Thread.Sleep(1000);

            Factory = ParticipantService.Instance.GetDomainParticipantFactory();

            Assert.IsFalse(TransportRegistry.Instance.Released);
            Assert.IsFalse(ParticipantService.Instance.IsShutdown);
        }
Пример #2
0
        public static void AssemblyInitialize(TestContext context)
        {
            Ace.Init();

            RtpsDiscovery disc = new RtpsDiscovery(RTPS_DISCOVERY);

            ParticipantService.Instance.AddDiscovery(disc);
            ParticipantService.Instance.DefaultDiscovery = RTPS_DISCOVERY;
            Assert.AreEqual(RTPS_DISCOVERY, ParticipantService.Instance.DefaultDiscovery);
            ParticipantService.Instance.SetRepoDomain(RTPS_DOMAIN, RTPS_DISCOVERY);
            ParticipantService.Instance.SetRepoDomain(RTPS_OTHER_DOMAIN, RTPS_DISCOVERY);

            InfoRepoDiscovery infoRepo = new InfoRepoDiscovery(INFOREPO_DISCOVERY, "file://" + INFOREPO_IOR);

            ParticipantService.Instance.AddDiscovery(infoRepo);
            ParticipantService.Instance.SetRepoDomain(INFOREPO_DOMAIN, INFOREPO_DISCOVERY);

            _supportProcess = new SupportProcessHelper(context);
            _infoProcess    = _supportProcess.SpawnDCPSInfoRepo();
            System.Threading.Thread.Sleep(1000);

            Factory = ParticipantService.Instance.GetDomainParticipantFactory("-DCPSDebugLevel", "10", "-ORBLogFile", "LogFile.log", "-ORBDebugLevel", "10");

            Assert.IsFalse(TransportRegistry.Instance.Released);
            Assert.IsFalse(ParticipantService.Instance.IsShutdown);
        }
Пример #3
0
        public void TestDefaultValues()
        {
            InfoRepoDiscovery infoRepo = new InfoRepoDiscovery(INFOREPO_DISCOVERY, "file://repo.ior");

            Assert.AreEqual(INFOREPO_DISCOVERY, infoRepo.Key);
            Assert.AreEqual("", infoRepo.BitTransportIp);
            Assert.AreEqual(0, infoRepo.BitTransportPort);
        }
Пример #4
0
        public void TestNonDefaultValues()
        {
            InfoRepoDiscovery infoRepo = new InfoRepoDiscovery(INFOREPO_DISCOVERY, "file://repo.ior")
            {
                BitTransportIp   = "127.0.0.1",
                BitTransportPort = 42
            };

            Assert.AreEqual(INFOREPO_DISCOVERY, infoRepo.Key);
            Assert.AreEqual("127.0.0.1", infoRepo.BitTransportIp);
            Assert.AreEqual(42, infoRepo.BitTransportPort);
        }
Пример #5
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                throw new ApplicationException("Incorrect number of arguments.");
            }

            OpenDDSharp.Ace.Init();

            RtpsDiscovery disc = new RtpsDiscovery(RTPS_DISCOVERY);

            ParticipantService.Instance.AddDiscovery(disc);
            ParticipantService.Instance.DefaultDiscovery = RTPS_DISCOVERY;

            InfoRepoDiscovery infoRepo = new InfoRepoDiscovery(INFOREPO_DISCOVERY, "file://" + INFOREPO_IOR);

            ParticipantService.Instance.AddDiscovery(infoRepo);
            ParticipantService.Instance.SetRepoDomain(INFOREPO_DOMAIN, INFOREPO_DISCOVERY);

            if (Enum.TryParse(args[0], out SupportTestKind testKind))
            {
                switch (testKind)
                {
                case SupportTestKind.InconsistentTopicTest:
                    TestOnInconsistentTopic();
                    break;

                case SupportTestKind.PublicationDisconnectedTest:
                case SupportTestKind.PublicationLostTest:
                    TestOnPublicationLostDisconnected();
                    break;

                case SupportTestKind.SubscriptionDisconnectedTest:
                case SupportTestKind.SubscriptionLostTest:
                    TestOnSubscriptionLostDisconnected();
                    break;

                default:
                    throw new ApplicationException("Unkwnon test requested." + testKind.ToString());
                }
            }
            else
            {
                throw new ApplicationException("Argument is not a valid test kind.");
            }

            OpenDDSharp.Ace.Fini();
        }
Пример #6
0
        public void TestNullOrEmptyParameters()
        {
            bool exception = false;

            try
            {
                InfoRepoDiscovery infoRepo = new InfoRepoDiscovery(null, "file://repo.ior");
            }
            catch (Exception ex)
            {
                exception = true;
                Assert.IsTrue(ex.GetType() == typeof(ArgumentNullException));
            }
            Assert.IsTrue(exception);

            exception = false;
            try
            {
                InfoRepoDiscovery infoRepo = new InfoRepoDiscovery(string.Empty, "file://repo.ior");
            }
            catch (Exception ex)
            {
                exception = true;
                Assert.IsTrue(ex.GetType() == typeof(ArgumentNullException));
            }
            Assert.IsTrue(exception);

            exception = false;
            try
            {
                InfoRepoDiscovery infoRepo = new InfoRepoDiscovery("   ", "file://repo.ior");
            }
            catch (Exception ex)
            {
                exception = true;
                Assert.IsTrue(ex.GetType() == typeof(ArgumentNullException));
            }
            Assert.IsTrue(exception);

            exception = false;
            try
            {
                InfoRepoDiscovery infoRepo = new InfoRepoDiscovery(INFOREPO_DISCOVERY, null);
            }
            catch (Exception ex)
            {
                exception = true;
                Assert.IsTrue(ex.GetType() == typeof(ArgumentNullException));
            }
            Assert.IsTrue(exception);

            exception = false;
            try
            {
                InfoRepoDiscovery infoRepo = new InfoRepoDiscovery(INFOREPO_DISCOVERY, string.Empty);
            }
            catch (Exception ex)
            {
                exception = true;
                Assert.IsTrue(ex.GetType() == typeof(ArgumentNullException));
            }
            Assert.IsTrue(exception);

            exception = false;
            try
            {
                InfoRepoDiscovery infoRepo = new InfoRepoDiscovery(INFOREPO_DISCOVERY, "   ");
            }
            catch (Exception ex)
            {
                exception = true;
                Assert.IsTrue(ex.GetType() == typeof(ArgumentNullException));
            }
            Assert.IsTrue(exception);
        }