Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[555096] Pluggable Validation Traversal #186

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

felixdo
Copy link
Contributor

@felixdo felixdo commented Apr 27, 2020

  • Tune the DiagnosticianProvider extension point so that multiple
    providers can be contributed. The current active provider can
    then be selected via preference. Commandline validation adds
    an optional parameter to override the provider to use.

Two providers are available by
default:

  1. The standard tree plus part-type validation (default)
  2. An extended traversal with the following extra validations:
    • Allocated functions
    • Deployed components
    • Component and Functional Exchanges between validated Components
    • Interfaces between validated component ports
  • Cleanup/refactoring of Capella validation code.

Signed-off-by: Felix Dorner felix.dorner@gmail.com

@eclipse-capella-bot
Copy link

🚀 Build master-PR-186-1 started!

@eclipse-capella-bot
Copy link

😞 Build master-PR-186-1 failed!

@eclipse-capella-bot
Copy link

🚀 Build master-PR-186-2 started!

@eclipse-capella-bot
Copy link

😟 Build master-PR-186-2 is unstable! The product is available here.

@pdulth
Copy link
Contributor

pdulth commented May 7, 2020

can you rebase it as both gmf commits are already available on master by #190

@felixdo felixdo force-pushed the 555096-pluggable-validation-traversal branch from 6bf339f to b64899c Compare May 13, 2020 14:58
@felixdo
Copy link
Contributor Author

felixdo commented May 13, 2020

Rebased and fixed the test

@eclipse-capella-bot
Copy link

🚀 Build master-PR-186-3 started!

@eclipse-capella-bot
Copy link

😟 Build master-PR-186-3 is unstable! The product is available here.

@felixdo felixdo force-pushed the 555096-pluggable-validation-traversal branch from b64899c to c457678 Compare June 8, 2020 15:31
@eclipse-capella-bot
Copy link

🚀 Build master-PR-186-4 started!

@felixdo felixdo force-pushed the 555096-pluggable-validation-traversal branch from c457678 to 996d21c Compare June 8, 2020 15:42
@eclipse-capella-bot
Copy link

🚀 Build master-PR-186-5 started!

@eclipse-capella-bot
Copy link

😟 Build master-PR-186-4 is unstable! The product is available here.

@eclipse-capella-bot
Copy link

😟 Build master-PR-186-5 is unstable! The product is available here.

@eclipse-capella-bot
Copy link

🚀 Build master-PR-186-1 started!

@eclipse-capella-bot
Copy link

😞 Build master-PR-186-1 failed!

Copy link
Contributor

@pdulth pdulth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • can you also update documentation about validation preference page.

  • the preference with choice Tree and Extended validation have a large top padding before Tree

  • does the epf file validation can handle both "Tree selection" and "Extended validation" choice ?

  • when i try to use the "Extended Validation" by RightClick > Validate Model on a Component allocating a Function , i got an error

!MESSAGE Plug-in "org.polarsys.capella.core.validation" was unable to instantiate class "org.polarsys.capella.core.validation.scope.DefaultScopedDiagnosticianProvider".
!STACK 0
java.lang.IllegalAccessException: Class org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI can not access a member of class org.polarsys.capella.core.validation.scope.DefaultScopedDiagnosticianProvider with modifiers "protected"
	at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
	at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(Unknown Source)
	at java.lang.reflect.AccessibleObject.checkAccess(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:204)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:934)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:246)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:63)
	at org.polarsys.capella.core.model.handler.validation.DiagnosticianProviderRegistry$Descriptor.getProvider(DiagnosticianProviderRegistry.java:75)
	at org.polarsys.capella.core.model.handler.validation.DiagnosticianProviderRegistry.getDiagnosticianProvider(DiagnosticianProviderRegistry.java:56)
	at org.polarsys.capella.core.platform.sirius.ui.actions.CapellaValidateAction.createDiagnostician(CapellaValidateAction.java:85)
	at org.polarsys.capella.core.platform.sirius.ui.actions.CapellaValidateAction.validate(CapellaValidateAction.java:223)
	at org.polarsys.capella.core.platform.sirius.ui.actions.CapellaValidateAction$2.run(CapellaValidateAction.java:143)
	at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:71)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.lambda$0(WorkspaceModifyOperation.java:110)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2295)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2322)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:131)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:438)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:354)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:469)
	at org.polarsys.capella.core.platform.sirius.ui.actions.CapellaValidateAction.executeValidationAction(CapellaValidateAction.java:174)
	at org.polarsys.capella.core.platform.sirius.ui.actions.CapellaValidateAction$1.run(CapellaValidateAction.java:125)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at org.polarsys.capella.common.ef.ExecutionManager.executeReadOnlyCommand(ExecutionManager.java:79)
	at org.polarsys.capella.common.ef.ExecutionManager.execute(ExecutionManager.java:66)
	at org.polarsys.capella.core.platform.sirius.ui.actions.CapellaValidateAction.run(CapellaValidateAction.java:122)

and if i fix the protected to public, it doesn't seems to validate on the allocated function from the component. can you retest it? do i missed something?

@@ -454,11 +454,11 @@
mapping="org.polarsys.capella.common.re"
purpose="org.polarsys.capella.common.re.scopeElements">
<scopeRetriever
class="org.polarsys.capella.core.re.handlers.scope.PartTypeRetriever"
class="org.polarsys.capella.core.transition.system.handlers.scope.PartTypeRetriever"
id="org.polarsys.capella.core.re.handlers.scope.PartTypeRetriever">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to rename id too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIU, no, the ID stays the same. The re plugin still is the declaring source of the retriever, it only reuses an implementation provided by transition.system.

id="org.polarsys.capella.core.re.handlers.scope.PartTypeRetriever">
</scopeRetriever>
<scopeRetriever
class="org.polarsys.capella.core.re.handlers.scope.DeployedElementRetriever"
class="org.polarsys.capella.core.transition.system.handlers.scope.DeployedElementRetriever"
id="org.polarsys.capella.core.re.handlers.scope.DeployedElementRetriever">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, the re plugin declares the scoperetriever in the given mapping, reusing the implementation class

@@ -127,6 +127,8 @@ private IStatus execute(final URI airdURI) {
capellaValidateCLineAction.setSelectedObjects(semanticRootResource.getContents());
}

capellaValidateCLineAction.setDiagnosticianProviderId(((ValidationArgumentHelper)argHelper).getDiagnosticianProviderId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really? 🥇

@@ -117,6 +122,7 @@ protected void setUp() throws Exception {
}

// create the filter and add it to the validator
System.out.println(ruleDescriptor.getId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syso

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@pdulth
Copy link
Contributor

pdulth commented Aug 20, 2020

  • and documentation for the command line new parameter with the both ids

registry.put(p, adapter);
}
registry.put(RePackage.eINSTANCE, adapter);
registry.put(null, adapter);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is intended. The diagnostician uses the registry to find an EValidator for a given Object by looking for a value for the EPackage of the Object, and if none is found, it uses the null key to find an adapter. This way, by default, extension packages (e.g. viewpoint extensions) will always use the capella adapter. All the put(ePackage...) above are only optimisations for faster lookup..

@felixdo
Copy link
Contributor Author

felixdo commented Sep 1, 2020

Philippe, thanks for your comments. I dont' know I didnt get a notification or anything from Github :/
I'll check your stuff and commit requested changes.

@felixdo felixdo force-pushed the 555096-pluggable-validation-traversal branch from 996d21c to 78995ad Compare September 8, 2020 14:30
@felixdo
Copy link
Contributor Author

felixdo commented Sep 8, 2020

I fixed all the issues except doc, will follow.

@eclipse-capella-bot
Copy link

🚀 Build master-PR-186-2 started!

@felixdo
Copy link
Contributor Author

felixdo commented Sep 8, 2020

As for the EPF validation: I'm not sure how you would want to handle this.. Should the EPF file include whether to use Tree or Extended Validation? TBH, I would probably revamp the whole system: A validation can be seen as a launch configuration, we would "run" validations, where users could select/define/store even more parameters, e.g. which elements to validate, which rules to use, and which traversal option.

@sonarcloud
Copy link

sonarcloud bot commented Sep 8, 2020

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 35 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@eclipse-capella-bot
Copy link

😟 Build master-PR-186-2 is unstable! The product is available here.

* Tune the DiagnosticianProvider extension point so that multiple
providers can be contributed. The current active provider can
then be selected via preference. Commandline validation adds
an optional parameter to override the provider to use.

Two providers are available by
default:

1) The standard tree plus part-type validation (default)
2) An extended traversal with the following extra validations:
     - Allocated functions
     - Deployed components
     - Component and Functional Exchanges between validated Components
     - Interfaces between validated component ports

* Cleanup/refactoring of Capella validation code.


Signed-off-by: Felix Dorner <felix.dorner@gmail.com>
extended - is the new extended validation
legacy - is the old tree validation

Signed-off-by: Felix Dorner <felix.dorner@gmail.com>
Signed-off-by: Felix Dorner <felix.dorner@gmail.com>
Signed-off-by: Felix Dorner <felix.dorner@gmail.com>
Signed-off-by: Felix Dorner <felix.dorner@gmail.com>
@felixdo felixdo force-pushed the 555096-pluggable-validation-traversal branch from 78995ad to f4027c3 Compare November 4, 2020 13:17
@eclipse-capella-bot
Copy link

🚀 Build master-PR-186-3 started!

@sonarcloud
Copy link

sonarcloud bot commented Nov 4, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 35 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@eclipse-capella-bot
Copy link

😟 Build master-PR-186-3 is unstable! The product is available here.

@eclipse-capella-bot
Copy link

🚀 Build master-PR-186-1 started!

@eclipse-capella-bot
Copy link

😞 Build master-PR-186-1 failed!

@eclipse-capella-bot
Copy link

🚀 Build master-PR-186-2 started!

@eclipse-capella-bot
Copy link

😞 Build master-PR-186-2 failed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants