|
|
|
|
|
|
|
|
|
Re: Import MyDslStandaloneSetup does not resolve [message #1837010 is a reply to message #1836697] |
Wed, 20 January 2021 18:45   |
Eclipse User |
|
|
|
Sorry for the long time without response.
In the meantime I did a bit of research and got more into EMF and Xtext.
You are right, the dsl name is TDLan2 (TDLan2StandaloneSetup).
so far I came up with a bit of code.
MANIFEST.MF:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Load
Bundle-SymbolicName: org.etsi.example.load
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: org.etsi.example.load
Require-Bundle: org.eclipse.emf.ecore,
org.etsi.mts.tdl.model,
org.etsi.mts.tdl.TPLan2,
org.etsi.mts.tdl.TDLan2,
org.eclipse.emf.mwe.utils,
org.eclipse.ocl.xtext.essentialocl
Bundle-RequiredExecutionEnvironment: JavaSE-11
I use a basic Test Descrition in TDLan2 format that can be opened with the Sample Ecore Model Editor, resulting in a tree-like structure with
the following URI: "platform:/resource/org.etsi.example.load/model/example.tdlan2". The code describes the interaction between a client and server (just for illustration purpose).
Package Example {
Type STRING;
Gate Type HTTP accepts STRING;
Component Type EndPoint having {
gate http of type HTTP;
}
Test Configuration BasicClientServer {
create SUT server of type EndPoint;
create Tester client of type EndPoint;
connect server.http to client.http;
}
Test Description TD1 uses configuration BasicClientServer {
client.http sends "GET /store" to server.http;
server.http sends "200 OK" to client.http;
}
Test Description TD2 uses configuration BasicClientServer {
client.http sends "GET /users" to server.http;
server.http sends "200 OK" to client.http;
}
}
Java Code:
package org.etsi.example.load.run;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.etsi.mts.tdl.TDLan2StandaloneSetup;
import com.google.inject.Injector;
public class exe {
public static void main(String [] args) {
//from the Xtext Wiki FAQ
new org.eclipse.emf.mwe.utils.StandaloneSetup().setPlatformUri("../");
//adapted for the specific Xtext-based language implementation
Injector injector = new TDLan2StandaloneSetup().createInjectorAndDoEMFRegistration();
XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);
resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
//adapted for the filename declared above (relative to working directory)
Resource resource = resourceSet.getResource(URI.createURI("platform:/resource/org.etsi.example.load/model/example.tdlan2"), true);
Console:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.eclipse.emf.mwe.utils.StandaloneSetup.<init>(StandaloneSetup.java:107)
at org.etsi.example.load.run.exe.main(exe.java:25)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 2 more
(StandaloneSetup.java:107)
at org.etsi.example.load.run.exe.main(exe.java:25) references new org.eclipse.emf.mwe.utils.StandaloneSetup().setPlatformUri("../"); .
Here I do not know, if the workspace root is correctly set with this argument. As written in https://wiki.eclipse.org/Xtext/FAQ it should be.
[Updated on: Wed, 20 January 2021 18:52] by Moderator
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06669 seconds