@fluid-experimental/property-properties 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/containerSerializer.d.ts.map +1 -1
- package/dist/containerSerializer.js +5 -5
- package/dist/containerSerializer.js.map +1 -1
- package/dist/enableValidations.js.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.d.ts +10 -10
- package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.js +70 -53
- package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/dist/properties/arrayProperty.d.ts.map +1 -1
- package/dist/properties/arrayProperty.js +152 -103
- package/dist/properties/arrayProperty.js.map +1 -1
- package/dist/properties/baseProperty.d.ts +4 -4
- package/dist/properties/baseProperty.d.ts.map +1 -1
- package/dist/properties/baseProperty.js +69 -47
- package/dist/properties/baseProperty.js.map +1 -1
- package/dist/properties/boolProperty.d.ts.map +1 -1
- package/dist/properties/boolProperty.js +3 -3
- package/dist/properties/boolProperty.js.map +1 -1
- package/dist/properties/containerProperty.d.ts +8 -8
- package/dist/properties/containerProperty.d.ts.map +1 -1
- package/dist/properties/containerProperty.js +33 -26
- package/dist/properties/containerProperty.js.map +1 -1
- package/dist/properties/enumArrayProperty.d.ts.map +1 -1
- package/dist/properties/enumArrayProperty.js +14 -14
- package/dist/properties/enumArrayProperty.js.map +1 -1
- package/dist/properties/enumProperty.d.ts.map +1 -1
- package/dist/properties/enumProperty.js +17 -17
- package/dist/properties/enumProperty.js.map +1 -1
- package/dist/properties/floatProperties.js +4 -4
- package/dist/properties/floatProperties.js.map +1 -1
- package/dist/properties/index.d.ts +23 -23
- package/dist/properties/index.d.ts.map +1 -1
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.js +47 -37
- package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/dist/properties/intProperties.d.ts.map +1 -1
- package/dist/properties/intProperties.js +10 -10
- package/dist/properties/intProperties.js.map +1 -1
- package/dist/properties/lazyLoadedProperties.js.map +1 -1
- package/dist/properties/mapProperty.d.ts.map +1 -1
- package/dist/properties/mapProperty.js +21 -17
- package/dist/properties/mapProperty.js.map +1 -1
- package/dist/properties/namedNodeProperty.d.ts.map +1 -1
- package/dist/properties/namedNodeProperty.js +3 -3
- package/dist/properties/namedNodeProperty.js.map +1 -1
- package/dist/properties/namedProperty.d.ts.map +1 -1
- package/dist/properties/namedProperty.js +7 -5
- package/dist/properties/namedProperty.js.map +1 -1
- package/dist/properties/nodeProperty.d.ts.map +1 -1
- package/dist/properties/nodeProperty.js +5 -3
- package/dist/properties/nodeProperty.js.map +1 -1
- package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/dist/properties/primitiveTypeCasts.js +9 -9
- package/dist/properties/primitiveTypeCasts.js.map +1 -1
- package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
- package/dist/properties/referenceArrayProperty.js +31 -25
- package/dist/properties/referenceArrayProperty.js.map +1 -1
- package/dist/properties/referenceMapProperty.d.ts.map +1 -1
- package/dist/properties/referenceMapProperty.js +18 -18
- package/dist/properties/referenceMapProperty.js.map +1 -1
- package/dist/properties/referenceProperty.d.ts.map +1 -1
- package/dist/properties/referenceProperty.js +33 -29
- package/dist/properties/referenceProperty.js.map +1 -1
- package/dist/properties/setProperty.d.ts.map +1 -1
- package/dist/properties/setProperty.js +31 -29
- package/dist/properties/setProperty.js.map +1 -1
- package/dist/properties/stringProperty.d.ts.map +1 -1
- package/dist/properties/stringProperty.js +56 -40
- package/dist/properties/stringProperty.js.map +1 -1
- package/dist/properties/uintProperties.js +5 -5
- package/dist/properties/uintProperties.js.map +1 -1
- package/dist/properties/valueArrayProperty.d.ts +1 -1
- package/dist/properties/valueArrayProperty.d.ts.map +1 -1
- package/dist/properties/valueArrayProperty.js +30 -29
- package/dist/properties/valueArrayProperty.js.map +1 -1
- package/dist/properties/valueMapProperty.d.ts.map +1 -1
- package/dist/properties/valueMapProperty.js +31 -29
- package/dist/properties/valueMapProperty.js.map +1 -1
- package/dist/properties/valueProperty.d.ts.map +1 -1
- package/dist/properties/valueProperty.js +11 -9
- package/dist/properties/valueProperty.js.map +1 -1
- package/dist/propertyFactory.d.ts.map +1 -1
- package/dist/propertyFactory.js +309 -252
- package/dist/propertyFactory.js.map +1 -1
- package/dist/propertyTemplate.d.ts +17 -17
- package/dist/propertyTemplate.d.ts.map +1 -1
- package/dist/propertyTemplate.js +64 -45
- package/dist/propertyTemplate.js.map +1 -1
- package/dist/propertyTemplateWrapper.d.ts.map +1 -1
- package/dist/propertyTemplateWrapper.js +40 -25
- package/dist/propertyTemplateWrapper.js.map +1 -1
- package/dist/propertyUtils.d.ts.map +1 -1
- package/dist/propertyUtils.js.map +1 -1
- package/dist/test/properties/arrayProperty.spec.js +566 -490
- package/dist/test/properties/arrayProperty.spec.js.map +1 -1
- package/dist/test/properties/baseProperty.spec.js +293 -280
- package/dist/test/properties/baseProperty.spec.js.map +1 -1
- package/dist/test/properties/containerProperty.spec.js +100 -94
- package/dist/test/properties/containerProperty.spec.js.map +1 -1
- package/dist/test/properties/customArrayProperty.spec.js +174 -147
- package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumArrayProperty.spec.js +67 -63
- package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumProperty.spec.js +115 -97
- package/dist/test/properties/enumProperty.spec.js.map +1 -1
- package/dist/test/properties/float32.spec.js +5 -5
- package/dist/test/properties/float32.spec.js.map +1 -1
- package/dist/test/properties/int64ArrayProperty.spec.js +157 -93
- package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/int64MapProperty.spec.js +185 -166
- package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
- package/dist/test/properties/int64Property.spec.js +109 -109
- package/dist/test/properties/int64Property.spec.js.map +1 -1
- package/dist/test/properties/isLeafNode.spec.js +75 -76
- package/dist/test/properties/isLeafNode.spec.js.map +1 -1
- package/dist/test/properties/mapProperty.spec.js +571 -531
- package/dist/test/properties/mapProperty.spec.js.map +1 -1
- package/dist/test/properties/namedNodeProperty.spec.js +31 -31
- package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
- package/dist/test/properties/nodeProperty.spec.js +805 -795
- package/dist/test/properties/nodeProperty.spec.js.map +1 -1
- package/dist/test/properties/referenceProperty.spec.js +729 -679
- package/dist/test/properties/referenceProperty.spec.js.map +1 -1
- package/dist/test/properties/relationshipProperty.spec.js +16 -16
- package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
- package/dist/test/properties/setProperty.spec.js +288 -227
- package/dist/test/properties/setProperty.spec.js.map +1 -1
- package/dist/test/properties/stringProperty.spec.js +326 -318
- package/dist/test/properties/stringProperty.spec.js.map +1 -1
- package/dist/test/properties/uint64Property.spec.js +46 -36
- package/dist/test/properties/uint64Property.spec.js.map +1 -1
- package/dist/test/properties/valueMapProperty.spec.js +259 -246
- package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
- package/dist/test/properties/valueProperty.spec.js +49 -43
- package/dist/test/properties/valueProperty.spec.js.map +1 -1
- package/dist/test/propertyFactory.spec.js +2038 -1631
- package/dist/test/propertyFactory.spec.js.map +1 -1
- package/dist/test/propertyTemplateWrapper.spec.js +72 -102
- package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
- package/dist/test/propertyUtils.spec.js +22 -21
- package/dist/test/propertyUtils.spec.js.map +1 -1
- package/dist/test/reversibleChangeset.spec.js +857 -703
- package/dist/test/reversibleChangeset.spec.js.map +1 -1
- package/dist/test/setup.js +5 -5
- package/dist/test/setup.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/test/utils.spec.js +1334 -1144
- package/dist/test/utils.spec.js.map +1 -1
- package/dist/test/validation/badMissingSemverInTypeid.js +20 -20
- package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
- package/dist/test/validation/badPrimitiveTypeid.js +12 -12
- package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
- package/dist/test/validation/goodColorId.js +91 -91
- package/dist/test/validation/goodColorId.js.map +1 -1
- package/dist/test/validation/goodColorPalette.js +4 -4
- package/dist/test/validation/goodColorPalette.js.map +1 -1
- package/dist/test/validation/goodPointId.js +20 -20
- package/dist/test/validation/goodPointId.js.map +1 -1
- package/dist/test/validation/reversibleChangeSetTestData.js +23841 -2
- package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
- package/lib/containerSerializer.d.ts.map +1 -1
- package/lib/containerSerializer.js +5 -5
- package/lib/containerSerializer.js.map +1 -1
- package/lib/enableValidations.js.map +1 -1
- package/lib/index.d.ts +19 -19
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -19
- package/lib/index.js.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.d.ts +10 -10
- package/lib/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.js +70 -53
- package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/lib/properties/arrayProperty.d.ts.map +1 -1
- package/lib/properties/arrayProperty.js +152 -103
- package/lib/properties/arrayProperty.js.map +1 -1
- package/lib/properties/baseProperty.d.ts +4 -4
- package/lib/properties/baseProperty.d.ts.map +1 -1
- package/lib/properties/baseProperty.js +73 -51
- package/lib/properties/baseProperty.js.map +1 -1
- package/lib/properties/boolProperty.d.ts.map +1 -1
- package/lib/properties/boolProperty.js +3 -3
- package/lib/properties/boolProperty.js.map +1 -1
- package/lib/properties/containerProperty.d.ts +8 -8
- package/lib/properties/containerProperty.d.ts.map +1 -1
- package/lib/properties/containerProperty.js +33 -26
- package/lib/properties/containerProperty.js.map +1 -1
- package/lib/properties/enumArrayProperty.d.ts.map +1 -1
- package/lib/properties/enumArrayProperty.js +14 -14
- package/lib/properties/enumArrayProperty.js.map +1 -1
- package/lib/properties/enumProperty.d.ts.map +1 -1
- package/lib/properties/enumProperty.js +17 -17
- package/lib/properties/enumProperty.js.map +1 -1
- package/lib/properties/floatProperties.js +4 -4
- package/lib/properties/floatProperties.js.map +1 -1
- package/lib/properties/index.d.ts +23 -23
- package/lib/properties/index.d.ts.map +1 -1
- package/lib/properties/index.js +23 -23
- package/lib/properties/index.js.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.js +47 -37
- package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/lib/properties/intProperties.d.ts.map +1 -1
- package/lib/properties/intProperties.js +10 -10
- package/lib/properties/intProperties.js.map +1 -1
- package/lib/properties/lazyLoadedProperties.js.map +1 -1
- package/lib/properties/mapProperty.d.ts.map +1 -1
- package/lib/properties/mapProperty.js +21 -17
- package/lib/properties/mapProperty.js.map +1 -1
- package/lib/properties/namedNodeProperty.d.ts.map +1 -1
- package/lib/properties/namedNodeProperty.js +3 -3
- package/lib/properties/namedNodeProperty.js.map +1 -1
- package/lib/properties/namedProperty.d.ts.map +1 -1
- package/lib/properties/namedProperty.js +7 -5
- package/lib/properties/namedProperty.js.map +1 -1
- package/lib/properties/nodeProperty.d.ts.map +1 -1
- package/lib/properties/nodeProperty.js +5 -3
- package/lib/properties/nodeProperty.js.map +1 -1
- package/lib/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/lib/properties/primitiveTypeCasts.js +9 -9
- package/lib/properties/primitiveTypeCasts.js.map +1 -1
- package/lib/properties/referenceArrayProperty.d.ts.map +1 -1
- package/lib/properties/referenceArrayProperty.js +31 -25
- package/lib/properties/referenceArrayProperty.js.map +1 -1
- package/lib/properties/referenceMapProperty.d.ts.map +1 -1
- package/lib/properties/referenceMapProperty.js +18 -18
- package/lib/properties/referenceMapProperty.js.map +1 -1
- package/lib/properties/referenceProperty.d.ts.map +1 -1
- package/lib/properties/referenceProperty.js +33 -29
- package/lib/properties/referenceProperty.js.map +1 -1
- package/lib/properties/setProperty.d.ts.map +1 -1
- package/lib/properties/setProperty.js +31 -29
- package/lib/properties/setProperty.js.map +1 -1
- package/lib/properties/stringProperty.d.ts.map +1 -1
- package/lib/properties/stringProperty.js +56 -40
- package/lib/properties/stringProperty.js.map +1 -1
- package/lib/properties/uintProperties.js +5 -5
- package/lib/properties/uintProperties.js.map +1 -1
- package/lib/properties/valueArrayProperty.d.ts +1 -1
- package/lib/properties/valueArrayProperty.d.ts.map +1 -1
- package/lib/properties/valueArrayProperty.js +30 -29
- package/lib/properties/valueArrayProperty.js.map +1 -1
- package/lib/properties/valueMapProperty.d.ts.map +1 -1
- package/lib/properties/valueMapProperty.js +31 -29
- package/lib/properties/valueMapProperty.js.map +1 -1
- package/lib/properties/valueProperty.d.ts.map +1 -1
- package/lib/properties/valueProperty.js +11 -9
- package/lib/properties/valueProperty.js.map +1 -1
- package/lib/propertyFactory.d.ts.map +1 -1
- package/lib/propertyFactory.js +309 -252
- package/lib/propertyFactory.js.map +1 -1
- package/lib/propertyTemplate.d.ts +17 -17
- package/lib/propertyTemplate.d.ts.map +1 -1
- package/lib/propertyTemplate.js +64 -45
- package/lib/propertyTemplate.js.map +1 -1
- package/lib/propertyTemplateWrapper.d.ts.map +1 -1
- package/lib/propertyTemplateWrapper.js +40 -25
- package/lib/propertyTemplateWrapper.js.map +1 -1
- package/lib/propertyUtils.d.ts.map +1 -1
- package/lib/propertyUtils.js.map +1 -1
- package/package.json +28 -28
- package/src/index.d.ts +2750 -2681
|
@@ -7,24 +7,22 @@
|
|
|
7
7
|
* @fileoverview In this file, we will test the int64 map property
|
|
8
8
|
* object described in /src/properties/valueMapProperty.js
|
|
9
9
|
*/
|
|
10
|
-
describe(
|
|
10
|
+
describe("Int64MapProperty", function () {
|
|
11
11
|
var PropertyFactory, BaseProperty, ChangeSet, myNode, Int64Map, Int64;
|
|
12
12
|
before(function () {
|
|
13
13
|
// Get all the objects we need in this test here.
|
|
14
|
-
PropertyFactory = require(
|
|
15
|
-
BaseProperty = require(
|
|
16
|
-
ChangeSet = require(
|
|
17
|
-
Int64 = require(
|
|
14
|
+
PropertyFactory = require("../..").PropertyFactory;
|
|
15
|
+
BaseProperty = require("../..").BaseProperty;
|
|
16
|
+
ChangeSet = require("@fluid-experimental/property-changeset").ChangeSet;
|
|
17
|
+
Int64 = require("@fluid-experimental/property-common").Int64;
|
|
18
18
|
// Register a template with a set property for the tests
|
|
19
19
|
var TestPropertyTemplate = {
|
|
20
|
-
typeid:
|
|
21
|
-
inherits: [
|
|
22
|
-
properties: [
|
|
23
|
-
{ id: 'Int64Map', typeid: 'Int64', context: 'map' },
|
|
24
|
-
],
|
|
20
|
+
typeid: "autodesk.tests:Int64MapTestPropertyID-1.0.0",
|
|
21
|
+
inherits: ["NamedProperty"],
|
|
22
|
+
properties: [{ id: "Int64Map", typeid: "Int64", context: "map" }],
|
|
25
23
|
};
|
|
26
24
|
PropertyFactory._reregister(TestPropertyTemplate);
|
|
27
|
-
myNode = PropertyFactory.create(
|
|
25
|
+
myNode = PropertyFactory.create("autodesk.tests:Int64MapTestPropertyID-1.0.0");
|
|
28
26
|
Int64Map = myNode._properties.Int64Map;
|
|
29
27
|
});
|
|
30
28
|
// Helper functions for the test cases
|
|
@@ -35,7 +33,7 @@ describe('Int64MapProperty', function () {
|
|
|
35
33
|
// Inserts a node with a given key (a new one is generated when undefined)
|
|
36
34
|
var insertEntryInRootWithKey = function (key, root) {
|
|
37
35
|
if (key === undefined) {
|
|
38
|
-
key =
|
|
36
|
+
key = "node" + keyCounter++;
|
|
39
37
|
}
|
|
40
38
|
root._properties.Int64Map.insert(key, new Int64(1, keyCounter));
|
|
41
39
|
};
|
|
@@ -45,7 +43,7 @@ describe('Int64MapProperty', function () {
|
|
|
45
43
|
};
|
|
46
44
|
// Returns a functor that will insert a node with a constant key
|
|
47
45
|
var insertEntryInRootWithUnqiueKey = function () {
|
|
48
|
-
var key =
|
|
46
|
+
var key = "node" + keyCounter++;
|
|
49
47
|
return insertEntryInRootWithKey.bind(undefined, key);
|
|
50
48
|
};
|
|
51
49
|
// Removes the first node from the root
|
|
@@ -58,146 +56,155 @@ describe('Int64MapProperty', function () {
|
|
|
58
56
|
var firstKey = root._properties.Int64Map.getIds()[0];
|
|
59
57
|
root._properties.Int64Map.set(firstKey, new Int64(1, root._properties.Int64Map.get(firstKey) + 1));
|
|
60
58
|
};
|
|
61
|
-
describe(
|
|
62
|
-
it(
|
|
59
|
+
describe("Testing creation, assignment and serialization", function () {
|
|
60
|
+
it("should be empty at the beginning", function () {
|
|
63
61
|
expect(Int64Map.getAsArray()).to.be.empty;
|
|
64
62
|
expect(Int64Map.getEntriesReadOnly()).to.be.empty;
|
|
65
|
-
expect(ChangeSet.isEmptyChangeSet(Int64Map.serialize({
|
|
66
|
-
expect(ChangeSet.isEmptyChangeSet(Int64Map.serialize({
|
|
63
|
+
expect(ChangeSet.isEmptyChangeSet(Int64Map.serialize({ dirtyOnly: false }))).to.be.ok;
|
|
64
|
+
expect(ChangeSet.isEmptyChangeSet(Int64Map.serialize({ dirtyOnly: true }))).to.be.ok;
|
|
67
65
|
});
|
|
68
|
-
it(
|
|
69
|
-
Int64Map.insert(
|
|
70
|
-
expect(Int64Map.get(
|
|
71
|
-
Int64Map.insert(
|
|
72
|
-
expect(Int64Map.get(
|
|
73
|
-
Int64Map.insert(
|
|
74
|
-
expect(Int64Map.get(
|
|
75
|
-
Int64Map.insert(
|
|
76
|
-
expect(Int64Map.get(
|
|
77
|
-
Int64Map.insert(
|
|
78
|
-
expect(Int64Map.get(
|
|
66
|
+
it("should be possible to add entries", function () {
|
|
67
|
+
Int64Map.insert("value1", new Int64(1, 1));
|
|
68
|
+
expect(Int64Map.get("value1")).to.deep.equal(new Int64(1, 1));
|
|
69
|
+
Int64Map.insert("value2", new Int64(1, 2));
|
|
70
|
+
expect(Int64Map.get("value2")).to.deep.equal(new Int64(1, 2));
|
|
71
|
+
Int64Map.insert("value3", new Int64(1, 3));
|
|
72
|
+
expect(Int64Map.get("value3")).to.deep.equal(new Int64(1, 3));
|
|
73
|
+
Int64Map.insert("value4", "123");
|
|
74
|
+
expect(Int64Map.get("value4")).to.deep.equal(new Int64(123, 0));
|
|
75
|
+
Int64Map.insert("value5", 123);
|
|
76
|
+
expect(Int64Map.get("value5")).to.deep.equal(new Int64(123, 0));
|
|
79
77
|
expect(Int64Map.getEntriesReadOnly()).to.deep.equal({
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
value1: new Int64(1, 1),
|
|
79
|
+
value2: new Int64(1, 2),
|
|
80
|
+
value3: new Int64(1, 3),
|
|
81
|
+
value4: new Int64(123, 0),
|
|
82
|
+
value5: new Int64(123, 0),
|
|
82
83
|
});
|
|
83
|
-
expect(Int64Map.has(
|
|
84
|
-
expect(Int64Map.has(
|
|
85
|
-
expect(Int64Map.has(
|
|
86
|
-
expect(Int64Map.has(
|
|
87
|
-
expect(Int64Map.has(
|
|
88
|
-
expect(Int64Map.serialize({
|
|
89
|
-
insert: {
|
|
84
|
+
expect(Int64Map.has("value1")).to.be.ok;
|
|
85
|
+
expect(Int64Map.has("value2")).to.be.ok;
|
|
86
|
+
expect(Int64Map.has("value3")).to.be.ok;
|
|
87
|
+
expect(Int64Map.has("value4")).to.be.ok;
|
|
88
|
+
expect(Int64Map.has("value5")).to.be.ok;
|
|
89
|
+
expect(Int64Map.serialize({ dirtyOnly: false })).to.deep.equal({
|
|
90
|
+
insert: {
|
|
91
|
+
value1: [1, 1],
|
|
92
|
+
value2: [1, 2],
|
|
93
|
+
value3: [1, 3],
|
|
94
|
+
value4: [123, 0],
|
|
95
|
+
value5: [123, 0],
|
|
96
|
+
},
|
|
90
97
|
});
|
|
91
98
|
});
|
|
92
|
-
it(
|
|
93
|
-
Int64Map.remove(
|
|
94
|
-
expect(Int64Map.has(
|
|
95
|
-
Int64Map.remove(
|
|
96
|
-
expect(Int64Map.has(
|
|
97
|
-
Int64Map.remove(
|
|
98
|
-
expect(Int64Map.has(
|
|
99
|
-
Int64Map.remove(
|
|
100
|
-
expect(Int64Map.has(
|
|
101
|
-
Int64Map.remove(
|
|
102
|
-
expect(Int64Map.has(
|
|
103
|
-
expect(ChangeSet.isEmptyChangeSet(Int64Map.serialize({
|
|
99
|
+
it("should be possible to remove entries", function () {
|
|
100
|
+
Int64Map.remove("value1");
|
|
101
|
+
expect(Int64Map.has("value1")).to.be.not.ok;
|
|
102
|
+
Int64Map.remove("value2");
|
|
103
|
+
expect(Int64Map.has("value2")).to.be.not.ok;
|
|
104
|
+
Int64Map.remove("value3");
|
|
105
|
+
expect(Int64Map.has("value3")).to.be.not.ok;
|
|
106
|
+
Int64Map.remove("value4");
|
|
107
|
+
expect(Int64Map.has("value4")).to.be.not.ok;
|
|
108
|
+
Int64Map.remove("value5");
|
|
109
|
+
expect(Int64Map.has("value5")).to.be.not.ok;
|
|
110
|
+
expect(ChangeSet.isEmptyChangeSet(Int64Map.serialize({ dirtyOnly: false }))).to.be.ok;
|
|
104
111
|
});
|
|
105
|
-
it(
|
|
106
|
-
Int64Map.insert(
|
|
112
|
+
it("a remove followed by an insert should become a modify", function () {
|
|
113
|
+
Int64Map.insert("value1", new Int64(1, 1));
|
|
107
114
|
Int64Map.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
108
115
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
109
|
-
Int64Map.remove(
|
|
110
|
-
Int64Map.insert(
|
|
111
|
-
expect(Int64Map.serialize({
|
|
112
|
-
modify: {
|
|
116
|
+
Int64Map.remove("value1");
|
|
117
|
+
Int64Map.insert("value1", new Int64(1, 2));
|
|
118
|
+
expect(Int64Map.serialize({ dirtyOnly: true })).to.deep.equal({
|
|
119
|
+
modify: { value1: [1, 2] },
|
|
113
120
|
});
|
|
114
121
|
// This should also work for a set operation
|
|
115
|
-
Int64Map.set(
|
|
116
|
-
expect(Int64Map.serialize({
|
|
117
|
-
modify: {
|
|
122
|
+
Int64Map.set("value1", new Int64(1, 3));
|
|
123
|
+
expect(Int64Map.serialize({ dirtyOnly: true })).to.deep.equal({
|
|
124
|
+
modify: { value1: [1, 3] },
|
|
118
125
|
});
|
|
119
126
|
// But setting the same value should give an empty ChangeSet
|
|
120
127
|
Int64Map.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
121
128
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
122
|
-
Int64Map.set(
|
|
123
|
-
expect(ChangeSet.isEmptyChangeSet(Int64Map.serialize({
|
|
129
|
+
Int64Map.set("value1", new Int64(1, 3));
|
|
130
|
+
expect(ChangeSet.isEmptyChangeSet(Int64Map.serialize({ dirtyOnly: true }))).to.be.ok;
|
|
124
131
|
// This should be tracked separately for dirtyness and pending changes
|
|
125
132
|
Int64Map.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
126
133
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
127
|
-
Int64Map.remove(
|
|
134
|
+
Int64Map.remove("value1");
|
|
128
135
|
Int64Map.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);
|
|
129
|
-
Int64Map.insert(
|
|
136
|
+
Int64Map.insert("value1", new Int64(1, 2));
|
|
130
137
|
expect(Int64Map.serialize({
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
138
|
+
dirtyOnly: true,
|
|
139
|
+
includeRootTypeid: false,
|
|
140
|
+
dirtinessType: BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,
|
|
134
141
|
})).to.deep.equal({
|
|
135
|
-
modify: {
|
|
142
|
+
modify: { value1: [1, 2] },
|
|
136
143
|
});
|
|
137
144
|
expect(Int64Map.serialize({
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
dirtyOnly: true,
|
|
146
|
+
includeRootTypeid: false,
|
|
147
|
+
dirtinessType: BaseProperty.MODIFIED_STATE_FLAGS.DIRTY,
|
|
141
148
|
})).to.deep.equal({
|
|
142
|
-
insert: {
|
|
149
|
+
insert: { value1: [1, 2] },
|
|
143
150
|
});
|
|
144
151
|
});
|
|
145
|
-
it(
|
|
146
|
-
var myInitialStateNode = PropertyFactory.create(
|
|
147
|
-
myInitialStateNode._properties.Int64Map.insert(
|
|
148
|
-
myInitialStateNode._properties.Int64Map.insert(
|
|
149
|
-
var initialChangeSet = myInitialStateNode.serialize({
|
|
152
|
+
it("deserialize should work", function () {
|
|
153
|
+
var myInitialStateNode = PropertyFactory.create("autodesk.tests:Int64MapTestPropertyID-1.0.0");
|
|
154
|
+
myInitialStateNode._properties.Int64Map.insert("value1", new Int64(1, 1));
|
|
155
|
+
myInitialStateNode._properties.Int64Map.insert("value2", new Int64(1, 2));
|
|
156
|
+
var initialChangeSet = myInitialStateNode.serialize({ dirtyOnly: false });
|
|
150
157
|
// Deserialize a copy into a second node and check that the chageset is correct
|
|
151
|
-
var myDeserializeNode1 = PropertyFactory.create(
|
|
158
|
+
var myDeserializeNode1 = PropertyFactory.create("autodesk.tests:Int64MapTestPropertyID-1.0.0");
|
|
152
159
|
var changes = myDeserializeNode1.deserialize(initialChangeSet);
|
|
153
160
|
expect(changes).to.deep.equal(initialChangeSet);
|
|
154
|
-
expect(myDeserializeNode1.serialize({
|
|
161
|
+
expect(myDeserializeNode1.serialize({ dirtyOnly: false })).to.deep.equal(myInitialStateNode.serialize({ dirtyOnly: false }));
|
|
155
162
|
myDeserializeNode1.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
156
163
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
157
164
|
// Create a third copy
|
|
158
|
-
var myDeserializeNode2 = PropertyFactory.create(
|
|
165
|
+
var myDeserializeNode2 = PropertyFactory.create("autodesk.tests:Int64MapTestPropertyID-1.0.0");
|
|
159
166
|
myDeserializeNode2.deserialize(initialChangeSet);
|
|
160
167
|
myDeserializeNode2.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
161
168
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
162
169
|
myInitialStateNode.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
163
170
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
164
|
-
myInitialStateNode._properties.Int64Map.set(
|
|
165
|
-
myInitialStateNode._properties.Int64Map.remove(
|
|
166
|
-
myInitialStateNode._properties.Int64Map.insert(
|
|
167
|
-
var changesChangeSet = myInitialStateNode.serialize({
|
|
168
|
-
var fullChangeSet = myInitialStateNode.serialize({
|
|
171
|
+
myInitialStateNode._properties.Int64Map.set("value1", new Int64(1, 2));
|
|
172
|
+
myInitialStateNode._properties.Int64Map.remove("value2");
|
|
173
|
+
myInitialStateNode._properties.Int64Map.insert("value3", new Int64(1, 3));
|
|
174
|
+
var changesChangeSet = myInitialStateNode.serialize({ dirtyOnly: true });
|
|
175
|
+
var fullChangeSet = myInitialStateNode.serialize({ dirtyOnly: false });
|
|
169
176
|
var reportedChanges = myDeserializeNode1.deserialize(fullChangeSet);
|
|
170
|
-
expect(myDeserializeNode1.serialize({
|
|
177
|
+
expect(myDeserializeNode1.serialize({ dirtyOnly: false })).to.deep.equal(myInitialStateNode.serialize({ dirtyOnly: false }));
|
|
171
178
|
expect(reportedChanges).to.deep.equal(changesChangeSet);
|
|
172
|
-
expect(myDeserializeNode1.serialize({
|
|
179
|
+
expect(myDeserializeNode1.serialize({ dirtyOnly: true })).to.deep.equal(changesChangeSet);
|
|
173
180
|
var deserializeChanges = myDeserializeNode2.deserialize(fullChangeSet);
|
|
174
181
|
expect(deserializeChanges).to.deep.equal(changesChangeSet);
|
|
175
182
|
});
|
|
176
|
-
it(
|
|
177
|
-
var rootNode = PropertyFactory.create(
|
|
178
|
-
rootNode._properties.Int64Map.insert(
|
|
183
|
+
it("inserting the same key twice should throw an exception", function () {
|
|
184
|
+
var rootNode = PropertyFactory.create("autodesk.tests:Int64MapTestPropertyID-1.0.0");
|
|
185
|
+
rootNode._properties.Int64Map.insert("node1", new Int64(1, 1));
|
|
179
186
|
expect(function () {
|
|
180
|
-
rootNode._properties.Int64Map.insert(
|
|
187
|
+
rootNode._properties.Int64Map.insert("node1", new Int64(1, 2));
|
|
181
188
|
}).to.throw();
|
|
182
189
|
});
|
|
183
|
-
it(
|
|
184
|
-
var rootNode = PropertyFactory.create(
|
|
185
|
-
rootNode._properties.Int64Map.set(
|
|
186
|
-
rootNode._properties.Int64Map.set(
|
|
190
|
+
it("set should overwrite existing entry", function () {
|
|
191
|
+
var rootNode = PropertyFactory.create("autodesk.tests:Int64MapTestPropertyID-1.0.0");
|
|
192
|
+
rootNode._properties.Int64Map.set("node1", new Int64(1, 0));
|
|
193
|
+
rootNode._properties.Int64Map.set("node1", new Int64(1, 1));
|
|
187
194
|
// the set should overwrite the insert
|
|
188
|
-
expect(rootNode.serialize({
|
|
195
|
+
expect(rootNode.serialize({ dirtyOnly: true })["map<Int64>"].Int64Map).to.have.all.keys("insert");
|
|
189
196
|
// Overwriting with the same property shouldn't dirty the node
|
|
190
197
|
rootNode.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
191
198
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
192
|
-
rootNode._properties.Int64Map.set(
|
|
193
|
-
expect(ChangeSet.isEmptyChangeSet(rootNode.serialize({
|
|
199
|
+
rootNode._properties.Int64Map.set("node1", new Int64(1, 1));
|
|
200
|
+
expect(ChangeSet.isEmptyChangeSet(rootNode.serialize({ dirtyOnly: true }))).to.be.ok;
|
|
194
201
|
expect(rootNode.isDirty()).to.be.false;
|
|
195
202
|
// Overwriting with a different value should result in a modify
|
|
196
|
-
rootNode._properties.Int64Map.set(
|
|
197
|
-
expect(rootNode.serialize({
|
|
203
|
+
rootNode._properties.Int64Map.set("node1", new Int64(1, 2));
|
|
204
|
+
expect(rootNode.serialize({ dirtyOnly: true })["map<Int64>"].Int64Map).to.have.all.keys("modify");
|
|
198
205
|
});
|
|
199
206
|
});
|
|
200
|
-
describe(
|
|
207
|
+
describe("squashing", function () {
|
|
201
208
|
//
|
|
202
209
|
// Helper function which takes a sequence of callbacks that are suceessively executed
|
|
203
210
|
// and the changes applied by the callbacks are separately tracked and squashed in a
|
|
@@ -208,19 +215,19 @@ describe('Int64MapProperty', function () {
|
|
|
208
215
|
//
|
|
209
216
|
var testChangeSetSquashing = function (in_options) {
|
|
210
217
|
resetKeyCounter();
|
|
211
|
-
var testProperty = PropertyFactory.create(
|
|
218
|
+
var testProperty = PropertyFactory.create("autodesk.tests:Int64MapTestPropertyID-1.0.0");
|
|
212
219
|
var callbacks = in_options.callbacks;
|
|
213
220
|
if (in_options.pre) {
|
|
214
221
|
in_options.pre(testProperty);
|
|
215
222
|
}
|
|
216
|
-
var initialChangeset = new ChangeSet(testProperty.serialize({
|
|
223
|
+
var initialChangeset = new ChangeSet(testProperty.serialize({ dirtyOnly: false }));
|
|
217
224
|
initialChangeset.setIsNormalized(true);
|
|
218
225
|
var squashedChangeset = new ChangeSet();
|
|
219
226
|
testProperty.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
220
227
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
221
228
|
for (var i = 0; i < callbacks.length; i++) {
|
|
222
229
|
callbacks[i](testProperty);
|
|
223
|
-
var changes = testProperty.serialize({
|
|
230
|
+
var changes = testProperty.serialize({ dirtyOnly: true });
|
|
224
231
|
testProperty.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
225
232
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
226
233
|
squashedChangeset.applyChangeSet(changes);
|
|
@@ -229,25 +236,38 @@ describe('Int64MapProperty', function () {
|
|
|
229
236
|
in_options.post(squashedChangeset.getSerializedChangeSet());
|
|
230
237
|
}
|
|
231
238
|
initialChangeset.applyChangeSet(squashedChangeset.getSerializedChangeSet());
|
|
232
|
-
expect(initialChangeset.getSerializedChangeSet()).to.deep.equal(testProperty.serialize({
|
|
239
|
+
expect(initialChangeset.getSerializedChangeSet()).to.deep.equal(testProperty.serialize({ dirtyOnly: false }));
|
|
233
240
|
};
|
|
234
|
-
it(
|
|
235
|
-
testChangeSetSquashing({
|
|
241
|
+
it("should work for multiple independent inserts", function () {
|
|
242
|
+
testChangeSetSquashing({
|
|
243
|
+
callbacks: [insertNodeInRoot, insertNodeInRoot, insertNodeInRoot],
|
|
244
|
+
});
|
|
236
245
|
});
|
|
237
|
-
it(
|
|
246
|
+
it("should work for inserts followed by removes", function () {
|
|
238
247
|
testChangeSetSquashing({
|
|
239
|
-
callbacks: [
|
|
248
|
+
callbacks: [
|
|
249
|
+
insertNodeInRoot,
|
|
250
|
+
insertNodeInRoot,
|
|
251
|
+
removeFirstNodeInRoot,
|
|
252
|
+
removeFirstNodeInRoot,
|
|
253
|
+
],
|
|
240
254
|
post: function (changeset) {
|
|
241
255
|
expect(changeset).to.be.empty;
|
|
242
256
|
},
|
|
243
257
|
});
|
|
244
258
|
});
|
|
245
|
-
it(
|
|
259
|
+
it("of inserts and modifies should work", function () {
|
|
246
260
|
testChangeSetSquashing({
|
|
247
|
-
callbacks: [
|
|
261
|
+
callbacks: [
|
|
262
|
+
insertNodeInRoot,
|
|
263
|
+
insertNodeInRoot,
|
|
264
|
+
insertNodeInRoot,
|
|
265
|
+
modifyEntry,
|
|
266
|
+
modifyEntry,
|
|
267
|
+
],
|
|
248
268
|
});
|
|
249
269
|
});
|
|
250
|
-
it(
|
|
270
|
+
it("an insert, modify and a remove should give an empty changeset", function () {
|
|
251
271
|
testChangeSetSquashing({
|
|
252
272
|
callbacks: [insertNodeInRoot, modifyEntry, modifyEntry, removeFirstNodeInRoot],
|
|
253
273
|
post: function (changeset) {
|
|
@@ -255,51 +275,51 @@ describe('Int64MapProperty', function () {
|
|
|
255
275
|
},
|
|
256
276
|
});
|
|
257
277
|
});
|
|
258
|
-
it(
|
|
278
|
+
it("should work for modifies after an already existing insert", function () {
|
|
259
279
|
testChangeSetSquashing({
|
|
260
280
|
pre: insertNodeInRoot,
|
|
261
281
|
callbacks: [modifyEntry, modifyEntry],
|
|
262
282
|
});
|
|
263
283
|
});
|
|
264
|
-
it(
|
|
284
|
+
it("of modify and remove after an already existing insert should work", function () {
|
|
265
285
|
testChangeSetSquashing({
|
|
266
286
|
pre: insertNodeInRoot,
|
|
267
287
|
callbacks: [modifyEntry, removeFirstNodeInRoot],
|
|
268
288
|
post: function (changeset) {
|
|
269
|
-
expect(changeset[
|
|
289
|
+
expect(changeset["map<Int64>"].Int64Map).to.have.all.keys("remove");
|
|
270
290
|
},
|
|
271
291
|
});
|
|
272
292
|
});
|
|
273
|
-
it(
|
|
293
|
+
it("of remove and insert should result in modify", function () {
|
|
274
294
|
// Create two nodes with the same GUID
|
|
275
295
|
testChangeSetSquashing({
|
|
276
296
|
pre: function (root) {
|
|
277
|
-
root._properties.Int64Map.insert(
|
|
297
|
+
root._properties.Int64Map.insert("node1", new Int64(1, 1));
|
|
278
298
|
},
|
|
279
299
|
callbacks: [
|
|
280
300
|
removeFirstNodeInRoot,
|
|
281
301
|
function (root) {
|
|
282
|
-
root._properties.Int64Map.insert(
|
|
302
|
+
root._properties.Int64Map.insert("node1", new Int64(1, 2));
|
|
283
303
|
},
|
|
284
304
|
],
|
|
285
305
|
post: function (changeset) {
|
|
286
|
-
expect(changeset[
|
|
306
|
+
expect(changeset["map<Int64>"].Int64Map).to.have.all.keys("modify");
|
|
287
307
|
},
|
|
288
308
|
});
|
|
289
309
|
});
|
|
290
310
|
});
|
|
291
|
-
describe(
|
|
311
|
+
describe("Rebasing", function () {
|
|
292
312
|
var testRebasing = function (in_options) {
|
|
293
313
|
// Prepare the initial state
|
|
294
|
-
var baseProperty1 = PropertyFactory.create(
|
|
314
|
+
var baseProperty1 = PropertyFactory.create("autodesk.tests:Int64MapTestPropertyID-1.0.0");
|
|
295
315
|
if (in_options.prepare) {
|
|
296
316
|
in_options.prepare(baseProperty1);
|
|
297
317
|
}
|
|
298
318
|
// Create two copies of this state
|
|
299
|
-
var baseProperty2 = PropertyFactory.create(
|
|
300
|
-
baseProperty2.deserialize(baseProperty1.serialize({
|
|
301
|
-
var baseProperty3 = PropertyFactory.create(
|
|
302
|
-
baseProperty3.deserialize(baseProperty1.serialize({
|
|
319
|
+
var baseProperty2 = PropertyFactory.create("autodesk.tests:Int64MapTestPropertyID-1.0.0");
|
|
320
|
+
baseProperty2.deserialize(baseProperty1.serialize({ dirtyOnly: false }));
|
|
321
|
+
var baseProperty3 = PropertyFactory.create("autodesk.tests:Int64MapTestPropertyID-1.0.0");
|
|
322
|
+
baseProperty3.deserialize(baseProperty1.serialize({ dirtyOnly: false }));
|
|
303
323
|
// Make sure the states are clear
|
|
304
324
|
baseProperty1.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
305
325
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
@@ -307,7 +327,7 @@ describe('Int64MapProperty', function () {
|
|
|
307
327
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
308
328
|
baseProperty3.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
309
329
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
310
|
-
var initialChangeSet = baseProperty1.serialize({
|
|
330
|
+
var initialChangeSet = baseProperty1.serialize({ dirtyOnly: false });
|
|
311
331
|
// Apply the operations to the two properties in parallel
|
|
312
332
|
if (in_options.op1) {
|
|
313
333
|
in_options.op1(baseProperty1);
|
|
@@ -316,8 +336,8 @@ describe('Int64MapProperty', function () {
|
|
|
316
336
|
in_options.op2(baseProperty2);
|
|
317
337
|
}
|
|
318
338
|
// Get the ChangeSets
|
|
319
|
-
var changeSet1 = new ChangeSet(baseProperty1.serialize({
|
|
320
|
-
var changeSet2 = baseProperty2.serialize({
|
|
339
|
+
var changeSet1 = new ChangeSet(baseProperty1.serialize({ dirtyOnly: true }));
|
|
340
|
+
var changeSet2 = baseProperty2.serialize({ dirtyOnly: true });
|
|
321
341
|
// Perform the actual rebase
|
|
322
342
|
var conflicts = [];
|
|
323
343
|
changeSet1._rebaseChangeSet(changeSet2, conflicts);
|
|
@@ -332,55 +352,55 @@ describe('Int64MapProperty', function () {
|
|
|
332
352
|
if (in_options.op2) {
|
|
333
353
|
in_options.op2(baseProperty3);
|
|
334
354
|
}
|
|
335
|
-
var finalChangeSet = baseProperty3.serialize({
|
|
355
|
+
var finalChangeSet = baseProperty3.serialize({ dirtyOnly: false });
|
|
336
356
|
expect(finalChangeSet).to.be.deep.equal(combinedChangeSet.getSerializedChangeSet());
|
|
337
357
|
}
|
|
338
358
|
if (in_options.checkResult) {
|
|
339
359
|
in_options.checkResult(conflicts, changeSet2, combinedChangeSet);
|
|
340
360
|
}
|
|
341
361
|
};
|
|
342
|
-
it(
|
|
362
|
+
it("with a NOP should be possible", function () {
|
|
343
363
|
testRebasing({
|
|
344
364
|
op2: insertEntryInRootWithUnqiueKey(),
|
|
345
365
|
compareToSequential: true,
|
|
346
366
|
});
|
|
347
367
|
});
|
|
348
|
-
it(
|
|
368
|
+
it("with independent inserts should be possible", function () {
|
|
349
369
|
testRebasing({
|
|
350
370
|
op1: insertEntryInRootWithUnqiueKey(),
|
|
351
371
|
op2: insertEntryInRootWithUnqiueKey(),
|
|
352
372
|
compareToSequential: true,
|
|
353
373
|
});
|
|
354
374
|
});
|
|
355
|
-
it(
|
|
375
|
+
it("with independent removes should be possible", function () {
|
|
356
376
|
testRebasing({
|
|
357
377
|
prepare: function (root) {
|
|
358
|
-
root._properties.Int64Map.insert(
|
|
359
|
-
root._properties.Int64Map.insert(
|
|
378
|
+
root._properties.Int64Map.insert("entry1", new Int64(1, 1));
|
|
379
|
+
root._properties.Int64Map.insert("entry2", new Int64(1, 2));
|
|
360
380
|
},
|
|
361
381
|
op1: function (root) {
|
|
362
|
-
root._properties.Int64Map.remove(
|
|
382
|
+
root._properties.Int64Map.remove("entry1");
|
|
363
383
|
},
|
|
364
384
|
op2: function (root) {
|
|
365
|
-
root._properties.Int64Map.remove(
|
|
385
|
+
root._properties.Int64Map.remove("entry2");
|
|
366
386
|
},
|
|
367
387
|
compareToSequential: true,
|
|
368
388
|
});
|
|
369
389
|
});
|
|
370
|
-
it(
|
|
390
|
+
it("with a modify and a remove should possible", function () {
|
|
371
391
|
testRebasing({
|
|
372
392
|
prepare: function (root) {
|
|
373
|
-
root._properties.Int64Map.insert(
|
|
393
|
+
root._properties.Int64Map.insert("entry1", new Int64(1, 1));
|
|
374
394
|
},
|
|
375
395
|
op1: modifyEntry,
|
|
376
396
|
op2: removeFirstNodeInRoot,
|
|
377
397
|
compareToSequential: true,
|
|
378
398
|
});
|
|
379
399
|
});
|
|
380
|
-
it(
|
|
400
|
+
it("with a remove and a modify should possible", function () {
|
|
381
401
|
testRebasing({
|
|
382
402
|
prepare: function (root) {
|
|
383
|
-
root._properties.Int64Map.insert(
|
|
403
|
+
root._properties.Int64Map.insert("entry1", new Int64(1, 1));
|
|
384
404
|
},
|
|
385
405
|
op1: removeFirstNodeInRoot,
|
|
386
406
|
op2: modifyEntry,
|
|
@@ -388,21 +408,21 @@ describe('Int64MapProperty', function () {
|
|
|
388
408
|
checkResult: function (conflicts, changeSet) {
|
|
389
409
|
expect(conflicts).to.have.length(1);
|
|
390
410
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.ENTRY_MODIFIED_AFTER_REMOVE);
|
|
391
|
-
expect(conflicts[0].path).to.be.equal(
|
|
411
|
+
expect(conflicts[0].path).to.be.equal("Int64Map[entry1]");
|
|
392
412
|
expect(ChangeSet.isEmptyChangeSet(changeSet)).to.be.ok;
|
|
393
413
|
},
|
|
394
414
|
});
|
|
395
415
|
});
|
|
396
|
-
it(
|
|
416
|
+
it("with two compatible removes should be possible", function () {
|
|
397
417
|
testRebasing({
|
|
398
418
|
prepare: function (root) {
|
|
399
|
-
root._properties.Int64Map.insert(
|
|
419
|
+
root._properties.Int64Map.insert("entry1", new Int64(1, 1));
|
|
400
420
|
},
|
|
401
421
|
op1: function (root) {
|
|
402
|
-
root._properties.Int64Map.remove(
|
|
422
|
+
root._properties.Int64Map.remove("entry1");
|
|
403
423
|
},
|
|
404
424
|
op2: function (root) {
|
|
405
|
-
root._properties.Int64Map.remove(
|
|
425
|
+
root._properties.Int64Map.remove("entry1");
|
|
406
426
|
},
|
|
407
427
|
compareToSequential: false,
|
|
408
428
|
checkResult: function (conflicts, changeSet) {
|
|
@@ -410,79 +430,78 @@ describe('Int64MapProperty', function () {
|
|
|
410
430
|
},
|
|
411
431
|
});
|
|
412
432
|
});
|
|
413
|
-
it(
|
|
433
|
+
it("with two conflicting modifies should be possible and report a conflict", function () {
|
|
414
434
|
testRebasing({
|
|
415
435
|
prepare: function (root) {
|
|
416
|
-
root._properties.Int64Map.insert(
|
|
436
|
+
root._properties.Int64Map.insert("entry1", new Int64(1, 1));
|
|
417
437
|
},
|
|
418
438
|
op1: function (root) {
|
|
419
|
-
root._properties.Int64Map.set(
|
|
439
|
+
root._properties.Int64Map.set("entry1", new Int64(1, 2));
|
|
420
440
|
},
|
|
421
441
|
op2: function (root) {
|
|
422
|
-
root._properties.Int64Map.set(
|
|
442
|
+
root._properties.Int64Map.set("entry1", new Int64(1, 3));
|
|
423
443
|
},
|
|
424
444
|
compareToSequential: true,
|
|
425
445
|
checkResult: function (conflicts, changeSet) {
|
|
426
446
|
expect(conflicts).to.have.length(1);
|
|
427
447
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
|
|
428
|
-
expect(conflicts[0].path).to.be.equal(
|
|
448
|
+
expect(conflicts[0].path).to.be.equal("Int64Map[entry1]");
|
|
429
449
|
},
|
|
430
450
|
});
|
|
431
451
|
});
|
|
432
|
-
it(
|
|
452
|
+
it("with modify followed by remove+insert should be a conflicting set", function () {
|
|
433
453
|
testRebasing({
|
|
434
454
|
prepare: function (root) {
|
|
435
|
-
root._properties.Int64Map.insert(
|
|
455
|
+
root._properties.Int64Map.insert("entry1", new Int64(1, 1));
|
|
436
456
|
},
|
|
437
457
|
op1: modifyEntry,
|
|
438
458
|
op2: function (root) {
|
|
439
|
-
root._properties.Int64Map.remove(
|
|
440
|
-
root._properties.Int64Map.insert(
|
|
459
|
+
root._properties.Int64Map.remove("entry1");
|
|
460
|
+
root._properties.Int64Map.insert("entry1", new Int64(1, 2));
|
|
441
461
|
},
|
|
442
462
|
compareToSequential: true,
|
|
443
463
|
checkResult: function (conflicts, changeSet) {
|
|
444
464
|
expect(conflicts).to.have.length(1);
|
|
445
465
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
|
|
446
|
-
expect(conflicts[0].path).to.be.equal(
|
|
466
|
+
expect(conflicts[0].path).to.be.equal("Int64Map[entry1]");
|
|
447
467
|
},
|
|
448
468
|
});
|
|
449
469
|
});
|
|
450
|
-
it(
|
|
470
|
+
it("with remove+insert followed by modify should be a conflicting set", function () {
|
|
451
471
|
testRebasing({
|
|
452
472
|
prepare: function (root) {
|
|
453
|
-
root._properties.Int64Map.insert(
|
|
473
|
+
root._properties.Int64Map.insert("entry1", new Int64(1, 1));
|
|
454
474
|
},
|
|
455
475
|
op1: function (root) {
|
|
456
|
-
root._properties.Int64Map.remove(
|
|
457
|
-
root._properties.Int64Map.insert(
|
|
476
|
+
root._properties.Int64Map.remove("entry1");
|
|
477
|
+
root._properties.Int64Map.insert("entry1", new Int64(1, 2));
|
|
458
478
|
},
|
|
459
479
|
op2: function (root) {
|
|
460
|
-
root._properties.Int64Map.set(
|
|
480
|
+
root._properties.Int64Map.set("entry1", new Int64(1, 3));
|
|
461
481
|
},
|
|
462
482
|
compareToSequential: true,
|
|
463
483
|
checkResult: function (conflicts, changeSet) {
|
|
464
484
|
expect(conflicts).to.have.length(1);
|
|
465
485
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
|
|
466
|
-
expect(conflicts[0].path).to.be.equal(
|
|
486
|
+
expect(conflicts[0].path).to.be.equal("Int64Map[entry1]");
|
|
467
487
|
},
|
|
468
488
|
});
|
|
469
489
|
});
|
|
470
|
-
it(
|
|
490
|
+
it("with conflicting inserts should report conflict", function () {
|
|
471
491
|
testRebasing({
|
|
472
|
-
prepare: function (root) {
|
|
473
|
-
},
|
|
492
|
+
prepare: function (root) { },
|
|
474
493
|
op1: function (root) {
|
|
475
|
-
root._properties.Int64Map.insert(
|
|
494
|
+
root._properties.Int64Map.insert("entry1", new Int64(1, 1));
|
|
476
495
|
},
|
|
477
496
|
op2: function (root) {
|
|
478
|
-
root._properties.Int64Map.insert(
|
|
497
|
+
root._properties.Int64Map.insert("entry1", new Int64(1, 2));
|
|
479
498
|
},
|
|
480
499
|
compareToSequential: false,
|
|
481
500
|
checkResult: function (conflicts, changeSet) {
|
|
482
|
-
expect(changeSet[
|
|
501
|
+
expect(changeSet["map<Int64>"].Int64Map).to.have.all.keys("modify");
|
|
483
502
|
expect(conflicts).to.have.length(1);
|
|
484
503
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
|
|
485
|
-
expect(conflicts[0].path).to.be.equal(
|
|
504
|
+
expect(conflicts[0].path).to.be.equal("Int64Map[entry1]");
|
|
486
505
|
},
|
|
487
506
|
});
|
|
488
507
|
});
|