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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
´╗┐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 PrintServerStringPropertiesTests()
        {
            Assert.IsTrue(!string.IsNullOrEmpty(Server.CurrentDatabaseName), "CurrentDatabaseName value empty");
            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 IntegerPropertyTests()
        {
            Console.WriteLine("Neighbor count=" + Server.NeighborLocations.Count);
            Assert.IsTrue(Server.DatabaseConnectionStatus == ConnectionStatus.Connected, "DatabaseConnectionStatus value false");
            Assert.IsTrue(Server.UnityVersionMajor >0, "Version Major is not greater than 0:"+Server.UnityVersionMajor);
            Console.WriteLine(Server.UnityVersionRev);
            Console.WriteLine(Server.UnityVersionMinor);
            Console.WriteLine(Server.UnityVersionBuild);
            Assert.IsFalse(Server.UnityVersionIsCoRes,"Server reporting as CoRes which is no longer supported");
        }


        [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 VersionCheckTests()
        {
            Assert.IsTrue(Server.IsConnectionVersionAtLeast(1, 0, 0, 0),"Version is not reporting as greater than 1.0.0.0");
            Assert.IsFalse(Server.IsConnectionVersionAtLeast(22, 0, 0, 0), "Version is not reporting as less than 22.0.0.0");
        }

        [TestMethod]
        public void LargeDbOperationPause()
        {
            Server.LargeDbOperationPause(true);
        }

        [TestMethod]
        public void LoginLogoutTest()
        {
            ConnectionServerOdbc oServer = new ConnectionServerOdbc(new ConnectionInformixAdoNetDatabaseFunctions("Test"));
            var res=oServer.LoginDatabaseBlocking(Server.DatabaseLoginName, Server.DatabaseLoginPassword,Server.DatabaseServerName);
            Assert.IsTrue(res.Successful,"Failed to log in to second instance of server:"+res);

            oServer.LogoutBlocking();
        }


        [TestMethod]
        public void UpdateStatisticsTest()
        {
            var res = Server.UpdateStatisticsForMailstore("UnityMbxDb2");
            Assert.IsTrue(res.Successful,"Failed updating UnityMbxDb2 statistics:"+res);

            res = Server.UpdateStatisticsForMailstore("Junk");
            Assert.IsFalse(res.Successful,"Updating statistics on invalid database name should fail:"+res);
        }

        [TestMethod]
        public void GetLogingErrorTests()
        {
            //currently there is no public constructor on the OdbcException class so testing this is difficult at best
            Assert.IsTrue(string.IsNullOrEmpty(Server.GetLoginErrorString(null)),"Empty string should be returned from " +
                                                                                 "GetLoginErrorString with null param");
        }
    }
}

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

Diff revisions: vs.
Revision Author Commited Message
10 Diff Diff jlindborg picture jlindborg Mon 02 Sep, 2013 18:54:54 +0000

More unit and integration test work

9 jlindborg picture jlindborg Fri 30 Aug, 2013 19:10:27 +0000

more unit and integration test setup work.