Commit bf68a6a2 authored by Marco Konersmann's avatar Marco Konersmann

Towards a JMeter integration of the MIC

parent baceb797
......@@ -678,8 +678,7 @@ public class ASTUtils {
* returned.
*
* @param signature
* @param baseType
* a type as basis for resolving a FQN
* @param baseType a type as basis for resolving a FQN
* @return
* @throws JavaModelException
*/
......@@ -730,6 +729,29 @@ public class ASTUtils {
return false;
}
public static boolean recursivelyImplementsInterface(IType type, String interfaceName) throws JavaModelException {
if (implementsInterface(type, interfaceName))
return true;
String superclassName = type.getSuperclassName();
if (superclassName == null)
// has no superclass
return false; // therefore does not implement the interface
return recursivelyImplementsInterface(getType(superclassName, type), interfaceName);
}
public static boolean extendsType(IType type, String parent) throws JavaModelException {
String[][] resolvedExpectedInterfaceName = type.resolveType(parent);
String superTypeName = type.getSuperclassName();
if (superTypeName == null)
return false; // has no supertype.
String[][] resolvedSuperType = type.resolveType(superTypeName);
if (Arrays.deepEquals(resolvedExpectedInterfaceName, resolvedSuperType))
return true;
return false;
}
public static List<IType> getTypes(List<IJavaProject> projects) throws JavaModelException {
LinkedList<IType> result = new LinkedList<>();
for (IJavaProject project : projects)
......@@ -803,6 +825,14 @@ public class ASTUtils {
result.add((IPackageFragment) pf);
return result;
}
public static IPackageFragmentRoot getPackageFragmentRoot(IJavaElement element) {
if(element instanceof IPackageFragmentRoot)
return (IPackageFragmentRoot) element;
if(element.getParent()==null)
throw new IllegalArgumentException("Element has no package fragment root. "+element.getPath().toString());
return getPackageFragmentRoot(element.getParent());
}
public static List<IPackageFragment> getDirectChildPackageFragmentsOf(IPackageFragment parent)
throws JavaModelException {
......
/target/
/bin/
\ No newline at end of file
# JMeter Case Study for Codeling
These plugins build a language binding for JMeter Codeling. This is the basis for the case study JMeter.
\ No newline at end of file
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.codeling.lang.jmeter.metamodel;singleton:=true
Automatic-Module-Name: org.codeling.lang.jmeter.metamodel
Bundle-Version: 0.1.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.codeling.lang.jmeter.metamodel.jmeter,
org.codeling.lang.jmeter.metamodel.jmeter.impl,
org.codeling.lang.jmeter.metamodel.jmeter.util
Require-Bundle: org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
#
bin.includes = .,\
model/,\
META-INF/,\
plugin.xml,\
plugin.properties
jars.compile.order = .
source.. = src/generated/java/
output.. = target/classes
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="jmeter" nsURI="http://www.example.org/jmeter" nsPrefix="jmeter">
<eClassifiers xsi:type="ecore:EClass" name="PreProcessor" eSuperTypes="#//ProcessComponent"/>
<eClassifiers xsi:type="ecore:EClass" name="PostProcessor" eSuperTypes="#//ProcessComponent"/>
<eClassifiers xsi:type="ecore:EClass" name="Sampler" eSuperTypes="#//TestElement"/>
<eClassifiers xsi:type="ecore:EClass" name="Controller" eSuperTypes="#//TestElement"/>
<eClassifiers xsi:type="ecore:EClass" name="Assertion" eSuperTypes="#//TestElement"/>
<eClassifiers xsi:type="ecore:EClass" name="EventListener" eSuperTypes="#//ProcessComponent"/>
<eClassifiers xsi:type="ecore:EClass" name="ThreadListener" eSuperTypes="#//ProcessComponent"/>
<eClassifiers xsi:type="ecore:EClass" name="Compiler" eSuperTypes="#//ProcessComponent"/>
<eClassifiers xsi:type="ecore:EClass" name="ProcessComponent" abstract="true" eSuperTypes="#//Named">
<eStructuralFeatures xsi:type="ecore:EReference" name="operation" upperBound="-1"
eType="#//Operation" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="proto" eType="#//Protocol"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TestElement" abstract="true" eSuperTypes="#//Named">
<eStructuralFeatures xsi:type="ecore:EReference" name="operation" upperBound="-1"
eType="#//Operation" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Operation" eSuperTypes="#//Named"/>
<eClassifiers xsi:type="ecore:EClass" name="Named" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="JMeterThread">
<eStructuralFeatures xsi:type="ecore:EReference" name="processcomponent" upperBound="-1"
eType="#//ProcessComponent" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="testelement" upperBound="-1"
eType="#//TestElement" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="protocols" upperBound="-1"
eType="#//Protocol" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Protocol" eSuperTypes="#//Named"/>
</ecore:EPackage>
<?xml version="1.0" encoding="UTF-8"?>
<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel"
modelDirectory="/org.codeling.lang.jmeter.metamodel/src/generated/java"
creationIcons="false" editDirectory="/org.codeling.lang.jmeter.metamodel.edit/src-gen"
editorDirectory="/org.codeling.lang.jmeter.metamodel.editor/src-gen" modelPluginID="org.codeling.lang.jmeter.metamodel"
modelName="Jmeter" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
codeFormatting="true" importerID="org.eclipse.emf.importer.ecore" complianceLevel="8.0"
copyrightFields="false" operationReflection="true" importOrganizing="true">
<foreignModel>jmeter.ecore</foreignModel>
<testsDirectory xsi:nil="true"/>
<genPackages prefix="Jmeter" basePackage="org.codeling.lang.jmeter.metamodel" disposableProviderFactory="true"
ecorePackage="jmeter.ecore#/">
<genClasses ecoreClass="jmeter.ecore#//PreProcessor"/>
<genClasses ecoreClass="jmeter.ecore#//PostProcessor"/>
<genClasses ecoreClass="jmeter.ecore#//Sampler"/>
<genClasses ecoreClass="jmeter.ecore#//Controller"/>
<genClasses ecoreClass="jmeter.ecore#//Assertion"/>
<genClasses ecoreClass="jmeter.ecore#//EventListener"/>
<genClasses ecoreClass="jmeter.ecore#//ThreadListener"/>
<genClasses ecoreClass="jmeter.ecore#//Compiler"/>
<genClasses ecoreClass="jmeter.ecore#//ProcessComponent">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference jmeter.ecore#//ProcessComponent/operation"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference jmeter.ecore#//ProcessComponent/proto"/>
</genClasses>
<genClasses ecoreClass="jmeter.ecore#//TestElement">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference jmeter.ecore#//TestElement/operation"/>
</genClasses>
<genClasses ecoreClass="jmeter.ecore#//Operation"/>
<genClasses image="false" ecoreClass="jmeter.ecore#//Named">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute jmeter.ecore#//Named/name"/>
</genClasses>
<genClasses ecoreClass="jmeter.ecore#//JMeterThread">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference jmeter.ecore#//JMeterThread/processcomponent"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference jmeter.ecore#//JMeterThread/testelement"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference jmeter.ecore#//JMeterThread/protocols"/>
</genClasses>
<genClasses ecoreClass="jmeter.ecore#//Protocol"/>
</genPackages>
</genmodel:GenModel>
#
pluginName = org.codeling.lang.jmeter.metamodel
providerName = www.example.org
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
-->
<plugin>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated jmeter -->
<package
uri="http://www.example.org/jmeter"
class="org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage"
genModel="model/jmeter.genmodel"/>
</extension>
</plugin>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>org.codeling.lang.jmeter.metamodel</artifactId>
<packaging>eclipse-plugin</packaging>
<name>Codeling JMeter Meta Model</name>
<parent>
<groupId>org.codeling</groupId>
<artifactId>org.codeling.lang.jmeter.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
</project>
\ No newline at end of file
/**
*/
package org.codeling.lang.jmeter.metamodel.jmeter;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Assertion</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getAssertion()
* @model
* @generated
*/
public interface Assertion extends TestElement {
} // Assertion
/**
*/
package org.codeling.lang.jmeter.metamodel.jmeter;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Compiler</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getCompiler()
* @model
* @generated
*/
public interface Compiler extends ProcessComponent {
} // Compiler
/**
*/
package org.codeling.lang.jmeter.metamodel.jmeter;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Controller</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getController()
* @model
* @generated
*/
public interface Controller extends TestElement {
} // Controller
/**
*/
package org.codeling.lang.jmeter.metamodel.jmeter;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Event Listener</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getEventListener()
* @model
* @generated
*/
public interface EventListener extends ProcessComponent {
} // EventListener
/**
*/
package org.codeling.lang.jmeter.metamodel.jmeter;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>JMeter Thread</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.codeling.lang.jmeter.metamodel.jmeter.JMeterThread#getProcesscomponent <em>Processcomponent</em>}</li>
* <li>{@link org.codeling.lang.jmeter.metamodel.jmeter.JMeterThread#getTestelement <em>Testelement</em>}</li>
* <li>{@link org.codeling.lang.jmeter.metamodel.jmeter.JMeterThread#getProtocols <em>Protocols</em>}</li>
* </ul>
*
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getJMeterThread()
* @model
* @generated
*/
public interface JMeterThread extends EObject {
/**
* Returns the value of the '<em><b>Processcomponent</b></em>' containment reference list.
* The list contents are of type {@link org.codeling.lang.jmeter.metamodel.jmeter.ProcessComponent}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Processcomponent</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Processcomponent</em>' containment reference list.
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getJMeterThread_Processcomponent()
* @model containment="true"
* @generated
*/
EList<ProcessComponent> getProcesscomponent();
/**
* Returns the value of the '<em><b>Testelement</b></em>' containment reference list.
* The list contents are of type {@link org.codeling.lang.jmeter.metamodel.jmeter.TestElement}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Testelement</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Testelement</em>' containment reference list.
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getJMeterThread_Testelement()
* @model containment="true"
* @generated
*/
EList<TestElement> getTestelement();
/**
* Returns the value of the '<em><b>Protocols</b></em>' containment reference list.
* The list contents are of type {@link org.codeling.lang.jmeter.metamodel.jmeter.Protocol}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Protocols</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Protocols</em>' containment reference list.
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getJMeterThread_Protocols()
* @model containment="true"
* @generated
*/
EList<Protocol> getProtocols();
} // JMeterThread
/**
*/
package org.codeling.lang.jmeter.metamodel.jmeter;
import org.eclipse.emf.ecore.EFactory;
/**
* <!-- begin-user-doc -->
* The <b>Factory</b> for the model.
* It provides a create method for each non-abstract class of the model.
* <!-- end-user-doc -->
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage
* @generated
*/
public interface JmeterFactory extends EFactory {
/**
* The singleton instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
JmeterFactory eINSTANCE = org.codeling.lang.jmeter.metamodel.jmeter.impl.JmeterFactoryImpl.init();
/**
* Returns a new object of class '<em>Pre Processor</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Pre Processor</em>'.
* @generated
*/
PreProcessor createPreProcessor();
/**
* Returns a new object of class '<em>Post Processor</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Post Processor</em>'.
* @generated
*/
PostProcessor createPostProcessor();
/**
* Returns a new object of class '<em>Sampler</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Sampler</em>'.
* @generated
*/
Sampler createSampler();
/**
* Returns a new object of class '<em>Controller</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Controller</em>'.
* @generated
*/
Controller createController();
/**
* Returns a new object of class '<em>Assertion</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Assertion</em>'.
* @generated
*/
Assertion createAssertion();
/**
* Returns a new object of class '<em>Event Listener</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Event Listener</em>'.
* @generated
*/
EventListener createEventListener();
/**
* Returns a new object of class '<em>Thread Listener</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Thread Listener</em>'.
* @generated
*/
ThreadListener createThreadListener();
/**
* Returns a new object of class '<em>Compiler</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Compiler</em>'.
* @generated
*/
Compiler createCompiler();
/**
* Returns a new object of class '<em>Operation</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Operation</em>'.
* @generated
*/
Operation createOperation();
/**
* Returns a new object of class '<em>JMeter Thread</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>JMeter Thread</em>'.
* @generated
*/
JMeterThread createJMeterThread();
/**
* Returns a new object of class '<em>Protocol</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Protocol</em>'.
* @generated
*/
Protocol createProtocol();
/**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the package supported by this factory.
* @generated
*/
JmeterPackage getJmeterPackage();
} //JmeterFactory
/**
*/
package org.codeling.lang.jmeter.metamodel.jmeter;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Named</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.codeling.lang.jmeter.metamodel.jmeter.Named#getName <em>Name</em>}</li>
* </ul>
*
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getNamed()
* @model abstract="true"
* @generated
*/
public interface Named extends EObject {
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getNamed_Name()
* @model
* @generated
*/
String getName();
/**
* Sets the value of the '{@link org.codeling.lang.jmeter.metamodel.jmeter.Named#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
void setName(String value);
} // Named
/**
*/
package org.codeling.lang.jmeter.metamodel.jmeter;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Operation</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getOperation()
* @model
* @generated
*/
public interface Operation extends Named {
} // Operation
/**
*/
package org.codeling.lang.jmeter.metamodel.jmeter;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Post Processor</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getPostProcessor()
* @model
* @generated
*/
public interface PostProcessor extends ProcessComponent {
} // PostProcessor
/**
*/
package org.codeling.lang.jmeter.metamodel.jmeter;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Pre Processor</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getPreProcessor()
* @model
* @generated
*/
public interface PreProcessor extends ProcessComponent {
} // PreProcessor
/**
*/
package org.codeling.lang.jmeter.metamodel.jmeter;
import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Process Component</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.codeling.lang.jmeter.metamodel.jmeter.ProcessComponent#getOperation <em>Operation</em>}</li>
* <li>{@link org.codeling.lang.jmeter.metamodel.jmeter.ProcessComponent#getProto <em>Proto</em>}</li>
* </ul>
*
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getProcessComponent()
* @model abstract="true"
* @generated
*/
public interface ProcessComponent extends Named {
/**
* Returns the value of the '<em><b>Operation</b></em>' containment reference list.
* The list contents are of type {@link org.codeling.lang.jmeter.metamodel.jmeter.Operation}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Operation</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Operation</em>' containment reference list.
* @see org.codeling.lang.jmeter.metamodel.jmeter.JmeterPackage#getProcessComponent_Operation()
* @model containment="true"
* @generated
*/
EList<Operation> getOperation();