From 2e447ef6f76acc2021b5bc191579b1542c92d8fb Mon Sep 17 00:00:00 2001 From: Lucas Nelaupe Date: Mon, 6 May 2019 14:19:36 +0800 Subject: [PATCH 1/3] Add default logger --- Sources/SwiftQueue/JobBuilder.swift | 2 +- .../SwiftQueueManagerTests.swift | 2 +- Tests/SwiftQueueTests/SwiftQueueTests.swift | 37 ------------------- 3 files changed, 2 insertions(+), 39 deletions(-) delete mode 100644 Tests/SwiftQueueTests/SwiftQueueTests.swift diff --git a/Sources/SwiftQueue/JobBuilder.swift b/Sources/SwiftQueue/JobBuilder.swift index bc7e9bf4..936c8c02 100644 --- a/Sources/SwiftQueue/JobBuilder.swift +++ b/Sources/SwiftQueue/JobBuilder.swift @@ -112,7 +112,7 @@ public final class JobBuilder { return self } - internal func build(job: Job, logger: SwiftQueueLogger) -> SqOperation { + internal func build(job: Job, logger: SwiftQueueLogger = NoLogger.shared) -> SqOperation { return SqOperation(job: job, info: info, logger: logger) } diff --git a/Tests/SwiftQueueTests/SwiftQueueManagerTests.swift b/Tests/SwiftQueueTests/SwiftQueueManagerTests.swift index 1bfdfd01..2e298909 100644 --- a/Tests/SwiftQueueTests/SwiftQueueManagerTests.swift +++ b/Tests/SwiftQueueTests/SwiftQueueManagerTests.swift @@ -133,7 +133,7 @@ class SwiftQueueManagerTests: XCTestCase { } func testAddOperationNotJobTask() { - let queue = SqOperationQueue(id: UUID().uuidString) + let queue = SqOperationQueue(BasicQueue.synchronous, TestCreator([:]), UserDefaultsPersister(), DecodableSerializer(), false, true, NoLogger.shared) let operation = Operation() queue.addOperation(operation) // Should not crash } diff --git a/Tests/SwiftQueueTests/SwiftQueueTests.swift b/Tests/SwiftQueueTests/SwiftQueueTests.swift deleted file mode 100644 index 17887d57..00000000 --- a/Tests/SwiftQueueTests/SwiftQueueTests.swift +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -import Foundation -import XCTest -@testable import SwiftQueue - -extension SqOperationQueue { - - convenience init(id: String) { - self.init(id, TestCreator([:]), UserDefaultsPersister(), DecodableSerializer(), false, true, NoLogger.shared) - - } - -} - -extension JobBuilder { - - internal func build(job: Job) -> SqOperation { - return self.build(job: job, logger: NoLogger.shared) - } - -} From 8af5e99951f0995ad2e97f27bd274b081d2712a7 Mon Sep 17 00:00:00 2001 From: Lucas Nelaupe Date: Mon, 6 May 2019 14:31:06 +0800 Subject: [PATCH 2/3] Update project --- SwiftQueue.xcodeproj/project.pbxproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/SwiftQueue.xcodeproj/project.pbxproj b/SwiftQueue.xcodeproj/project.pbxproj index 90bd9ddf..38d448fc 100644 --- a/SwiftQueue.xcodeproj/project.pbxproj +++ b/SwiftQueue.xcodeproj/project.pbxproj @@ -85,7 +85,6 @@ D0B7CD1E797A69C89CB0ADE2 /* SqOperationQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B7CB571CECEEA34DD07398 /* SqOperationQueue.swift */; }; D0B7CE62CE9A0DB7DF08FB57 /* ConstraintUniqueUUIDTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B7C37E250DEE9A9B55C8ED /* ConstraintUniqueUUIDTests.swift */; }; D0B7CFA2089DFF576E0D765B /* JobBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B7CB3B79E039D3B11D8921 /* JobBuilder.swift */; }; - OBJ_27 /* SwiftQueueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_11 /* SwiftQueueTests.swift */; }; OBJ_29 /* SwiftQueue.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = OBJ_13 /* SwiftQueue.framework */; }; /* End PBXBuildFile section */ @@ -132,7 +131,6 @@ D0B7C898344F1EB3A0815D67 /* ConstraintDeadlineTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintDeadlineTests.swift; sourceTree = ""; }; D0B7CB3B79E039D3B11D8921 /* JobBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JobBuilder.swift; path = SwiftQueue/JobBuilder.swift; sourceTree = ""; }; D0B7CB571CECEEA34DD07398 /* SqOperationQueue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SqOperationQueue.swift; path = SwiftQueue/SqOperationQueue.swift; sourceTree = ""; }; - OBJ_11 /* SwiftQueueTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftQueueTests.swift; sourceTree = ""; }; OBJ_13 /* SwiftQueue.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftQueue.framework; sourceTree = BUILT_PRODUCTS_DIR; }; OBJ_14 /* SwiftQueueTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; path = SwiftQueueTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -192,7 +190,6 @@ 1D7B3D2E1F5C1EC7000D49B6 /* ConstraintTests.swift */, 1D7B3D2F1F5C1EC7000D49B6 /* StartStopTests.swift */, 1D7B3D311F5C1EC7000D49B6 /* TestUtils.swift */, - OBJ_11 /* SwiftQueueTests.swift */, D0B7C37E250DEE9A9B55C8ED /* ConstraintUniqueUUIDTests.swift */, D0B7C812F675CD459799C2DD /* ConstraintNetworkTests.swift */, D0B7C62E5894FA6EE00D3160 /* PersisterTests.swift */, @@ -492,7 +489,6 @@ buildActionMask = 0; files = ( 1D7B3D361F5C1EDC000D49B6 /* StartStopTests.swift in Sources */, - OBJ_27 /* SwiftQueueTests.swift in Sources */, 1D7B3D391F5C1EE4000D49B6 /* TestUtils.swift in Sources */, 1D7B3D371F5C1EDE000D49B6 /* ConstraintTests.swift in Sources */, D0B7C94CAD20ADBB67BE5192 /* SwiftQueueBuilderTests.swift in Sources */, From 8a6b3ebb944347472549bc81995dd8d022713ad4 Mon Sep 17 00:00:00 2001 From: Lucas Nelaupe Date: Mon, 6 May 2019 14:38:21 +0800 Subject: [PATCH 3/3] Fix --- Tests/SwiftQueueTests/SwiftQueueManagerTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/SwiftQueueTests/SwiftQueueManagerTests.swift b/Tests/SwiftQueueTests/SwiftQueueManagerTests.swift index 2e298909..69920a28 100644 --- a/Tests/SwiftQueueTests/SwiftQueueManagerTests.swift +++ b/Tests/SwiftQueueTests/SwiftQueueManagerTests.swift @@ -133,7 +133,7 @@ class SwiftQueueManagerTests: XCTestCase { } func testAddOperationNotJobTask() { - let queue = SqOperationQueue(BasicQueue.synchronous, TestCreator([:]), UserDefaultsPersister(), DecodableSerializer(), false, true, NoLogger.shared) + let queue = SqOperationQueue(UUID().uuidString, TestCreator([:]), UserDefaultsPersister(), DecodableSerializer(), false, true, NoLogger.shared) let operation = Operation() queue.addOperation(operation) // Should not crash }