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

Add QueryPerformanceTest to the plugin skeleton #33

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

Conversation

benedekh
Copy link

@benedekh benedekh commented Mar 27, 2020

The PR closes #32.

There are three changes in viatra.QueryPerformanceTest in comparison with its origin.

  1. In line 63 a constructor for QueryPerformanceData had to be implemented, because Xtend was complaining for missing constructor.

Two additional changes were made due to the fact that in MagicDraw it is advised to use V4MD to construct the Viatra engine:

  1. def QueryScope getScope() is replaced by def AdvancedViatraQueryEngine getEngine().

  2. queryEngine = AdvancedViatraQueryEngine.createUnmanagedEngine(preparedScope, getEngineOptions()) is replaced by queryEngine = engine.

QueryPerformanceTestAdapter is implemented as an adapter that creates the Viatra Engine by getting it from V4MD. Moreover it extends RelativeQueryPerformanceTest so that it can run the measurement.

Last but not least, QueryPerformanceTest is responsible for loading the project and calling the adapter to start the measurement on the project.

Please let me know if you have any feedback about this contribution.


One technical debt which might be a no-go: in order to make the PR work, you have to re-enable guava in the plugin skeleton. Otherwise you will get a NoClassDefFoundError when running the runTest gradle job.

In order to discuss the problem, the PR does not contain any changes in build.gradle yet.

2020-03-26 22:52:45,965 [main] ERROR PLUGINS - Can not start plugin IncQuery Labs MagicDraw Plugin Example
java.lang.NoClassDefFoundError: com/google/common/collect/Lists
	at org.eclipse.xtext.service.CompoundModule.<init>(CompoundModule.java:28)
	at org.eclipse.xtext.service.AbstractGenericModule.getBindings(AbstractGenericModule.java:38)
	at org.eclipse.xtext.service.AbstractGenericModule.configure(AbstractGenericModule.java:32)
	at org.eclipse.xtext.service.DefaultRuntimeModule.configure(DefaultRuntimeModule.java:76)
	at org.eclipse.viatra.query.patternlanguage.emf.AbstractEMFPatternLanguageRuntimeModule.configure(AbstractEMFPatternLanguageRuntimeModule.java:85)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
	at com.google.inject.spi.Elements.getElements(Elements.java:101)
	at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
	at com.google.inject.Guice.createInjector(Guice.java:95)
	at com.google.inject.Guice.createInjector(Guice.java:72)
	at com.google.inject.Guice.createInjector(Guice.java:62)
	at com.incquerylabs.magicdraw.plugin.example.ExamplePlugin.init(ExamplePlugin.java:43)
	at com.nomagic.magicdraw.plugins.g.b(g.java:690)
	at com.nomagic.magicdraw.plugins.g.a(g.java:533)
	at com.nomagic.magicdraw.plugins.g.C(g.java:463)
	at com.nomagic.magicdraw.core.l.t(l.java:45)
	at com.nomagic.rcpf.product.q.a(q.java:277)
	at com.nomagic.rcpf.product.k.a(k.java:93)
	at com.nomagic.rcpf.product.k.b(k.java:77)
	at com.nomagic.magicdraw.core.Application.internalStart(Application.java:683)
	at com.nomagic.magicdraw.core.Application.start(Application.java:447)
	at com.nomagic.magicdraw.commandline.CommandLineActionLauncher.launch(CommandLineActionLauncher.java:29)
	at com.nomagic.magicdraw.ApplicationGateway.start(ApplicationGateway.java:46)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at com.nomagic.osgi.launcher.FrameworkLauncher$DefaultApplication.run(FrameworkLauncher.java:227)
	at com.nomagic.osgi.launcher.FrameworkLauncher.runFrameworkApplication(FrameworkLauncher.java:177)
	at com.nomagic.osgi.launcher.FrameworkLauncher.run(FrameworkLauncher.java:114)
	at com.nomagic.osgi.launcher.FrameworkLauncher.run(FrameworkLauncher.java:93)
	at com.nomagic.osgi.launcher.ProductionFrameworkLauncher.run(ProductionFrameworkLauncher.java:66)
	at com.nomagic.osgi.launcher.ProductionFrameworkLauncher.main(ProductionFrameworkLauncher.java:53)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Lists
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at com.nomagic.magicdraw.plugins.h.loadClass(h.java:41)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 34 more

…o the tests in order to benchmark VQL queries in a MagicDraw project.
@benedekh benedekh requested a review from lunkpeter March 27, 2020 07:36
@benedekh benedekh self-assigned this Mar 27, 2020
@ujhelyiz
Copy link
Member

I'd rewrite the test QueryPerformanceTest and RelativeQueryPerformanceTest classes to Java and manually remove all Guava dependencies. As a starting point, you can rely on the generated classes from xtend-gen - that would simplify handling Guava greatly.

@benedekh
Copy link
Author

benedekh commented Apr 3, 2020

@ujhelyiz: I have reimplemented both QueryPerformanceTest and RelativeQueryPerformanceTest in pure Java to get rid of any Guava dependencies they might have. The new implmenetation is 1:1 equivalent with the old one. However, I had to replace Stopwatch by StopWatch from Apache, because the former one came from the Guava library.


As far as the Exception above is concerned, its entry point is line 43 in ExamplePlugin. If we put this and the following lines in comment, then the runTest gradle job is executed successfully.

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

Successfully merging this pull request may close these issues.

Add QueryPerformanceTest to the plugin skeleton
2 participants