Search in sources :

Example 1 with TraceElement

use of de.dagere.peass.dependency.analysis.data.TraceElement in project peass by DaGeRe.

the class TestSequiturSerialization method testDeepRepetition3.

@Test
public void testDeepRepetition3() throws ParseException, IOException {
    final List<TraceElement> calls = new LinkedList<>();
    for (int j = 0; j < 3; j++) {
        for (int i = 0; i < 5; i++) {
            calls.add(new TraceElement("CalleeSimpleFor", "methodA", 0));
            calls.add(new TraceElement("CalleeSimpleFor", "methodB", 0));
            for (int k = 0; k < 5; k++) {
                calls.add(new TraceElement("CalleeSimpleFor", "method1", 0));
                calls.add(new TraceElement("CalleeSimpleFor", "method2", 0));
            }
            calls.add(new TraceElement("CalleeSimpleFor", "methodG", 0));
        }
        calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
        calls.add(new TraceElement("CalleeSimpleFor", "methodD", 0));
    }
    calls.add(new TraceElement("CalleeSimpleFor", "methodE", 0));
    final TraceMethodReader reader = new TraceMethodReader(calls, new File("src/test/java/"));
    final TraceWithMethods trace = reader.getTraceWithMethods();
    testTrace(calls, trace);
}
Also used : TraceElement(de.dagere.peass.dependency.analysis.data.TraceElement) TraceWithMethods(de.dagere.peass.dependency.traces.TraceWithMethods) TraceMethodReader(de.dagere.peass.dependency.traces.TraceMethodReader) File(java.io.File) LinkedList(java.util.LinkedList) Test(org.junit.jupiter.api.Test)

Example 2 with TraceElement

use of de.dagere.peass.dependency.analysis.data.TraceElement in project peass by DaGeRe.

the class TestTraceElementContent method testEquality.

@Test
public void testEquality() {
    TraceElement element = new TraceElement("Clazz", "method", 1);
    element.setParameterTypes(new String[] { "String" });
    TraceElementContent content1 = new TraceElementContent(element);
    TraceElement element2 = new TraceElement("Clazz", "method", 1);
    element2.setParameterTypes(new String[] { "String[]" });
    TraceElementContent content2 = new TraceElementContent(element2);
    Assert.assertFalse(content1.equals(content2));
}
Also used : TraceElementContent(de.dagere.peass.dependency.traces.TraceElementContent) TraceElement(de.dagere.peass.dependency.analysis.data.TraceElement) Test(org.junit.jupiter.api.Test)

Example 3 with TraceElement

use of de.dagere.peass.dependency.analysis.data.TraceElement in project peass by DaGeRe.

the class TestTraceMinimization method testSimple4NestedLoop.

@Test
public void testSimple4NestedLoop() throws ParseException, IOException {
    final List<TraceElement> calls = new LinkedList<>();
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            calls.add(new TraceElement("CalleeSimpleFor", "methodA", 0));
            calls.add(new TraceElement("CalleeSimpleFor", "methodB", 0));
            calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
            calls.add(new TraceElement("CalleeSimpleFor", "methodD", 0));
        }
        calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
    }
    final TraceMethodReader reader = new TraceMethodReader(calls, new File("src/test/java/"));
    final TraceWithMethods trace = reader.getTraceWithMethods();
    System.out.println("trace");
    System.out.println(trace);
    Assert.assertEquals(" (6)", trace.getTraceElement(0).toString());
    Assert.assertEquals(3, trace.getTraceOccurences(0));
    Assert.assertEquals(" (4)", trace.getTraceElement(1).toString());
    Assert.assertEquals(3, trace.getTraceOccurences(1));
    Assert.assertEquals("CalleeSimpleFor#methodA", trace.getTraceElement(2).toString());
    Assert.assertEquals("CalleeSimpleFor#methodB", trace.getTraceElement(3).toString());
    Assert.assertEquals("CalleeSimpleFor#methodC", trace.getTraceElement(4).toString());
    Assert.assertEquals("CalleeSimpleFor#methodD", trace.getTraceElement(5).toString());
    Assert.assertEquals("CalleeSimpleFor#methodC", trace.getTraceElement(6).toString());
}
Also used : TraceElement(de.dagere.peass.dependency.analysis.data.TraceElement) TraceWithMethods(de.dagere.peass.dependency.traces.TraceWithMethods) TraceMethodReader(de.dagere.peass.dependency.traces.TraceMethodReader) File(java.io.File) LinkedList(java.util.LinkedList) Test(org.junit.jupiter.api.Test)

Example 4 with TraceElement

use of de.dagere.peass.dependency.analysis.data.TraceElement in project peass by DaGeRe.

the class TestTraceMinimization method testTwoMethodLoop.

@Test
public void testTwoMethodLoop() throws ParseException, IOException {
    final List<TraceElement> calls = new LinkedList<>();
    calls.add(new TraceElement("CalleeSimpleFor", "methodA", 0));
    calls.add(new TraceElement("CalleeSimpleFor", "methodB", 0));
    calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
    calls.add(new TraceElement("CalleeSimpleFor", "methodB", 0));
    calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
    calls.add(new TraceElement("CalleeSimpleFor", "methodB", 0));
    calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
    final TraceMethodReader reader = new TraceMethodReader(calls, new File("src/test/java/"));
    final TraceWithMethods trace = reader.getTraceWithMethods();
    System.out.println();
    System.out.println("Trace");
    System.out.println(trace);
    Assert.assertEquals("CalleeSimpleFor#methodA", trace.getTraceElement(0).toString());
    Assert.assertEquals(" (2)", trace.getTraceElement(1).toString());
    // Assert.assertEquals("#0 (2)", trace.getTraceElement(1).toString());
    Assert.assertEquals("CalleeSimpleFor#methodB", trace.getTraceElement(2).toString());
    Assert.assertEquals("CalleeSimpleFor#methodC", trace.getTraceElement(3).toString());
    // Assert.assertEquals("methodB", trace.getTraceElement(1).getMethod());
    // Assert.assertEquals("methodC", trace.getTraceElement(2).getMethod());
    Assert.assertEquals(3, trace.getTraceOccurences(1));
}
Also used : TraceElement(de.dagere.peass.dependency.analysis.data.TraceElement) TraceWithMethods(de.dagere.peass.dependency.traces.TraceWithMethods) TraceMethodReader(de.dagere.peass.dependency.traces.TraceMethodReader) File(java.io.File) LinkedList(java.util.LinkedList) Test(org.junit.jupiter.api.Test)

Example 5 with TraceElement

use of de.dagere.peass.dependency.analysis.data.TraceElement in project peass by DaGeRe.

the class TestTraceMinimization method testSimple2NestedLoop.

@Test
public void testSimple2NestedLoop() throws ParseException, IOException {
    final List<TraceElement> calls = new LinkedList<>();
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            calls.add(new TraceElement("CalleeSimpleFor", "methodA", 0));
            calls.add(new TraceElement("CalleeSimpleFor", "methodB", 0));
        }
        calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
    }
    calls.add(new TraceElement("CalleeSimpleFor", "methodD", 0));
    final TraceMethodReader reader = new TraceMethodReader(calls, new File("src/test/java/"));
    final TraceWithMethods trace = reader.getTraceWithMethods();
    System.out.println();
    System.out.println("Trace");
    System.out.println(trace);
    Assert.assertEquals(" (4)", trace.getTraceElement(0).toString());
    Assert.assertEquals(3, trace.getTraceOccurences(0));
    Assert.assertEquals(" (2)", trace.getTraceElement(1).toString());
    Assert.assertEquals(3, trace.getTraceOccurences(1));
    Assert.assertEquals("CalleeSimpleFor#methodA", trace.getTraceElement(2).toString());
    Assert.assertEquals("CalleeSimpleFor#methodB", trace.getTraceElement(3).toString());
    Assert.assertEquals("CalleeSimpleFor#methodC", trace.getTraceElement(4).toString());
    Assert.assertEquals("CalleeSimpleFor#methodD", trace.getTraceElement(5).toString());
}
Also used : TraceElement(de.dagere.peass.dependency.analysis.data.TraceElement) TraceWithMethods(de.dagere.peass.dependency.traces.TraceWithMethods) TraceMethodReader(de.dagere.peass.dependency.traces.TraceMethodReader) File(java.io.File) LinkedList(java.util.LinkedList) Test(org.junit.jupiter.api.Test)

Aggregations

TraceElement (de.dagere.peass.dependency.analysis.data.TraceElement)25 File (java.io.File)18 Test (org.junit.jupiter.api.Test)15 TraceMethodReader (de.dagere.peass.dependency.traces.TraceMethodReader)12 TraceWithMethods (de.dagere.peass.dependency.traces.TraceWithMethods)12 LinkedList (java.util.LinkedList)11 KiekerConfig (de.dagere.peass.config.KiekerConfig)5 CalledMethodLoader (de.dagere.peass.dependency.analysis.CalledMethodLoader)4 TraceElementContent (de.dagere.peass.dependency.traces.TraceElementContent)3 CompilationUnit (com.github.javaparser.ast.CompilationUnit)2 Node (com.github.javaparser.ast.Node)2 PeassFolders (de.dagere.peass.folders.PeassFolders)2 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)1 KiekerResultManager (de.dagere.peass.dependency.KiekerResultManager)1 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)1 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)1 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)1 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)1 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)1 Symbol (de.dagere.requitur.Symbol)1