예제 #1
0
  /** Test of setPeriods method, of class PhoneSignalDetector. */
  @Test
  public void testSetPeriods() throws Exception {
    det.start();
    gen.start();

    semaphore.tryAcquire(10, TimeUnit.SECONDS);

    assertTrue("Event not detected", evtDetected);
  }
예제 #2
0
  @Before
  public void setUp() {
    timer = new TimerImpl();
    timer.start();
    short A = Short.MAX_VALUE / 2;

    int[] F = new int[] {100, 200};
    int[] T = new int[] {1, 1};

    gen = new PhoneSignalGenerator("phone.gen", timer);
    gen.setAmplitude((short) 320);
    gen.setFrequency(F);
    gen.setPeriods(T);

    det = new PhoneSignalDetector("phone.detector");
    det.setFrequency(F);
    det.setPeriods(T);
    det.setVolume(-30);
    det.setEventID(50);
    det.addListener(this);
    gen.connect(det);
  }