Exemplo n.º 1
0
        public void StorageFactoryCreationTest(TargetStorage targetStorage, Type factoryType)
        {
            StorageFactoryFactory factoryFactory = new StorageFactoryFactory();
            IStorageFactory       storageFactory = factoryFactory.CreateStorageFactory(targetStorage);

            Assert.True(storageFactory.GetType().Equals(factoryType));
        }
Exemplo n.º 2
0
 /**
  * Attempts to set the storage factory for the current environment and fails and dies if there
  * is already a storage factory set if specified. Should be used by actual applications who need to use
  * a specific storage factory and shouldn't tolerate being pre-empted.
  *
  * @param fact An available storage factory.
  * @param mustWork true if it is intolerable for another storage factory to have been set. False otherwise
  */
 public static void setStorageFactory(IStorageFactory fact, Boolean mustWork)
 {
     if (storageFactory == null)
     {
         storageFactory = fact;
     }
     else
     {
         if (mustWork)
         {
             Logger.die("A Storage Factory had already been set when storage factory " + fact.GetType().FullName + " attempted to become the only storage factory", new System.SystemException("Duplicate Storage Factory set"));
         }
         else
         {
             //Not an issue
         }
     }
 }