Subversion Repository Public Repository

ConnectionOdbcSdk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
´╗┐using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Cisco.UnityConnection.OdbcSdk;

namespace ConnectionServerOdbcIntegrationTests
{
    [TestClass]
    public class IntegrationTest : BaseIntegrationTests
    {

        #region Additional test attributes

        //Use ClassInitialize to run code before running the first test in the class
        [ClassInitialize]
        public new static void MyClassInitialize(TestContext testContext)
        {
            BaseIntegrationTests.MyClassInitialize(testContext);
        }

        #endregion


        [TestMethod]
        public void PrintServerPropertiesTests()
        {
            Assert.IsTrue(!string.IsNullOrEmpty(Server.CurrentDatabaseName), "CurrentDatabaseName value empty");
            Assert.IsTrue(Server.DatabaseConnectionStatus == ConnectionStatus.Connected, "DatabaseConnectionStatus value false");
            Assert.IsTrue(!string.IsNullOrEmpty(Server.DatabaseLoginName), "DatabaseLoginName value empty");
            Assert.IsTrue(!string.IsNullOrEmpty(Server.DatabaseLoginPassword), "DatabaseLoginPassword value empty");
            Assert.IsTrue(!string.IsNullOrEmpty(Server.DatabaseServerIpAddress), "DatabaseServerIpAddress value empty");
            Assert.IsTrue(!string.IsNullOrEmpty(Server.DatabaseServerName), "DatabaseServerName value empty");
            Assert.IsTrue(!string.IsNullOrEmpty(Server.PrimaryLocationDisplayName), "PrimaryLocationDisplayName value empty");
            Assert.IsTrue(!string.IsNullOrEmpty(Server.PrimaryLocationDomainName), "PrimaryLocationDomainName value empty");
            Assert.IsTrue(!string.IsNullOrEmpty(Server.PrimaryLocationObjectId), "PrimaryLocationObjectId value empty");
            Assert.IsTrue(!string.IsNullOrEmpty(Server.PrimaryLocationServerAddress), "PrimaryLocationServerAddress value empty");
            Assert.IsTrue(!string.IsNullOrEmpty(Server.UnityVersionString), "UnityVersionString value empty");
        }

        [TestMethod]
        public void ChangeDatabaseTests()
        {
            bool ret = Server.ChangeActiveDatabase("junk");
            Assert.IsFalse(ret,"Changing active database to 'junk' did not fail");
            Console.WriteLine("Current database name =" + Server.CurrentDatabaseName);

            ret = Server.ChangeActiveDatabase("UnityDynDb");
            Assert.IsTrue(ret, "Changing active database to 'UnityDynDb' failed");
            Console.WriteLine("Current database name =" + Server.CurrentDatabaseName);

            ret = Server.ChangeActiveDatabase("UnityMbxDb1");
            Assert.IsTrue(ret, "Changing active database to 'UnityMbxDb1' failed");
            Console.WriteLine("Current database name =" + Server.CurrentDatabaseName);

            ret = Server.ChangeActiveDatabase("UnityRptDb");
            Assert.IsTrue(ret, "Changing active database to 'UnityRptDb' failed");
            Console.WriteLine("Current database name =" + Server.CurrentDatabaseName);

            ret = Server.ChangeActiveDatabase("UnityDirDb");
            Assert.IsTrue(ret, "Changing active database to 'UnityDirDb' failed");
            Console.WriteLine("Current database name =" + Server.CurrentDatabaseName);
        }

        [TestMethod]
        public void LanguageInstalledTest()
        {
            bool ret = Server.IsLanguageInstalled(1033);
            Assert.IsTrue(ret,"1033 language not installed, should always be by default");

            ret = Server.IsLanguageInstalled("1033");
            Assert.IsTrue(ret, "string version of 1033 language not installed, should always be by default");

            ret = Server.IsLanguageInstalled("7777");
            Assert.IsFalse(ret, "Invalid 7777 as string language reported as installed");

            ret = Server.IsLanguageInstalled(7777);
            Assert.IsFalse(ret, "invalid 7777 langauge Id reported as installed");
        }

        [TestMethod]
        public void DefaultLanguageTest()
        {
            Console.WriteLine("Default language=" + Server.GetDefaultLanguage());
            int iLang = Server.GetDefaultLanguage();
            Assert.IsTrue(iLang>0,"Default language Id invalid:"+iLang);
        }

        [TestMethod]
        public void TestMethod1()
        {
            Console.WriteLine("Neighbor count=" + Server.NeighborLocations.Count);
            Console.WriteLine("version is greater than 9.0.0 =" + Server.IsConnectionVersionAtLeast(9, 0, 0, 0));
            Console.WriteLine("version is greater than 10.5.0 =" + Server.IsConnectionVersionAtLeast(10, 5, 0, 0));
            Console.WriteLine("1033 installed " + Server.IsLanguageInstalled(1033));
            Console.WriteLine("1066 installed " + Server.IsLanguageInstalled(1066));
            Console.WriteLine("ENU installed " + Server.IsLanguageInstalled("ENU"));
            Console.WriteLine("XXX installed " + Server.IsLanguageInstalled("XXX"));
            Server.LargeDbOperationPause(true);

            var res = Server.UpdateStatisticsForMailstore("UnityMbxDb2");
            if (res.Successful == false)
            {
                Console.WriteLine("Failure updating statistics:" + res);
            }

            res = Server.UpdateStatisticsForMailstore("Junk");
            if (res.Successful == false)
            {
                Console.WriteLine("Failure updating statistics:" + res);
            }


            

            Server.LogoutBlocking();
        }
    }
}

Commits for ConnectionOdbcSdk/trunk/ConnectionServerOdbcIntegrationTests/IntegrationTests/ConnectionServerOdbcIntegrationTests.cs

Diff revisions: vs.
Revision Author Commited Message
9 jlindborg picture jlindborg Fri 30 Aug, 2013 19:10:27 +0000

more unit and integration test setup work.