Exemplo n.º 1
0
        public void GetAddress()
        {
            String address;

            address = TaxonAttributeServer.GetAddress();
            Assert.IsTrue(address.IsNotEmpty());
        }
Exemplo n.º 2
0
 public void Constructor()
 {
     using (DataServer database = new TaxonAttributeServer())
     {
         Assert.IsNotNull(database);
     }
 }
Exemplo n.º 3
0
 public void CommitTransactionNoTransactionError()
 {
     using (DataServer database = new TaxonAttributeServer())
     {
         database.CommitTransaction();
     }
 }
Exemplo n.º 4
0
 public void BeginTransaction()
 {
     using (DataServer database = new TaxonAttributeServer())
     {
         database.BeginTransaction();
     }
 }
Exemplo n.º 5
0
 public void RollbackTransactionNoTransactionError()
 {
     using (DataServer database = new TaxonAttributeServer())
     {
         database.RollbackTransaction();
     }
 }
Exemplo n.º 6
0
 public void BeginTransactionAlreadyStartedError()
 {
     using (DataServer database = new TaxonAttributeServer())
     {
         database.BeginTransaction();
         database.BeginTransaction();
     }
 }
Exemplo n.º 7
0
 public new void TestCleanup()
 {
     if (_database.IsNotNull())
     {
         _database.RollbackTransaction();
         _database.Dispose();
         _database = null;
     }
 }
Exemplo n.º 8
0
 public void HasPendingTransaction()
 {
     using (DataServer database = new TaxonAttributeServer())
     {
         Assert.IsFalse(database.HasPendingTransaction());
         database.BeginTransaction();
         Assert.IsTrue(database.HasPendingTransaction());
     }
 }
Exemplo n.º 9
0
        public void Dispose()
        {
            using (DataServer database = new TaxonAttributeServer())
            {
                database.Dispose();

                // Should be ok to dispose an already disposed database.
                database.Dispose();
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Get status for database.
        /// </summary>
        /// <param name="status">
        /// Current database status is returned in the object
        /// that is referenced by this parameter.
        /// </param>
        private void GetDatabaseStatus(Dictionary <Int32, List <WebResourceStatus> > status)
        {
            Boolean           ping;
            String            address, informationEnglish, informationSwedish;
            WebResourceStatus resourceStatus;

            address = null;

            try
            {
                address            = TaxonAttributeServer.GetAddress();
                informationEnglish = null;
                informationSwedish = null;
                using (TaxonAttributeServer database = new TaxonAttributeServer())
                {
                    ping = database.Ping();
                }

                if (!ping)
                {
                    informationEnglish = WebService.Settings.Default.DatabaseStatusErrorEnglish;
                    informationSwedish = WebService.Settings.Default.DatabaseStatusErrorSwedish;
                }
            }
            catch (Exception exception)
            {
                ping = false;
                informationEnglish = WebService.Settings.Default.DatabaseCommunicationFailureEnglish + " " +
                                     WebService.Settings.Default.ErrorMessageEnglish + " = " + exception.Message;
                informationSwedish = WebService.Settings.Default.DatabaseCommunicationFailureSwedish + " " +
                                     WebService.Settings.Default.ErrorMessageSwedish + " = " + exception.Message;
            }

            resourceStatus              = new WebResourceStatus();
            resourceStatus.AccessType   = WebService.Settings.Default.ResourceAccessTypeReadAndWriteSwedish;
            resourceStatus.Address      = address;
            resourceStatus.Information  = informationSwedish;
            resourceStatus.Name         = DatabaseName.TaxonAttribute.ToString();
            resourceStatus.ResourceType = WebServiceBase.GetResourceType(ResourceTypeIdentifier.Database,
                                                                         (Int32)(LocaleId.sv_SE));
            resourceStatus.Status = ping;
            resourceStatus.Time   = DateTime.Now;
            status[(Int32)(LocaleId.sv_SE)].Add(resourceStatus);

            resourceStatus              = new WebResourceStatus();
            resourceStatus.AccessType   = WebService.Settings.Default.ResourceAccessTypeReadAndWriteEnglish;
            resourceStatus.Address      = address;
            resourceStatus.Information  = informationEnglish;
            resourceStatus.Name         = DatabaseName.TaxonAttribute.ToString();
            resourceStatus.ResourceType = WebServiceBase.GetResourceType(ResourceTypeIdentifier.Database,
                                                                         (Int32)(LocaleId.en_GB));
            resourceStatus.Status = ping;
            resourceStatus.Time   = DateTime.Now;
            status[(Int32)(LocaleId.en_GB)].Add(resourceStatus);
        }
Exemplo n.º 11
0
        private TaxonAttributeServer GetDatabase(Boolean refresh = false)
        {
            if (_database.IsNull() || refresh)
            {
                if (_database.IsNotNull())
                {
                    _database.Dispose();
                }

                _database = new TaxonAttributeServer();
                _database.BeginTransaction();
            }

            return(_database);
        }
Exemplo n.º 12
0
 public TaxonAttributeServerTest()
 {
     _database = null;
 }