Пример #1
0
 public Anonymous_C9(DatabaseCodeResolverTest databaseCodeResolverTest, CodeSetDao codeSetDao, TypedCodeFactory codeFactory)
 {
     Will(Org.Jmock.Expectations
          .ReturnValue(Ca.Infoway.Messagebuilder.Terminology.Codeset.DatabaseCodeResolverTest.CODE));
     this.One(f_factory)
     .Create(
         this.With(Org.Jmock.Expectations
                   .Same <System.Type>(typeof(x_NormalRestrictedTabooConfidentialityKind))),
         this.With(outer_DatabaseCodeResolverTest
                   .HasSameContents(ILOG.J2CsMapping.Collections.Arrays.AsList(typeof(x_NormalRestrictedTabooConfidentialityKind)))),
         this.With(Org.Jmock.Expectations
                   .Equal <System.String>(Ca.Infoway.Messagebuilder.Terminology.Codeset.DatabaseCodeResolverTest.CODE_VALUE)),
         this.With(Org.Jmock.Expectations
                   .Equal <System.String>(Ca.Infoway.Messagebuilder.Terminology.Codeset.DatabaseCodeResolverTest.CODE_SYSTEM_OID)),
         this.With(Org.Jmock.Expectations.Any <System.Collections.Generic.IDictionary <% 1, % 2> >(typeof(IDictionary))),
         With(Org.Jmock.Expectations.Any <System.Int32?>(typeof(Int32?))),
         With(Org.Jmock.Expectations.Any <System.Boolean?>(typeof(Boolean?))),
         With(Org.Jmock.Expectations.Any <System.Boolean?>(typeof(Boolean?))));
     Will(Org.Jmock.Expectations
          .ReturnValue(outer_DatabaseCodeResolverTest
                       .CreateValueSetsCollection(new String[] { Ca.Infoway.Messagebuilder.Terminology.Codeset.DatabaseCodeResolverTest.CODE_VALUE })));
     this.Allowing(f_setDao).SelectValueSetsByCode(
         this.With(Org.Jmock.Expectations.Any <System.Type>(typeof(Type))),
         this.With(Org.Jmock.Expectations.Any <System.String>(typeof(String))),
         this.With(Org.Jmock.Expectations.Equal <System.String>(Ca.Infoway.Messagebuilder.Terminology.Codeset.DatabaseCodeResolverTest.VERSION))
         );
     outer_DatabaseCodeResolverTest = databaseCodeResolverTest;
     this.f_setDao  = codeSetDao;
     this.f_factory = codeFactory;
 }
Пример #2
0
        /// <summary>Create a DB resolver from supplied parameters and register all found interfaces.</summary>
        /// <remarks>Create a DB resolver from supplied parameters and register all found interfaces.</remarks>
        /// <param name="dao">the code set DAO</param>
        /// <param name="codeFactory">a code factory</param>
        /// <param name="version">the value set version being used</param>
        /// <param name="registry">a code resolver registry</param>
        /// <param name="domainInterfaces">the domain interfaces to register resolvers for</param>
        private void RegisterDomainsAgainstDatabaseCodeResolver(CodeSetDao dao, TypedCodeFactory
                                                                codeFactory, string version, GenericCodeResolverRegistry registry, IList <Type> domainInterfaces)
        {
            CodeResolver dbResolver = new DatabaseCodeResolver(dao, codeFactory, version);

            foreach (Type domainInterface in domainInterfaces)
            {
                registry.RegisterResolver(domainInterface, dbResolver);
            }
        }
Пример #3
0
 public Anonymous_C3(CodeSetDao codeSetDao)
 {
     Will(Org.Jmock.Expectations.ReturnValue(null));
     this.Allowing(f_setDao).FindValueByCodeSystem(
         this.With(Org.Jmock.Expectations.Any <System.Type>(typeof(Type))),
         this.With(Org.Jmock.Expectations.Any <System.String>(typeof(String))),
         this.With(Org.Jmock.Expectations.Any <System.String>(typeof(String))),
         this.With(Org.Jmock.Expectations.Equal <System.String>(Ca.Infoway.Messagebuilder.Terminology.Codeset.DatabaseCodeResolverTest.VERSION))
         );
     this.f_setDao = codeSetDao;
 }
Пример #4
0
        /// <summary>Find all domains that have value sets for the supplied version and register their matching MB interfaces against a database code resolver.
        ///     </summary>
        /// <remarks>Find all domains that have value sets for the supplied version and register their matching MB interfaces against a database code resolver.
        ///     </remarks>
        /// <param name="dao">the code set DAO</param>
        /// <param name="codeFactory">a code factory</param>
        /// <param name="version">the value set version being used</param>
        /// <param name="registry">a code resolver registry</param>
        /// <param name="releaseSpecificBasePackageName">base package name for the specific API release being targeted</param>
        /// <returns>the results of the registration process</returns>
        public virtual DatabaseCodeResolverRegistrationUtilityResults RegisterAll(CodeSetDao
                                                                                  dao, TypedCodeFactory codeFactory, string version, GenericCodeResolverRegistry
                                                                                  registry, string releaseSpecificBasePackageName)
        {
            DatabaseCodeResolverRegistrationUtilityResults results = new DatabaseCodeResolverRegistrationUtilityResults
                                                                         (this);
            ICollection <string> domainTypes      = DetermineAllDomains(dao, version);
            IList <Type>         domainInterfaces = FindAllMatchingDomainInterfaces(domainTypes, releaseSpecificBasePackageName, results);

            RegisterDomainsAgainstDatabaseCodeResolver(dao, codeFactory, version, registry, domainInterfaces);
            return(results);
        }
Пример #5
0
 public Anonymous_C7(DatabaseCodeResolverTest databaseCodeResolverTest, CodeSetDao codeSetDao)
 {
     Will(Org.Jmock.Expectations
          .ReturnValue(outer_DatabaseCodeResolverTest
                       .CreateEmptyCollection <System.Object>()));
     this.Allowing(f_setDao).SelectValueSetsByCode(
         this.With(Org.Jmock.Expectations.Any <System.Type>(typeof(Type))),
         this.With(Org.Jmock.Expectations.Any <System.String>(typeof(String))),
         this.With(Org.Jmock.Expectations.Equal <System.String>(Ca.Infoway.Messagebuilder.Terminology.Codeset.DatabaseCodeResolverTest.VERSION))
         );
     outer_DatabaseCodeResolverTest = databaseCodeResolverTest;
     this.f_setDao = codeSetDao;
 }
Пример #6
0
        public void CreateDao(bool secondLevelCache)
        {
            Configuration configuration = new Configuration();

            configuration.SetNamingStrategy(ImprovedNamingStrategy.Instance);
            configuration.Properties = (IDictionary <string, string>)CreateProperties(secondLevelCache);
            configuration.AddClass(typeof(VocabularyDomain));
            configuration.AddClass(typeof(CodeSystem));
            configuration.AddClass(typeof(CodedValue));
            configuration.AddClass(typeof(ValueSet));
            configuration.AddClass(typeof(ValueSetEntry));

            this.factory = configuration.BuildSessionFactory();
            this.dao     = new HibernateCodeSetDao(this.factory);
        }
Пример #7
0
        /// <summary>Determines all domain types that have value sets for the supplied version.</summary>
        /// <remarks>Determines all domain types that have value sets for the supplied version.</remarks>
        /// <param name="dao">the code set DAO</param>
        /// <param name="version">the value set version to use</param>
        /// <returns>the set of domain types as strings</returns>
        private ICollection <string> DetermineAllDomains(CodeSetDao dao, string version)
        {
            // use version to determine all applicable ValueSets
            IList <ValueSet> valueSets = dao.SelectValueSetsByVersion(version);
            // pull out all VocabularyDomains referenced by the value sets
            ICollection <string> domainTypes = new System.Collections.Generic.SortedSet <string>();

            foreach (ValueSet valueSet in valueSets)
            {
                ICollection <VocabularyDomain> vocabularyDomains = valueSet.VocabularyDomains;
                foreach (VocabularyDomain vocabularyDomain in vocabularyDomains)
                {
                    domainTypes.Add(vocabularyDomain.Type);
                }
            }
            return(domainTypes);
        }
Пример #8
0
 public Anonymous_C4(DatabaseCodeResolverTest databaseCodeResolverTest, CodeSetDao codeSetDao, IList <Type> list,
                     TypedCodeFactory codeFactory)
 {
     Will(Org.Jmock.Expectations
          .ReturnValue(Ca.Infoway.Messagebuilder.Terminology.Codeset.DatabaseCodeResolverTest.CODE));
     this.One(f_factory)
     .Create(
         this.With(Org.Jmock.Expectations
                   .Same <System.Type>(typeof(Confidentiality))),
         this.With(outer_DatabaseCodeResolverTest
                   .HasSameContents(f_list)),
         this.With(Org.Jmock.Expectations
                   .Equal <System.String>(Ca.Infoway.Messagebuilder.Terminology.Codeset.DatabaseCodeResolverTest.CODE_VALUE)),
         this.With(Org.Jmock.Expectations
                   .Equal <System.String>(Ca.Infoway.Messagebuilder.Terminology.Codeset.DatabaseCodeResolverTest.CODE_SYSTEM_OID)),
         this.With(Org.Jmock.Expectations
                   .Any <System.Collections.Generic.IDictionary <% 1, % 2> >(typeof(IDictionary))),
         With(Org.Jmock.Expectations
              .Any <System.Int32?>(typeof(Int32?))),
         With(Org.Jmock.Expectations
              .Any <System.Boolean?>(typeof(Boolean?))),
         With(Org.Jmock.Expectations
              .Any <System.Boolean?>(typeof(Boolean?))));
     Will(Org.Jmock.Expectations
          .ReturnValue(outer_DatabaseCodeResolverTest
                       .CreateValueSet(
                           Ca.Infoway.Messagebuilder.Terminology.Codeset.DatabaseCodeResolverTest.CODE_VALUE,
                           f_list)));
     this.Allowing(f_setDao).FindValueByCodeSystem(
         this.With(Org.Jmock.Expectations.Any <System.Type>(typeof(Type))),
         this.With(Org.Jmock.Expectations.Any <System.String>(typeof(String))),
         this.With(Org.Jmock.Expectations.Any <System.String>(typeof(String))),
         this.With(Org.Jmock.Expectations.Equal <System.String>(Ca.Infoway.Messagebuilder.Terminology.Codeset.DatabaseCodeResolverTest.VERSION))
         );
     outer_DatabaseCodeResolverTest = databaseCodeResolverTest;
     this.f_setDao  = codeSetDao;
     this.f_list    = list;
     this.f_factory = codeFactory;
 }
Пример #9
0
 /// <summary>
 /// Instantiates a new database c resolver.
 /// </summary>
 ///
 /// <param name="dao_0">the dao</param>
 /// <param name="codeFactory_1">the c factory</param>
 public DatabaseCodeResolver(CodeSetDao dao_0, TypedCodeFactory codeFactory_1, String version_2)
 {
     this.dao         = dao_0;
     this.codeFactory = codeFactory_1;
     this.version     = version_2;
 }
Пример #10
0
 public void SetUp()
 {
     codeSetDao  = this.jmock.Mock <CodeSetDao>(typeof(CodeSetDao));
     codeFactory = this.jmock.Mock <TypedCodeFactory>(typeof(TypedCodeFactory));
     resolver    = new DatabaseCodeResolver(this.codeSetDao, this.codeFactory, VERSION);
 }