Changeset 2009
- Timestamp:
- 07/14/15 13:20:26 (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-uml-test/src/test/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtilsTest.java
r2006 r2009 306 306 307 307 // create a test case for each observed sequence 308 int i = 0; 309 for (List<Event> sequence : sequences) { 310 UMLUtils.createInteractionFromEventSequence(sequence, model, 311 properties.getProperty("testcases.prefix") + 312 "_" + i, 313 properties.getProperty("test.context"), 314 false); 315 i++; 316 } 308 UMLUtils.createInteractionFromEventSequence(sequences, model, properties.getProperty("testcases.prefix"), properties.getProperty("test.context"), false); 317 309 318 310 ModelUtils.writeModelToFile(model, OUTPUT_DIR + testdata.testSuiteFile); … … 330 322 331 323 int i = 1; 332 List<Interaction> interactions = new LinkedList<>();324 List<Interaction> interactions = UMLUtils.createInteractionFromEventSequence(generatedSequences, model, properties.getProperty("testcases.prefix"), properties.getProperty("test.context"), Boolean.parseBoolean(properties.getProperty("testcases.data.random", "false"))); 333 325 int[] lengths = new int[generatedSequences.size()]; 334 326 for (List<Event> sequence : generatedSequences) { 335 interactions.add(UMLUtils336 .createInteractionFromEventSequence(sequence, model,337 properties.getProperty("testcases.prefix") +338 "_" + i,339 properties.getProperty("test.context"),340 Boolean.parseBoolean(properties.getProperty("testcases.data.random", "false"))));341 327 lengths[i - 1] = sequence.size(); 342 328 i++; … … 357 343 Collection<List<Event>> generatedSequences = 358 344 createRandomSequences(usageProfile, properties); 359 int i = 1; 360 for (List<Event> sequence : generatedSequences) { 361 UMLUtils.createInteractionFromEventSequence(sequence, model, 362 properties.getProperty("testcases.prefix") + 363 "_" + i, 364 properties.getProperty("test.context"), 365 true); 366 i++; 367 } 368 345 UMLUtils.createInteractionFromEventSequence(generatedSequences, model, properties.getProperty("testcases.prefix"), properties.getProperty("test.context"), Boolean.parseBoolean(properties.getProperty("testcases.data.random", "false"))); 346 369 347 UMLUtils.createScheduling(model, usageProfile, properties.getProperty("test.context")); 370 348 … … 419 397 int testCaseMinLength = Integer.parseInt(properties.getProperty("testcases.minlenth", "1")); 420 398 int testCaseMaxLength = 421 Integer.parseInt(properties.getProperty("testcases.maxlen th", "100"));399 Integer.parseInt(properties.getProperty("testcases.maxlength", "100")); 422 400 int maxIter = numberOfTestCases * 100; 423 401 RandomWalkGenerator testGenerator = 424 402 new RandomWalkGenerator(numberOfTestCases, testCaseMinLength, testCaseMaxLength, true, 425 403 maxIter); 426 return testGenerator.generateTestSuite(usageProfile);404 return SOAPUtils.dropInvalidResponseRequestPairs(testGenerator.generateTestSuite(usageProfile)); 427 405 } 428 406 -
trunk/autoquest-plugin-uml-test/src/test/resources/ita_imported_properties.prop
r2007 r2009 23 23 testcases.number = 10 24 24 testcases.minlenght = 1 25 testcases.maxlength = 1025 testcases.maxlength = 50 26 26 testcases.data.random = false 27 27 -
trunk/autoquest-plugin-uml/src/main/java/de/ugoe/cs/autoquest/plugin/uml/UMLInteractionCreator.java
r2008 r2009 15 15 package de.ugoe.cs.autoquest.plugin.uml; 16 16 17 import java.util.HashMap; 17 18 import java.util.Iterator; 18 19 import java.util.List; 20 import java.util.Map; 19 21 import java.util.Set; 20 22 import java.util.logging.Level; … … 45 47 import org.eclipse.uml2.uml.Slot; 46 48 import org.eclipse.uml2.uml.UMLPackage; 49 import org.w3c.dom.Element; 47 50 48 51 import de.ugoe.cs.autoquest.eventcore.Event; … … 75 78 */ 76 79 private final boolean useRandomMsgBodies; 77 80 81 /** 82 * TODO 83 */ 84 private final Map<String, InstanceSpecification> instanceSpecificationCache; 85 78 86 /** 79 87 * <p> … … 93 101 this.testContextName = testContextName; 94 102 this.useRandomMsgBodies = useRandomMsgBodies; 103 instanceSpecificationCache = new HashMap<String, InstanceSpecification>(); 95 104 } 96 105 … … 316 325 String prefix) 317 326 { 318 org.w3c.dom.Element requestBody;327 Element requestBody; 319 328 if (SOAPUtils.isSOAPRequest(event)) { 320 329 requestBody = … … 388 397 internalParameter.getType(), 389 398 UMLPackage.Literals.INSTANCE_VALUE); 390 value391 .setInstance(createInstanceSpecification((DataType) internalParameter392 .getType(),393 instSpecPkg, prefix,394 instSpecNumber, paramNode,395 path));399 InstanceSpecification instSpec = createInstanceSpecification((DataType) internalParameter 400 .getType(), 401 instSpecPkg, prefix, 402 instSpecNumber, paramNode, 403 path); 404 value.setInstance(instSpec); 396 405 /* 397 406 * InstanceValue value = (InstanceValue) argument .createOperand(null, … … 443 452 String path) 444 453 { 454 if( instanceSpecificationCache.containsKey(SOAPUtils.getSerialization(currentNode)) ) { 455 return instanceSpecificationCache.get(SOAPUtils.getSerialization(currentNode)); 456 } 445 457 if ("".equals(path)) { 446 458 path = type.getName(); … … 505 517 } 506 518 } 519 instanceSpecificationCache.put(SOAPUtils.getSerialization(currentNode), instSpec); 507 520 return instSpec; 508 521 } -
trunk/autoquest-plugin-uml/src/main/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtils.java
r2008 r2009 423 423 * defines is random request bodies are used or the body of the associated event 424 424 */ 425 public static Interaction createInteractionFromEventSequence(List<Event> sequence,425 public static List<Interaction> createInteractionFromEventSequence(Collection<List<Event>> sequences, 426 426 Model model, 427 427 String interactionName, … … 429 429 boolean useRandomMsgBodies) 430 430 { 431 List<Interaction> interactions = new LinkedList<>(); 431 432 UMLInteractionCreator interactionCreator = new UMLInteractionCreator(model, testContextName, useRandomMsgBodies); 432 return interactionCreator.createInteraction(sequence, interactionName); 433 int i=0; 434 for( List<Event> sequence : sequences ) { 435 interactions.add(interactionCreator.createInteraction(sequence, interactionName+"_"+i)); 436 i++; 437 } 438 return interactions; 433 439 } 434 440
Note: See TracChangeset
for help on using the changeset viewer.