Added Junit test cases for Simulator Java APIs.
[platform/upstream/iotivity.git] / service / simulator / unittests / SimulatorTest / src / org / oic / simulator / clientcontroller / test / PostListener.java
1 package org.oic.simulator.clientcontroller.test;
2
3 import java.util.concurrent.CountDownLatch;
4
5 import org.oic.simulator.SimulatorResourceModel;
6 import org.oic.simulator.clientcontroller.IPostListener;
7
8 public class PostListener implements IPostListener
9 {
10
11     private CountDownLatch lockObject;
12     private ListenerObject getListenerObject;
13
14     public PostListener(CountDownLatch lockObject, ListenerObject getListenerObject)
15     {
16         this.lockObject = lockObject;
17         this.getListenerObject = getListenerObject;
18     }
19
20     @Override
21     public void onPostCompleted(String uId, SimulatorResourceModel representation)
22     {
23         getListenerObject.setuId(uId);
24         getListenerObject.setRepresentation(representation);
25
26         lockObject.countDown();
27     }
28
29     @Override
30     public void onPostFailed(Throwable ex)
31     {
32         getListenerObject.setEx(ex);
33
34         lockObject.countDown();
35     }
36 }