Changeset 1931 for trunk/autoquest-plugin-uml-test/src/test/java/de/ugoe
- Timestamp:
- 03/23/15 13:37:42 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-uml-test/src/test/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtilsTest.java
r1929 r1931 28 28 import java.util.logging.Level; 29 29 30 //import static org.junit.Assert.*; 31 32 33 30 import static org.junit.Assert.*; 34 31 35 32 import org.eclipse.uml2.uml.Interaction; … … 45 42 import de.ugoe.cs.autoquest.plugin.http.HTTPLogParser; 46 43 import de.ugoe.cs.autoquest.plugin.http.SOAPUtils; 47 import de.ugoe.cs.autoquest.plugin.http.eventcore.SOAPEventType;48 44 import de.ugoe.cs.autoquest.plugin.http.eventcore.SimpleSOAPEventType; 49 45 import de.ugoe.cs.autoquest.testgeneration.RandomWalkGenerator; … … 137 133 } 138 134 139 @Test (expected = java.lang.RuntimeException.class)135 @Test 140 136 public void testCreateUMLTransitionSequence_ITA_1() throws Exception { 141 137 TestData testdata = ita_1; 142 138 139 /* 140 * Properties properties = loadProperties(testdata); //Collection<List<Event>> sequences = 141 * loadAndPreprocessUsageJournal(testdata, properties); 142 * 143 * Model model = 144 * ModelUtils.loadModel(ClassLoader.getSystemResourceAsStream(testdata.dslModelFile)); 145 * 146 * StateMachine stateMachine = (StateMachine) 147 * model.getPackagedElement("StateMachineTransportService", true, 148 * UMLPackage.Literals.STATE_MACHINE, true); 149 * 150 * 151 * Collection<List<Event>> umlSequences = new LinkedList<>(); 152 * 153 * // remove everything but transport from sequences for (List<Event> sequence : sequences) 154 * { for (Iterator<Event> eventIter = sequence.iterator(); eventIter.hasNext();) { Event 155 * event = eventIter.next(); if 156 * (!"TransportService".equals(SOAPUtils.getServiceNameFromEvent(event))) { 157 * eventIter.remove(); } } umlSequences.add(UMLUtils.createUMLTransitionSequence(sequence, 158 * stateMachine)); } 159 */ 160 161 Model model = 162 ModelUtils.loadModel(ClassLoader.getSystemResourceAsStream(testdata.dslModelFile)); 163 164 StateMachine stateMachine = 165 (StateMachine) model.getPackagedElement("StateMachineTransportService", true, 166 UMLPackage.Literals.STATE_MACHINE, true); 167 168 List<Event> manuallyCreatedSequence = new LinkedList<>(); 169 manuallyCreatedSequence 170 .add(new Event(new SimpleSOAPEventType("transportInstructionRequest", 171 "TransportService", "Logistics_Environment", 172 null))); 173 manuallyCreatedSequence 174 .add(new Event(new SimpleSOAPEventType("transportInstructionConfirmationRequest", 175 "materialSupplierService", 176 "Logistics_Environment", null))); 177 178 UMLUtils.createUMLTransitionSequence(manuallyCreatedSequence, stateMachine); 179 } 180 181 @Test 182 public void testConvertStateMachineToUsageProfile__ITA_1() throws Exception { 183 TestData testdata = ita_1; 184 185 assertTrue("test currently not working", false); 186 143 187 Properties properties = loadProperties(testdata); 144 188 Collection<List<Event>> sequences = loadAndPreprocessUsageJournal(testdata, properties); 145 189 Model model = 146 190 ModelUtils.loadModel(ClassLoader.getSystemResourceAsStream(testdata.dslModelFile)); 147 148 191 StateMachine stateMachine = 149 192 (StateMachine) model.getPackagedElement("StateMachineTransportService", true, … … 156 199 for (Iterator<Event> eventIter = sequence.iterator(); eventIter.hasNext();) { 157 200 Event event = eventIter.next(); 158 SOAPEventType eventType = (SOAPEventType) event.getType(); 159 if (!"TransportService".equals(eventType.getServiceName())) { 201 if (!"TransportService".equals(SOAPUtils.getServiceNameFromEvent(event))) { 160 202 eventIter.remove(); 161 203 } … … 163 205 umlSequences.add(UMLUtils.createUMLTransitionSequence(sequence, stateMachine)); 164 206 } 165 } 166 167 @Test 168 public void testConvertStateMachineToUsageProfile__ITA_1() throws Exception { 169 TestData testdata = ita_1; 170 171 Properties properties = loadProperties(testdata); 172 Collection<List<Event>> sequences = loadAndPreprocessUsageJournal(testdata, properties); 173 174 Model model = 175 ModelUtils.loadModel(ClassLoader.getSystemResourceAsStream(testdata.dslModelFile)); 176 177 // remove everything but transport from sequences 178 for (List<Event> sequence : sequences) { 179 for (Iterator<Event> eventIter = sequence.iterator(); eventIter.hasNext();) { 180 Event event = eventIter.next(); 181 SOAPEventType eventType = (SOAPEventType) event.getType(); 182 if (!"TransportService".equals(eventType.getServiceName())) { 183 eventIter.remove(); 184 } 185 } 186 } 187 188 StateMachine stateMachine = 189 (StateMachine) model.getPackagedElement("StateMachineTransportService", true, 190 UMLPackage.Literals.STATE_MACHINE, true); 191 192 UMLUtils.convertStateMachineToUsageProfile(sequences, stateMachine); 207 208 UMLUtils.convertStateMachineToUsageProfile(umlSequences, stateMachine); 193 209 194 210 ModelUtils.writeModelToFile(model, OUTPUT_DIR + "ita_v2_result.uml"); … … 304 320 int[] lengths = new int[generatedSequences.size()]; 305 321 for (List<Event> sequence : generatedSequences) { 306 interactions.add(UMLUtils.createInteractionFromEventSequence(sequence, model, 307 properties.getProperty("testcases.prefix") + 308 "_" + i, 309 properties.getProperty("test.context"))); 322 interactions.add(UMLUtils 323 .createInteractionFromEventSequence(sequence, model, 324 properties.getProperty("testcases.prefix") + 325 "_" + i, 326 properties.getProperty("test.context"))); 310 327 lengths[i - 1] = sequence.size(); 311 328 i++; … … 385 402 } 386 403 387 private IStochasticProcess createUsageProfile(TestData testdata, Collection<List<Event>> sequences) 404 private IStochasticProcess createUsageProfile(TestData testdata, 405 Collection<List<Event>> sequences) 388 406 throws Exception 389 407 {
Note: See TracChangeset
for help on using the changeset viewer.