示例#1
0
        /// <summary>
        /// Adds a document type definition to the collection
        /// </summary>
        /// <param name="profileMapping"></param>
        public virtual void Add(ProfileMapping profileMapping)
        {
            ProfileMappingCollectionConfig configuration = ConfigurationHandler.GetConfigurationSection <ProfileMappingCollectionConfig>();

            if (!configuration.ContainsProfileMappingByName(profileMapping.Name))
            {
                configuration.AddProfileMapping(profileMapping);
            }
        }
示例#2
0
        public void SetupAllSections()
        {
            string   fileName = "RaspConfiguration.UnitTest.SetupAllSections.xml";
            FileInfo fileInfo = new FileInfo(fileName);

            if (fileInfo.Exists)
            {
                fileInfo.Delete();
            }

            while (File.Exists(fileName))
            {
                // wait
                Thread.Sleep(1);
                if (File.Exists(fileName))
                {
                    File.Delete(fileName);
                }
            }

            ConfigurationHandler.ConfigFilePath = fileName;
            ConfigurationHandler.Reset();

            SetupDefaultDocumentTypes();
            SetupProfileMappings();
            SetupDefaultLdapConfig();
            SetupDefaultOscpConfig();
            SetupDefaultUddiConfig();
            SetupDefaultCacheConfig();
            SetupDefaultRootCertificateConfig();
            SetupDefaultOcesCertificates();
            SetupDefaultSendingOptionConfig();
            ConfigurationHandler.SaveToFile();

            Assert.IsTrue(File.Exists(ConfigurationHandler.ConfigFilePath));
            FileInfo file = new FileInfo(ConfigurationHandler.ConfigFilePath);

            Assert.IsTrue(file.Length > 1024);

            DocumentTypeCollectionConfig docTypeConfig =
                ConfigurationHandler.GetConfigurationSection <DocumentTypeCollectionConfig>();

            Assert.AreEqual(35, docTypeConfig.DocumentTypes.Length, "Expected number of document types not found.");

            ProfileMappingCollectionConfig profileMappingConfig =
                ConfigurationHandler.GetConfigurationSection <ProfileMappingCollectionConfig>();

            //// OioXml           +2
            //// OIOUBL:         +22
            //// OIOUBL nesubl:   +6
            //// OIOUBL Utility:  +2
            //// OioUbl 20140915: +6
            //// Peppol profiles: +5
            //// NemKonto         +2
            //// TotalCount       45
            Assert.AreEqual(45, profileMappingConfig.ProfileMappings.Length, "Expected number of profilemappings not found.");
        }
示例#3
0
        protected UddiId GetProfileTModelId(OiosiMessage message, DocumentTypeConfig docTypeConfig)
        {
            UddiId uddiId;

            // If doctype does't have a XPath expression to extract the document Profile
            // then we assume that the current document type does operate with OIOUBL profiles
            if (docTypeConfig.ProfileIdXPath == null)
            {
                uddiId = null;
            }
            else if (docTypeConfig.ProfileIdXPath.XPath == null)
            {
                uddiId = null;
            }
            else if (docTypeConfig.ProfileIdXPath.XPath.Equals(""))
            {
                uddiId = null;
            }
            else
            {
                // Fetch the OIOUBL profile name
                string profileName = DocumentXPathResolver.GetElementValueByXPathNavigator(
                    message.MessageXml,
                    docTypeConfig.ProfileIdXPath.XPath,
                    docTypeConfig.Namespaces);

                ProfileMappingCollectionConfig config = ConfigurationHandler.GetConfigurationSection <ProfileMappingCollectionConfig>();
                if (config.ContainsProfileMappingByName(profileName))
                {
                    ProfileMapping profileMapping    = config.GetMapping(profileName);
                    string         profileTModelGuid = profileMapping.TModelGuid;
                    uddiId = IdentifierUtility.GetUddiIDFromString(profileTModelGuid);
                }
                else
                {
                    throw new Exception("GetProfileTModelId failed for : " + profileName);
                }
            }

            return(uddiId);
        }