コード例 #1
0
        private void PrepareModulesTestDirectories(string testPath, string moduleAPath, string moduleBPath)
        {
            if (Directory.Exists(testPath))
            {
                Directory.Delete(testPath, true);
            }
            Directory.CreateDirectory(testPath);

            // compile modules into a.dll / b.dll
            var compiler = new ModuleCompiler();


            compiler.OutputDirectory = moduleAPath;
            compiler.OutputName      = Path.Combine(moduleAPath, "a.dll");
            compiler.GenerateModuleFromCode(
                @"..\Source\Nomad.Tests\FunctionalTests\Data\SimplestModulePossible1.cs");

            compiler.OutputDirectory = moduleBPath;
            compiler.OutputName      = Path.Combine(moduleBPath, "b.dll");
            compiler.GenerateModuleFromCode(
                @"..\Source\Nomad.Tests\FunctionalTests\Data\SimplestModulePossible1.cs");

            // generate manifests
            var builder = new ManifestBuilder(@"TEST_ISSUER", KeyFile, @"a.dll", moduleAPath);

            builder.CreateAndPublish();
            builder = new ManifestBuilder(@"TEST_ISSUER", KeyFile, @"b.dll", moduleBPath);
            builder.CreateAndPublish();

            // add spoiling module (assembly without manifest)
            File.Copy(Path.Combine(moduleAPath, @"a.dll"), Path.Combine(testPath, "c.dll"));
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: NomadPL/Nomad
 private static void GenerateManifestUsingApi(string assemblyName, string path)
 {
     var builder = new ManifestBuilder(@"TUTORIAL_ISSUER",
                                       @"..\..\KEY_FILE.xml",
                                       assemblyName,
                                       path);
     builder.CreateAndPublish();
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: orb1t/Nomad
        private static void GenerateManifestUsingApi(string assemblyName, string path)
        {
            var builder = new ManifestBuilder(@"TUTORIAL_ISSUER",
                                              @"..\..\KEY_FILE.xml",
                                              assemblyName,
                                              path);

            builder.CreateAndPublish();
        }
コード例 #4
0
        private void SignUsedModules()
        {
            var builder = new ManifestBuilder(IssuerName, IssuerXmlPath,
                                              @"SimplestModulePossible1.dll", @"Modules\Simple\");

            builder.CreateAndPublish();
            builder = new ManifestBuilder(IssuerName, IssuerXmlPath, @"SimplestModulePossible2.dll",
                                          @"Modules\Simple\");
            builder.CreateAndPublish();
        }
コード例 #5
0
        private static string AddManifestFile()
        {
            // generate manifest for SimplestModulePossible file
            var builder = new ManifestBuilder(IssuerName, IssuerXmlPath,
                                              @"SimplestModulePossible1.dll",
                                              @"Modules\Simple");

            _manifest = builder.CreateAndPublish();
            return(@"Modules\Simple\SimplestModulePossible1.dll" +
                   ModuleManifest.ManifestFileNameSuffix);
        }
コード例 #6
0
ファイル: ModuleCompiler.cs プロジェクト: orb1t/Nomad
        /// <summary>
        ///     Wrapps the generating manifest with values that should be provided. Provides access to <paramref name="configuration"/>.
        /// </summary>
        /// <param name="modulePath"></param>
        /// <param name="keyLocation"></param>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public string GenerateManifestForModule(string modulePath, string keyLocation,
                                                ManifestBuilderConfiguration configuration)
        {
            string directory = Path.GetFullPath(Path.GetDirectoryName(modulePath));
            var    builder   = new ManifestBuilder("TEST_ISSUER_COMPILER",
                                                   keyLocation,
                                                   Path.GetFileName(modulePath), directory, KeyStorage.Nomad, string.Empty,
                                                   configuration);

            builder.CreateAndPublish();

            return(modulePath + ModuleManifest.ManifestFileNameSuffix);
        }
コード例 #7
0
        public void discovers_all_proper_modules_with_manifests_ignores_others_assemblies()
        {
            // make another folder
            string testPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                           @"IntegrationTests\DirectoryModuleDiscovery2\");

            if (Directory.Exists(testPath))
            {
                Directory.Delete(testPath, true);
            }
            Directory.CreateDirectory(testPath);

            // compile modules into a.dll / b.dll
            var compiler = new ModuleCompiler();

            compiler.OutputDirectory = testPath;

            compiler.OutputName = Path.Combine(testPath, "a.dll");
            compiler.GenerateModuleFromCode(
                @"..\Source\Nomad.Tests\FunctionalTests\Data\SimplestModulePossible1.cs");

            compiler.OutputName = Path.Combine(testPath, "b.dll");
            compiler.GenerateModuleFromCode(
                @"..\Source\Nomad.Tests\FunctionalTests\Data\SimplestModulePossible1.cs");

            // generate manifests
            var builder = new ManifestBuilder(@"TEST_ISSUER", KeyFile, @"a.dll", testPath);

            builder.CreateAndPublish();
            builder = new ManifestBuilder(@"TEST_ISSUER", KeyFile, @"b.dll", testPath);
            builder.CreateAndPublish();

            // add spoiling module (assembly without manifest)
            File.Copy(Path.Combine(testPath, @"a.dll"), Path.Combine(testPath, "c.dll"));

            var expectedModules = new[]
            {
                new ModuleInfo(Path.Combine(testPath, "a.dll")),
                new ModuleInfo(Path.Combine(testPath, "b.dll")),
            };

            var discovery = new Nomad.Modules.Discovery.DirectoryModuleDiscovery(testPath, SearchOption.TopDirectoryOnly);

            Assert.That(discovery.GetModules().ToArray(), Is.EquivalentTo(expectedModules),
                        "Discovered modules differ from expected");
        }
コード例 #8
0
        private static void BuildModule()
        {
            // some remarkable constancies, we are using sample module from psake build
            const string issuerName    = @"TEST_ISSUER";
            const string issuerXmlPath = @"TEST_XML_KEY_FILE.xml";
            const string assemblyName  = @"Modules\Simple\SimplestModulePossible1.dll";

            // get the key file
            KeysGeneratorProgram.Main(new[] { Path.Combine(FolderPath, issuerXmlPath) });

            // get the assembly file into test folder
            File.Copy(assemblyName, Path.Combine(FolderPath, Path.GetFileName(assemblyName)), true);

            // NOTE: we are using here default builder configuration for simplicity of the test
            var manifestBuilder = new ManifestBuilder(issuerName,
                                                      Path.Combine(FolderPath, issuerXmlPath),
                                                      Path.GetFileName(assemblyName), FolderPath, KeyStorage.Nomad,
                                                      string.Empty, ManifestBuilderConfiguration.Default);

            manifestBuilder.CreateAndPublish();
        }
コード例 #9
0
 protected void SignModule(string name, string path)
 {
     var builder = new ManifestBuilder(IssuerName, IssuerXmlPath, name, path);
     builder.CreateAndPublish();
 }
コード例 #10
0
        public void discovers_all_proper_modules_with_manifests_ignores_others_assemblies()
        {
            // make another folder
            string testPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                           @"IntegrationTests\DirectoryModuleDiscovery2\");

            if (Directory.Exists(testPath))
                Directory.Delete(testPath, true);
            Directory.CreateDirectory(testPath);

            // compile modules into a.dll / b.dll
            var compiler = new ModuleCompiler();
            compiler.OutputDirectory = testPath;

            compiler.OutputName = Path.Combine(testPath, "a.dll");
            compiler.GenerateModuleFromCode(
                @"..\Source\Nomad.Tests\FunctionalTests\Data\SimplestModulePossible1.cs");

            compiler.OutputName = Path.Combine(testPath, "b.dll");
            compiler.GenerateModuleFromCode(
                @"..\Source\Nomad.Tests\FunctionalTests\Data\SimplestModulePossible1.cs");

            // generate manifests
            var builder = new ManifestBuilder(@"TEST_ISSUER", KeyFile, @"a.dll", testPath);
            builder.CreateAndPublish();
            builder = new ManifestBuilder(@"TEST_ISSUER", KeyFile, @"b.dll", testPath);
            builder.CreateAndPublish();

            // add spoiling module (assembly without manifest)
            File.Copy(Path.Combine(testPath, @"a.dll"), Path.Combine(testPath, "c.dll"));

            var expectedModules = new[]
                                      {
                                          new ModuleInfo(Path.Combine(testPath, "a.dll")),
                                          new ModuleInfo(Path.Combine(testPath, "b.dll")),
                                      };

            var discovery = new Nomad.Modules.Discovery.DirectoryModuleDiscovery(testPath,SearchOption.TopDirectoryOnly);

            Assert.That(discovery.GetModules().ToArray(), Is.EquivalentTo(expectedModules),
                        "Discovered modules differ from expected");
        }
コード例 #11
0
        private void PrepareModulesTestDirectories(string testPath, string moduleAPath, string moduleBPath)
        {
            if (Directory.Exists(testPath))
                Directory.Delete(testPath, true);
            Directory.CreateDirectory(testPath);

            // compile modules into a.dll / b.dll
            var compiler = new ModuleCompiler();

            compiler.OutputDirectory = moduleAPath;
            compiler.OutputName = Path.Combine(moduleAPath, "a.dll");
            compiler.GenerateModuleFromCode(
                @"..\Source\Nomad.Tests\FunctionalTests\Data\SimplestModulePossible1.cs");

            compiler.OutputDirectory = moduleBPath;
            compiler.OutputName = Path.Combine(moduleBPath, "b.dll");
            compiler.GenerateModuleFromCode(
                @"..\Source\Nomad.Tests\FunctionalTests\Data\SimplestModulePossible1.cs");

            // generate manifests
            var builder = new ManifestBuilder(@"TEST_ISSUER", KeyFile, @"a.dll", moduleAPath);
            builder.CreateAndPublish();
            builder = new ManifestBuilder(@"TEST_ISSUER", KeyFile, @"b.dll", moduleBPath);
            builder.CreateAndPublish();

            // add spoiling module (assembly without manifest)
            File.Copy(Path.Combine(moduleAPath, @"a.dll"), Path.Combine(testPath, "c.dll"));
        }
コード例 #12
0
ファイル: ModuleCompiler.cs プロジェクト: NomadPL/Nomad
        /// <summary>
        ///     Wrapps the generating manifest with values that should be provided. Provides access to <paramref name="configuration"/>.
        /// </summary>
        /// <param name="modulePath"></param>
        /// <param name="keyLocation"></param>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public string GenerateManifestForModule(string modulePath, string keyLocation,
            ManifestBuilderConfiguration configuration)
        {
            string directory = Path.GetFullPath(Path.GetDirectoryName(modulePath));
            var builder = new ManifestBuilder("TEST_ISSUER_COMPILER",
                                              keyLocation,
                                              Path.GetFileName(modulePath), directory, KeyStorage.Nomad, string.Empty,
                                              configuration);
            builder.CreateAndPublish();

            return modulePath + ModuleManifest.ManifestFileNameSuffix;
        }
コード例 #13
0
 private void SignUsedModules()
 {
     var builder = new ManifestBuilder(IssuerName, IssuerXmlPath,
                                       @"SimplestModulePossible1.dll", @"Modules\Simple\");
     builder.CreateAndPublish();
     builder = new ManifestBuilder(IssuerName, IssuerXmlPath, @"SimplestModulePossible2.dll",
                                   @"Modules\Simple\");
     builder.CreateAndPublish();
 }
コード例 #14
0
ファイル: ZipPackagerTests.cs プロジェクト: NomadPL/Nomad
 private static string AddManifestFile()
 {
     // generate manifest for SimplestModulePossible file
     var builder = new ManifestBuilder(IssuerName, IssuerXmlPath,
                                       @"SimplestModulePossible1.dll",
                                       @"Modules\Simple");
     _manifest = builder.CreateAndPublish();
     return @"Modules\Simple\SimplestModulePossible1.dll" +
            ModuleManifest.ManifestFileNameSuffix;
 }
コード例 #15
0
        private static void BuildModule()
        {
            // some remarkable constancies, we are using sample module from psake build
            const string issuerName = @"TEST_ISSUER";
            const string issuerXmlPath = @"TEST_XML_KEY_FILE.xml";
            const string assemblyName = @"Modules\Simple\SimplestModulePossible1.dll";

            // get the key file
            KeysGeneratorProgram.Main(new[] { Path.Combine(FolderPath, issuerXmlPath) });

            // get the assembly file into test folder
            File.Copy(assemblyName, Path.Combine(FolderPath, Path.GetFileName(assemblyName)),true);

            // NOTE: we are using here default builder configuration for simplicity of the test
            var manifestBuilder = new ManifestBuilder(issuerName,
                                                      Path.Combine(FolderPath, issuerXmlPath),
                                                      Path.GetFileName(assemblyName), FolderPath, KeyStorage.Nomad,
                                                      string.Empty, ManifestBuilderConfiguration.Default);

            manifestBuilder.CreateAndPublish();
        }
コード例 #16
0
        protected void SignModule(string name, string path)
        {
            var builder = new ManifestBuilder(IssuerName, IssuerXmlPath, name, path);

            builder.CreateAndPublish();
        }