예제 #1
0
        public void local_module_published_once_one_module_revieved()
        {
            PrepareSharedLibrary();

            string publishingModuleSrc = GetSourceCodePath(typeof(SDPublishingModule));
            string listeningModuleSrc  = GetSourceCodePath(typeof(SDListeningModule));

            string listener1 = GenerateListener(RuntimePath, _sharedDll, listeningModuleSrc, 1);
            string listener2 = GenerateListener(RuntimePath, _sharedDll, listeningModuleSrc, 2);

            string publisherDll = Compiler.GenerateModuleFromCode(publishingModuleSrc, _sharedDll);
            ManifestBuilderConfiguration manifestConfiguration = ManifestBuilderConfiguration.Default;

            manifestConfiguration.ModulesDependenciesProvider = new SingleModulesDependencyProvider();
            Compiler.GenerateManifestForModule(publisherDll, KeyFile, manifestConfiguration);

            // use the default Nomad Configuration
            ListenerKernel = new NomadKernel();
            IModuleDiscovery listnerDiscovery =
                new CompositeModuleDiscovery(new SingleModuleDiscovery(listener1),
                                             new SingleModuleDiscovery(listener2)
                                             );

            ListenerKernel.LoadModules(listnerDiscovery);
            DistributedMessageCarrier firstCarrier = CreateCarrier(ListenerKernel);

            IModuleDiscovery publisherDiscovery = new SingleModuleDiscovery(publisherDll);

            ListenerKernel.LoadModules(publisherDiscovery);

            Thread.Sleep(PUBLISH_TIMEOUT);
            int firstMsg = firstCarrier.GetStatus.Count;

            Assert.AreEqual(5, firstMsg, "The number of delivered messages is not exactly 5");
        }
예제 #2
0
        public void local_module_publishes_and_later_loaded_listener_module_does_not_receive_outdated_messages()
        {
            // path for this test (using the test method name) use in each code
            PrepareSharedLibrary();

            string publishingModuleSrc = GetSourceCodePath(typeof(InThePastPublishingModule));
            string listeningModuleSrc  = GetSourceCodePath(typeof(SimpleListeningModule));

            string listener1 = GenerateListener(RuntimePath, _sharedDll, listeningModuleSrc, 1);

            string publisherDll = Compiler.GenerateModuleFromCode(publishingModuleSrc, _sharedDll);
            ManifestBuilderConfiguration manifestConfiguration = ManifestBuilderConfiguration.Default;

            manifestConfiguration.ModulesDependenciesProvider = new SingleModulesDependencyProvider();
            Compiler.GenerateManifestForModule(publisherDll, KeyFile, manifestConfiguration);

            // preaparing modules discoveries.
            IModuleDiscovery listenerDiscovery  = new SingleModuleDiscovery(listener1);
            IModuleDiscovery publisherDiscovery = new SingleModuleDiscovery(publisherDll);

            // create non-distributed kernel
            PublisherKernel = new NomadKernel();

            // publisher module load
            PublisherKernel.LoadModules(publisherDiscovery);

            // postponed listener module load
            PublisherKernel.LoadModules(listenerDiscovery);

            // assert the events being published
            var fi = new FileInfo(listener1 + "_CounterFile");

            Assert.False(fi.Exists);
        }
예제 #3
0
        public void event_all_modules_loaded_is_catched_upon_every_success()
        {
            NomadKernel kernel = SetupMockedKernel();

            // subscribe kernel for event
            bool hasBeenLoaded = false;

            kernel.EventAggregator.Subscribe <NomadAllModulesLoadedMessage>((message) =>
            {
                Assert.AreNotEqual(0, message.ModuleInfos.Count());
                hasBeenLoaded = true;
            });

            //  compiling simple modules
            const string dir         = @"Modules\Kernel\SimpleAllModulesLoadedAwarenessTestModules\Simple\";
            const string fileName    = "AllModulesLoadedEventAwareModule.dll";
            const string module1Name = "SimpleModule1.dll";
            const string module2Name = "SimpleModule2.dll";
            const string keyFile     = @"newkey.xml";

            CompileSimpleModules(dir, keyFile, module1Name, module2Name);

            // compiling aware module
            var compiler = new ModuleCompiler
            {
                OutputDirectory =
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                 @"Modules\Kernel\SimpleAllModulesLoadedAwarenessTestModules\Aware\")
            };

            compiler.OutputName = Path.Combine(compiler.OutputDirectory, fileName);

            string modulePath = compiler.GenerateModuleFromCode(
                @"..\Source\Nomad.Tests\FunctionalTests\Data\Kernel\AllModulesLoadedEventAwareModule.cs");

            KeysGeneratorProgram.Main(new[] { keyFile });
            compiler.GenerateManifestForModule(modulePath, keyFile);
            // set up module which subscribes for event

            // loading aware module
            IModuleDiscovery setUpDiscovery = SetUpDiscovery(new ModuleInfo(modulePath));

            Assert.DoesNotThrow(() => kernel.LoadModules(setUpDiscovery));

            // loading simple modules
            var directoryDiscovery = new DirectoryModuleDiscovery(dir, SearchOption.TopDirectoryOnly);

            Assert.DoesNotThrow(() => kernel.LoadModules(directoryDiscovery));

            //verify the method being called in a module.
            var carrier = (MessageCarrier)kernel.ModuleAppDomain.CreateInstanceAndUnwrap(
                typeof(MessageCarrier).Assembly.FullName, typeof(MessageCarrier).FullName);

            Assert.AreEqual(
                new[] { "AllModulesLoadedEventAwareModule", "AllModulesLoadedEventAwareModule" },
                carrier.List.ToArray());
            Assert.IsTrue(hasBeenLoaded);
        }
예제 #4
0
        public void distributed_module_publishes_and_two_later_loaded_listener_modules_receive_those_messages()
        {
            // path for this test (using the test method name) use in each code
            PrepareSharedLibrary();

            string publishingModuleSrc = GetSourceCodePath(typeof(MixedBufferedPublishingModule));
            string listeningModuleSrc  = GetSourceCodePath(typeof(SimpleListeningModule));

            string listener1 = GenerateListener(RuntimePath, _sharedDll, listeningModuleSrc, 1);
            string listener2 = GenerateListener(RuntimePath, _sharedDll, listeningModuleSrc, 1);

            string publisherDll = Compiler.GenerateModuleFromCode(publishingModuleSrc, _sharedDll);
            ManifestBuilderConfiguration manifestConfiguration = ManifestBuilderConfiguration.Default;

            manifestConfiguration.ModulesDependenciesProvider = new SingleModulesDependencyProvider();
            Compiler.GenerateManifestForModule(publisherDll, KeyFile, manifestConfiguration);

            // create listener site
            string listenerSite = "net.tcp://127.0.0.1:5555/IDEA";

            // create published sites
            string publisherSite = "net.tcp://127.0.0.1:7777/IDEA";

            // create listener1 kernel
            NomadConfiguration config1 = NomadConfiguration.Default;

            config1.DistributedConfiguration          = DistributedConfiguration.Default;
            config1.DistributedConfiguration.LocalURI = new Uri(listenerSite);
            ListenerKernel = new NomadKernel(config1);
            IModuleDiscovery listenerDiscovery = new SingleModuleDiscovery(listener1);

            ListenerKernel.LoadModules(listenerDiscovery);

            // create publishing kernel
            NomadConfiguration publisherConfig = NomadConfiguration.Default;

            publisherConfig.DistributedConfiguration          = DistributedConfiguration.Default;
            publisherConfig.DistributedConfiguration.LocalURI = new Uri(publisherSite);
            publisherConfig.DistributedConfiguration.URLs.Add(listenerSite);
            PublisherKernel = new NomadKernel(publisherConfig);
            IModuleDiscovery publisherDiscovery = new SingleModuleDiscovery(publisherDll);

            PublisherKernel.LoadModules(publisherDiscovery);

            // postponed load of a second listener module
            IModuleDiscovery listenerDiscovery2 = new SingleModuleDiscovery(listener2);

            ListenerKernel.LoadModules(listenerDiscovery2);

            // assert the events being published
            AssertEventPublished(listener1);

            // assert that last loaded listener2 received valid events
            AssertEventPublished(listener2);
        }
예제 #5
0
        exception_during_module_loading_is_changed_into_event_visible_from_module_and_kernel()
        {
            // set up configuration of kernel with mocks
            NomadKernel kernel = SetupMockedKernel();

            // set up listener for kernel side
            bool hasBeenCalled = false;

            kernel.EventAggregator.Subscribe <NomadAllModulesLoadedMessage>(
                (message) => hasBeenCalled = true);

            //  compile module for event aggregation
            const string dir      = @"Modules\Kernel\Event\";
            const string fileName = "EventAwareModule.dll";
            const string keyFile  = @"newkey.xml";

            var compiler = new ModuleCompiler
            {
                OutputDirectory =
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dir)
            };

            compiler.OutputName = Path.Combine(compiler.OutputDirectory, fileName);

            string modulePath = compiler.GenerateModuleFromCode(
                @"..\Source\Nomad.Tests\FunctionalTests\Data\Kernel\EventAwareModule.cs");

            KeysGeneratorProgram.Main(new[] { keyFile });
            compiler.GenerateManifestForModule(modulePath, keyFile);

            // set up module which subscribes for event
            IModuleDiscovery setUpDiscovery = SetUpDiscovery(new ModuleInfo(modulePath));

            kernel.LoadModules(setUpDiscovery);

            // set up the discovery mock
            IModuleDiscovery nonExistingDiscovery =
                SetUpDiscovery(new ModuleInfo("NonExistingModule.dll"));

            // perform test
            Assert.Throws <NomadCouldNotLoadModuleException>(
                () => kernel.LoadModules(nonExistingDiscovery),
                "Exception should  be thrown in kernel domain.");

            //verify the method being called in a module.
            var carrier = (MessageCarrier)kernel.ModuleAppDomain.CreateInstanceAndUnwrap(
                typeof(MessageCarrier).Assembly.FullName, typeof(MessageCarrier).FullName);

            Assert.AreEqual(new[] { "EventAwareModule" }, carrier.List.ToArray());
            Assert.IsTrue(hasBeenCalled);
        }
예제 #6
0
        private static void loading_more_than_one_module_into_module_appdomain_callback()
        {
            SetUpInDomain();
            _nomadKernel = new NomadKernel(_configuration);

            var expectedModuleInfos = new[]
            {
                //Set Up modules to be loaded.
                new ModuleInfo(_assemblyFullPath),
                new ModuleInfo(_assemblyFullPath2),
            };

            SetUpModuleDiscovery(expectedModuleInfos);

            _nomadKernel.ModuleAppDomain.AssemblyLoad += (sender, args) => Assert.That(
                args.LoadedAssembly.FullName.
                Equals(AssemblyFullName)
                ||
                args.LoadedAssembly.FullName.
                Equals(AssemblyFullName2)
                );

            _nomadKernel.LoadModules(_moduleDiscoveryMock.Object);

            //Check for not loading assembly into kernel appDomain);););
            foreach (
                Assembly kernelAsm in _nomadKernel.KernelAppDomain.ReflectionOnlyGetAssemblies())
            {
                Assert.AreNotEqual(AssemblyFullName, kernelAsm.FullName,
                                   "The module assembly 1 has been loaded into KernelAppDomain.");
                Assert.AreNotEqual(AssemblyFullName2, kernelAsm.FullName,
                                   "The module assembly 2 has been loaded into KernelAppDomain.");
            }
        }
예제 #7
0
        private static void Main()
        {
            // signing the assemblies and creating the manifest using manifestBuilder api
            GenerateManifestUsingApi("DistributableListenerModule.dll", @"..\Modules\Listener");



            // using default distributed configuration
            string             site1  = "net.tcp://127.0.0.1:5555/IDEA";
            NomadConfiguration config = NomadConfiguration.Default;

            config.DistributedConfiguration          = DistributedConfiguration.Default;
            config.DistributedConfiguration.LocalURI = new Uri(site1);
            var kernel = new NomadKernel(config);

            // loading modules using single module discovery pattern
            var discovery =
                new DirectoryModuleDiscovery(@"..\Modules\Listener", SearchOption.TopDirectoryOnly);

            kernel.LoadModules(discovery);

            Console.WriteLine("Listener kernel ready");
            //wait for input
            Console.ReadLine();
        }
예제 #8
0
파일: Program.cs 프로젝트: orb1t/Nomad
        private static void Main()
        {
            // signing the assemblies and creating the manifest using manifestBuilder api
            GenerateManifestUsingApi("WpfApplicationModule.exe", @".\Modules\WpfApplication");
            GenerateManifestUsingApi("WpfButtonModule.dll", @".\Modules\WpfButton");
            GenerateManifestUsingApi("WpfUpdaterModule.dll", @".\Modules\WpfUpdater");


            // setting up configuration for repository
            NomadConfiguration configuration = NomadConfiguration.Default;

            configuration.ModuleRepository = new WebModulesRepository("http://*****:*****@".\Modules\WpfApplication\WpfApplicationModule.exe"),
                new SingleModuleDiscovery(@".\Modules\WpfButton\WpfButtonModule.dll"),
                new SingleModuleDiscovery(@".\Modules\WpfUpdater\WpfUpdaterModule.dll")
                );

            kernel.LoadModules(discovery);

            // FIXME: what about ending the thread here ?
        }
예제 #9
0
        private static void Main()
        {
            // signing the assemblies and creating the manifest using manifestBuilder api
            GenerateManifestUsingApi("DistributablePublisherModule.dll", @"..\Modules\Publisher");



            // using default configuration
            string             publisherSite = "net.tcp://127.0.0.1:6666/IDEA";
            NomadConfiguration config2       = NomadConfiguration.Default;

            config2.DistributedConfiguration          = DistributedConfiguration.Default;
            config2.DistributedConfiguration.LocalURI = new Uri(publisherSite);

            // adding listener address to known sites.
            const string listenerSite = "net.tcp://127.0.0.1:5555/IDEA";

            config2.DistributedConfiguration.URLs.Add(listenerSite);
            var kernel = new NomadKernel(config2);

            // loading modules using single module discovery pattern
            var discovery =
                new DirectoryModuleDiscovery(@"..\Modules\Publisher", SearchOption.TopDirectoryOnly);

            kernel.LoadModules(discovery);

            Console.WriteLine("Publisher kernel ready");
            //wait for input
            Console.ReadLine();
        }
예제 #10
0
        private static void loading_module_into_module_appdomain_callback()
        {
            SetUpInDomain();

            _nomadKernel = new NomadKernel(_configuration);

            var expectedModuleInfos = new[]
            {
                //Set Up modules to be loaded.
                new ModuleInfo(_assemblyFullPath),
            };

            SetUpModuleDiscovery(expectedModuleInfos);

            _nomadKernel.ModuleAppDomain.AssemblyLoad +=
                (sender, args) => Assert.AreEqual(AssemblyFullName,
                                                  args.LoadedAssembly.
                                                  FullName,
                                                  "The module has not been loaded into Module AppDomain");

            _nomadKernel.ModuleAppDomain.UnhandledException +=
                (sender, args) => Assert.Fail("Exception has been thrown" + args.ToString());

            _nomadKernel.LoadModules(_moduleDiscoveryMock.Object);

            //Check for not loading assembly into kernel appDomain
            foreach (Assembly kernelAsm in _nomadKernel.KernelAppDomain.GetAssemblies())
            {
                Assert.AreNotEqual(AssemblyFullName, kernelAsm.FullName,
                                   "The module assembly has been loaded into KernelAppDomain.");
            }
        }
예제 #11
0
        public void local_module_publishes_and_later_loaded_listener_module_receives_those_messages()
        {
            // path for this test (using the test method name) use in each code
            PrepareSharedLibrary();

            string publishingModuleSrc = GetSourceCodePath(typeof(BufferedPublishingModule));
            string listeningModuleSrc  = GetSourceCodePath(typeof(SimpleListeningModule));

            string listener1 = GenerateListener(RuntimePath, _sharedDll, listeningModuleSrc, 1);

            string publisherDll = Compiler.GenerateModuleFromCode(publishingModuleSrc, _sharedDll);
            ManifestBuilderConfiguration manifestConfiguration = ManifestBuilderConfiguration.Default;

            manifestConfiguration.ModulesDependenciesProvider = new SingleModulesDependencyProvider();
            Compiler.GenerateManifestForModule(publisherDll, KeyFile, manifestConfiguration);

            // preaparing modules discoveries.
            IModuleDiscovery listenerDiscovery  = new SingleModuleDiscovery(listener1);
            IModuleDiscovery publisherDiscovery = new SingleModuleDiscovery(publisherDll);

            // create non-distributed kernel
            PublisherKernel = new NomadKernel();

            // publisher module load
            PublisherKernel.LoadModules(publisherDiscovery);

            // postponed listener module load
            PublisherKernel.LoadModules(listenerDiscovery);

            // assert the events being published
            var fi = new FileInfo(listener1 + "_CounterFile");

            if (fi.Exists)
            {
                using (StreamReader counterReader = fi.OpenText())
                {
                    int value = Convert.ToInt32(counterReader.ReadLine());
                    // Verifying that locally the event aggregator works properly
                    Assert.AreEqual(5, value);
                    counterReader.Close();
                }
            }
            else
            {
                Assert.Fail("No counter file from listener module in local postponed configuration");
            }
        }
예제 #12
0
        private static void Main()
        {
            // use default configuration for kernel
            var kernel = new NomadKernel();

            // load the Application_WPF_Shell
            kernel.LoadModules(new SingleModuleDiscovery(@".\Application_WPF_Shell\Application_WPF_Shell.exe"));


            kernel.LoadModules(new CompositeModuleDiscovery(
                                   new SingleModuleDiscovery(@".\FileLoaderModule\FileLoaderModule.dll"),
                                   new SingleModuleDiscovery(@".\GraphicFilesHandlerModule\GraphicFilesHandlerModule.dll"),
                                   new SingleModuleDiscovery(@".\TextFileHandlerModule\TextFileHandlerModule.dll"),
                                   new SingleModuleDiscovery(@".\ListingAllLoadedModule\ListingAllLoadedModule.dll"),
                                   new SingleModuleDiscovery(@".\ThreadedToolbarControlledModule\ThreadedToolbarControlledModule.dll")
                                   ));
        }
예제 #13
0
        public void module_publishes_module_listens()
        {
            // path for this test (using the test method name) use in each code
            PrepareSharedLibrary();

            string publishingModuleSrc = GetSourceCodePath(typeof(SimplePublishingModule));
            string listeningModuleSrc  = GetSourceCodePath(typeof(SimpleListeningModule));

            string listener1 = GenerateListener(RuntimePath, _sharedDll, listeningModuleSrc, 1);

            string publisherDll = Compiler.GenerateModuleFromCode(publishingModuleSrc, _sharedDll);
            ManifestBuilderConfiguration manifestConfiguration = ManifestBuilderConfiguration.Default;

            manifestConfiguration.ModulesDependenciesProvider = new SingleModulesDependencyProvider();
            Compiler.GenerateManifestForModule(publisherDll, KeyFile, manifestConfiguration);

            // create listener site
            string listenerSite = "net.tcp://127.0.0.1:5555/IDEA";

            // create published sites
            string publisherSite = "net.tcp://127.0.0.1:7777/IDEA";

            // create kernels with configuration
            NomadConfiguration config1 = NomadConfiguration.Default;

            config1.DistributedConfiguration          = DistributedConfiguration.Default;
            config1.DistributedConfiguration.LocalURI = new Uri(listenerSite);
            ListenerKernel = new NomadKernel(config1);
            IModuleDiscovery listenerDiscovery = new SingleModuleDiscovery(listener1);

            ListenerKernel.LoadModules(listenerDiscovery);

            // create publishing kernel
            NomadConfiguration publisherConfig = NomadConfiguration.Default;

            publisherConfig.DistributedConfiguration          = DistributedConfiguration.Default;
            publisherConfig.DistributedConfiguration.LocalURI = new Uri(publisherSite);
            publisherConfig.DistributedConfiguration.URLs.Add(listenerSite);
            PublisherKernel = new NomadKernel(publisherConfig);
            IModuleDiscovery publisherDiscovery = new SingleModuleDiscovery(publisherDll);

            PublisherKernel.LoadModules(publisherDiscovery);


            // assert the events being published
            AssertEventPublished(listener1, 5);
        }
예제 #14
0
        private static void Main()
        {
            // signing the assemblies and creating the manifest using manifestBuilder api
            GenerateManifestUsingApi("Controlling_Publisher_Module.dll", @".\Modules\ControllingPublisher");
            GenerateManifestUsingApi("Simple_Publisher_Module.dll", @".\Modules\SimplePublisher");


            // using default configuration
            var kernel = new NomadKernel();

            // loading modules using single module discovery pattern
            var discovery = new CompositeModuleDiscovery(
                new DirectoryModuleDiscovery(@".\Modules\ControllingPublisher", SearchOption.TopDirectoryOnly),
                new DirectoryModuleDiscovery(@".\Modules\SimplePublisher", SearchOption.TopDirectoryOnly));

            kernel.LoadModules(discovery);

            //wait for input
            Console.ReadLine();
        }
예제 #15
0
        private static void unloading_modules_upon_request_callback()
        {
            SetUpInDomain();
            _nomadKernel = new NomadKernel(_configuration);

            var expectedModuleInfos = new[]
            {
                //Set Up modules to be loaded.
                new ModuleInfo(_assemblyFullPath),
                new ModuleInfo(_assemblyFullPath2),
            };

            SetUpModuleDiscovery(expectedModuleInfos);

            _nomadKernel.LoadModules(_moduleDiscoveryMock.Object);

            AppDomain moduleAppDomain = _nomadKernel.ModuleAppDomain;

            _nomadKernel.UnloadModules();

            Assert.AreNotSame(moduleAppDomain, _nomadKernel.ModuleAppDomain);
        }
예제 #16
0
파일: Program.cs 프로젝트: orb1t/Nomad
        private static void Main(string[] args)
        {
            // signing the assembly and creating the manifest using manifestBuilder api
            GenerateManifestUsingApi();

            // using default configuration
            var kernel = new NomadKernel();

            // loading modules using directory module discovery pattern
            var discovery = new SimpleDirectoryModuleDiscovery(@".\Modules\");

            // loading discovered modules
            kernel.LoadModules(discovery);

            //wait for input
            Console.ReadLine();

            // unloading all modules
            kernel.UnloadModules();

            //wait for input
            Console.ReadLine();
        }
예제 #17
0
        private static void Main(string[] args)
        {
            // signing the assemblies and creating the manifest using manifestBuilder api
            // FIXME(i dont like this) this step should be omitted in real life scenarios
            GenerateManifestUsingApi("Registering_within_ServiceLocator_Module.dll",
                                     @".\Modules\RegisteringModule");
            GenerateManifestUsingApi("ServiceLocator_dependent_Module.dll",
                                     @".\Modules\DependantModule");

            // using default configuration
            var kernel = new NomadKernel();

            // loading modules using composite module discovery pattern
            var discovery =
                new CompositeModuleDiscovery(new DirectoryModuleDiscovery(@".\Modules\",
                                                                          SearchOption.
                                                                          AllDirectories));

            kernel.LoadModules(discovery);

            //wait
            Console.ReadLine();
        }
예제 #18
0
        public void module_published_once_only_one_module_recieved()
        {
            // path for this test (using the test method name) use in each code
            PrepareSharedLibrary();

            string publishingModuleSrc = GetSourceCodePath(typeof(SDPublishingModule));
            string listeningModuleSrc  = GetSourceCodePath(typeof(SDListeningModule));

            string listener1 = GenerateListener(RuntimePath, _sharedDll, listeningModuleSrc, 1);
            string listener2 = GenerateListener(RuntimePath, _sharedDll, listeningModuleSrc, 2);

            string publisherDll = Compiler.GenerateModuleFromCode(publishingModuleSrc, _sharedDll);
            ManifestBuilderConfiguration manifestConfiguration = ManifestBuilderConfiguration.Default;

            manifestConfiguration.ModulesDependenciesProvider = new SingleModulesDependencyProvider();
            Compiler.GenerateManifestForModule(publisherDll, KeyFile, manifestConfiguration);

            // create listeners sites
            string site1 = "net.tcp://127.0.0.1:5555/IDEA";
            string site2 = "net.tcp://127.0.0.1:6666/IDEA";

            // create published sites
            string publisherSite = "net.tcp://127.0.0.1:7777/IDEA";

            // create kernels with configuration
            NomadConfiguration config1 = NomadConfiguration.Default;

            config1.DistributedConfiguration          = DistributedConfiguration.Default;
            config1.DistributedConfiguration.LocalURI = new Uri(site1);
            config1.DistributedConfiguration.URLs.Add(site2);
            config1.DistributedConfiguration.URLs.Add(publisherSite);
            ListenerKernel = new NomadKernel(config1);
            IModuleDiscovery listnerDiscovery = new SingleModuleDiscovery(listener1);

            ListenerKernel.LoadModules(listnerDiscovery);
            DistributedMessageCarrier firstCarrier = CreateCarrier(ListenerKernel);

            NomadConfiguration config2 = NomadConfiguration.Default;

            config2.DistributedConfiguration          = DistributedConfiguration.Default;
            config2.DistributedConfiguration.LocalURI = new Uri(site2);
            config2.DistributedConfiguration.URLs.Add(site1);
            config2.DistributedConfiguration.URLs.Add(publisherSite);
            ListenerKernelSecond = new NomadKernel(config2);
            IModuleDiscovery listenerDiscovery2 = new SingleModuleDiscovery(listener2);

            ListenerKernelSecond.LoadModules(listenerDiscovery2);
            DistributedMessageCarrier secondCarrier = CreateCarrier(ListenerKernelSecond);

            // create publishing kernel
            NomadConfiguration publisherConfig = NomadConfiguration.Default;

            publisherConfig.DistributedConfiguration          = DistributedConfiguration.Default;
            publisherConfig.DistributedConfiguration.LocalURI = new Uri(publisherSite);
            publisherConfig.DistributedConfiguration.URLs.Add(site1);
            publisherConfig.DistributedConfiguration.URLs.Add(site2);
            PublisherKernel = new NomadKernel(publisherConfig);
            IModuleDiscovery publisherDiscovery = new SingleModuleDiscovery(publisherDll);

            PublisherKernel.LoadModules(publisherDiscovery);

            // assert the events being published
            // wait for publishing messages etc
            Thread.Sleep(PUBLISH_TIMEOUT);
            int firstMsg  = firstCarrier.GetStatus.Count;
            int secondMsg = secondCarrier.GetStatus.Count;

            Assert.AreEqual(5, firstMsg + secondMsg, "The number of delivered messages is not exactly 5");
        }