From 9aa17bee560e6d42114445c644aee79e63ba5b6c Mon Sep 17 00:00:00 2001 From: GWlodarek Date: Wed, 24 Aug 2016 14:17:13 -0400 Subject: [PATCH] 08-23 snapshot support --- Build/linux.sh | 15 ++-- Build/osx.sh | 8 +- README.md | 18 +---- Sources/IBMDB/SwiftDB2.swift | 79 +++++-------------- .../ConnectSyncTests.swift | 0 .../{IBMDB => IBMDBTests}/ConnectTests.swift | 8 +- .../DisconnectSyncTests.swift | 0 .../DisconnectTests.swift | 4 +- .../QuerySyncTests.swift | 0 Tests/{IBMDB => IBMDBTests}/QueryTests.swift | 48 +++++------ Tests/LinuxMain.swift | 2 +- 11 files changed, 64 insertions(+), 118 deletions(-) rename Tests/{IBMDB => IBMDBTests}/ConnectSyncTests.swift (100%) rename Tests/{IBMDB => IBMDBTests}/ConnectTests.swift (84%) rename Tests/{IBMDB => IBMDBTests}/DisconnectSyncTests.swift (100%) rename Tests/{IBMDB => IBMDBTests}/DisconnectTests.swift (89%) rename Tests/{IBMDB => IBMDBTests}/QuerySyncTests.swift (100%) rename Tests/{IBMDB => IBMDBTests}/QueryTests.swift (89%) diff --git a/Build/linux.sh b/Build/linux.sh index df3eae6..90cb445 100755 --- a/Build/linux.sh +++ b/Build/linux.sh @@ -27,25 +27,22 @@ docker pull ubuntu:wily # Install dependencies update="apt-get update" -install_primary="apt-get install -y clang unixodbc-dev unzip wget tar git sudo" +install_primary="apt-get install -y clang unixodbc-dev unzip wget tar git sudo uuid-dev autoconf libtool pkg-config systemtap-sdt-dev libblocksruntime-dev libkqueue-dev libbsd-dev" # Install the IBM DB2 CLI install_cli="wget https://github.com/IBM-DTeam/swift-for-db2-cli/archive/master.zip && unzip master.zip && cd swift-for-db2-cli-master && sudo ./cli.sh && . env.sh && cd .. && rm -f master.zip && rm -rf swift-for-db2-cli-master" # Get the needed Swift snapshot -get_swift="wget https://swift.org/builds/development/ubuntu1510/swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a/swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a-ubuntu15.10.tar.gz" -open_swift="tar -xvzf swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a-ubuntu15.10.tar.gz" +get_swift="wget https://swift.org/builds/development/ubuntu1510/swift-DEVELOPMENT-SNAPSHOT-2016-08-23-a/swift-DEVELOPMENT-SNAPSHOT-2016-08-23-a-ubuntu15.10.tar.gz" +open_swift="tar -xvzf swift-DEVELOPMENT-SNAPSHOT-2016-08-23-a-ubuntu15.10.tar.gz" mkdir_swift="mkdir -p /home/root/swift" -cp_swift="cp -r swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a-ubuntu15.10/* /home/root/swift/" +cp_swift="cp -r swift-DEVELOPMENT-SNAPSHOT-2016-08-23-a-ubuntu15.10/* /home/root/swift/" export_path="export PATH=/home/root/swift/usr/bin:$PATH" # DB2 database used for testing export_db="export DB2_CONN_STRING=\"DRIVER={DB2};DATABASE=BLUDB;UID=dash6435;PWD=0NKUFZxcskVZ;HOSTNAME=dashdb-entry-yp-dal09-09.services.dal.bluemix.net;PORT=50000\"" -# Dependencies for the dispatch library -install_secondary="apt-get install -y autoconf libtool pkg-config systemtap-sdt-dev libblocksruntime-dev libkqueue-dev libbsd-dev" -ldispatch="git clone -b experimental/foundation https://github.com/apple/swift-corelibs-libdispatch.git && cd swift-corelibs-libdispatch && git submodule init && git submodule update && sh ./autogen.sh && ./configure --with-swift-toolchain=/home/root/swift/usr --prefix=/home/root/swift/usr && make && make install" # Build the project and test it -build_and_test="cd /swift-for-db2 && swift build -Xcc -fblocks -Xcc -I/usr/local/include -Xlinker -L/usr/local/lib && swift test" +build_and_test="cd /swift-for-db2 && swift build && swift test -Xcc -I/usr/local/include -Xlinker -L/usr/local/lib" -docker run -v ${TRAVIS_BUILD_DIR}:/swift-for-db2 -i -t ubuntu:wily /bin/bash -c "${update} && ${install_primary} && ${install_cli} && ${get_swift} && ${open_swift} && ${mkdir_swift} && ${cp_swift} && ${export_path} && ${export_db} && ${install_secondary} && ${ldispatch} && ${build_and_test}" +docker run -v ${TRAVIS_BUILD_DIR}:/swift-for-db2 -i -t ubuntu:wily /bin/bash -c "${update} && ${install_primary} && ${install_cli} && ${get_swift} && ${open_swift} && ${mkdir_swift} && ${cp_swift} && ${export_path} && ${export_db} && ${build_and_test}" diff --git a/Build/osx.sh b/Build/osx.sh index bdf5299..ade37d4 100755 --- a/Build/osx.sh +++ b/Build/osx.sh @@ -29,13 +29,13 @@ brew install wget unixodbc wget https://github.com/IBM-DTeam/swift-for-db2-cli/archive/master.zip && unzip master.zip && cd swift-for-db2-cli-master && sudo ./cli.sh && . env.sh && cd .. && rm -f master.zip && rm -rf swift-for-db2-cli-master # Get the needed Swift snapshot -export SWIFT_VERSION=swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a -wget https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a/swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a-osx.pkg -sudo installer -pkg swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a-osx.pkg -target / +export SWIFT_VERSION=swift-DEVELOPMENT-SNAPSHOT-2016-08-23-a +wget https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2016-08-23-a/swift-DEVELOPMENT-SNAPSHOT-2016-08-23-a-osx.pkg +sudo installer -pkg swift-DEVELOPMENT-SNAPSHOT-2016-08-23-a-osx.pkg -target / export TOOLCHAINS=swift # DB2 database used for testing export DB2_CONN_STRING="DRIVER={DB2};DATABASE=BLUDB;UID=dash6435;PWD=0NKUFZxcskVZ;HOSTNAME=dashdb-entry-yp-dal09-09.services.dal.bluemix.net;PORT=50000" # Build the project and test it -cd ${TRAVIS_BUILD_DIR} && swift build -Xcc -I/usr/local/include -Xlinker -L/usr/local/lib && swift test +cd ${TRAVIS_BUILD_DIR} && swift build && swift test -Xcc -I/usr/local/include -Xlinker -L/usr/local/lib diff --git a/README.md b/README.md index 0295ab9..4382588 100755 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ The Swift SDK for DB2 allows you to connect to your IBM DB2 database or products - Query your database asynchronously or synchronously. ## Swift Version -The latest version of the Swift SDK for DB2 works with the DEVELOPMENT-SNAPSHOT-2016-06-20-a version of the Swift binaries. You can download this version of the Swift binaries by following this [link](https://swift.org/download/). Compatibility with other Swift versions is not guaranteed. +The latest version of the Swift SDK for DB2 works with the DEVELOPMENT-SNAPSHOT-2016-08-23-a version of the Swift binaries. You can download this version of the Swift binaries by following this [link](https://swift.org/download/). Compatibility with other Swift versions is not guaranteed. ## Installation (OS X) @@ -72,11 +72,7 @@ The latest version of the Swift SDK for DB2 works with the DEVELOPMENT-SNAPSHOT- Follow the instructions provided on that page. After installing it (i.e. uncompressing the tar file), make sure you update your PATH environment variable so that it includes the extracted tools: `export PATH=//usr/bin:$PATH`. To update the PATH env variable, you can update your [.bashrc file](http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html). -5. Clone, build and install the libdispatch library. -The complete instructions for building and installing this library are [here](https://github.com/apple/swift-corelibs-libdispatch/blob/experimental/foundation/INSTALL), though, all you need to do is just this - `git clone -b experimental/foundation https://github.com/apple/swift-corelibs-libdispatch.git && cd swift-corelibs-libdispatch && git submodule init && git submodule update && sh ./autogen.sh && ./configure --with-swift-toolchain=/usr --prefix=/usr && make && make install` - -6. Now you are ready to use the Swift SDK for DB2. See [Using Swift SDK for DB2](#using-swift-sdk-for-db2). +5. Now you are ready to use the Swift SDK for DB2. See [Using Swift SDK for DB2](#using-swift-sdk-for-db2). ## Using Swift SDK for DB2 @@ -100,14 +96,8 @@ let package = Package( 2.Then, run the following command in terminal (in your project folder) - ### OS X - ``` - swift build -Xcc -I/usr/local/include -Xlinker -L/usr/local/lib - ``` - - ### Linux ``` - swift build -Xcc -fblocks -Xcc -I/usr/local/include -Xlinker -L/usr/local/lib + swift build ``` 3.Wait until the build finishes, then run the project @@ -120,7 +110,7 @@ Visit the [Wiki](https://github.com/IBM-DTeam/swift-for-db2/wiki) for examples o ## Contributing 1. Clone this repository, `git clone https://github.com/IBM-DTeam/swift-for-db2` -2. Build and run tests +2. Build and run tests with `swift test -Xcc -I/usr/local/include -Xlinker -L/usr/local/lib` ### Notes * You are required to set the environment variable DB2_CONN_STRING to your database connection string. diff --git a/Sources/IBMDB/SwiftDB2.swift b/Sources/IBMDB/SwiftDB2.swift index 108a158..23862bd 100755 --- a/Sources/IBMDB/SwiftDB2.swift +++ b/Sources/IBMDB/SwiftDB2.swift @@ -27,18 +27,12 @@ import Dispatch import IBMCliDarwin #endif -// Custom named queues -#if os(Linux) -let queue = dispatch_queue_create("swift-for-db2", DISPATCH_QUEUE_CONCURRENT) -#else -let queue = DispatchQueue(label: "swift-for-db2", attributes: .concurrent) -#endif +// Custom named queue +let queue = DispatchQueue(label: "swift-for-db2", attributes: Dispatch.DispatchQueue.Attributes.concurrent) + + +public typealias DB2Dictionary = [String : String] -#if os(OSX) - public typealias DB2Dictionary = [String : AnyObject] -#else - public typealias DB2Dictionary = [String : Any] -#endif /** * IBMDB Class @@ -58,14 +52,14 @@ public class IBMDB { /** * Async method to connect to the database using the connection string 'info' */ - public func connect(info: String, callback: (error: [DBError]?, connection: Connection?) -> Void) -> Void { + public func connect(info: String, callback: ([DBError]?, Connection?) -> Void) -> Void { var conn: UnsafeMutablePointer! - func run() -> Void { + queue.sync { // Try to connect to the database. conn = info.withCString { cString in - db_connect(conn, UnsafeMutablePointer(cString)) + db_connect(conn, UnsafeMutablePointer(mutating: cString)) } if !connection_error_found(conn) { @@ -74,7 +68,7 @@ public class IBMDB { // Create a Connection object with conn to use in the callback. let db = Connection(conn: conn) - callback(error: nil, connection: db) + callback(nil, db) } else { // Error! Disconnect and callback with an error. var error_arr = [DBError]() @@ -89,21 +83,10 @@ public class IBMDB { } while (connection_error_found(conn)) db_disconnect(conn) - callback(error: error_arr, connection: nil) + callback(error_arr, nil) } } - #if os(Linux) - dispatch_async(queue) { - run() - } - #else - queue.sync { - run() - } - #endif - - } /** @@ -115,7 +98,7 @@ public class IBMDB { // Try to connect to the database. conn = info.withCString { cString in - db_connect(conn, UnsafeMutablePointer(cString)) + db_connect(conn, UnsafeMutablePointer(mutating: cString)) } if !connection_error_found(conn) { @@ -188,34 +171,25 @@ public class Connection { * Runs a query asynchronously against the database. * Executes the callback upon completion. */ - public func query(query:String, callback: (result: [[DB2Dictionary]], error: [DBError]?) -> Void) -> Void { + public func query(query:String, callback: ([[DB2Dictionary]], [DBError]?) -> Void) -> Void { - func run() -> Void { + queue.sync { var data = [[DB2Dictionary]]() var response = self.data_fetch(query: query, data: &data) if response.success { - callback(result: data, error: nil) + callback(data, nil) } else { data.removeAll() if sql_error_found(response.result) { - callback(result: data, error: self.error(Error: DBErrorType().Fetch, result: &response.result!)) + callback(data, self.error(Error: DBErrorType().Fetch, result: &response.result!)) } else { - callback(result: data, error: nil) + callback(data, nil) } } } - #if os(Linux) - dispatch_async(queue) { - run() - } - #else - queue.sync { - run() - } - #endif } @@ -248,7 +222,7 @@ public class Connection { private func data_fetch(query: String, data: inout [[DB2Dictionary]]) -> (success: Bool, result: UnsafeMutablePointer?) { var result = query.withCString { cString in - table_fetch(self.conn, UnsafeMutablePointer(cString)) + table_fetch(self.conn, UnsafeMutablePointer(mutating: cString)) } if sql_error_found(result) { @@ -292,11 +266,7 @@ public class Connection { } switch Int(col_data_type_fetch(Int32(col), result)) { default: - #if os(Linux) - let dict:DB2Dictionary = ["\(col_name)": String(value).bridge()] - #else - let dict:DB2Dictionary = ["\(col_name)" : String(value) as AnyObject] - #endif + let dict = ["\(col_name)": String(value)!] return dict } @@ -349,24 +319,13 @@ public class Connection { * Disconnect asynchronously from the database associated with this Connection object. */ public func disconnect(callback: () -> Void) -> Void { - func run() -> Void { + queue.sync { if self.conn != nil { db_disconnect(self.conn) self.conn = nil } callback() } - - #if os(Linux) - dispatch_async(queue) { - run() - } - #else - queue.sync { - run() - } - #endif - } diff --git a/Tests/IBMDB/ConnectSyncTests.swift b/Tests/IBMDBTests/ConnectSyncTests.swift similarity index 100% rename from Tests/IBMDB/ConnectSyncTests.swift rename to Tests/IBMDBTests/ConnectSyncTests.swift diff --git a/Tests/IBMDB/ConnectTests.swift b/Tests/IBMDBTests/ConnectTests.swift similarity index 84% rename from Tests/IBMDB/ConnectTests.swift rename to Tests/IBMDBTests/ConnectTests.swift index be58b88..4a2dea5 100755 --- a/Tests/IBMDB/ConnectTests.swift +++ b/Tests/IBMDBTests/ConnectTests.swift @@ -50,7 +50,7 @@ class ConnectTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs the callback closure") + let expectation = self.expectation(description: "Attempts to connect to the database and runs the callback closure") db.connect(info: connStringValid!) { (error, connection) -> Void in XCTAssertNil(error, "error is Nil") @@ -58,7 +58,7 @@ class ConnectTests : XCTestCase { expectation.fulfill() } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } @@ -68,7 +68,7 @@ class ConnectTests : XCTestCase { func testConnectInvalidConfig() { - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs the callback closure") + let expectation = self.expectation(description: "Attempts to connect to the database and runs the callback closure") db.connect(info: connStringInvalid) { (error, connection) -> Void in XCTAssertNotNil(error, "error is not Nil") @@ -76,7 +76,7 @@ class ConnectTests : XCTestCase { expectation.fulfill() } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } diff --git a/Tests/IBMDB/DisconnectSyncTests.swift b/Tests/IBMDBTests/DisconnectSyncTests.swift similarity index 100% rename from Tests/IBMDB/DisconnectSyncTests.swift rename to Tests/IBMDBTests/DisconnectSyncTests.swift diff --git a/Tests/IBMDB/DisconnectTests.swift b/Tests/IBMDBTests/DisconnectTests.swift similarity index 89% rename from Tests/IBMDB/DisconnectTests.swift rename to Tests/IBMDBTests/DisconnectTests.swift index a310e3a..1c443ed 100755 --- a/Tests/IBMDB/DisconnectTests.swift +++ b/Tests/IBMDBTests/DisconnectTests.swift @@ -56,14 +56,14 @@ class DisconnectTests : XCTestCase { XCTFail("Cannot establish a connection to the database.") } - let expectation = self.expectation(withDescription: "Attempts to connect and disconnect from the database and runs the callback closure") + let expectation = self.expectation(description: "Attempts to connect and disconnect from the database and runs the callback closure") conn!.disconnect() { () -> Void in XCTAssertNotNil(conn!.info().error, "Cannot fetch database info.") expectation.fulfill() } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } diff --git a/Tests/IBMDB/QuerySyncTests.swift b/Tests/IBMDBTests/QuerySyncTests.swift similarity index 100% rename from Tests/IBMDB/QuerySyncTests.swift rename to Tests/IBMDBTests/QuerySyncTests.swift diff --git a/Tests/IBMDB/QueryTests.swift b/Tests/IBMDBTests/QueryTests.swift similarity index 89% rename from Tests/IBMDB/QueryTests.swift rename to Tests/IBMDBTests/QueryTests.swift index fdac8fb..0c569df 100755 --- a/Tests/IBMDB/QueryTests.swift +++ b/Tests/IBMDBTests/QueryTests.swift @@ -104,7 +104,7 @@ class QueryTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs queries.") + let expectation = self.expectation(description: "Attempts to connect to the database and runs queries.") db.connect(info: connString!) { (error, connection) -> Void in if error != nil { @@ -133,7 +133,7 @@ class QueryTests : XCTestCase { } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } @@ -154,7 +154,7 @@ class QueryTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs queries.") + let expectation = self.expectation(description: "Attempts to connect to the database and runs queries.") db.connect(info: connString!) { (error, connection) -> Void in if error != nil { @@ -193,7 +193,7 @@ class QueryTests : XCTestCase { } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } @@ -213,7 +213,7 @@ class QueryTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs queries.") + let expectation = self.expectation(description: "Attempts to connect to the database and runs queries.") db.connect(info: connString!) { (error, connection) -> Void in if error != nil { @@ -252,7 +252,7 @@ class QueryTests : XCTestCase { } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } @@ -272,7 +272,7 @@ class QueryTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs queries.") + let expectation = self.expectation(description: "Attempts to connect to the database and runs queries.") db.connect(info: connString!) { (error, connection) -> Void in if error != nil { @@ -295,7 +295,7 @@ class QueryTests : XCTestCase { } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } @@ -315,7 +315,7 @@ class QueryTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs queries.") + let expectation = self.expectation(description: "Attempts to connect to the database and runs queries.") db.connect(info: connString!) { (error, connection) -> Void in if error != nil { @@ -347,7 +347,7 @@ class QueryTests : XCTestCase { } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } @@ -366,7 +366,7 @@ class QueryTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs queries.") + let expectation = self.expectation(description: "Attempts to connect to the database and runs queries.") db.connect(info: connString!) { (error, connection) -> Void in if error != nil { @@ -398,7 +398,7 @@ class QueryTests : XCTestCase { } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } @@ -418,7 +418,7 @@ class QueryTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs queries.") + let expectation = self.expectation(description: "Attempts to connect to the database and runs queries.") db.connect(info: connString!) { (error, connection) -> Void in if error != nil { @@ -447,7 +447,7 @@ class QueryTests : XCTestCase { } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } @@ -466,7 +466,7 @@ class QueryTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs queries.") + let expectation = self.expectation(description: "Attempts to connect to the database and runs queries.") db.connect(info: connString!) { (error, connection) -> Void in if error != nil { @@ -505,7 +505,7 @@ class QueryTests : XCTestCase { } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } @@ -524,7 +524,7 @@ class QueryTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs queries.") + let expectation = self.expectation(description: "Attempts to connect to the database and runs queries.") db.connect(info: connString!) { (error, connection) -> Void in if error != nil { @@ -563,7 +563,7 @@ class QueryTests : XCTestCase { } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } @@ -582,7 +582,7 @@ class QueryTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs queries.") + let expectation = self.expectation(description: "Attempts to connect to the database and runs queries.") db.connect(info: connString!) { (error, connection) -> Void in if error != nil { @@ -611,7 +611,7 @@ class QueryTests : XCTestCase { } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } @@ -631,7 +631,7 @@ class QueryTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs queries.") + let expectation = self.expectation(description: "Attempts to connect to the database and runs queries.") db.connect(info: connString!) { (error, connection) -> Void in if error != nil { @@ -670,7 +670,7 @@ class QueryTests : XCTestCase { } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } @@ -689,7 +689,7 @@ class QueryTests : XCTestCase { XCTFail("Environment Variable DB2_CONN_STRING not set.") } - let expectation = self.expectation(withDescription: "Attempts to connect to the database and runs queries.") + let expectation = self.expectation(description: "Attempts to connect to the database and runs queries.") db.connect(info: connString!) { (error, connection) -> Void in if error != nil { @@ -728,7 +728,7 @@ class QueryTests : XCTestCase { } - self.waitForExpectations(withTimeout: 600) { error in + self.waitForExpectations(timeout: 600) { error in if let error = error { XCTFail("waitForExpectationsWithTimeout errored: \(error)") } diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift index fab1e3b..225ab89 100755 --- a/Tests/LinuxMain.swift +++ b/Tests/LinuxMain.swift @@ -16,7 +16,7 @@ import XCTest -@testable import IBMDBTestSuite +@testable import IBMDBTests XCTMain([ testCase(ConnectTests.allTests),