Skip to content

Commit

Permalink
development: default watch setting is to be running
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Dahan committed Nov 20, 2016
1 parent fc73961 commit dd701b0
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 54 deletions.
2 changes: 1 addition & 1 deletion Graph.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Graph'
s.version = '2.0.5'
s.version = '2.0.6'
s.license = 'BSD-3-Clause'
s.summary = 'Graph is a semantic database that is used to create data-driven applications.'
s.homepage = 'http://graphswift.io'
Expand Down
2 changes: 1 addition & 1 deletion Sources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0.5</string>
<string>2.0.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
1 change: 1 addition & 0 deletions Sources/Watch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,7 @@ public class Watch<T: Node>: Watchable {
/// Prepares the Watch instance.
private func prepare() {
prepareGraph()
resume()
}

/// Prepares the instance for save notifications.
Expand Down
6 changes: 3 additions & 3 deletions Tests/ActionGroupTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ActionGroupTests: XCTestCase, WatchActionDelegate {
tagAddExpception = expectation(description: "[ActionTests Error: Group add test failed.]")

let graph = Graph()
let watch = Watch<Action>(graph: graph).for(types: "T").member(of: "G1").resume()
let watch = Watch<Action>(graph: graph).for(types: "T").member(of: "G1")
watch.delegate = self

let action = Action(type: "T")
Expand Down Expand Up @@ -88,7 +88,7 @@ class ActionGroupTests: XCTestCase, WatchActionDelegate {
tagAddExpception = expectation(description: "[ActionTests Error: Group add test failed.]")
tagRemoveExpception = expectation(description: "[ActionTests Error: Group remove test failed.]")

let watch = Watch<Action>(graph: graph).member(of: "G1", "G2").resume()
let watch = Watch<Action>(graph: graph).member(of: "G1", "G2")
watch.delegate = self

action.toggle(groups: "G1", "G2")
Expand Down Expand Up @@ -126,7 +126,7 @@ class ActionGroupTests: XCTestCase, WatchActionDelegate {
saveExpectation = expectation(description: "[ActionTests Error: Graph save test failed.]")
tagRemoveExpception = expectation(description: "[ActionTests Error: Group remove test failed.]")

let watch = Watch<Action>(graph: graph).member(of: "G2").resume()
let watch = Watch<Action>(graph: graph).member(of: "G2")
watch.delegate = self

action.remove(from: "G2")
Expand Down
2 changes: 1 addition & 1 deletion Tests/ActionPropertyStressTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ActionPropertyStressTests: XCTestCase, WatchActionDelegate {
actionInsertExpectation = expectation(description: "[ActionPropertyStressTests Error: Action insert test failed.]")

let graph = Graph()
let watch = Watch<Action>(graph: graph).for(types: "T").resume()
let watch = Watch<Action>(graph: graph).for(types: "T")
watch.delegate = self

let action = Action(type: "T")
Expand Down
6 changes: 3 additions & 3 deletions Tests/ActionPropertyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ActionPropertyTests: XCTestCase, WatchActionDelegate {
propertyInsertExpception = expectation(description: "[ActionTests Error: Property insert test failed.]")

let graph = Graph()
let watch = Watch<Action>(graph: graph).where(properties: "P1").resume()
let watch = Watch<Action>(graph: graph).where(properties: "P1")
watch.delegate = self

let action = Action(type: "T")
Expand Down Expand Up @@ -87,7 +87,7 @@ class ActionPropertyTests: XCTestCase, WatchActionDelegate {
saveExpectation = expectation(description: "[ActionTests Error: Graph save test failed.]")
propertyUpdateExpception = expectation(description: "[ActionTests Error: Property update test failed.]")

let watch = Watch<Action>(graph: graph).where(properties: "P1").resume()
let watch = Watch<Action>(graph: graph).where(properties: "P1")
watch.delegate = self

action["P1"] = "V2"
Expand Down Expand Up @@ -122,7 +122,7 @@ class ActionPropertyTests: XCTestCase, WatchActionDelegate {
saveExpectation = expectation(description: "[ActionTests Error: Graph save test failed.]")
propertyDeleteExpception = expectation(description: "[ActionTests Error: Property delete test failed.]")

let watch = Watch<Action>(graph: graph).where(properties: "P1").resume()
let watch = Watch<Action>(graph: graph).where(properties: "P1")
watch.delegate = self

action["P1"] = nil
Expand Down
6 changes: 3 additions & 3 deletions Tests/ActionTagTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ActionTagTests: XCTestCase, WatchActionDelegate {
tagAddExpception = expectation(description: "[ActionTests Error: Tag add test failed.]")

let graph = Graph()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: ["G1"]).resume()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: ["G1"])
watch.delegate = self

let action = Action(type: "T")
Expand Down Expand Up @@ -88,7 +88,7 @@ class ActionTagTests: XCTestCase, WatchActionDelegate {
tagAddExpception = expectation(description: "[ActionTests Error: Tag add test failed.]")
tagRemoveExpception = expectation(description: "[ActionTests Error: Tag remove test failed.]")

let watch = Watch<Action>(graph: graph).has(tags: ["G1", "G2"]).resume()
let watch = Watch<Action>(graph: graph).has(tags: ["G1", "G2"])
watch.delegate = self

action.toggle(tags: "G1", "G2")
Expand Down Expand Up @@ -126,7 +126,7 @@ class ActionTagTests: XCTestCase, WatchActionDelegate {
saveExpectation = expectation(description: "[ActionTests Error: Graph save test failed.]")
tagRemoveExpception = expectation(description: "[ActionTests Error: Tag remove test failed.]")

let watch = Watch<Action>(graph: graph).has(tags: ["G2"]).resume()
let watch = Watch<Action>(graph: graph).has(tags: ["G2"])
watch.delegate = self


Expand Down
14 changes: 7 additions & 7 deletions Tests/ActionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ActionTests: XCTestCase, WatchActionDelegate {
propertyExpception = expectation(description: "[ActionTests Error: Property test failed.]")

let graph = Graph()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let action = Action(type: "T")
Expand All @@ -77,7 +77,7 @@ class ActionTests: XCTestCase, WatchActionDelegate {
propertyExpception = expectation(description: "[ActionTests Error: Property test failed.]")

let graph = Graph(name: "ActionTests-testNamedGraphSave")
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let action = Action(type: "T", graph: "ActionTests-testNamedGraphSave")
Expand All @@ -102,7 +102,7 @@ class ActionTests: XCTestCase, WatchActionDelegate {
propertyExpception = expectation(description: "[ActionTests Error: Property test failed.]")

let graph = Graph(name: "ActionTests-testReferenceGraphSave")
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let action = Action(type: "T", graph: graph)
Expand All @@ -129,7 +129,7 @@ class ActionTests: XCTestCase, WatchActionDelegate {
propertyExpception = expectation(description: "[ActionTests Error: Property test failed.]")

let graph = Graph(name: "ActionTests-testAsyncGraphSave")
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let action = Action(type: "T", graph: graph)
Expand All @@ -156,7 +156,7 @@ class ActionTests: XCTestCase, WatchActionDelegate {
propertyExpception = expectation(description: "[ActionTests Error: Property test failed.]")

let graph = Graph()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let action = [Entity(type: "T"), Entity(type: "T")].did(action: "T").what(objects: [Entity(type: "T"), Entity(type: "T")])
Expand Down Expand Up @@ -198,7 +198,7 @@ class ActionTests: XCTestCase, WatchActionDelegate {
propertyExpception = expectation(description: "[ActionTests Error: Property test failed.]")

let graph = Graph()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let action = Action(type: "T")
Expand Down Expand Up @@ -237,7 +237,7 @@ class ActionTests: XCTestCase, WatchActionDelegate {
propertyExpception = expectation(description: "[ActionTests Error: Property test failed.]")

let graph = Graph()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let action = Action(type: "T")
Expand Down
2 changes: 1 addition & 1 deletion Tests/ActionThreadTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ActionThreadTests : XCTestCase, WatchActionDelegate {
let q3 = DispatchQueue(label: "io.cosmicmind.graph.thread.3", attributes: .concurrent)

let graph = Graph()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Action>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let action = Action(type: "T")
Expand Down
6 changes: 3 additions & 3 deletions Tests/EntityGroupTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class EntityGroupTests: XCTestCase, WatchEntityDelegate {
tagAddExpception = expectation(description: "[EntityTests Error: Group add test failed.]")

let graph = Graph()
let watch = Watch<Entity>(graph: graph).for(types: "T").member(of: "G1").resume()
let watch = Watch<Entity>(graph: graph).for(types: "T").member(of: "G1")
watch.delegate = self

let entity = Entity(type: "T")
Expand Down Expand Up @@ -88,7 +88,7 @@ class EntityGroupTests: XCTestCase, WatchEntityDelegate {
tagAddExpception = expectation(description: "[EntityTests Error: Group add test failed.]")
tagRemoveExpception = expectation(description: "[EntityTests Error: Group remove test failed.]")

let watch = Watch<Entity>(graph: graph).member(of: "G1", "G2").resume()
let watch = Watch<Entity>(graph: graph).member(of: "G1", "G2")
watch.delegate = self

entity.toggle(groups: "G1", "G2")
Expand Down Expand Up @@ -126,7 +126,7 @@ class EntityGroupTests: XCTestCase, WatchEntityDelegate {
saveExpectation = expectation(description: "[EntityTests Error: Graph save test failed.]")
tagRemoveExpception = expectation(description: "[EntityTests Error: Group remove test failed.]")

let watch = Watch<Entity>(graph: graph).member(of: "G2").resume()
let watch = Watch<Entity>(graph: graph).member(of: "G2")
watch.delegate = self

entity.remove(from: "G2")
Expand Down
2 changes: 1 addition & 1 deletion Tests/EntityPropertyStressTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class EntityPropertyStressTests: XCTestCase, WatchEntityDelegate {
entityInsertExpectation = expectation(description: "[EntityPropertyStressTests Error: Entity insert test failed.]")

let graph = Graph()
let watch = Watch<Entity>(graph: graph).for(types: "T").resume()
let watch = Watch<Entity>(graph: graph).for(types: "T")
watch.delegate = self

let entity = Entity(type: "T")
Expand Down
6 changes: 3 additions & 3 deletions Tests/EntityPropertyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class EntityPropertyTests: XCTestCase, WatchEntityDelegate {
propertyInsertExpception = expectation(description: "[EntityTests Error: Property insert test failed.]")

let graph = Graph()
let watch = Watch<Entity>(graph: graph).where(properties: "P1").resume()
let watch = Watch<Entity>(graph: graph).where(properties: "P1")
watch.delegate = self

let entity = Entity(type: "T")
Expand Down Expand Up @@ -87,7 +87,7 @@ class EntityPropertyTests: XCTestCase, WatchEntityDelegate {
saveExpectation = expectation(description: "[EntityTests Error: Graph save test failed.]")
propertyUpdateExpception = expectation(description: "[EntityTests Error: Property update test failed.]")

let watch = Watch<Entity>(graph: graph).where(properties: "P1").resume()
let watch = Watch<Entity>(graph: graph).where(properties: "P1")
watch.delegate = self

entity["P1"] = "V2"
Expand Down Expand Up @@ -122,7 +122,7 @@ class EntityPropertyTests: XCTestCase, WatchEntityDelegate {
saveExpectation = expectation(description: "[EntityTests Error: Graph save test failed.]")
propertyDeleteExpception = expectation(description: "[EntityTests Error: Property delete test failed.]")

let watch = Watch<Entity>(graph: graph).where(properties: "P1").resume()
let watch = Watch<Entity>(graph: graph).where(properties: "P1")
watch.delegate = self

entity["P1"] = nil
Expand Down
6 changes: 3 additions & 3 deletions Tests/EntityTagTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class EntityTagTests: XCTestCase, WatchEntityDelegate {
tagAddExpception = expectation(description: "[EntityTests Error: Tag add test failed.]")

let graph = Graph()
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G1").resume()
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G1")
watch.delegate = self

let entity = Entity(type: "T")
Expand Down Expand Up @@ -88,7 +88,7 @@ class EntityTagTests: XCTestCase, WatchEntityDelegate {
tagAddExpception = expectation(description: "[EntityTests Error: Tag add test failed.]")
tagRemoveExpception = expectation(description: "[EntityTests Error: Tag remove test failed.]")

let watch = Watch<Entity>(graph: graph).has(tags: "G1", "G2").resume()
let watch = Watch<Entity>(graph: graph).has(tags: "G1", "G2")
watch.delegate = self

entity.toggle(tags: "G1", "G2")
Expand Down Expand Up @@ -126,7 +126,7 @@ class EntityTagTests: XCTestCase, WatchEntityDelegate {
saveExpectation = expectation(description: "[EntityTests Error: Graph save test failed.]")
tagRemoveExpception = expectation(description: "[EntityTests Error: Tag remove test failed.]")

let watch = Watch<Entity>(graph: graph).has(tags: "G2").resume()
let watch = Watch<Entity>(graph: graph).has(tags: "G2")
watch.delegate = self

entity.remove(tags: "G2")
Expand Down
10 changes: 5 additions & 5 deletions Tests/EntityTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class EntityTests: XCTestCase, WatchEntityDelegate {
propertyExpception = expectation(description: "[EntityTests Error: Property test failed.]")

let graph = Graph()
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let entity = Entity(type: "T")
Expand All @@ -77,7 +77,7 @@ class EntityTests: XCTestCase, WatchEntityDelegate {
propertyExpception = expectation(description: "[EntityTests Error: Property test failed.]")

let graph = Graph(name: "EntityTests-testNamedGraphSave")
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let entity = Entity(type: "T", graph: "EntityTests-testNamedGraphSave")
Expand All @@ -102,7 +102,7 @@ class EntityTests: XCTestCase, WatchEntityDelegate {
propertyExpception = expectation(description: "[EntityTests Error: Property test failed.]")

let graph = Graph(name: "EntityTests-testReferenceGraphSave")
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let entity = Entity(type: "T", graph: graph)
Expand All @@ -129,7 +129,7 @@ class EntityTests: XCTestCase, WatchEntityDelegate {
propertyExpception = expectation(description: "[EntityTests Error: Property test failed.]")

let graph = Graph(name: "EntityTests-testAsyncGraphSave")
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let entity = Entity(type: "T", graph: graph)
Expand All @@ -156,7 +156,7 @@ class EntityTests: XCTestCase, WatchEntityDelegate {
propertyExpception = expectation(description: "[EntityTests Error: Property test failed.]")

let graph = Graph()
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let entity = Entity(type: "T")
Expand Down
2 changes: 1 addition & 1 deletion Tests/EntityThreadTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class EntityThreadTests : XCTestCase, WatchEntityDelegate {
let q3 = DispatchQueue(label: "io.cosmicmind.graph.thread.3", attributes: .concurrent)

let graph = Graph()
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P").resume()
let watch = Watch<Entity>(graph: graph).for(types: "T").has(tags: "G").where(properties: "P")
watch.delegate = self

let entity = Entity(type: "T")
Expand Down
6 changes: 3 additions & 3 deletions Tests/RelationshipGroupTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class RelationshipGroupTests: XCTestCase, WatchRelationshipDelegate {
tagAddExpception = expectation(description: "[RelationshipTests Error: Group add test failed.]")

let graph = Graph()
let watch = Watch<Relationship>(graph: graph).for(types: "T").member(of: "G1").resume()
let watch = Watch<Relationship>(graph: graph).for(types: "T").member(of: "G1")
watch.delegate = self

let relationship = Relationship(type: "T")
Expand Down Expand Up @@ -88,7 +88,7 @@ class RelationshipGroupTests: XCTestCase, WatchRelationshipDelegate {
tagAddExpception = expectation(description: "[RelationshipTests Error: Group add test failed.]")
tagRemoveExpception = expectation(description: "[RelationshipTests Error: Group remove test failed.]")

let watch = Watch<Relationship>(graph: graph).member(of: "G1", "G2").resume()
let watch = Watch<Relationship>(graph: graph).member(of: "G1", "G2")
watch.delegate = self

relationship.toggle(groups: "G1", "G2")
Expand Down Expand Up @@ -126,7 +126,7 @@ class RelationshipGroupTests: XCTestCase, WatchRelationshipDelegate {
saveExpectation = expectation(description: "[RelationshipTests Error: Graph save test failed.]")
tagRemoveExpception = expectation(description: "[RelationshipTests Error: Group remove test failed.]")

let watch = Watch<Relationship>(graph: graph).member(of: "G2").resume()
let watch = Watch<Relationship>(graph: graph).member(of: "G2")
watch.delegate = self

relationship.remove(from: "G2")
Expand Down
2 changes: 1 addition & 1 deletion Tests/RelationshipPropertyStressTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class RelationshipPropertyStressTests: XCTestCase, WatchRelationshipDelegate {
relationshipInsertExpectation = expectation(description: "[RelationshipPropertyStressTests Error: Relationship insert test failed.]")

let graph = Graph()
let watch = Watch<Relationship>(graph: graph).for(types: "T").resume()
let watch = Watch<Relationship>(graph: graph).for(types: "T")
watch.delegate = self

let relationship = Relationship(type: "T")
Expand Down
Loading

0 comments on commit dd701b0

Please sign in to comment.