Beispiel #1
0
 @Test
 public void testIConnect() throws ActionFailedException {
   try {
     ObservationTimeSeries ts = new ObservationTimeSeries();
     ts.add(Observation.createRandomObservation());
     ts.add(Observation.createRandomObservation());
     ts.add(Observation.createRandomObservation());
     ts.add(Observation.createRandomObservation());
     ts.get(0).setTimestamp(System.currentTimeMillis());
     Thread.sleep(10);
     ts.get(1).setTimestamp(System.currentTimeMillis());
     Thread.sleep(10);
     ts.get(2).setTimestamp(System.currentTimeMillis());
     Thread.sleep(10);
     ts.get(3).setTimestamp(System.currentTimeMillis());
     src.setInput(ts);
     src.iConnect();
   } catch (InterruptedException exception) {
     exception.printStackTrace();
   }
 }
Beispiel #2
0
 @Test
 public void testScheduler() throws ActionFailedException {
   try {
     ObservationTimeSeries ts = new ObservationTimeSeries();
     for (int i = 0; i < ITERATIONS; i++) {
       ts.add(Observation.createRandomObservation());
     }
     for (int i = 0; i < ITERATIONS; i++) {
       Thread.sleep(1);
       ts.get(i).setTimestamp(System.currentTimeMillis());
     }
     src.setInput(ts);
     src.iConnect();
     synchronized (this) {
       this.wait(40 * ITERATIONS);
     }
   } catch (InterruptedException exception) {
     exception.printStackTrace();
   }
 }