-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(mps-legacy-sync-plugin): fix initialization of
ModelSyncService
Initialization of `ModelSyncService` initialized `org.modelix.model.mpsplugin.plugin.ApplicationPlugin_AppPluginPart`. During initialization of `ApplicationPlugin_AppPluginPart` in some cases `ModelSyncService` was accessed. Such a case was when `EModelixExecutionMode.PROJECTOR` was used. In such cases, initialization of `ApplicationPlugin_AppPluginPart` failed because `ModelSyncService` was still initializing. Now `ApplicationPlugin_AppPluginPart` is initialized while adding the first project.
- Loading branch information
Oleksandr Dzhychko
committed
Apr 11, 2024
1 parent
1809fe9
commit c3e98f7
Showing
5 changed files
with
99 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
mps-legacy-sync-plugin/src/test/kotlin/ProjectorAutoBindingTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2023. | ||
* | ||
* Licensed 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 org.modelix.model.client2.ModelClientV2 | ||
import org.modelix.model.mpsplugin.ModelServerConnections | ||
import org.modelix.model.mpsplugin.plugin.EModelixExecutionMode | ||
import org.modelix.model.mpsplugin.plugin.ModelixConfigurationSystemProperties | ||
|
||
class ProjectorAutoBindingTest : SyncPluginTestBase("projectWithOneEmptyModel") { | ||
fun `test project binds project when in with execution mode is PROJECTOR`() { | ||
System.setProperty("MODEL_URI", "http://localhost") | ||
System.setProperty("REPOSITORY_ID", "default") | ||
System.setProperty( | ||
ModelixConfigurationSystemProperties.EXECUTION_MODE_SYSPROP, | ||
EModelixExecutionMode.PROJECTOR.toString(), | ||
) | ||
|
||
runTestWithSyncService { | ||
val modelClient = ModelClientV2.builder().url(baseUrl).client(httpClient).build() | ||
modelClient.init() | ||
delayUntil(exceptionMessage = "Failed to auto connect to the model server.") { | ||
ModelServerConnections.instance.modelServers.isNotEmpty() | ||
} | ||
assertTrue(ModelServerConnections.instance.modelServers.size == 1) | ||
delayUntil(exceptionMessage = "Failed to sync to model server.") { | ||
val branches = modelClient.listBranches(defaultBranchRef.repositoryId) | ||
branches.isNotEmpty() | ||
} | ||
|
||
val dataOnServer = readDumpFromServer(defaultBranchRef) | ||
val project = dataOnServer.children.single() | ||
val moduleData = project.children.single() | ||
val model = moduleData.children.single { it.role == "models" } | ||
assertEquals("aSolution.aModel", model.properties["name"]) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters