Skip to content
Snippets Groups Projects
Commit 8acd1d75 authored by Matthias's avatar Matthias
Browse files

KiekerManagerTest + fixings

parent facd477a
No related branches found
No related tags found
No related merge requests found
Showing
with 422 additions and 358 deletions
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
<target name="dql-kieker" sequenceNumber="1474237762">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="false" includeConfigurePhase="false" type="InstallableUnit">
<unit id="org.eclipse.m2m.qvt.oml" version="3.6.0.v20160606-1156"/>
<unit id="org.eclipse.m2m.qvt.oml.sdk.feature.group" version="3.6.0.v20160606-1156"/>
<unit id="org.eclipse.m2m.qvt.oml.runtime.feature.group" version="3.6.0.v20160606-1156"/>
<unit id="org.eclipse.emf.common" version="2.12.0.v20160420-0247"/>
<unit id="org.eclipse.core.resources" version="3.11.0.v20160503-1608"/>
<unit id="org.eclipse.core.filesystem" version="1.6.0.v20160503-1608"/>
<unit id="org.eclipse.emf.feature.group" version="2.12.0.v20160526-0356"/>
<unit id="org.eclipse.xtext.sdk.feature.group" version="2.10.0.v201605250459"/>
<unit id="org.antlr.runtime" version="4.3.0.v201502022030"/>
<unit id="com.google.inject" version="3.0.0.v201605172100"/>
<unit id="com.google.guava" version="15.0.0.v201403281430"/>
<unit id="org.eclipse.sdk.feature.group" version="4.6.0.v20160606-1342"/>
<unit id="org.eclipse.emf.mwe2.runtime.sdk.feature.group" version="2.9.0.v201605261103"/>
<unit id="org.eclipse.xtend.feature.group" version="2.2.0.v201605260315"/>
<unit id="org.eclipse.xtend.lib" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.xtend.lib.macro" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.ocl.examples.xtext.oclinecore" version="3.5.0.v20160105-2030"/>
<unit id="org.eclipse.ecf" version="3.8.0.v20160405-1820"/>
<unit id="org.eclipse.ecf.identity" version="3.7.0.v20160405-1820"/>
<unit id="org.eclipse.ecf.filetransfer.feature.feature.group" version="3.13.1.v20160405-1820"/>
<unit id="org.eclipse.emf.mwe.utils" version="1.3.20.v201605261103"/>
<unit id="org.eclipse.emf.mwe.core" version="1.3.20.v201605261103"/>
<unit id="org.eclipse.xtend.shared.ui" version="2.2.0.v201605260315"/>
<unit id="org.eclipse.xpand" version="2.2.0.v201605260315"/>
<unit id="org.eclipse.ocl.examples.pivot" version="3.5.0.v20160105-2030"/>
<unit id="org.eclipse.emf.mwe.ui" version="1.3.20.v201605261103"/>
<unit id="org.eclipse.equinox.concurrent" version="1.1.0.v20130327-1442"/>
<unit id="org.eclipse.ant.core" version="3.4.100.v20160505-0642"/>
<unit id="org.eclipse.ant.ui.source" version="3.6.200.v20160525-1820"/>
<unit id="org.eclipse.jdt.feature.group" version="3.12.0.v20160606-1100"/>
<unit id="org.eclipse.debug.core" version="3.10.100.v20160419-1720"/>
<unit id="org.eclipse.core.externaltools" version="1.0.400.v20160509-1057"/>
<unit id="org.objectweb.asm" version="5.0.1.v201404251740"/>
<unit id="org.eclipse.emf.ecore.xcore.sdk.feature.group" version="1.4.0.v20160526-0606"/>
<unit id="org.eclipse.gef.sdk.feature.group" version="3.11.0.201606061308"/>
<unit id="org.eclipse.osgi.util" version="3.3.100.v20150423-1351"/>
<unit id="org.eclipse.m2m.qvt.oml.feature.group" version="3.6.0.v20160606-1156"/>
<unit id="org.eclipse.xtext.util" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.xtext.common.types" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.xtext.xbase.lib" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.graphiti" version="0.13.0.v20160608-1043"/>
<unit id="org.eclipse.xtext" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.jface.source" version="3.12.0.v20160518-1929"/>
<unit id="org.eclipse.ocl.feature.group" version="3.6.0.v20160523-1914"/>
<unit id="org.eclipse.emf.cdo.feature.group" version="4.5.0.v20160607-1254"/>
<unit id="org.eclipse.net4j.util.feature.group" version="4.5.0.v20160607-1254"/>
<unit id="org.eclipse.emf.transaction.feature.jar" version="1.10.0.201606071900"/>
<unit id="org.eclipse.emf.validation.feature.group" version="1.10.0.201606071713"/>
<unit id="org.h2.source" version="1.3.168.v201212121212"/>
<unit id="org.eclipse.uml2.common.edit.feature.group" version="2.1.0.v20160516-0939"/>
<unit id="org.eclipse.uml2.codegen.ecore.ui.feature.group" version="2.2.0.v20160516-0939"/>
<unit id="org.eclipse.uml2.common.feature.group" version="2.1.0.v20160516-0939"/>
<unit id="org.eclipse.uml2.uml.feature.group" version="5.2.0.v20160516-0939"/>
<unit id="org.eclipse.uml2.uml.resources.source" version="5.2.0.v20160516-0939"/>
<unit id="org.eclipse.gef.feature.group" version="3.11.0.201606061308"/>
<unit id="org.eclipse.emf.query.feature.group" version="1.10.0.201606071631"/>
<unit id="org.eclipse.emf.query.ocl.feature.group" version="1.10.0.201606071631"/>
<unit id="org.eclipse.emf.cdo.sdk.feature.group" version="4.5.0.v20160607-1511"/>
<unit id="org.eclipse.net4j.feature.group" version="4.5.0.v20160607-1254"/>
<unit id="org.eclipse.net4j.db.feature.group" version="4.5.0.v20160607-1254"/>
<unit id="org.eclipse.emf.compare.feature.group" version="3.2.0.201605311222"/>
<unit id="org.eclipse.net4j.defs.feature.group" version="4.5.0.v20160607-1254"/>
<unit id="org.eclipse.emf.compare.ide.ui.feature.group" version="3.2.0.201605311222"/>
<unit id="org.eclipse.emf.transaction.feature.group" version="1.10.0.201606071900"/>
<unit id="org.eclipse.emf.compare.rcp" version="2.4.0.201605311222"/>
<unit id="org.eclipse.emf.compare.rcp.ui" version="4.2.0.201605311222"/>
<unit id="org.eclipse.ocl.all.feature.group" version="5.2.0.v20160523-1914"/>
<unit id="org.eclipse.ocl.examples.feature.group" version="6.1.0.v20160526-1513"/>
<unit id="org.eclipse.ocl.examples.classic.feature.group" version="5.2.0.v20160523-1914"/>
<unit id="org.eclipse.ocl.examples.unified.feature.group" version="4.1.0.v20160526-1513"/>
<unit id="org.eclipse.ocl.examples" version="3.4.200.v20150611-1921"/>
<unit id="org.eclipse.ocl.common" version="1.4.0.v20160521-2033"/>
<unit id="org.eclipse.emf.validation" version="1.8.0.201606071713"/>
<unit id="org.eclipse.ocl.pivot.uml" version="1.1.0.v20160523-1914"/>
<unit id="org.eclipse.ocl.all.sdk.feature.group" version="5.2.0.v20160523-1914"/>
<unit id="org.eclipse.ocl.core.sdk.feature.group" version="5.2.0.v20160523-1914"/>
<unit id="org.eclipse.uml2.sdk.feature.group" version="5.2.0.v20160516-0939"/>
<unit id="org.eclipse.graphiti.sdk.feature.feature.group" version="0.13.0.v20160608-1043"/>
<unit id="org.eclipse.zest.layouts" version="1.1.300.201606061308"/>
<unit id="org.eclipse.emf.mwe2.launch" version="2.9.0.v201605261103"/>
<unit id="org.eclipse.emf.mwe2.language.sdk.feature.group" version="2.9.0.v201605261103"/>
<unit id="org.eclipse.emf.workspace.feature.group" version="1.10.0.201606071900"/>
<repository location="http://download.eclipse.org/releases/neon"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="false" includeConfigurePhase="false" type="InstallableUnit">
<unit id="tools.descartes.dql.runtime.feature.feature.group" version="1.0.0.201609151306"/>
<unit id="tools.descartes.dql.lang.tests.feature.feature.group" version="1.0.0.201609151306"/>
<unit id="tools.descartes.dql.ui.feature.feature.group" version="1.0.0.201609151306"/>
<repository location="https://se4.informatik.uni-wuerzburg.de/dql/downloads/snapshot/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="false" includeConfigurePhase="false" type="InstallableUnit">
<unit id="edu.kit.ipd.descartes.mm.applicationlevel" version="0.0.0"/>
<unit id="edu.kit.ipd.descartes.mm.deployment" version="0.0.0"/>
<unit id="edu.kit.ipd.descartes.mm.resourcelandscape" version="0.0.0"/>
<unit id="edu.kit.ipd.descartes.mm.usageprofile" version="0.0.0"/>
<unit id="edu.kit.ipd.descartes.solving.feature.feature.group" version="0.0.0"/>
<unit id="edu.kit.ipd.descartes.core" version="0.0.0"/>
<unit id="edu.kit.ipd.descartes.identifier" version="0.0.0"/>
<repository location="https://se4.informatik.uni-wuerzburg.de/dml/downloads/snapshot/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="false" includeConfigurePhase="false" type="InstallableUnit">
<unit id="org.junit" version="4.11.0.v201303080030"/>
<unit id="org.apache.ant" version="1.9.2.v201404171502"/>
<unit id="org.apache.commons.math" version="2.1.0.v201105210652"/>
<unit id="org.apache.commons.cli" version="1.2.0.v201404270220"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="false" includeConfigurePhase="false" type="InstallableUnit">
<unit id="kieker" version="0.0.0"/>
<unit id="org.jfreechart.core" version="1.0.19.v00"/>
<unit id="org.jfreechart.experimental" version="1.0.12.v02"/>
<unit id="org.jfreechart.jcommon" version="1.0.19.v00"/>
<unit id="org.jfreechart.swt" version="1.0.12.v02"/>
<repository location="https://se4.informatik.uni-wuerzburg.de/thirdparty/repository/"/>
</location>
</locations>
<?pde version="3.8"?><target name="dql-kieker" sequenceNumber="1474237780">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
<unit id="org.eclipse.m2m.qvt.oml" version="3.6.0.v20160606-1156"/>
<unit id="org.eclipse.m2m.qvt.oml.sdk.feature.group" version="3.6.0.v20160606-1156"/>
<unit id="org.eclipse.m2m.qvt.oml.runtime.feature.group" version="3.6.0.v20160606-1156"/>
<unit id="org.eclipse.emf.common" version="2.12.0.v20160420-0247"/>
<unit id="org.eclipse.core.resources" version="3.11.0.v20160503-1608"/>
<unit id="org.eclipse.core.filesystem" version="1.6.0.v20160503-1608"/>
<unit id="org.eclipse.emf.feature.group" version="2.12.0.v20160526-0356"/>
<unit id="org.eclipse.xtext.sdk.feature.group" version="2.10.0.v201605250459"/>
<unit id="org.antlr.runtime" version="4.3.0.v201502022030"/>
<unit id="com.google.inject" version="3.0.0.v201605172100"/>
<unit id="com.google.guava" version="15.0.0.v201403281430"/>
<unit id="org.eclipse.sdk.feature.group" version="4.6.1.v20160907-1200"/>
<unit id="org.eclipse.emf.mwe2.runtime.sdk.feature.group" version="2.9.0.v201605261103"/>
<unit id="org.eclipse.xtend.feature.group" version="2.2.0.v201605260315"/>
<unit id="org.eclipse.xtend.lib" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.xtend.lib.macro" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.ocl.examples.xtext.oclinecore" version="3.5.0.v20160105-2030"/>
<unit id="org.eclipse.ecf" version="3.8.0.v20160823-2221"/>
<unit id="org.eclipse.ecf.identity" version="3.7.0.v20160823-2221"/>
<unit id="org.eclipse.ecf.filetransfer.feature.feature.group" version="3.13.2.v20160823-2221"/>
<unit id="org.eclipse.emf.mwe.utils" version="1.3.20.v201605261103"/>
<unit id="org.eclipse.emf.mwe.core" version="1.3.20.v201605261103"/>
<unit id="org.eclipse.xtend.shared.ui" version="2.2.0.v201605260315"/>
<unit id="org.eclipse.xpand" version="2.2.0.v201605260315"/>
<unit id="org.eclipse.ocl.examples.pivot" version="3.5.0.v20160105-2030"/>
<unit id="org.eclipse.emf.mwe.ui" version="1.3.20.v201605261103"/>
<unit id="org.eclipse.equinox.concurrent" version="1.1.0.v20130327-1442"/>
<unit id="org.eclipse.ant.core" version="3.4.100.v20160505-0642"/>
<unit id="org.eclipse.ant.ui.source" version="3.6.200.v20160525-1820"/>
<unit id="org.eclipse.jdt.feature.group" version="3.12.1.v20160907-1200"/>
<unit id="org.eclipse.debug.core" version="3.10.100.v20160419-1720"/>
<unit id="org.eclipse.core.externaltools" version="1.0.400.v20160509-1057"/>
<unit id="org.objectweb.asm" version="5.0.1.v201404251740"/>
<unit id="org.eclipse.emf.ecore.xcore.sdk.feature.group" version="1.4.0.v20160526-0606"/>
<unit id="org.eclipse.gef.sdk.feature.group" version="3.11.0.201606061308"/>
<unit id="org.eclipse.osgi.util" version="3.3.100.v20150423-1351"/>
<unit id="org.eclipse.m2m.qvt.oml.feature.group" version="3.6.0.v20160606-1156"/>
<unit id="org.eclipse.xtext.util" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.xtext.common.types" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.xtext.xbase.lib" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.graphiti" version="0.13.1.v20160830-1309"/>
<unit id="org.eclipse.xtext" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.jface.source" version="3.12.0.v20160518-1929"/>
<unit id="org.eclipse.ocl.feature.group" version="3.6.0.v20160523-1914"/>
<unit id="org.eclipse.emf.cdo.feature.group" version="4.5.0.v20160607-1254"/>
<unit id="org.eclipse.net4j.util.feature.group" version="4.5.0.v20160607-1254"/>
<unit id="org.eclipse.emf.transaction.feature.jar" version="1.10.0.201606071900"/>
<unit id="org.eclipse.emf.validation.feature.group" version="1.10.0.201606071713"/>
<unit id="org.h2.source" version="1.3.168.v201212121212"/>
<unit id="org.eclipse.uml2.common.edit.feature.group" version="2.1.0.v20160822-0739"/>
<unit id="org.eclipse.uml2.codegen.ecore.ui.feature.group" version="2.2.0.v20160822-0739"/>
<unit id="org.eclipse.uml2.common.feature.group" version="2.1.0.v20160822-0739"/>
<unit id="org.eclipse.uml2.uml.feature.group" version="5.2.1.v20160822-0739"/>
<unit id="org.eclipse.uml2.uml.resources.source" version="5.2.0.v20160822-0739"/>
<unit id="org.eclipse.gef.feature.group" version="3.11.0.201606061308"/>
<unit id="org.eclipse.emf.query.feature.group" version="1.10.0.201606071631"/>
<unit id="org.eclipse.emf.query.ocl.feature.group" version="1.10.0.201606071631"/>
<unit id="org.eclipse.emf.cdo.sdk.feature.group" version="4.5.0.v20160607-1511"/>
<unit id="org.eclipse.net4j.feature.group" version="4.5.0.v20160607-1254"/>
<unit id="org.eclipse.net4j.db.feature.group" version="4.5.0.v20160607-1254"/>
<unit id="org.eclipse.emf.compare.feature.group" version="3.2.1.201608311750"/>
<unit id="org.eclipse.net4j.defs.feature.group" version="4.5.0.v20160607-1254"/>
<unit id="org.eclipse.emf.compare.ide.ui.feature.group" version="3.2.1.201608311750"/>
<unit id="org.eclipse.emf.transaction.feature.group" version="1.10.0.201606071900"/>
<unit id="org.eclipse.emf.compare.rcp" version="2.4.1.201608311750"/>
<unit id="org.eclipse.emf.compare.rcp.ui" version="4.2.1.201608311750"/>
<unit id="org.eclipse.ocl.all.feature.group" version="5.2.0.v20160523-1914"/>
<unit id="org.eclipse.ocl.examples.feature.group" version="6.1.1.v20160808-1615"/>
<unit id="org.eclipse.ocl.examples.classic.feature.group" version="5.2.1.v20160808-1416"/>
<unit id="org.eclipse.ocl.examples.unified.feature.group" version="4.1.1.v20160808-1615"/>
<unit id="org.eclipse.ocl.examples" version="3.4.200.v20150611-1921"/>
<unit id="org.eclipse.ocl.common" version="1.4.0.v20160521-2033"/>
<unit id="org.eclipse.emf.validation" version="1.8.0.201606071713"/>
<unit id="org.eclipse.ocl.pivot.uml" version="1.1.1.v20160808-1615"/>
<unit id="org.eclipse.ocl.all.sdk.feature.group" version="5.2.0.v20160523-1914"/>
<unit id="org.eclipse.ocl.core.sdk.feature.group" version="5.2.0.v20160523-1914"/>
<unit id="org.eclipse.uml2.sdk.feature.group" version="5.2.1.v20160822-0739"/>
<unit id="org.eclipse.graphiti.sdk.feature.feature.group" version="0.13.1.v20160830-1309"/>
<unit id="org.eclipse.zest.layouts" version="1.1.300.201606061308"/>
<unit id="org.eclipse.emf.mwe2.launch" version="2.9.0.v201605261103"/>
<unit id="org.eclipse.emf.mwe2.language.sdk.feature.group" version="2.9.0.v201605261103"/>
<unit id="org.eclipse.emf.workspace.feature.group" version="1.10.0.201606071900"/>
<repository location="http://download.eclipse.org/releases/neon"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
<unit id="tools.descartes.dql.runtime.feature.feature.group" version="1.0.0.201610301352"/>
<unit id="tools.descartes.dql.lang.tests.feature.feature.group" version="1.0.0.201610301352"/>
<unit id="tools.descartes.dql.ui.feature.feature.group" version="1.0.0.201610301352"/>
<repository location="https://se4.informatik.uni-wuerzburg.de/dql/downloads/snapshot/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
<unit id="org.junit" version="4.11.0.v201303080030"/>
<unit id="org.apache.ant" version="1.9.2.v201404171502"/>
<unit id="org.apache.commons.math" version="2.1.0.v201105210652"/>
<unit id="org.apache.commons.cli" version="1.2.0.v201404270220"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
<unit id="kieker" version="1.13.0.v00"/>
<unit id="org.jaxen" version="1.1.6.v02"/>
<unit id="org.reflections" version="0.9.10.v08"/>
<unit id="org.dom4j" version="1.6.1.v02"/>
<repository location="https://se4.informatik.uni-wuerzburg.de/thirdparty/repository/"/>
</location>
</locations>
</target>
......@@ -5,8 +5,7 @@ Bundle-SymbolicName: tools.descartes.dql.connector.kieker.tests
Bundle-Version: 1.0.0.qualifier
Fragment-Host: tools.descartes.dql.connector.kieker;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.xtext.junit,
org.eclipse.xtext.junit4,
Require-Bundle: org.eclipse.xtext.junit4,
tools.descartes.dql.lang.tests,
org.junit,
tools.descartes.dql.core.engine,
......
SELECT res1.utilization.SAMPLE
FOR RESOURCE 'CPU_5' AS res1
USING kieker@'..\\..\\kiekerDqlTest.properties';
\ No newline at end of file
package tools.descartes.dql.connector.kieker.tests;
import static org.junit.Assert.*;
import java.util.List;
import java.util.Map;
import org.eclipse.xtext.junit4.InjectWith;
import org.eclipse.xtext.junit4.XtextRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import tools.descartes.dql.connector.kieker.KiekerHelper;
import tools.descartes.dql.connector.kieker.KiekerManager;
import tools.descartes.dql.connector.kieker.structures.Component;
import tools.descartes.dql.connector.kieker.structures.Trace;
import tools.descartes.dql.connector.kieker.structures.records.EventRecord;
import tools.descartes.dql.connector.kieker.structures.records.ResourceRecord;
import tools.descartes.dql.lang.DescartesQLInjectorProvider;
import tools.descartes.dql.models.mapping.domain.DomainFactory;
import tools.descartes.dql.models.mapping.domain.Entity;
import tools.descartes.dql.models.mapping.mapping.EntityMapping;
import tools.descartes.dql.models.mapping.mapping.MappingFactory;
@RunWith(XtextRunner.class)
@InjectWith(DescartesQLInjectorProvider.class)
public class KiekerManagerTest extends AbstractKiekerConnectorTest {
public static final String QUERY_LOCATION = "fixtures/Queries";
public static final String QUERY_FILE = "SelectUtilization";
public static final String MODE = "ENTITIES";
EntityMapping request = MappingFactory.eINSTANCE.createEntityMapping();
@Override
@Before
public void initializeTest() throws Exception {
super.initialize(createFileName(QUERY_LOCATION, QUERY_FILE));
}
@Test
public void testListEntitiesAnalysis(){
this.request.setModelLocation("D:\\Master\\runtime-DQL\\Tests\\dql.properties");
KiekerManager manager = new KiekerManager(request);
manager.run();
Trace result = manager.getAnalysisResult();
assertNotNull(result);
assertTrue(result.getResources().size() > 0);
assertTrue(result.getEvents().size() > 0);
}
@Test
public void testUtilizationAnalysis(){
Entity cpu1 = DomainFactory.eINSTANCE.createEntity();
cpu1.setEntityType("RESOURCE");
cpu1.setAlias("res1");
cpu1.setIdentifier("CPU_1");
Entity cpu2 = DomainFactory.eINSTANCE.createEntity();
cpu2.setEntityType("RESOURCE");
cpu2.setAlias("res2");
cpu2.setIdentifier("CPU_2");
this.request.setModelLocation("D:\\Master\\runtime-DQL\\Tests\\dql.properties");
this.request.getEntities().add(cpu1);
this.request.getEntities().add(cpu2);
KiekerManager manager = new KiekerManager(request);
manager.run();
Trace result = manager.getAnalysisResult();
assertNotNull(result);
List<ResourceRecord> resources =result.getResources();
assertTrue(resources.size() > 0);
assertTrue(result.getResourceIdentifierToResourceMap().size() > 0);
assertEquals(result.getResourceIdentifierToResourceMap().size(),this.request.getEntities().size());
int recordCounter = 0;
for (ResourceRecord record : resources) {
if (record.getIdentifier().getRessourceName().equals(cpu1.getIdentifier())){
recordCounter++;
}
}
assertTrue(recordCounter > 0);
recordCounter = 0;
for (ResourceRecord record : resources) {
if (record.getIdentifier().getRessourceName().equals(cpu2.getIdentifier())){
recordCounter++;
}
}
assertTrue(recordCounter > 0);
}
@Test
public void testResponseTimeAnalysis(){
Entity res1 = DomainFactory.eINSTANCE.createEntity();
res1.setEntityType("SERVICE");
res1.setAlias("svc1");
res1.setIdentifier("descartes.atest.App.test1()");
this.request.setModelLocation("D:\\Master\\runtime-DQL\\Tests\\dql.properties");
this.request.getEntities().add(res1);
KiekerManager manager = new KiekerManager(request);
manager.run();
Trace result = manager.getAnalysisResult();
assertNotNull(result);
Map<Component, Trace> services = result.getComponentToTraceMap();
assertTrue(services.size() > 0);
Component comp = new Component(KiekerHelper.getComponentString(res1.getIdentifier()));
Trace tr = services.get(comp);
assertNotNull(tr);
assertTrue(tr.getEvents().size() > 0);
assertTrue(result.getComponentIdentifierToComponentMap().size() > 0);
assertEquals(result.getComponentIdentifierToComponentMap().size(),this.request.getEntities().size());
int recordCounter = 0;
for (EventRecord er : tr.getEvents()) {
String dqlId = res1.getIdentifier();
String kiekerId = er.getIdentifier().getComponentID();
if (er.getIdentifier().isInterfaceIdentifier()){
kiekerId += "." + er.getIdentifier().getInterfaceID();
}
if (dqlId.equals(kiekerId)) {
recordCounter++;
}
}
assertTrue(recordCounter > 0);
}
}
......@@ -5,12 +5,6 @@ Bundle-SymbolicName: tools.descartes.dql.connector.kieker;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: tools.descartes.dql.connector.kieker.Activator
Require-Bundle: org.eclipse.core.runtime,
edu.kit.ipd.descartes.mm.applicationlevel,
edu.kit.ipd.descartes.mm.deployment,
edu.kit.ipd.descartes.mm.resourcelandscape,
edu.kit.ipd.descartes.mm.usageprofile,
edu.kit.ipd.descartes.solving,
edu.kit.ipd.descartes.solving.probes,
org.eclipse.core.resources,
org.eclipse.emf.query,
org.eclipse.emf.query.ocl,
......
......@@ -22,7 +22,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import edu.kit.ipd.descartes.solving.ValidationError;
import kieker.common.configuration.Configuration;
import tools.descartes.dql.core.engine.util.DQLLogger;
import tools.descartes.dql.models.mapping.domain.DomainFactory;
......@@ -156,18 +155,7 @@ public class KiekerHelper {
public static void openValidationErrorWindow(Collection<ValidationError> errors) {
final List<ValidationError> finalErrors = new LinkedList<ValidationError>();
finalErrors.addAll(errors);
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
Shell activeShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
MessageDialog dialog = new ValidationErrorDialog(activeShell, finalErrors);
dialog.open();
}
});
}
public static SeriesResultElement getSeriesResultElement(long timeStamp, double value, long firstTimestamp){
SeriesResultElement e = DomainFactory.eINSTANCE.createSeriesResultElement();
......
package tools.descartes.dql.connector.kieker;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Properties;
import org.apache.log4j.Logger;
import kieker.common.configuration.Configuration;
import tools.descartes.dql.connector.kieker.configgenerator.XMLGenerationManager;
import tools.descartes.dql.connector.kieker.filter.KiekerAnalysisController;
import tools.descartes.dql.connector.kieker.structures.Trace;
import tools.descartes.dql.core.engine.util.DQLLogger;
import tools.descartes.dql.models.mapping.mapping.EntityMapping;
public class KiekerManager {
Logger log;
private final EntityMapping request;
private String modelLocation;
private String projectPath;
private String appLocation;
private String kiekerJarLocation;
private String kiekerConfigLocation;
private String kiekerLocation;
private String traceFileOutputPath;
private Trace analysisResult;
int monitoringTimeout = 10;
public KiekerManager(EntityMapping request){
this.log = DQLLogger.getLogger(KiekerManager.class.getName());
this.request = request;
this.modelLocation = request.getModelLocation();
}
public void run(){
log("Checking location for user config file...");
if (KiekerHelper.checkPropertiesFileExist(modelLocation)){
log("Valid user config found, start processing...");
Properties prop = KiekerHelper.getProperties(modelLocation);
this.traceFileOutputPath= (String) prop.get(KiekerHelper.KIEKER_LOG_DIRECTORY);
if (!KiekerHelper.checkTraceFilesExist(traceFileOutputPath)){
log("No traceFiles found in specified log directory");
log("Start monitoring");
//do monitoring first
loadMonitoringConfig(prop);
startMonitoring();
log("Finished monitoring");
if (!KiekerHelper.checkTraceFilesExist(traceFileOutputPath)){
log("Produced traceFiles cannot be found under "+traceFileOutputPath+", aborting...");
throw new IllegalStateException(
"Could not find any valid Kieker traceFiles under "+traceFileOutputPath);
}
}
log("TraceFiles found under "+traceFileOutputPath);
startAnalysis();
} else {
// no user config, try modelLocation as traceFile directory
log("No user config found under "+modelLocation);
log("Search for existent traceFiles instead...");
if (!KiekerHelper.checkTraceFilesExist(modelLocation)){
log.error("No traceFiles found under "+modelLocation+", aborting...");
throw new IllegalStateException(
"Could not find any valid Kieker traceFiles under "+modelLocation);
} else {
log("TraceFiles possibly found under "+modelLocation);
this.traceFileOutputPath = modelLocation;
log("Try Analysis...");
startAnalysis();
}
}
}
private void loadMonitoringConfig(Properties prop){
log("Loading monitoring properties...");
try{
this.appLocation = (String) prop.get(KiekerHelper.APPLICATION_JAR_FILE);
this.kiekerJarLocation = (String) prop.get(KiekerHelper.KIEKER_JAR_FILE);
this.kiekerLocation = (String) prop.get(KiekerHelper.KIEKER_LOCATION);
this.projectPath = (modelLocation.substring(0,modelLocation.lastIndexOf(File.separator) + File.separator.length()));
this.monitoringTimeout = Integer.valueOf(prop.getProperty(KiekerHelper.MAX_TIMEOUT_KEY));
this.kiekerConfigLocation = prop.getProperty(KiekerHelper.KIEKER_CONFIG_DEFAULT_KEY);
log("Loading monitoring properties finished");
} catch(Exception e){
log("could not parse Properties-file. Aborting...");
throw new IllegalStateException("Could not parse properties file under "+modelLocation);
}
}
public void startMonitoring(){
log("Creating monitoring configurations...");
KiekerHelper.createNewOutPutPath(traceFileOutputPath);
KiekerHelper.setMonitoringProperties(kiekerConfigLocation, traceFileOutputPath);
ArrayList<String> services = KiekerHelper.getComponentIdentifiers(request);
// Config Generation
if (!XMLGenerationManager.generateDefaultXML(services, projectPath+File.separator+"META-INF")) {
System.out.println("Warning: Config could not be created");
}
log("Start monitoring for "+monitoringTimeout +" seconds...");
Process p;
try {
ResourceMonitor.startResourceMonitor(kiekerLocation,projectPath);
String command = "java -javaagent:" + kiekerJarLocation + " -jar " + appLocation;
p = Runtime.getRuntime()
.exec(command);
String line;
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
/*while ((line = in.readLine()) != null) {
System.out.println(line);
}*/
in.close();
} catch (Exception e) {
log(e.getMessage());
e.printStackTrace();
throw new IllegalStateException("Could not execute application with kieker");
}
// warten bis timeout
try {
Thread.sleep(monitoringTimeout * 1000);
p.destroy();
ResourceMonitor.stopRessourceMonitor();
} catch (InterruptedException e) {
e.printStackTrace();
}
log("Monitoring terminated");
}
public void startAnalysis(){
log("Starting analysis...");
try{
Configuration analysisConfiguration = KiekerHelper.createAnalysisConfig(request, traceFileOutputPath);
KiekerAnalysisController c = new KiekerAnalysisController(analysisConfiguration);
c.fillTrace();
this.analysisResult = c.getTrace();
this.analysisResult.sortChronological();
} catch(Exception e){
log("Unable to analyze traceFiles!");
throw new IllegalStateException("Analyzing Kieker traceFiles failed");
}
log("Analysis finished");
}
public Trace getAnalysisResult(){
return this.analysisResult;
}
public long getStartingTime(){
long firstEvent = Long.MAX_VALUE;
long firstResource = Long.MAX_VALUE;
if (this.analysisResult.getEvents() != null && this.analysisResult.getEvents().size()>0){
firstEvent = this.analysisResult.getEvents().get(0).getTimestamp();
}
if (this.analysisResult.getResources() != null && this.analysisResult.getResources().size()>0){
firstResource = this.analysisResult.getResources().get(0).getTimestamp();
}
return Math.min(firstEvent, firstResource);
}
private void log(String msg){
log.info(msg);
}
}
......@@ -13,6 +13,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.util.EcoreUtil;
import kieker.common.configuration.Configuration;
......@@ -73,7 +74,7 @@ public class PerformanceMetricsQueryConnectorImpl extends
// browse through each entity and its probes
// and try to replace the probe with a result
for (Entity ent : response.getEntities()) {
for (Probe dqlProbe : ent.getProbes()) {
for (Probe dqlProbe : ent.getProbes()) {
for (StatType st : dqlProbe.getStatTypes()) {
if (KiekerHelper.METRIC_UTILIZATION.equalsIgnoreCase(dqlProbe.getMetricName())) {
if (st.getTypeName().equals("DEFAULT") || st.getTypeName().equals("SAMPLE")){
......@@ -82,6 +83,7 @@ public class PerformanceMetricsQueryConnectorImpl extends
try {
for (ResourceRecord record : resources) {
if (record.getIdentifier().getRessourceName().equals(ent.getIdentifier())){
//System.out.println("ADDING for "+ent.getIdentifier()+": Time" +record.getTimestamp()+" / Util: "+record.getContent().get(2));
result.getElements().add(KiekerHelper.getSeriesResultElement(record.getTimestamp(), record.getContent().get(2), firstTs));
}
}
......
package tools.descartes.dql.connector.kieker;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import edu.kit.ipd.descartes.solving.ValidationError;
import edu.kit.ipd.descartes.solving.ValidationErrorSource;
public class ValidationErrorDialog extends MessageDialog {
Collection<ValidationError> errors;
public ValidationErrorDialog(Shell parentShell, Collection<ValidationError> errors) {
super(parentShell, "ValidationError", null, "",
MessageDialog.ERROR, new String[] { "OK" }, 0);
this.errors = errors;
}
@Override
public Control createDialogArea(Composite parent) {
addImage(parent);
Composite messageArea = createMessageComposite(parent);
createHeadline(messageArea, "Validation failed!");
createFullRowText(messageArea, "The DML-Files you provided contained invalid data."
+ " Please fix the following issues and try again.");
Composite nonScroll = createNonScrollContent(messageArea);
if (getHeight(nonScroll) > 400) {
nonScroll.dispose();
createScrollContent(messageArea);
}
return parent;
}
private void createScrollContent(Composite composite) {
final ScrolledComposite sc = new ScrolledComposite(composite, SWT.V_SCROLL);
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
Composite content = new Composite(sc, SWT.NONE);
sc.setContent(content);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.heightHint = 400;
sc.setLayoutData(data);
content.setLayout(new GridLayout(2, false));
createContent(content);
sc.setMinSize(content.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
private int getHeight(Composite composite) {
return composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
}
private Composite createNonScrollContent(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
createContent(composite);
return composite;
}
private void createContent(Composite parent) {
Map<ValidationErrorSource, List<String>> errorMap = getErrorMap();
for (Map.Entry<ValidationErrorSource,List<String>> entry: errorMap.entrySet()) {
createSubHeadline(parent, entry.getKey().getName());
for (String message: entry.getValue())
createBulletPoint(parent, message);
}
}
private void createBulletPoint(Composite parent, String text) {
Text bullet = new Text(parent, SWT.READ_ONLY);
bullet.setText("-");
GridData gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING, GridData.HORIZONTAL_ALIGN_BEGINNING, false, false);
bullet.setLayoutData(gridData);
Text bulletText = new Text(parent, SWT.WRAP | SWT.READ_ONLY);
GridData gd = new GridData ();
gd.widthHint = 700;
bulletText.setLayoutData (gd);
bulletText.setText(insertNewLines(text, bulletText.getFont(), 700));
}
private Text createSubHeadline(Composite parent, String text) {
Text subHeadLine = createFullRowText(parent, text);
Font font = new Font(PlatformUI.getWorkbench().getDisplay(),
new FontData("Headline Font", 12, SWT.BOLD));
subHeadLine.setFont(font);
return subHeadLine;
}
private Text createHeadline(Composite parent, String text) {
Text headLine = createFullRowText(parent, text);
Font font = new Font(PlatformUI.getWorkbench().getDisplay(),
new FontData("Headline Font", 16, SWT.BOLD));
headLine.setFont(font);
return headLine;
}
private Text createFullRowText(Composite parent, String text) {
Text label = new Text(parent, SWT.READ_ONLY);
label.setText(text);
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
gridData.horizontalSpan = 2;
label.setLayoutData(gridData);
return label;
}
private Composite createMessageComposite(Composite parent) {
Composite panel = new Composite(parent, SWT.NONE);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.minimumWidth = 700;
panel.setLayoutData(gd);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 2;
panel.setLayout(layout);
return panel;
}
private void addImage(Composite composite) {
Image image = getImage();
if (image != null) {
imageLabel = new Label(composite, SWT.NULL);
image.setBackground(imageLabel.getBackground());
imageLabel.setImage(image);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING)
.applyTo(imageLabel);
}
}
private Map<ValidationErrorSource, List<String>> getErrorMap() {
Map<ValidationErrorSource, List<String>> map = new HashMap<ValidationErrorSource, List<String>>();
for (ValidationError error: errors) {
if (!map.containsKey(error.getSource()))
map.put(error.getSource(), new LinkedList<String>());
map.get(error.getSource()).add(error.getMessage());
}
return map;
}
private String insertNewLines(String text, Font f, int width) {
String edited = "";
while (text.length() != 0) {
int initialCutoff = getInitialCutoff(text, f, width);
int newCutoff = adjustCutoffForSmallWords(text, initialCutoff);
edited += text.substring(0, newCutoff);
if (newCutoff != text.length())
edited += "\n";
text = text.substring(newCutoff);
}
return edited;
}
private int adjustCutoffForSmallWords(String text, int initialCutoff) {
int start = getPosOfFirstLetter(text, initialCutoff);
int end = getPosOfNextWhitespace(text, initialCutoff);
int wordLength = end - start;
if (end != -1 && wordLength < 20)
return start;
return initialCutoff;
}
private int getPosOfNextWhitespace(String text, int initialCutoff) {
int pos = text.indexOf(" ", initialCutoff);
return pos;
}
private int getPosOfFirstLetter(String text, int initialCutoff) {
int pos = text.lastIndexOf(" ", initialCutoff) + 1;
return pos;
}
private int getInitialCutoff(String text, Font f, int width) {
String buffer = "";
int pos = 0;
while (getWidth(buffer, f) < width && pos < text.length()) {
buffer += text.charAt(pos);
pos++;
}
if (getWidth(buffer, f) >= width) {
pos--;
}
return pos;
}
private int getWidth(String s, Font f) {
Text l = new Text(getShell(), SWT.NONE);
l.setFont(f);
GC gc = new GC(l);
Point size = gc.textExtent(s);
gc.dispose();
l.dispose();
return size.x;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment