-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cannot change version of Aspect Model (#185)
* Fixing changing namespace and version of models * Fix caching problem on current loaded model * Fix Github findings * Fix update title information * Fix cypress tests * Add testing for changing namespace and version * Fix dependencies should not update on changed file * Update sidebar-state.service.ts
- Loading branch information
Showing
51 changed files
with
576 additions
and
432 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
30 changes: 30 additions & 0 deletions
30
core/apps/ame-e2e/src/fixtures/change-namespace/aspect-workspace-one.txt
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,30 @@ | ||
# Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH | ||
# | ||
# See the AUTHORS file(s) distributed with this work for | ||
# additional information regarding authorship. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
@prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0#> . | ||
@prefix samm-c: <urn:samm:org.eclipse.esmf.samm:characteristic:2.1.0#> . | ||
@prefix samm-e: <urn:samm:org.eclipse.esmf.samm:entity:2.1.0#> . | ||
@prefix unit: <urn:samm:org.eclipse.esmf.samm:unit:2.1.0#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix : <urn:samm:org.eclipse.examples.one:1.0.0#> . | ||
|
||
:AspectDefault a samm:Aspect ; | ||
samm:properties (:property1) ; | ||
samm:operations (); | ||
samm:events () . | ||
|
||
:property1 a samm:Property; | ||
samm:characteristic :Characteristic1 . | ||
|
||
:Characteristic1 a samm:Characteristic ; | ||
samm:dataType xsd:string . |
30 changes: 30 additions & 0 deletions
30
core/apps/ame-e2e/src/fixtures/change-namespace/aspect-workspace-three.txt
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,30 @@ | ||
# Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH | ||
# | ||
# See the AUTHORS file(s) distributed with this work for | ||
# additional information regarding authorship. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
@prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0#> . | ||
@prefix samm-c: <urn:samm:org.eclipse.esmf.samm:characteristic:2.1.0#> . | ||
@prefix samm-e: <urn:samm:org.eclipse.esmf.samm:entity:2.1.0#> . | ||
@prefix unit: <urn:samm:org.eclipse.esmf.samm:unit:2.1.0#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix : <urn:samm:org.eclipse.examples.two:2.0.0#> . | ||
|
||
:NewName a samm:Aspect ; | ||
samm:properties (:property1) ; | ||
samm:operations (); | ||
samm:events () . | ||
|
||
:property1 a samm:Property; | ||
samm:characteristic :Characteristic1 . | ||
|
||
:Characteristic1 a samm:Characteristic ; | ||
samm:dataType xsd:string . |
30 changes: 30 additions & 0 deletions
30
core/apps/ame-e2e/src/fixtures/change-namespace/aspect-workspace-two.txt
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,30 @@ | ||
# Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH | ||
# | ||
# See the AUTHORS file(s) distributed with this work for | ||
# additional information regarding authorship. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
@prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0#> . | ||
@prefix samm-c: <urn:samm:org.eclipse.esmf.samm:characteristic:2.1.0#> . | ||
@prefix samm-e: <urn:samm:org.eclipse.esmf.samm:entity:2.1.0#> . | ||
@prefix unit: <urn:samm:org.eclipse.esmf.samm:unit:2.1.0#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix : <urn:samm:org.eclipse.examples.two:2.0.0#> . | ||
|
||
:AspectDefault a samm:Aspect ; | ||
samm:properties (:property1) ; | ||
samm:operations (); | ||
samm:events () . | ||
|
||
:property1 a samm:Property; | ||
samm:characteristic :Characteristic1 . | ||
|
||
:Characteristic1 a samm:Characteristic ; | ||
samm:dataType xsd:string . |
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
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
176 changes: 176 additions & 0 deletions
176
core/apps/ame-e2e/src/integration/settings/change-model-namespace.cy.ts
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,176 @@ | ||
/* eslint-disable cypress/no-unnecessary-waiting */ | ||
/* | ||
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH | ||
* | ||
* See the AUTHORS file(s) distributed with this work for | ||
* additional information regarding authorship. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
/// <reference types="Cypress" /> | ||
|
||
import 'cypress-real-events'; | ||
import { | ||
ACTION_dialogButton, | ||
FIELD_name, | ||
SELECTOR_namespaceTabValueInput, | ||
SELECTOR_namespaceTabVersionInput, | ||
SELECTOR_settingsButton, | ||
SELECTOR_workspaceBtn, | ||
SettingsDialogSelectors, | ||
} from '../../support/constants'; | ||
import {cyHelp} from '../../support/helpers'; | ||
|
||
describe('Test namespace settings dialog', () => { | ||
describe('Test changing model namespace version', () => { | ||
it('should open namespace settings', () => { | ||
cy.visitDefault(); | ||
cy.startModelling(); | ||
openNamespaceSettings().then(() => verifyNamespaceSettings('org.eclipse.examples.aspect', '1.0.0')); | ||
}); | ||
|
||
it('change namespace and version on settings', () => { | ||
changeNamespaceSettings('org.eclipse.examples.test', '2.0.0') | ||
.then(() => openNamespaceSettings()) | ||
.then(() => verifyNamespaceSettings('org.eclipse.examples.test', '2.0.0')) | ||
.then(() => cy.get(SettingsDialogSelectors.settingsDialogCancelButton).click()); | ||
}); | ||
}); | ||
|
||
describe('Test changing model namespace version', () => { | ||
it('should change namespace and version and save aspect model', () => { | ||
cy.intercept('GET', 'http://localhost:9091/ame/api/models/namespaces?shouldRefresh=true', {}); | ||
|
||
cy.visitDefault(); | ||
cy.fixture('/change-namespace/aspect-workspace-one') | ||
.as('rdfString') | ||
.then(rdfString => cy.loadModel(rdfString)); | ||
|
||
cy.intercept('GET', 'http://localhost:9091/ame/api/models/namespaces?shouldRefresh=true', { | ||
'org.eclipse.examples.one:1.0.0': ['AspectDefault.ttl'], | ||
}); | ||
|
||
cy.intercept( | ||
{ | ||
method: 'POST', | ||
url: 'http://localhost:9091/ame/api/models', | ||
headers: {namespace: 'org.eclipse.examples.one:1.0.0', 'file-name': 'AspectDefault.ttl'}, | ||
}, | ||
{ | ||
fixture: '/change-namespace/aspect-workspace-one.txt', | ||
}, | ||
); | ||
|
||
cy.saveAspectModelToWorkspace().then(() => cy.get(SELECTOR_workspaceBtn).click()); | ||
|
||
cy.intercept('GET', 'http://localhost:9091/ame/api/models/namespaces?shouldRefresh=true', { | ||
'org.eclipse.examples.one:1.0.0': ['AspectDefault.ttl'], | ||
'org.eclipse.examples.two:2.0.0': ['AspectDefault.ttl'], | ||
}); | ||
|
||
cy.intercept( | ||
{ | ||
method: 'POST', | ||
url: 'http://localhost:9091/ame/api/models', | ||
headers: {namespace: 'org.eclipse.examples.two:2.0.0', 'file-name': 'AspectDefault.ttl'}, | ||
}, | ||
{ | ||
fixture: '/change-namespace/aspect-workspace-two.txt', | ||
}, | ||
); | ||
|
||
openNamespaceSettings() | ||
.then(() => changeNamespaceSettings('org.eclipse.examples.two', '2.0.0')) | ||
.then(() => cy.saveAspectModelToWorkspace()) | ||
.then(() => cy.get(ACTION_dialogButton).click()) | ||
.then(() => openNamespaceSettings()) | ||
.then(() => verifyNamespaceSettings('org.eclipse.examples.two', '2.0.0')) | ||
.then(() => cy.get(SettingsDialogSelectors.settingsDialogCancelButton).click()) | ||
.then(() => cy.get('.namespaces').invoke('html')) | ||
.then(html => { | ||
expect(html).contain('org.eclipse.examples.two:2.0.0'); | ||
expect((html.match(/AspectDefault.ttl/g) || []).length).to.equal(2); | ||
}) | ||
.then(() => cy.get('[ng-reflect-message="This file is currently opened "]').invoke('html')) | ||
.then(html => expect(html).contain('AspectDefault.ttl')); | ||
}); | ||
|
||
it('should change name of aspect element and save to workspace', () => { | ||
cy.intercept('GET', 'http://localhost:9091/ame/api/models/namespaces?shouldRefresh=true', { | ||
'org.eclipse.examples.one:1.0.0': ['AspectDefault.ttl'], | ||
'org.eclipse.examples.two:2.0.0': ['AspectDefault.ttl', 'NewName.ttl'], | ||
}); | ||
|
||
cy.intercept( | ||
{ | ||
method: 'POST', | ||
url: 'http://localhost:9091/ame/api/models', | ||
headers: {namespace: 'org.eclipse.examples.one:1.0.0', 'file-name': 'AspectDefault.ttl'}, | ||
}, | ||
{ | ||
fixture: '/change-namespace/aspect-workspace-one.txt', | ||
}, | ||
); | ||
|
||
cy.intercept( | ||
{ | ||
method: 'POST', | ||
url: 'http://localhost:9091/ame/api/models', | ||
headers: {namespace: 'org.eclipse.examples.two:2.0.0', 'file-name': 'AspectDefault.ttl'}, | ||
}, | ||
{ | ||
fixture: '/change-namespace/aspect-workspace-two.txt', | ||
}, | ||
); | ||
|
||
cy.intercept( | ||
{ | ||
method: 'POST', | ||
url: 'http://localhost:9091/ame/api/models', | ||
headers: {namespace: 'org.eclipse.examples.two:2.0.0', 'file-name': 'NewName.ttl'}, | ||
}, | ||
{ | ||
fixture: '/change-namespace/aspect-workspace-three.txt', | ||
}, | ||
); | ||
|
||
cy.dbClickShape('AspectDefault') | ||
.then(() => cy.get(FIELD_name).clear({force: true}).type('NewName')) | ||
.then(() => cyHelp.clickSaveButton()) | ||
.then(() => cy.saveAspectModelToWorkspace()) | ||
.then(() => openNamespaceSettings()) | ||
.then(() => verifyNamespaceSettings('org.eclipse.examples.two', '2.0.0')) | ||
.then(() => cy.get(SettingsDialogSelectors.settingsDialogCancelButton).click()) | ||
.then(() => cy.get('.namespaces').invoke('html')) | ||
.then(html => { | ||
expect(html).contain('org.eclipse.examples.two:2.0.0'); | ||
expect((html.match(/AspectDefault.ttl/g) || []).length).to.equal(2); | ||
}) | ||
.then(() => cy.get('[ng-reflect-message="This file is currently opened "]').invoke('html')) | ||
.then(html => expect(html).contain('NewName.ttl')); | ||
}); | ||
}); | ||
|
||
function openNamespaceSettings() { | ||
return cy.get(SELECTOR_settingsButton).click().wait(1000).get(':nth-child(6) > .settings__node').click(); | ||
} | ||
|
||
function verifyNamespaceSettings(namespace: string, version: string): void { | ||
cy.get(SELECTOR_namespaceTabValueInput).should('have.value', namespace); | ||
cy.get(SELECTOR_namespaceTabVersionInput).should('have.value', version); | ||
} | ||
|
||
function changeNamespaceSettings(namespace: string, version: string) { | ||
return cy | ||
.get(SELECTOR_namespaceTabValueInput) | ||
.clear() | ||
.type(namespace) | ||
.then(() => cy.get(SELECTOR_namespaceTabVersionInput).clear().type(version)) | ||
.then(() => cy.get(SettingsDialogSelectors.settingsDialogOkButton).click()); | ||
} | ||
}); |
25 changes: 0 additions & 25 deletions
25
core/apps/ame-e2e/src/integration/settings/change-referenced-model-namespace.cy.ts
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.