Skip to content
Snippets Groups Projects
Select Git revision
  • 8ca9774c1572f101627ba1f0fa77c9d4c837f8b9
  • master default protected
  • protobuf_gen
  • ns3_work
  • Lip6-2025
  • Lip6-MultipleABD
  • AIProperties
  • sec-pattern-check
  • avatarSysML_04_2024
  • parser_work_06_2025
  • parser_work_04_2025
  • guard_refactoring_04_2025
  • parser_06_2023
  • guard_refactoring_debug
  • parser_03_2023
  • avatarSysML_Graphics
  • alan_attack_tree_gen
  • tags
  • separate_simulator
  • tests_explo
  • debug_simulator_07_2024
21 results

ComparisonOfsimulationTraces.java

Blame
  • ComparisonOfsimulationTraces.java 2.73 KiB
    package ui.ComparisonOfsimulationTracesInXML;
    
    import static org.junit.Assert.*;
    
    import java.awt.event.ActionEvent;
    import java.io.IOException;
    
    import javax.xml.parsers.ParserConfigurationException;
    
    import org.junit.*;
    import org.xml.sax.SAXException;
    
    import ui.AbstractUITest;
    import ui.SimulationTrace;
    import ui.interactivesimulation.JFrameCompareSimulationTraces;
    import ui.interactivesimulation.JFrameShowLatencyDetails;
    import ui.interactivesimulation.JPanelCompareXmlGraph;
    
    public class ComparisonOfsimulationTraces extends AbstractUITest {
    
    	protected static SimulationTrace selectedST1;
    	protected static SimulationTrace selectedST2;
    
    	protected static String STfilePath1;
    	protected static String STfilePath2;
    
    	private static JFrameCompareSimulationTraces cSimTrace;
    	private static JPanelCompareXmlGraph newContentPane;
    	private static JFrameShowLatencyDetails showLatencyDetails;
    	private static final String path1 = "/ui/xmlCompare/input/simple.xml";
    	private static final String path2 = "/ui/xmlCompare/input/simplifiedWithSecurity.xml";
    
    	@BeforeClass
    	public static void setUpBeforeClass() throws Exception {
    
    		STfilePath1 = getBaseResourcesDir() + path1;
    		STfilePath2 = getBaseResourcesDir() + path2;
    
    		// STfilePath1 =
    		// "/home/maysam/eclipse/TTool/ttool/src/test/resources/ui/xmlCompare/input/simple.xml";
    		// STfilePath2 =
    		// "/home/maysam/eclipse/TTool/ttool/src/test/resources/ui/xmlCompare/input/simplifiedWithSecurity.xml";
    		selectedST1 = new SimulationTrace("simple.xml", 6, STfilePath1);
    		selectedST2 = new SimulationTrace("simplifiedWithSecurity.xml", 6, STfilePath2);
    
    	}
    
    	@Test
    	public void loadTest() {
    		assertNotNull(selectedST1);
    		assertNotNull(selectedST2);
    
    	}
    
    	@Test
    	public void parseXMLTest() throws SAXException, IOException, ParserConfigurationException {
    
    		cSimTrace = new JFrameCompareSimulationTraces(mainGUI, "Compare Simulation simulation", selectedST1);
    		cSimTrace.setVisible(false);
    		cSimTrace.parseXML(STfilePath1, STfilePath2);
    
    		assertNotNull(cSimTrace.getTransFile1());
    		assertNotNull(cSimTrace.getTransFile2());
    
    		newContentPane = new JPanelCompareXmlGraph(cSimTrace.getTransFile1(), cSimTrace.getTransFile2());
    		newContentPane.setVisible(false);
    
    	}
    
    	@Test
    	public void diffTest() throws SAXException, IOException, ParserConfigurationException {
    
    		assertTrue(newContentPane.getTable().getRowCount() > 0);
    
    	}
    
    	@Test
    	public void latencyTest() throws SAXException, IOException, ParserConfigurationException {
    		JFrameShowLatencyDetails showLatencyDetails = new JFrameShowLatencyDetails(cSimTrace.getTransFile1(),
    				cSimTrace.getTransFile2(), "CPU1_1", "Request SmartCard", "CPU1_1", "Send end");
    
    		showLatencyDetails.setVisible(false);
    
    		assertTrue(showLatencyDetails.getTable11().getRowCount() > 0);
    
    	}
    
    }