@api-client/core 0.11.11 → 0.12.1
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/Testing.md +1 -1
- package/bin/plugins/events/EventPlugin.ts +61 -0
- package/bin/plugins/events/assert.ts +193 -0
- package/bin/plugins/events/types.ts +6 -0
- package/bin/test.ts +8 -1
- package/build/src/amf/AmfShapeGenerator.d.ts +6 -3
- package/build/src/amf/AmfShapeGenerator.d.ts.map +1 -1
- package/build/src/amf/AmfShapeGenerator.js +7 -4
- package/build/src/amf/AmfShapeGenerator.js.map +1 -1
- package/build/src/amf/AmfTypes.d.ts +2 -2
- package/build/src/amf/AmfTypes.d.ts.map +1 -1
- package/build/src/amf/AmfTypes.js.map +1 -1
- package/build/src/amf/DataValueGenerator.d.ts +15 -15
- package/build/src/amf/DataValueGenerator.d.ts.map +1 -1
- package/build/src/amf/DataValueGenerator.js +17 -16
- package/build/src/amf/DataValueGenerator.js.map +1 -1
- package/build/src/amf/models/AmfDataNode.d.ts.map +1 -1
- package/build/src/amf/models/AmfDataNode.js +2 -2
- package/build/src/amf/models/AmfDataNode.js.map +1 -1
- package/build/src/browser.d.ts +12 -9
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +11 -8
- package/build/src/browser.js.map +1 -1
- package/build/src/exceptions/attach_exception.d.ts +11 -0
- package/build/src/exceptions/attach_exception.d.ts.map +1 -0
- package/build/src/exceptions/attach_exception.js +11 -0
- package/build/src/exceptions/attach_exception.js.map +1 -0
- package/build/src/exceptions/detach_exception.d.ts +11 -0
- package/build/src/exceptions/detach_exception.d.ts.map +1 -0
- package/build/src/exceptions/detach_exception.js +11 -0
- package/build/src/exceptions/detach_exception.js.map +1 -0
- package/build/src/exceptions/remove_model_exception.d.ts +8 -0
- package/build/src/exceptions/remove_model_exception.d.ts.map +1 -0
- package/build/src/exceptions/remove_model_exception.js +8 -0
- package/build/src/exceptions/remove_model_exception.js.map +1 -0
- package/build/src/exceptions/remove_namespace_exception.d.ts +8 -0
- package/build/src/exceptions/remove_namespace_exception.d.ts.map +1 -0
- package/build/src/exceptions/remove_namespace_exception.js +8 -0
- package/build/src/exceptions/remove_namespace_exception.js.map +1 -0
- package/build/src/index.d.ts +12 -9
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +11 -8
- package/build/src/index.js.map +1 -1
- package/build/src/legacy.d.ts +8 -0
- package/build/src/legacy.d.ts.map +1 -1
- package/build/src/legacy.js +9 -0
- package/build/src/legacy.js.map +1 -1
- package/build/src/lib/uuid.d.ts +1 -1
- package/build/src/lib/uuid.js +1 -1
- package/build/src/lib/uuid.js.map +1 -1
- package/build/src/mocking/lib/History.js +8 -8
- package/build/src/mocking/lib/History.js.map +1 -1
- package/build/src/mocking/lib/HostRules.js +1 -1
- package/build/src/mocking/lib/HostRules.js.map +1 -1
- package/build/src/mocking/lib/User.js +2 -2
- package/build/src/mocking/lib/User.js.map +1 -1
- package/build/src/modeling/Bindings.d.ts +2 -2
- package/build/src/modeling/Bindings.d.ts.map +1 -1
- package/build/src/modeling/Bindings.js.map +1 -1
- package/build/src/modeling/DataDomain.d.ts +601 -0
- package/build/src/modeling/DataDomain.d.ts.map +1 -0
- package/build/src/modeling/DataDomain.js +1141 -0
- package/build/src/modeling/DataDomain.js.map +1 -0
- package/build/src/modeling/DataFormat.d.ts +42 -41
- package/build/src/modeling/DataFormat.d.ts.map +1 -1
- package/build/src/modeling/DataFormat.js +30 -131
- package/build/src/modeling/DataFormat.js.map +1 -1
- package/build/src/modeling/DomainAssociation.d.ts +281 -0
- package/build/src/modeling/DomainAssociation.d.ts.map +1 -0
- package/build/src/modeling/DomainAssociation.js +440 -0
- package/build/src/modeling/DomainAssociation.js.map +1 -0
- package/build/src/modeling/DomainElement.d.ts +33 -0
- package/build/src/modeling/DomainElement.d.ts.map +1 -0
- package/build/src/modeling/DomainElement.js +32 -0
- package/build/src/modeling/DomainElement.js.map +1 -0
- package/build/src/modeling/DomainEntity.d.ts +383 -0
- package/build/src/modeling/DomainEntity.d.ts.map +1 -0
- package/build/src/modeling/DomainEntity.js +718 -0
- package/build/src/modeling/DomainEntity.js.map +1 -0
- package/build/src/modeling/DomainFile.d.ts +25 -0
- package/build/src/modeling/DomainFile.d.ts.map +1 -0
- package/build/src/modeling/DomainFile.js +86 -0
- package/build/src/modeling/DomainFile.js.map +1 -0
- package/build/src/modeling/DomainImpactAnalysis.d.ts +60 -47
- package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
- package/build/src/modeling/DomainImpactAnalysis.js +201 -132
- package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
- package/build/src/modeling/DomainModel.d.ts +226 -0
- package/build/src/modeling/DomainModel.d.ts.map +1 -0
- package/build/src/modeling/DomainModel.js +401 -0
- package/build/src/modeling/DomainModel.js.map +1 -0
- package/build/src/modeling/DomainNamespace.d.ts +268 -0
- package/build/src/modeling/DomainNamespace.d.ts.map +1 -0
- package/build/src/modeling/DomainNamespace.js +512 -0
- package/build/src/modeling/DomainNamespace.js.map +1 -0
- package/build/src/modeling/DomainProperty.d.ts +281 -0
- package/build/src/modeling/DomainProperty.d.ts.map +1 -0
- package/build/src/modeling/DomainProperty.js +560 -0
- package/build/src/modeling/DomainProperty.js.map +1 -0
- package/build/src/modeling/DomainSerialization.d.ts +40 -0
- package/build/src/modeling/DomainSerialization.d.ts.map +1 -0
- package/build/src/modeling/DomainSerialization.js +288 -0
- package/build/src/modeling/DomainSerialization.js.map +1 -0
- package/build/src/modeling/DomainVersioning.d.ts +17 -0
- package/build/src/modeling/DomainVersioning.d.ts.map +1 -0
- package/build/src/modeling/DomainVersioning.js +124 -0
- package/build/src/modeling/DomainVersioning.js.map +1 -0
- package/build/src/modeling/GraphUtils.d.ts +8 -0
- package/build/src/modeling/GraphUtils.d.ts.map +1 -0
- package/build/src/modeling/GraphUtils.js +26 -0
- package/build/src/modeling/GraphUtils.js.map +1 -0
- package/build/src/modeling/amf/ShapeGenerator.d.ts +164 -0
- package/build/src/modeling/amf/ShapeGenerator.d.ts.map +1 -0
- package/build/src/modeling/amf/ShapeGenerator.js +492 -0
- package/build/src/modeling/amf/ShapeGenerator.js.map +1 -0
- package/build/src/modeling/{DataAssociation.d.ts → legacy/DataAssociation.d.ts} +10 -5
- package/build/src/modeling/legacy/DataAssociation.d.ts.map +1 -0
- package/build/src/modeling/{DataAssociation.js → legacy/DataAssociation.js} +11 -8
- package/build/src/modeling/legacy/DataAssociation.js.map +1 -0
- package/build/src/modeling/{DataEntity.d.ts → legacy/DataEntity.d.ts} +12 -7
- package/build/src/modeling/legacy/DataEntity.d.ts.map +1 -0
- package/build/src/modeling/{DataEntity.js → legacy/DataEntity.js} +21 -20
- package/build/src/modeling/legacy/DataEntity.js.map +1 -0
- package/build/src/modeling/{DataEntityBuilder.d.ts → legacy/DataEntityBuilder.d.ts} +3 -2
- package/build/src/modeling/legacy/DataEntityBuilder.d.ts.map +1 -0
- package/build/src/modeling/{DataEntityBuilder.js → legacy/DataEntityBuilder.js} +4 -3
- package/build/src/modeling/legacy/DataEntityBuilder.js.map +1 -0
- package/build/src/modeling/legacy/DataImpactAnalysis.d.ts +298 -0
- package/build/src/modeling/legacy/DataImpactAnalysis.d.ts.map +1 -0
- package/build/src/modeling/legacy/DataImpactAnalysis.js +441 -0
- package/build/src/modeling/legacy/DataImpactAnalysis.js.map +1 -0
- package/build/src/modeling/{DataModel.d.ts → legacy/DataModel.d.ts} +6 -4
- package/build/src/modeling/legacy/DataModel.d.ts.map +1 -0
- package/build/src/modeling/{DataModel.js → legacy/DataModel.js} +9 -8
- package/build/src/modeling/legacy/DataModel.js.map +1 -0
- package/build/src/modeling/{DataNamespace.d.ts → legacy/DataNamespace.d.ts} +22 -3
- package/build/src/modeling/legacy/DataNamespace.d.ts.map +1 -0
- package/build/src/modeling/{DataNamespace.js → legacy/DataNamespace.js} +9 -5
- package/build/src/modeling/legacy/DataNamespace.js.map +1 -0
- package/build/src/modeling/{DataProperty.d.ts → legacy/DataProperty.d.ts} +13 -5
- package/build/src/modeling/legacy/DataProperty.d.ts.map +1 -0
- package/build/src/modeling/{DataProperty.js → legacy/DataProperty.js} +10 -7
- package/build/src/modeling/legacy/DataProperty.js.map +1 -0
- package/build/src/modeling/observed.d.ts +67 -0
- package/build/src/modeling/observed.d.ts.map +1 -0
- package/build/src/modeling/observed.js +230 -0
- package/build/src/modeling/observed.js.map +1 -0
- package/build/src/modeling/types.d.ts +165 -1
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/src/models/AuthorizationData.js +3 -3
- package/build/src/models/AuthorizationData.js.map +1 -1
- package/build/src/models/CertificateFile.js +2 -2
- package/build/src/models/CertificateFile.js.map +1 -1
- package/build/src/models/ClientCertificate.js +5 -5
- package/build/src/models/ClientCertificate.js.map +1 -1
- package/build/src/models/Environment.js +6 -6
- package/build/src/models/Environment.js.map +1 -1
- package/build/src/models/Folder.js +2 -2
- package/build/src/models/Folder.js.map +1 -1
- package/build/src/models/HostRule.js +4 -4
- package/build/src/models/HostRule.js.map +1 -1
- package/build/src/models/HttpProject.js +12 -12
- package/build/src/models/HttpProject.js.map +1 -1
- package/build/src/models/Project.d.ts.map +1 -1
- package/build/src/models/Project.js +2 -2
- package/build/src/models/Project.js.map +1 -1
- package/build/src/models/ProjectFolder.d.ts.map +1 -1
- package/build/src/models/ProjectFolder.js +6 -6
- package/build/src/models/ProjectFolder.js.map +1 -1
- package/build/src/models/ProjectRequest.d.ts.map +1 -1
- package/build/src/models/ProjectRequest.js +8 -8
- package/build/src/models/ProjectRequest.js.map +1 -1
- package/build/src/models/ProjectSchema.js +6 -6
- package/build/src/models/ProjectSchema.js.map +1 -1
- package/build/src/models/Thing.d.ts +26 -5
- package/build/src/models/Thing.d.ts.map +1 -1
- package/build/src/models/Thing.js +193 -91
- package/build/src/models/Thing.js.map +1 -1
- package/build/src/models/kinds.d.ts +31 -6
- package/build/src/models/kinds.d.ts.map +1 -1
- package/build/src/models/kinds.js +31 -6
- package/build/src/models/kinds.js.map +1 -1
- package/build/src/models/store/DataFile.d.ts +3 -1
- package/build/src/models/store/DataFile.d.ts.map +1 -1
- package/build/src/models/store/DataFile.js +4 -2
- package/build/src/models/store/DataFile.js.map +1 -1
- package/build/src/models/store/File.d.ts.map +1 -1
- package/build/src/models/store/File.js +3 -3
- package/build/src/models/store/File.js.map +1 -1
- package/build/src/models/store/Organization.js +3 -3
- package/build/src/models/store/Organization.js.map +1 -1
- package/build/src/models/store/Permission.js +7 -7
- package/build/src/models/store/Permission.js.map +1 -1
- package/build/src/models/store/UserIdentity.js +3 -3
- package/build/src/models/store/UserIdentity.js.map +1 -1
- package/build/src/models/transformers/ArcDexieTransformer.js +4 -4
- package/build/src/models/transformers/ArcDexieTransformer.js.map +1 -1
- package/build/src/models/transformers/ArcLegacyTransformer.js +3 -3
- package/build/src/models/transformers/ArcLegacyTransformer.js.map +1 -1
- package/build/src/models/transformers/ArcPouchTransformer.js +2 -2
- package/build/src/models/transformers/ArcPouchTransformer.js.map +1 -1
- package/build/src/models/transformers/PostmanV21Transformer.js +2 -2
- package/build/src/models/transformers/PostmanV21Transformer.js.map +1 -1
- package/build/src/models/transformers/PostmanV2Transformer.js +2 -2
- package/build/src/models/transformers/PostmanV2Transformer.js.map +1 -1
- package/build/src/models/types.d.ts +12 -0
- package/build/src/models/types.d.ts.map +1 -0
- package/build/src/models/types.js +2 -0
- package/build/src/models/types.js.map +1 -0
- package/build/src/patch/PatchClient.js +2 -2
- package/build/src/patch/PatchClient.js.map +1 -1
- package/build/src/runtime/store/FilesSdk.d.ts +2 -2
- package/build/src/runtime/store/FilesSdk.d.ts.map +1 -1
- package/build/src/runtime/store/FilesSdk.js +3 -3
- package/build/src/runtime/store/FilesSdk.js.map +1 -1
- package/data/models/example-generator-api.json +8 -8
- package/package.json +20 -6
- package/readme.md +1 -1
- package/src/amf/AmfShapeGenerator.ts +10 -7
- package/src/amf/AmfTypes.ts +2 -2
- package/src/amf/DataValueGenerator.ts +24 -23
- package/src/amf/models/AmfDataNode.ts +2 -2
- package/src/exceptions/attach_exception.ts +11 -0
- package/src/exceptions/detach_exception.ts +11 -0
- package/src/exceptions/remove_model_exception.ts +8 -0
- package/src/exceptions/remove_namespace_exception.ts +8 -0
- package/src/lib/uuid.ts +1 -1
- package/src/mocking/lib/History.ts +8 -8
- package/src/mocking/lib/HostRules.ts +1 -1
- package/src/mocking/lib/User.ts +2 -2
- package/src/modeling/Bindings.ts +2 -2
- package/src/modeling/DataDomain.ts +1220 -0
- package/src/modeling/DataFormat.ts +54 -163
- package/src/modeling/DomainAssociation.ts +476 -0
- package/src/modeling/DomainElement.ts +50 -0
- package/src/modeling/DomainEntity.ts +769 -0
- package/src/modeling/DomainFile.ts +94 -0
- package/src/modeling/DomainImpactAnalysis.ts +218 -144
- package/src/modeling/DomainModel.ts +421 -0
- package/src/modeling/DomainNamespace.ts +537 -0
- package/src/modeling/DomainProperty.ts +548 -0
- package/src/modeling/DomainSerialization.ts +312 -0
- package/src/modeling/DomainVersioning.ts +144 -0
- package/src/modeling/GraphUtils.ts +28 -0
- package/src/modeling/amf/ShapeGenerator.ts +552 -0
- package/src/modeling/graph.md +115 -0
- package/src/modeling/{DataAssociation.ts → legacy/DataAssociation.ts} +15 -10
- package/src/modeling/{DataEntity.ts → legacy/DataEntity.ts} +30 -25
- package/src/modeling/{DataEntityBuilder.ts → legacy/DataEntityBuilder.ts} +5 -4
- package/src/modeling/legacy/DataImpactAnalysis.ts +530 -0
- package/src/modeling/{DataModel.ts → legacy/DataModel.ts} +12 -10
- package/src/modeling/{DataNamespace.ts → legacy/DataNamespace.ts} +25 -7
- package/src/modeling/{DataProperty.ts → legacy/DataProperty.ts} +17 -9
- package/src/modeling/observed.ts +267 -0
- package/src/modeling/types.ts +174 -1
- package/src/models/AuthorizationData.ts +3 -3
- package/src/models/CertificateFile.ts +2 -2
- package/src/models/ClientCertificate.ts +5 -5
- package/src/models/Environment.ts +6 -6
- package/src/models/Folder.ts +2 -2
- package/src/models/HostRule.ts +4 -4
- package/src/models/HttpProject.ts +12 -12
- package/src/models/Project.ts +2 -2
- package/src/models/ProjectFolder.ts +6 -6
- package/src/models/ProjectRequest.ts +8 -8
- package/src/models/ProjectSchema.ts +6 -6
- package/src/models/Thing.ts +70 -5
- package/src/models/kinds.ts +32 -6
- package/src/models/store/DataFile.ts +5 -3
- package/src/models/store/File.ts +3 -3
- package/src/models/store/Organization.ts +3 -3
- package/src/models/store/Permission.ts +7 -7
- package/src/models/store/UserIdentity.ts +3 -3
- package/src/models/transformers/ArcDexieTransformer.ts +4 -4
- package/src/models/transformers/ArcLegacyTransformer.ts +3 -3
- package/src/models/transformers/ArcPouchTransformer.ts +2 -2
- package/src/models/transformers/PostmanV21Transformer.ts +2 -2
- package/src/models/transformers/PostmanV2Transformer.ts +2 -2
- package/src/models/types.ts +11 -0
- package/src/patch/PatchClient.ts +2 -2
- package/src/runtime/store/FilesSdk.ts +5 -5
- package/tests/unit/amf/data_value_generator.spec.ts +15 -15
- package/tests/unit/legacy-transformers/ARC-legacy-import.spec.ts +1 -1
- package/tests/unit/modeling/amf/shape_generator.spec.ts +1174 -0
- package/tests/unit/modeling/data_domain.spec.ts +444 -0
- package/tests/unit/modeling/data_domain_associations.spec.ts +279 -0
- package/tests/unit/modeling/data_domain_change_observers.spec.ts +681 -0
- package/tests/unit/modeling/data_domain_entities.spec.ts +449 -0
- package/tests/unit/modeling/data_domain_foreign.spec.ts +355 -0
- package/tests/unit/modeling/data_domain_models.spec.ts +658 -0
- package/tests/unit/modeling/data_domain_namespaces.spec.ts +668 -0
- package/tests/unit/modeling/data_domain_property.spec.ts +264 -0
- package/tests/unit/modeling/data_domain_serialization.spec.ts +294 -0
- package/tests/unit/modeling/domain.property.spec.ts +822 -0
- package/tests/unit/modeling/domain_asociation.spec.ts +643 -0
- package/tests/unit/modeling/domain_asociation_targets.spec.ts +350 -0
- package/tests/unit/modeling/domain_entity.spec.ts +730 -0
- package/tests/unit/modeling/domain_entity_associations.spec.ts +330 -0
- package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +988 -0
- package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +1451 -0
- package/tests/unit/modeling/domain_entity_fields.spec.ts +113 -0
- package/tests/unit/modeling/domain_entity_generators.spec.ts +20 -0
- package/tests/unit/modeling/domain_entity_parents.spec.ts +291 -0
- package/tests/unit/modeling/domain_entity_properties.spec.ts +305 -0
- package/tests/unit/modeling/{data_file.spec.ts → domain_file.spec.ts} +29 -85
- package/tests/unit/modeling/domain_impact_analysis.spec.ts +452 -0
- package/tests/unit/modeling/domain_model.spec.ts +568 -0
- package/tests/unit/modeling/domain_model_entities.spec.ts +408 -0
- package/tests/unit/modeling/domain_namespace.spec.ts +514 -0
- package/tests/unit/modeling/domain_namespace_models.spec.ts +324 -0
- package/tests/unit/modeling/domain_namespace_namespaces.spec.ts +404 -0
- package/tests/unit/modeling/domain_versioning.spec.ts +140 -0
- package/tests/unit/{amf → modeling/legacy}/amf_shape_generator.spec.ts +11 -11
- package/tests/unit/modeling/{data_association.spec.ts → legacy/data_association.spec.ts} +3 -11
- package/tests/unit/modeling/{data_entity.spec.ts → legacy/data_entity.spec.ts} +10 -8
- package/tests/unit/modeling/{data_entity_generator_json.spec.ts → legacy/data_entity_generator_json.spec.ts} +1 -1
- package/tests/unit/modeling/{data_entity_generator_xml.spec.ts → legacy/data_entity_generator_xml.spec.ts} +1 -1
- package/tests/unit/modeling/{data_model.spec.ts → legacy/data_model.spec.ts} +3 -3
- package/tests/unit/modeling/{data_namespace.spec.ts → legacy/data_namespace.spec.ts} +3 -10
- package/tests/unit/modeling/{data_property.spec.ts → legacy/data_property.spec.ts} +3 -6
- package/tests/unit/modeling/{impact_analysis.spec.ts → legacy/impact_analysis.spec.ts} +9 -9
- package/tests/unit/models/File/new.spec.ts +1 -1
- package/tests/unit/models/HttpProject.spec.ts +3 -3
- package/tests/unit/runtime/proxy/HttpProjectProxy.spec.ts +8 -8
- package/tsconfig.node.json +35 -0
- package/build/src/modeling/DataAssociation.d.ts.map +0 -1
- package/build/src/modeling/DataAssociation.js.map +0 -1
- package/build/src/modeling/DataEntity.d.ts.map +0 -1
- package/build/src/modeling/DataEntity.js.map +0 -1
- package/build/src/modeling/DataEntityBuilder.d.ts.map +0 -1
- package/build/src/modeling/DataEntityBuilder.js.map +0 -1
- package/build/src/modeling/DataModel.d.ts.map +0 -1
- package/build/src/modeling/DataModel.js.map +0 -1
- package/build/src/modeling/DataNamespace.d.ts.map +0 -1
- package/build/src/modeling/DataNamespace.js.map +0 -1
- package/build/src/modeling/DataProperty.d.ts.map +0 -1
- package/build/src/modeling/DataProperty.js.map +0 -1
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
import { test } from '@japa/runner'
|
|
2
|
+
import { DomainImpactAnalysis } from '../../../src/modeling/DomainImpactAnalysis.js'
|
|
3
|
+
import {
|
|
4
|
+
DomainNamespaceKind,
|
|
5
|
+
DomainEntityKind,
|
|
6
|
+
DomainModelKind,
|
|
7
|
+
DomainPropertyKind,
|
|
8
|
+
DomainAssociationKind,
|
|
9
|
+
DataDomain,
|
|
10
|
+
DomainNamespace,
|
|
11
|
+
DomainModel,
|
|
12
|
+
DomainEntity,
|
|
13
|
+
DomainProperty,
|
|
14
|
+
DomainAssociation,
|
|
15
|
+
} from '../../../src/index.js'
|
|
16
|
+
|
|
17
|
+
test.group('DomainImpactAnalysis', (group) => {
|
|
18
|
+
let analyzer: DomainImpactAnalysis
|
|
19
|
+
let root: DataDomain
|
|
20
|
+
let n1: DomainNamespace
|
|
21
|
+
let n2: DomainNamespace
|
|
22
|
+
let m1: DomainModel
|
|
23
|
+
let m2: DomainModel
|
|
24
|
+
let m3: DomainModel
|
|
25
|
+
let e1: DomainEntity
|
|
26
|
+
let e2: DomainEntity
|
|
27
|
+
let e3: DomainEntity
|
|
28
|
+
let e4: DomainEntity
|
|
29
|
+
let p1: DomainProperty
|
|
30
|
+
let a1: DomainAssociation
|
|
31
|
+
|
|
32
|
+
group.each.setup(() => {
|
|
33
|
+
root = new DataDomain()
|
|
34
|
+
analyzer = new DomainImpactAnalysis(root)
|
|
35
|
+
n1 = root.addNamespace({ key: 'n1', info: { name: 'n1' } })
|
|
36
|
+
m1 = root.addModel({ key: 'm1', info: { name: 'm1' } })
|
|
37
|
+
n2 = n1.addNamespace({ key: 'n2', info: { name: 'n2' } })
|
|
38
|
+
m2 = n1.addModel({ key: 'm2', info: { name: 'm2' } })
|
|
39
|
+
e1 = m1.addEntity({ key: 'e1', info: { name: 'e1' } })
|
|
40
|
+
e2 = m2.addEntity({ key: 'e2', info: { name: 'e2' } })
|
|
41
|
+
m3 = n2.addModel({ key: 'm3', info: { name: 'm3' } })
|
|
42
|
+
e3 = m3.addEntity({ key: 'e3', info: { name: 'e3' } })
|
|
43
|
+
p1 = e1.addProperty({ key: 'p1', info: { name: 'p1' } })
|
|
44
|
+
a1 = e1.addAssociation()
|
|
45
|
+
a1.info.name = 'a1'
|
|
46
|
+
a1.addTarget(e2)
|
|
47
|
+
e2.addParent(e3.key)
|
|
48
|
+
e3.addParent(e1.key)
|
|
49
|
+
e4 = root.addModel({ key: 'm4', info: { name: 'm4' } }).addEntity({ key: 'e4', info: { name: 'e4' } })
|
|
50
|
+
e4.addParent(e3.key)
|
|
51
|
+
// DataDomain (root)
|
|
52
|
+
// ├── DomainNamespace (n1)
|
|
53
|
+
// │ ├── DomainModel (m2)
|
|
54
|
+
// │ │ └── DomainEntity (e2)
|
|
55
|
+
// │ │ └── parent: DomainEntity (e3)
|
|
56
|
+
// │ └── DomainNamespace (n2)
|
|
57
|
+
// │ └── DomainModel (m3)
|
|
58
|
+
// │ └── DomainEntity (e3)
|
|
59
|
+
// │ └── parent: DomainEntity (e1)
|
|
60
|
+
// ├── DomainModel (m1)
|
|
61
|
+
// │ └── DomainEntity (e1)
|
|
62
|
+
// │ ├── DomainProperty (p1)
|
|
63
|
+
// │ └── DomainAssociation (a1)
|
|
64
|
+
// │ └── target: DomainEntity (e2)
|
|
65
|
+
// └── DomainModel (m4)
|
|
66
|
+
// └── DomainEntity (e4)
|
|
67
|
+
// └── parent: DomainEntity (e3)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
test('returns a report for deleting a namespace', ({ assert }) => {
|
|
71
|
+
const report = analyzer.deleteAnalysis(n1.key, DomainNamespaceKind)
|
|
72
|
+
assert.equal(report.key, n1.key)
|
|
73
|
+
assert.equal(report.kind, DomainNamespaceKind)
|
|
74
|
+
assert.isFalse(report.canProceed, 'operation should not be able to proceed')
|
|
75
|
+
// Affected items:
|
|
76
|
+
// - n1 (self)
|
|
77
|
+
// - n2 (child)
|
|
78
|
+
// - m3 (child)
|
|
79
|
+
// - e3 (child)
|
|
80
|
+
// - e4 (parent of e3)
|
|
81
|
+
// - m2 (child)
|
|
82
|
+
// - e2 (child), note, e3 parent is not included because it is included in the deletion.
|
|
83
|
+
// - a1 (target of e2)
|
|
84
|
+
assert.lengthOf(report.impact, 8, 'has all items')
|
|
85
|
+
const [n1r, n2r, m3r, e3r, e4r, m2r, e2r, a1r] = report.impact
|
|
86
|
+
|
|
87
|
+
assert.ok(n1r)
|
|
88
|
+
assert.equal(n1r.key, n1.key)
|
|
89
|
+
assert.equal(n1r.kind, DomainNamespaceKind)
|
|
90
|
+
assert.equal(n1r.type, 'delete')
|
|
91
|
+
assert.equal(n1r.impact, `The n1 namespace will be deleted.`)
|
|
92
|
+
assert.isFalse(n1r.blocking)
|
|
93
|
+
|
|
94
|
+
assert.ok(n2r)
|
|
95
|
+
assert.equal(n2r.key, n2.key)
|
|
96
|
+
assert.equal(n2r.kind, DomainNamespaceKind)
|
|
97
|
+
assert.equal(n2r.type, 'delete')
|
|
98
|
+
assert.equal(n2r.impact, `The n2 namespace will be deleted.`)
|
|
99
|
+
assert.isFalse(n2r.blocking)
|
|
100
|
+
|
|
101
|
+
assert.ok(m3r)
|
|
102
|
+
assert.equal(m3r.key, m3.key)
|
|
103
|
+
assert.equal(m3r.kind, DomainModelKind)
|
|
104
|
+
assert.equal(m3r.type, 'delete')
|
|
105
|
+
assert.equal(m3r.impact, `The m3 data model will be deleted.`)
|
|
106
|
+
assert.isFalse(m3r.blocking)
|
|
107
|
+
|
|
108
|
+
assert.ok(e3r)
|
|
109
|
+
assert.equal(e3r.key, e3.key)
|
|
110
|
+
assert.equal(e3r.kind, DomainEntityKind)
|
|
111
|
+
assert.equal(e3r.type, 'delete')
|
|
112
|
+
assert.equal(e3r.impact, `The e3 entity will be deleted.`)
|
|
113
|
+
assert.isFalse(e3r.blocking)
|
|
114
|
+
|
|
115
|
+
assert.ok(e4r)
|
|
116
|
+
assert.equal(e4r.key, e4.key)
|
|
117
|
+
assert.equal(e4r.kind, DomainEntityKind)
|
|
118
|
+
assert.equal(e4r.type, 'delete')
|
|
119
|
+
assert.equal(e4r.impact, `The "e4" entity will become an orphan because it is a child of the "e3" entity.`)
|
|
120
|
+
assert.equal(e4r.resolution, `The "e3" entity will be removed as the parent of the "e4" entity.`)
|
|
121
|
+
assert.isTrue(e4r.blocking)
|
|
122
|
+
assert.equal(e4r.relationship, 'child')
|
|
123
|
+
|
|
124
|
+
assert.ok(m2r)
|
|
125
|
+
assert.equal(m2r.key, m2.key)
|
|
126
|
+
assert.equal(m2r.kind, DomainModelKind)
|
|
127
|
+
assert.equal(m2r.type, 'delete')
|
|
128
|
+
assert.equal(m2r.impact, `The m2 data model will be deleted.`)
|
|
129
|
+
assert.isFalse(m2r.blocking)
|
|
130
|
+
|
|
131
|
+
assert.ok(e2r)
|
|
132
|
+
assert.equal(e2r.key, e2.key)
|
|
133
|
+
assert.equal(e2r.kind, DomainEntityKind)
|
|
134
|
+
assert.equal(e2r.type, 'delete')
|
|
135
|
+
assert.equal(e2r.impact, `The e2 entity will be deleted.`)
|
|
136
|
+
assert.isFalse(e2r.blocking)
|
|
137
|
+
|
|
138
|
+
assert.ok(a1r)
|
|
139
|
+
assert.equal(a1r.key, a1.key)
|
|
140
|
+
assert.equal(a1r.kind, DomainAssociationKind)
|
|
141
|
+
assert.equal(a1r.type, 'delete')
|
|
142
|
+
assert.equal(a1r.impact, `The a1 association will be broken because it has a target to e2.`)
|
|
143
|
+
assert.equal(a1r.resolution, `The a1 association will be removed from e2.`)
|
|
144
|
+
assert.isTrue(a1r.blocking)
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
test('returns a report for deleting a data model', ({ assert }) => {
|
|
148
|
+
const report = analyzer.deleteAnalysis(m1.key, DomainModelKind)
|
|
149
|
+
assert.equal(report.key, m1.key)
|
|
150
|
+
assert.equal(report.kind, DomainModelKind)
|
|
151
|
+
assert.isFalse(report.canProceed, 'operation should not be able to proceed')
|
|
152
|
+
|
|
153
|
+
// Affected items:
|
|
154
|
+
// - m1 (self)
|
|
155
|
+
// - e1 (child)
|
|
156
|
+
// - p1 (child of e1)
|
|
157
|
+
// - a1 (child of e1)
|
|
158
|
+
// - e3 (parent of e4)
|
|
159
|
+
assert.lengthOf(report.impact, 5, 'has all items')
|
|
160
|
+
const [m1r, e1r, e3r, p1r, a1r] = report.impact
|
|
161
|
+
|
|
162
|
+
assert.ok(m1r)
|
|
163
|
+
assert.equal(m1r.key, m1.key)
|
|
164
|
+
assert.equal(m1r.kind, DomainModelKind)
|
|
165
|
+
assert.equal(m1r.type, 'delete')
|
|
166
|
+
assert.equal(m1r.impact, `The m1 data model will be deleted.`)
|
|
167
|
+
assert.isFalse(m1r.blocking)
|
|
168
|
+
|
|
169
|
+
assert.ok(e1r)
|
|
170
|
+
assert.equal(e1r.key, e1.key)
|
|
171
|
+
assert.equal(e1r.kind, DomainEntityKind)
|
|
172
|
+
assert.equal(e1r.type, 'delete')
|
|
173
|
+
assert.equal(e1r.impact, `The e1 entity will be deleted.`)
|
|
174
|
+
assert.isFalse(e1r.blocking)
|
|
175
|
+
|
|
176
|
+
assert.ok(p1r)
|
|
177
|
+
assert.equal(p1r.key, p1.key)
|
|
178
|
+
assert.equal(p1r.kind, DomainPropertyKind)
|
|
179
|
+
assert.equal(p1r.type, 'delete')
|
|
180
|
+
assert.equal(p1r.impact, `The p1 property will be deleted.`)
|
|
181
|
+
assert.isFalse(p1r.blocking)
|
|
182
|
+
|
|
183
|
+
assert.ok(a1r)
|
|
184
|
+
assert.equal(a1r.key, a1.key)
|
|
185
|
+
assert.equal(a1r.kind, DomainAssociationKind)
|
|
186
|
+
assert.equal(a1r.type, 'delete')
|
|
187
|
+
assert.equal(a1r.impact, `The a1 association will be deleted.`)
|
|
188
|
+
assert.isFalse(a1r.blocking)
|
|
189
|
+
|
|
190
|
+
assert.ok(e3r)
|
|
191
|
+
assert.equal(e3r.key, e3.key)
|
|
192
|
+
assert.equal(e3r.kind, DomainEntityKind)
|
|
193
|
+
assert.equal(e3r.type, 'delete')
|
|
194
|
+
assert.equal(e3r.impact, `The "e3" entity will become an orphan because it is a child of the "e1" entity.`)
|
|
195
|
+
assert.equal(e3r.resolution, `The "e1" entity will be removed as the parent of the "e3" entity.`)
|
|
196
|
+
assert.isTrue(e3r.blocking)
|
|
197
|
+
assert.equal(e3r.relationship, 'child')
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
test('returns a report for deleting an entity', ({ assert }) => {
|
|
201
|
+
const report = analyzer.deleteAnalysis(e1.key, DomainEntityKind)
|
|
202
|
+
assert.equal(report.key, e1.key)
|
|
203
|
+
assert.equal(report.kind, DomainEntityKind)
|
|
204
|
+
assert.isFalse(report.canProceed, 'operation should not be able to proceed')
|
|
205
|
+
|
|
206
|
+
// Affected items:
|
|
207
|
+
// - e1 (self)
|
|
208
|
+
// - e3 (parent)
|
|
209
|
+
// - p1 (child)
|
|
210
|
+
// - a1 (child)
|
|
211
|
+
assert.lengthOf(report.impact, 4, 'has all items')
|
|
212
|
+
const [e1r, e3r, p1r, a1r] = report.impact
|
|
213
|
+
|
|
214
|
+
assert.ok(e1r)
|
|
215
|
+
assert.equal(e1r.key, e1.key)
|
|
216
|
+
assert.equal(e1r.kind, DomainEntityKind)
|
|
217
|
+
assert.equal(e1r.type, 'delete')
|
|
218
|
+
assert.equal(e1r.impact, `The e1 entity will be deleted.`)
|
|
219
|
+
assert.isFalse(e1r.blocking)
|
|
220
|
+
|
|
221
|
+
assert.ok(p1r)
|
|
222
|
+
assert.equal(p1r.key, p1.key)
|
|
223
|
+
assert.equal(p1r.kind, DomainPropertyKind)
|
|
224
|
+
assert.equal(p1r.type, 'delete')
|
|
225
|
+
assert.equal(p1r.impact, `The p1 property will be deleted.`)
|
|
226
|
+
assert.isFalse(p1r.blocking)
|
|
227
|
+
|
|
228
|
+
assert.ok(a1r)
|
|
229
|
+
assert.equal(a1r.key, a1.key)
|
|
230
|
+
assert.equal(a1r.kind, DomainAssociationKind)
|
|
231
|
+
assert.equal(a1r.type, 'delete')
|
|
232
|
+
assert.equal(a1r.impact, `The a1 association will be deleted.`)
|
|
233
|
+
assert.isFalse(a1r.blocking)
|
|
234
|
+
|
|
235
|
+
assert.ok(e3r)
|
|
236
|
+
assert.equal(e3r.key, e3.key)
|
|
237
|
+
assert.equal(e3r.kind, DomainEntityKind)
|
|
238
|
+
assert.equal(e3r.type, 'delete')
|
|
239
|
+
assert.equal(e3r.impact, `The "e3" entity will become an orphan because it is a child of the "e1" entity.`)
|
|
240
|
+
assert.equal(e3r.resolution, `The "e1" entity will be removed as the parent of the "e3" entity.`)
|
|
241
|
+
assert.isTrue(e3r.blocking)
|
|
242
|
+
assert.equal(e3r.relationship, 'child')
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
test('returns a report for deleting a property', ({ assert }) => {
|
|
246
|
+
p1.getWebBinding().hidden = true
|
|
247
|
+
const report = analyzer.deleteAnalysis(p1.key, DomainPropertyKind)
|
|
248
|
+
assert.equal(report.key, p1.key)
|
|
249
|
+
assert.equal(report.kind, DomainPropertyKind)
|
|
250
|
+
assert.isTrue(report.canProceed, 'operation should be able to proceed')
|
|
251
|
+
|
|
252
|
+
// Affected items:
|
|
253
|
+
// - p1 (self)
|
|
254
|
+
assert.lengthOf(report.impact, 1, 'has all items')
|
|
255
|
+
const [p1r] = report.impact
|
|
256
|
+
|
|
257
|
+
assert.ok(p1r)
|
|
258
|
+
assert.equal(p1r.key, p1.key)
|
|
259
|
+
assert.equal(p1r.kind, DomainPropertyKind)
|
|
260
|
+
assert.equal(p1r.type, 'delete')
|
|
261
|
+
assert.equal(p1r.impact, `The p1 property will be deleted.`)
|
|
262
|
+
assert.isFalse(p1r.blocking)
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
test('returns a report for deleting an association', ({ assert }) => {
|
|
266
|
+
a1.getWebBinding().hidden = true
|
|
267
|
+
const report = analyzer.deleteAnalysis(a1.key, DomainAssociationKind)
|
|
268
|
+
assert.equal(report.key, a1.key)
|
|
269
|
+
assert.equal(report.kind, DomainAssociationKind)
|
|
270
|
+
assert.isTrue(report.canProceed, 'operation should be able to proceed')
|
|
271
|
+
|
|
272
|
+
// Affected items:
|
|
273
|
+
// - a1 (self)
|
|
274
|
+
assert.lengthOf(report.impact, 1, 'has all items')
|
|
275
|
+
const [a1r] = report.impact
|
|
276
|
+
|
|
277
|
+
assert.ok(a1r)
|
|
278
|
+
assert.equal(a1r.key, a1.key)
|
|
279
|
+
assert.equal(a1r.kind, DomainAssociationKind)
|
|
280
|
+
assert.equal(a1r.type, 'delete')
|
|
281
|
+
assert.equal(a1r.impact, `The a1 association will be deleted.`)
|
|
282
|
+
assert.isFalse(a1r.blocking)
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
test('handles circular dependencies', ({ assert }) => {
|
|
286
|
+
const report = analyzer.deleteAnalysis(e3.key, DomainEntityKind)
|
|
287
|
+
assert.equal(report.key, e3.key)
|
|
288
|
+
assert.equal(report.kind, DomainEntityKind)
|
|
289
|
+
assert.isFalse(report.canProceed, 'operation should not be able to proceed')
|
|
290
|
+
|
|
291
|
+
// Affected items:
|
|
292
|
+
// - e3 (self)
|
|
293
|
+
// - e2 (target of a1)
|
|
294
|
+
// - e4 (child)
|
|
295
|
+
assert.lengthOf(report.impact, 3, 'has all items')
|
|
296
|
+
const [e3r, e2r, e4r] = report.impact
|
|
297
|
+
|
|
298
|
+
assert.ok(e3r)
|
|
299
|
+
assert.equal(e3r.key, e3.key)
|
|
300
|
+
assert.equal(e3r.kind, DomainEntityKind)
|
|
301
|
+
assert.equal(e3r.type, 'delete')
|
|
302
|
+
assert.equal(e3r.impact, `The e3 entity will be deleted.`)
|
|
303
|
+
assert.isFalse(e3r.blocking)
|
|
304
|
+
|
|
305
|
+
assert.ok(e2r)
|
|
306
|
+
assert.equal(e2r.key, e2.key)
|
|
307
|
+
assert.equal(e2r.kind, DomainEntityKind)
|
|
308
|
+
assert.equal(e2r.type, 'delete')
|
|
309
|
+
assert.equal(e2r.impact, `The "e2" entity will become an orphan because it is a child of the "e3" entity.`)
|
|
310
|
+
assert.equal(e2r.resolution, `The "e3" entity will be removed as the parent of the "e2" entity.`)
|
|
311
|
+
assert.isTrue(e2r.blocking)
|
|
312
|
+
assert.equal(e2r.relationship, 'child')
|
|
313
|
+
|
|
314
|
+
assert.ok(e4r)
|
|
315
|
+
assert.equal(e4r.key, e4.key)
|
|
316
|
+
assert.equal(e4r.kind, DomainEntityKind)
|
|
317
|
+
assert.equal(e4r.type, 'delete')
|
|
318
|
+
assert.equal(e4r.impact, `The "e4" entity will become an orphan because it is a child of the "e3" entity.`)
|
|
319
|
+
assert.equal(e4r.resolution, `The "e3" entity will be removed as the parent of the "e4" entity.`)
|
|
320
|
+
assert.isTrue(e4r.blocking)
|
|
321
|
+
assert.equal(e4r.relationship, 'child')
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
test('deleteAnalysis() handles foreign namespaces', ({ assert }) => {
|
|
325
|
+
const f1 = new DataDomain()
|
|
326
|
+
const fm1 = f1.addModel({ info: { name: 'fm1' } })
|
|
327
|
+
const fe1 = fm1.addEntity({ info: { name: 'fe1' } })
|
|
328
|
+
f1.info.version = '1.0.0'
|
|
329
|
+
root.registerForeignDomain(f1)
|
|
330
|
+
a1.addTarget(fe1)
|
|
331
|
+
|
|
332
|
+
const report = analyzer.deleteAnalysis(e1.key, DomainEntityKind)
|
|
333
|
+
// console.log(JSON.stringify(report.impact, null, 2))
|
|
334
|
+
assert.equal(report.key, e1.key)
|
|
335
|
+
assert.equal(report.kind, DomainEntityKind)
|
|
336
|
+
assert.isFalse(report.canProceed, 'operation should not be able to proceed')
|
|
337
|
+
|
|
338
|
+
// Affected items:
|
|
339
|
+
// - e1 (self)
|
|
340
|
+
// - e3 (parent)
|
|
341
|
+
// - p1 (child)
|
|
342
|
+
// - a1 (child)
|
|
343
|
+
assert.lengthOf(report.impact, 4, 'has all items')
|
|
344
|
+
const [e1r, e3r, p1r, a1r] = report.impact
|
|
345
|
+
|
|
346
|
+
assert.ok(e1r)
|
|
347
|
+
assert.equal(e1r.key, e1.key)
|
|
348
|
+
assert.equal(e1r.kind, DomainEntityKind)
|
|
349
|
+
assert.equal(e1r.type, 'delete')
|
|
350
|
+
assert.equal(e1r.impact, `The e1 entity will be deleted.`)
|
|
351
|
+
assert.isFalse(e1r.blocking)
|
|
352
|
+
|
|
353
|
+
assert.ok(p1r)
|
|
354
|
+
assert.equal(p1r.key, p1.key)
|
|
355
|
+
assert.equal(p1r.kind, DomainPropertyKind)
|
|
356
|
+
assert.equal(p1r.type, 'delete')
|
|
357
|
+
assert.equal(p1r.impact, `The p1 property will be deleted.`)
|
|
358
|
+
assert.isFalse(p1r.blocking)
|
|
359
|
+
|
|
360
|
+
assert.ok(a1r)
|
|
361
|
+
assert.equal(a1r.key, a1.key)
|
|
362
|
+
assert.equal(a1r.kind, DomainAssociationKind)
|
|
363
|
+
assert.equal(a1r.type, 'delete')
|
|
364
|
+
assert.equal(a1r.impact, `The a1 association will be deleted.`)
|
|
365
|
+
assert.isFalse(a1r.blocking)
|
|
366
|
+
|
|
367
|
+
assert.ok(e3r)
|
|
368
|
+
assert.equal(e3r.key, e3.key)
|
|
369
|
+
assert.equal(e3r.kind, DomainEntityKind)
|
|
370
|
+
assert.equal(e3r.type, 'delete')
|
|
371
|
+
assert.equal(e3r.impact, `The "e3" entity will become an orphan because it is a child of the "e1" entity.`)
|
|
372
|
+
assert.equal(e3r.resolution, `The "e1" entity will be removed as the parent of the "e3" entity.`)
|
|
373
|
+
assert.isTrue(e3r.blocking)
|
|
374
|
+
assert.equal(e3r.relationship, 'child')
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
test('removeForeignNamespaceAnalysis() handles parent relationships to foreign entities', ({ assert }) => {
|
|
378
|
+
const f1 = new DataDomain()
|
|
379
|
+
f1.key = 'f1'
|
|
380
|
+
f1.info.name = 'f1'
|
|
381
|
+
const fm1 = f1.addModel({ key: 'fm1', info: { name: 'fm1' } })
|
|
382
|
+
const fe1 = fm1.addEntity({ key: 'fe1', info: { name: 'fe1' } })
|
|
383
|
+
f1.info.version = '1.0.0'
|
|
384
|
+
root.registerForeignDomain(f1)
|
|
385
|
+
e1.addParent(fe1.key, f1.key)
|
|
386
|
+
|
|
387
|
+
const report = analyzer.removeForeignNamespaceAnalysis(f1.key)
|
|
388
|
+
assert.equal(report.key, f1.key)
|
|
389
|
+
assert.equal(report.kind, DomainNamespaceKind)
|
|
390
|
+
assert.isFalse(report.canProceed, 'operation should not be able to proceed')
|
|
391
|
+
|
|
392
|
+
assert.lengthOf(report.impact, 1, 'has all items')
|
|
393
|
+
const [e1r] = report.impact
|
|
394
|
+
|
|
395
|
+
assert.ok(e1r)
|
|
396
|
+
assert.equal(e1r.key, e1.key)
|
|
397
|
+
assert.equal(e1r.kind, DomainEntityKind)
|
|
398
|
+
assert.equal(e1r.type, 'delete')
|
|
399
|
+
assert.equal(
|
|
400
|
+
e1r.impact,
|
|
401
|
+
`The "e1" entity will become an orphan because its parent "fe1" is in the foreign namespace "${f1.key}".`
|
|
402
|
+
)
|
|
403
|
+
assert.equal(e1r.resolution, `The "fe1" entity will be removed as the parent of the "e1" entity.`)
|
|
404
|
+
assert.isTrue(e1r.blocking)
|
|
405
|
+
assert.equal(e1r.relationship, 'child')
|
|
406
|
+
})
|
|
407
|
+
|
|
408
|
+
test('removeForeignNamespaceAnalysis() handles associations to foreign entities', ({ assert }) => {
|
|
409
|
+
const f1 = new DataDomain()
|
|
410
|
+
f1.key = 'f1'
|
|
411
|
+
f1.info.name = 'f1'
|
|
412
|
+
const fm1 = f1.addModel({ key: 'fm1', info: { name: 'fm1' } })
|
|
413
|
+
const fe1 = fm1.addEntity({ key: 'fe1', info: { name: 'fe1' } })
|
|
414
|
+
f1.info.version = '1.0.0'
|
|
415
|
+
root.registerForeignDomain(f1)
|
|
416
|
+
a1.addTarget(fe1)
|
|
417
|
+
|
|
418
|
+
const report = analyzer.removeForeignNamespaceAnalysis(f1.key)
|
|
419
|
+
assert.equal(report.key, f1.key)
|
|
420
|
+
assert.equal(report.kind, DomainNamespaceKind)
|
|
421
|
+
assert.isFalse(report.canProceed, 'operation should not be able to proceed')
|
|
422
|
+
|
|
423
|
+
assert.lengthOf(report.impact, 1, 'has all items')
|
|
424
|
+
const [a1r] = report.impact
|
|
425
|
+
|
|
426
|
+
assert.ok(a1r)
|
|
427
|
+
assert.equal(a1r.key, a1.key)
|
|
428
|
+
assert.equal(a1r.kind, DomainAssociationKind)
|
|
429
|
+
assert.equal(a1r.type, 'delete')
|
|
430
|
+
assert.equal(
|
|
431
|
+
a1r.impact,
|
|
432
|
+
`The "a1" association from "e1" will be broken because it targets "fe1" in the foreign namespace "${f1.key}".`
|
|
433
|
+
)
|
|
434
|
+
assert.equal(a1r.resolution, `The "a1" association will be removed from "e1".`)
|
|
435
|
+
assert.isTrue(a1r.blocking)
|
|
436
|
+
})
|
|
437
|
+
|
|
438
|
+
test('removeForeignNamespaceAnalysis() handles no foreign entities', ({ assert }) => {
|
|
439
|
+
const f1 = new DataDomain()
|
|
440
|
+
const fm1 = f1.addModel({ key: 'fm1', info: { name: 'fm1' } })
|
|
441
|
+
const fe1 = fm1.addEntity({ key: 'fe1', info: { name: 'fe1' } })
|
|
442
|
+
fe1.addProperty()
|
|
443
|
+
f1.info.version = '1.0.0'
|
|
444
|
+
root.registerForeignDomain(f1)
|
|
445
|
+
|
|
446
|
+
const report = analyzer.removeForeignNamespaceAnalysis(f1.key)
|
|
447
|
+
assert.equal(report.key, f1.key)
|
|
448
|
+
assert.equal(report.kind, DomainNamespaceKind)
|
|
449
|
+
assert.isTrue(report.canProceed, 'operation should be able to proceed')
|
|
450
|
+
assert.lengthOf(report.impact, 0, 'has all items')
|
|
451
|
+
})
|
|
452
|
+
})
|