Ignore:
Timestamp:
03/06/15 09:18:02 (9 years ago)
Author:
sherbold
Message:
  • added validation function for models based on observed usage data
  • Interaction generation now automatically decides if a call is SYNCH/ASYNCH based on the concurrency information of the operation that is called
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-plugin-uml-test/src/test/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtilsTest.java

    r1896 r1898  
    2121import java.util.List; 
    2222import java.util.Random; 
     23import java.util.logging.Level; 
    2324 
    2425import org.apache.commons.lang.SerializationUtils; 
     
    2930import org.eclipse.uml2.uml.UMLPackage; 
    3031import org.junit.After; 
     32import org.junit.BeforeClass; 
    3133import org.junit.Test; 
    3234 
     
    4042import de.ugoe.cs.autoquest.usageprofiles.FirstOrderMarkovModel; 
    4143import de.ugoe.cs.autoquest.usageprofiles.IStochasticProcess; 
     44import de.ugoe.cs.util.console.Console; 
     45import de.ugoe.cs.util.console.TextConsole; 
    4246 
    4347/** 
     
    5256    private final static String OUTPUT_DIR = "target/tmp/test-outputs/"; 
    5357 
    54     /** 
    55     * 
    56     */ 
     58    @BeforeClass 
     59    public static void setUpBeforeClass() throws Exception { 
     60        Console.getInstance().registerTraceListener(new TextConsole(Level.INFO)); 
     61    } 
     62     
    5763    @After 
    5864    public void tearDown() throws Exception { 
     
    181187        Collection<List<Event>> httpSequences = parser.getSequences(); 
    182188 
    183          
    184189        Model model = 
    185190            ModelUtils.loadModel(ClassLoader 
     
    197202        } 
    198203 
    199         ModelUtils.writeModelToFile(model, OUTPUT_DIR + "testCreateInteractionFromEventSequence_2_result.uml"); 
    200          
     204        ModelUtils.writeModelToFile(model, OUTPUT_DIR + "testCreateInteractionFromEventSequence_1_result.uml"); 
    201205    } 
    202206     
     
    294298        ModelUtils.writeModelToFile(model, OUTPUT_DIR + "testCreateScheduling_1_result.uml"); 
    295299    } 
     300     
     301    @Test 
     302    public void testValidateModelWithLog_1() throws Exception { 
     303        HTTPLogParser parser = 
     304                new HTTPLogParser(new File(ClassLoader 
     305                    .getSystemResource("testCreateInteractionFromEventSequence_1_properties.txt") 
     306                    .getFile())); 
     307        parser 
     308            .parseFile(new File(ClassLoader 
     309                .getSystemResource("testCreateInteractionFromEventSequence_1_usagedata.log") 
     310                .getFile())); 
     311        Collection<List<Event>> httpSequences = parser.getSequences(); 
     312 
     313         
     314        Model model = 
     315            ModelUtils.loadModel(ClassLoader 
     316                .getSystemResourceAsStream("testCreateInteractionFromEventSequence_1_model.uml")); 
     317         
     318        UMLUtils.validateModelWithLog(httpSequences, model, null); 
     319    } 
     320     
     321    @Test 
     322    public void testValidateModelWithLog_2() throws Exception { 
     323        HTTPLogParser parser = 
     324                new HTTPLogParser(new File(ClassLoader 
     325                    .getSystemResource("testCreateInteractionFromEventSequence_2_properties.txt") 
     326                    .getFile())); 
     327        parser 
     328            .parseFile(new File(ClassLoader 
     329                .getSystemResource("testCreateInteractionFromEventSequence_2_usagedata.log") 
     330                .getFile())); 
     331        Collection<List<Event>> httpSequences = parser.getSequences(); 
     332 
     333         
     334        Model model = 
     335            ModelUtils.loadModel(ClassLoader 
     336                .getSystemResourceAsStream("testCreateInteractionFromEventSequence_2_model.uml")); 
     337         
     338        UMLUtils.validateModelWithLog(httpSequences, model, null); 
     339    } 
     340     
     341    @Test 
     342    public void testValidateModelWithLog_HL7_v2() throws Exception { 
     343        HTTPLogParser parser = 
     344                new HTTPLogParser(new File(ClassLoader 
     345                    .getSystemResource("hl7_servicenamemap.txt") 
     346                    .getFile())); 
     347        parser 
     348            .parseFile(new File(ClassLoader 
     349                .getSystemResource("testCreateInteractionFromEventSequence_1_usagedata.log") 
     350                .getFile())); 
     351        Collection<List<Event>> httpSequences = parser.getSequences(); 
     352 
     353         
     354        Model model = 
     355            ModelUtils.loadModel(ClassLoader 
     356                .getSystemResourceAsStream("hl7model_v2.uml")); 
     357         
     358        UMLUtils.validateModelWithLog(httpSequences, model, "IXSTestSuite_1"); 
     359    } 
    296360 
    297361    private void deleteFiles(File file) { 
Note: See TracChangeset for help on using the changeset viewer.