- Timestamp:
- 11/16/12 13:51:11 (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/autoquest/eventcore/EventTest.java
r958 r996 313 313 } 314 314 315 @Test 316 public void testSetParameter_1() throws Exception { 317 Event fixture = new Event(mock(IEventType.class)); 318 assertNull(fixture.getParameter("key")); 319 } 320 321 @Test 322 public void testSetParameter_2() throws Exception { 323 Event fixture = new Event(mock(IEventType.class)); 324 fixture.setParameter("key", "value"); 325 assertEquals("value", fixture.getParameter("key")); 326 } 327 328 @Test 329 public void testSetParameter_3() throws Exception { 330 Event fixture = new Event(mock(IEventType.class)); 331 fixture.setParameter("key", "value"); 332 fixture.setParameter("key", null); 333 assertNull(fixture.getParameter("key")); 334 } 335 336 @Test 337 public void testSetParameter_4() throws Exception { 338 Event fixture = new Event(mock(IEventType.class)); 339 fixture.setParameter("key", "value"); 340 assertNull(fixture.getParameter("key2")); 341 } 342 343 @Test(expected = java.lang.IllegalArgumentException.class) 344 public void testSetParameter_5() throws Exception { 345 Event fixture = new Event(mock(IEventType.class)); 346 fixture.setParameter(null, null); 347 } 348 349 @Test(expected = java.lang.IllegalArgumentException.class) 350 public void testGetParameter_1() throws Exception { 351 Event fixture = new Event(mock(IEventType.class)); 352 fixture.getParameter(null); 353 } 354 355 @Test 356 public void testGetTimestamp_1() throws Exception { 357 Event fixture = new Event(mock(IEventType.class)); 358 assertTrue(fixture.getTimestamp() < 0); 359 } 360 361 @Test 362 public void testSetTimestamp_1() throws Exception { 363 Event fixture = new Event(mock(IEventType.class)); 364 fixture.setTimestamp(1234); 365 assertEquals(1234, fixture.getTimestamp()); 366 } 367 315 368 public static void main(String[] args) { 316 369 new org.junit.runner.JUnitCore().run(EventTest.class); -
trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/Event.java
r958 r996 24 24 * <p> 25 25 * Base class for all events. An event is described by its {@link #type} and its {@link #target}. 26 * An event may be provided with a timestamp and further parameters. 26 27 * </p> 27 28 * … … 62 63 63 64 /** 64 * </p> Target of the event. 65 * <p> 66 * Target of the event. 67 * </p> 65 68 */ 66 69 private IEventTarget target = null; 70 71 /** 72 * <p> 73 * Timestamp of when the event took place. 74 * </p> 75 */ 76 private long timestamp = Long.MIN_VALUE; 67 77 68 78 /** … … 114 124 /** 115 125 * <p> 116 * Two events are equal, if their {@link #type} and {@link #target} are equal. 126 * Two events are equal, if their {@link #type} and {@link #target} are equal. The timestamp 127 * and other parameters are ignored. 117 128 * </p> 118 129 * <p> … … 309 320 /** 310 321 * <p> 322 * Sets the timestamp of the event, i.e. when the event occurred. A timestamp for events is 323 * optional. Therefore it is also ignored by the {@link #equals(Object)}-method. A timestamp 324 * with a value smaller 0 means, that now timestamp for the event exists. 325 * </p> 326 * 327 * @param timestamp the new value for the timestamp 328 */ 329 public void setTimestamp(long timestamp) { 330 this.timestamp = timestamp; 331 } 332 333 /** 334 * <p> 335 * Returns the timestamp of the event or a value lower than 0 if no timestamp for the event 336 * exists. 337 * </p> 338 * 339 * @return the timestamp of the event or a value lower than 0 if no timestamp exists 340 */ 341 public long getTimestamp() { 342 return timestamp; 343 } 344 345 /** 346 * <p> 311 347 * Returns a the list of replay events. 312 348 * </p> -
trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/HTMLLogParser.java
r975 r996 356 356 Event event = new Event(interaction, guiElement); 357 357 event.setParameter("clientId", clientId); 358 event.setParameter("timestamp", Long.toString(timestamp));359 358 event.setParameter("agent", agent); 359 360 event.setTimestamp(timestamp); 360 361 361 362 return event;
Note: See TracChangeset
for help on using the changeset viewer.