@@ -10,10 +10,10 @@ import org.modelix.metamodel.TypedLanguagesRegistry
10
10
import org.modelix.metamodel.typed
11
11
import org.modelix.model.ModelFacade
12
12
import org.modelix.model.api.ConceptReference
13
- import org.modelix.model.api.IBranch
14
13
import org.modelix.model.api.getDescendants
15
14
import org.modelix.model.api.getRootNode
16
15
import org.modelix.model.client2.ModelClientV2PlatformSpecificBuilder
16
+ import org.modelix.model.client2.ReplicatedModel
17
17
import org.modelix.model.client2.getReplicatedModel
18
18
import org.modelix.model.data.ModelData
19
19
import org.modelix.model.data.NodeData
@@ -40,21 +40,21 @@ class PushTest {
40
40
val repoId = RepositoryId (" ci-test" )
41
41
val branchName = " master"
42
42
val url = " http://0.0.0.0:${Main .DEFAULT_PORT } /v2"
43
+
43
44
val branchRef = ModelFacade .createBranchReference(repoId, branchName)
44
- val client = ModelClientV2PlatformSpecificBuilder ().url(url).build()
45
+ val client = ModelClientV2PlatformSpecificBuilder ().url(url).build().apply { runBlocking { init () } }
46
+ val replicatedModel = client.getReplicatedModel(branchRef)
47
+ val branch = runBlocking { replicatedModel.start() }
45
48
46
- val branch = runBlocking {
47
- client.init ()
48
- client.getReplicatedModel(branchRef).start()
49
- }
50
49
branch.runRead {
51
50
assertContentEquals(inputModel.root.children, branch.getRootNode().allChildren.map { it.asExported() })
52
51
}
53
52
54
- applyChangesForPullTest(branch )
53
+ applyChangesForPullTest(replicatedModel )
55
54
}
56
55
57
- private fun applyChangesForPullTest (branch : IBranch ) {
56
+ private fun applyChangesForPullTest (replicatedModel : ReplicatedModel ) {
57
+ val branch = replicatedModel.getBranch()
58
58
branch.runWrite {
59
59
val graphNodes = branch.getRootNode()
60
60
.getDescendants(false )
@@ -67,5 +67,6 @@ class PushTest {
67
67
graphNodes[2 ].name = " Z"
68
68
}
69
69
sleep(5000 ) // changes are pushed asynchronously to the server. wait for the propagation
70
+ replicatedModel.dispose()
70
71
}
71
72
}
0 commit comments