Review comment changes for Simulator Junit.
authorspurthi.segu <spurthi.segu@samsung.com>
Tue, 6 Oct 2015 06:05:55 +0000 (11:35 +0530)
committerUze Choi <uzchoi@samsung.com>
Tue, 6 Oct 2015 23:07:57 +0000 (23:07 +0000)
Change-Id: Ia20ffbfefef7c6715ebf277c7c0093c410b0e755
Signed-off-by: spurthi.segu <spurthi.segu@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3589
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
20 files changed:
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/clientcontroller/test/GetListener.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/clientcontroller/test/ListenerObject.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/clientcontroller/test/ObserveListener.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/clientcontroller/test/ObserveListenerObject.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/clientcontroller/test/PostListener.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/clientcontroller/test/PutListener.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/clientcontroller/test/SimulatorRemoteResourceTest.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/clientcontroller/test/VerifyListener.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/clientcontroller/test/VerifyListenerObject.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/serviceprovider/test/AutomationListener.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/serviceprovider/test/AutomationObject.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/serviceprovider/test/Observer.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/serviceprovider/test/ObserverObject.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/serviceprovider/test/SimlatorResourceServerTest.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/test/FindResourceListener.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/test/ResourceModelChangeListener.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/test/ResourceModelObject.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/test/SimulatorManagerTest.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/test/SimulatorRemoteResourceObject.java
service/simulator/unittests/SimulatorTest/src/org/oic/simulator/test/SimulatorResourceModelTest.java

index c421083..ed9fd7e 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.clientcontroller.test;
 
 import java.util.concurrent.CountDownLatch;
@@ -5,6 +21,10 @@ import java.util.concurrent.CountDownLatch;
 import org.oic.simulator.SimulatorResourceModel;
 import org.oic.simulator.clientcontroller.IGetListener;
 
+/**
+ * This class implements methods for receiving notification when
+ * response is received for GET request.
+ */
 public class GetListener implements IGetListener
 {
 
@@ -20,8 +40,10 @@ public class GetListener implements IGetListener
     @Override
     public void onGetCompleted(String uId, SimulatorResourceModel representation)
     {
-        getListenerObject.setuId(uId);
-        getListenerObject.setRepresentation(representation);
+        if (null != getListenerObject) {
+            getListenerObject.setuId(uId);
+            getListenerObject.setRepresentation(representation);
+        }
 
         lockObject.countDown();
     }
@@ -29,7 +51,8 @@ public class GetListener implements IGetListener
     @Override
     public void onGetFailed(Throwable ex)
     {
-        getListenerObject.setEx(ex);
+        if (null != getListenerObject)
+            getListenerObject.setEx(ex);
 
         lockObject.countDown();
     }
index ad2bba6..860cf6a 100644 (file)
@@ -1,7 +1,27 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.clientcontroller.test;
 
 import org.oic.simulator.SimulatorResourceModel;
 
+/**
+ * This class implements methods for setting/getting UID and
+ * resource representation.
+ */
 public class ListenerObject
 {
 
index 72c08e7..ecc6c10 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.clientcontroller.test;
 
 import java.util.concurrent.CountDownLatch;
@@ -5,6 +21,10 @@ import java.util.concurrent.CountDownLatch;
 import org.oic.simulator.SimulatorResourceModel;
 import org.oic.simulator.clientcontroller.IObserveListener;
 
+/**
+ * This class implements methods for receiving notification when
+ * response is received for Observe request.
+ */
 public class ObserveListener implements IObserveListener
 {
 
index 48edc47..6bcca0c 100644 (file)
@@ -1,10 +1,29 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.clientcontroller.test;
 
 import org.oic.simulator.SimulatorResourceModel;
 
+/**
+ * This class implements methods for setting/getting UID,
+ * resource representation and sequence number for observe.
+ */
 public class ObserveListenerObject
 {
-
     private String uId;
     private SimulatorResourceModel representation;
     private int sequenceNumber;
index 8a4b394..3942b51 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.clientcontroller.test;
 
 import java.util.concurrent.CountDownLatch;
@@ -5,23 +21,29 @@ import java.util.concurrent.CountDownLatch;
 import org.oic.simulator.SimulatorResourceModel;
 import org.oic.simulator.clientcontroller.IPostListener;
 
+/**
+ * This class implements methods for receiving notification when
+ * response is received for POST request.
+ */
 public class PostListener implements IPostListener
 {
 
     private CountDownLatch lockObject;
-    private ListenerObject getListenerObject;
+    private ListenerObject postListenerObject;
 
-    public PostListener(CountDownLatch lockObject, ListenerObject getListenerObject)
+    public PostListener(CountDownLatch lockObject, ListenerObject postListenerObject)
     {
         this.lockObject = lockObject;
-        this.getListenerObject = getListenerObject;
+        this.postListenerObject = postListenerObject;
     }
 
     @Override
     public void onPostCompleted(String uId, SimulatorResourceModel representation)
     {
-        getListenerObject.setuId(uId);
-        getListenerObject.setRepresentation(representation);
+        if (null != postListenerObject) {
+            postListenerObject.setuId(uId);
+            postListenerObject.setRepresentation(representation);
+        }
 
         lockObject.countDown();
     }
@@ -29,7 +51,8 @@ public class PostListener implements IPostListener
     @Override
     public void onPostFailed(Throwable ex)
     {
-        getListenerObject.setEx(ex);
+        if (null != postListenerObject)
+            postListenerObject.setEx(ex);
 
         lockObject.countDown();
     }
index 1ecd076..1dafed3 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.clientcontroller.test;
 
 import java.util.concurrent.CountDownLatch;
@@ -5,23 +21,28 @@ import java.util.concurrent.CountDownLatch;
 import org.oic.simulator.SimulatorResourceModel;
 import org.oic.simulator.clientcontroller.IPutListener;
 
+/**
+ * This class implements methods for receiving notification when
+ * response is received for PUT request.
+ */
 public class PutListener implements IPutListener
 {
-
     private CountDownLatch lockObject;
-    private ListenerObject listenerObject;
+    private ListenerObject putListenerObject;
 
-    public PutListener(CountDownLatch lockObject, ListenerObject listenerObject)
+    public PutListener(CountDownLatch lockObject, ListenerObject putListenerObject)
     {
         this.lockObject = lockObject;
-        this.listenerObject = listenerObject;
+        this.putListenerObject = putListenerObject;
     }
 
     @Override
     public void onPutCompleted(String uId, SimulatorResourceModel representation)
     {
-        listenerObject.setuId(uId);
-        listenerObject.setRepresentation(representation);
+        if (null != putListenerObject) {
+            putListenerObject.setuId(uId);
+            putListenerObject.setRepresentation(representation);
+        }
 
         lockObject.countDown();
     }
@@ -29,7 +50,8 @@ public class PutListener implements IPutListener
     @Override
     public void onPutFailed(Throwable ex)
     {
-        listenerObject.setEx(ex);
+        if (null != putListenerObject)
+            putListenerObject.setEx(ex);
 
         lockObject.countDown();
     }
index 59b2f61..0ceab6d 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.clientcontroller.test;
 
 import java.util.HashMap;
@@ -18,9 +34,12 @@ import org.oic.simulator.test.ResourceModelChangeListener;
 import org.oic.simulator.test.ResourceModelObject;
 import org.oic.simulator.test.SimulatorRemoteResourceObject;
 
+/**
+ * This class tests the functionality of Simulator Remote Resource
+ * class APIs.
+ */
 public class SimulatorRemoteResourceTest extends TestCase
 {
-
     private static final String CONFIG_PATH = "./ramls/simple-light.raml";
     //  private static final String RESOURCE_TYPE = "oic.light";
 
@@ -117,7 +136,6 @@ public class SimulatorRemoteResourceTest extends TestCase
         assertNotNull(simulatorRemoteResource.getId());
     }
 
-    //TODO call back not coming
     public void testStartObserve_P01()
     {
         boolean result = true;
@@ -161,7 +179,6 @@ public class SimulatorRemoteResourceTest extends TestCase
         observeListener = null;
     }
 
-    //TODO call back not coming
     public void testStopObserve_P01()
     {
         boolean result = true;
@@ -335,31 +352,6 @@ public class SimulatorRemoteResourceTest extends TestCase
         assertTrue(result && listenerObject != null && listenerObject.getRepresentation() != null && listenerObject.getuId() != null);
     }
 
-    /**
-     * model as null
-     */
-    //TODO crashing
-    /*public void testPut_N01() {
-        boolean result = true;
-        ListenerObject listenerObject = new ListenerObject();
-        PutListener putListener = new PutListener(lockObject, listenerObject);
-
-        try {
-            simulatorRemoteResource.put(null, null, putListener);
-            result = false;
-        } catch (Exception e1) {
-            result = true;
-        }
-
-        try {
-            lockObject.await(10, TimeUnit.SECONDS);
-        } catch (InterruptedException e) {
-        }
-
-        assertTrue(result && listenerObject.getRepresentation() == null && listenerObject.getuId() == null);
-    }*/
-
-    //TODO fail
     public void testPost_P01()
     {
         boolean result = true;
@@ -393,34 +385,6 @@ public class SimulatorRemoteResourceTest extends TestCase
         assertTrue(result && listenerObject != null && listenerObject.getRepresentation() != null && listenerObject.getuId() != null);
     }
 
-    /**
-     * Model is set to null
-     */
-    //TODO crash
-    /*public void testPost_N01() {
-        boolean result = true;
-
-        lockObject = new CountDownLatch(1);
-
-        ListenerObject listenerObject = new ListenerObject();
-        PostListener postListener = new PostListener(lockObject, listenerObject);
-
-        try {
-            simulatorRemoteResource.post(null, null, postListener);
-            result = false;
-        } catch (Exception e1) {
-            result = true;
-        }
-
-        try {
-            lockObject.await(10, TimeUnit.SECONDS);
-        } catch (InterruptedException e) {
-        }
-
-        assertTrue(result && listenerObject.getRepresentation() == null && listenerObject.getuId() == null);
-    }*/
-
-    //TODO failign
     public void testGet_P01()
     {
         boolean result = true;
@@ -458,7 +422,6 @@ public class SimulatorRemoteResourceTest extends TestCase
     /**
      * null resInterface
      */
-    //TODO failing
     public void testGet_N01()
     {
         boolean result = false;
@@ -492,7 +455,6 @@ public class SimulatorRemoteResourceTest extends TestCase
     /**
      * null listener
      */
-    //TODO failing
     public void testGet_N02()
     {
         boolean result = false;
@@ -580,7 +542,6 @@ public class SimulatorRemoteResourceTest extends TestCase
         assertTrue(result);
     }
 
-    //TODO Resource does not support this request type!
     public void testSetConfigInfo_P01()
     {
         boolean result = true;
@@ -640,7 +601,6 @@ public class SimulatorRemoteResourceTest extends TestCase
         assertTrue(result);
     }
 
-    //TODO Resource does not support this request type!
     public void testStartVerification_P01()
     {
         boolean result = true;
@@ -680,7 +640,6 @@ public class SimulatorRemoteResourceTest extends TestCase
                    verifyListenerObject.getId() != -1);
     }
 
-    //TODO Resource does not support this request type!
     public void testStartVerification_P02()
     {
         boolean result = true;
@@ -720,7 +679,6 @@ public class SimulatorRemoteResourceTest extends TestCase
                    verifyListenerObject.getId() != -1);
     }
 
-    //TODO Resource does not support this request type!
     public void testStartVerification_P03()
     {
         boolean result = true;
@@ -763,7 +721,6 @@ public class SimulatorRemoteResourceTest extends TestCase
     /**
      * setting listener to null
      */
-    //TODO Resource does not support this request type!
     public void testStartVerification_N01()
     {
         boolean result = true;
@@ -789,7 +746,6 @@ public class SimulatorRemoteResourceTest extends TestCase
         assertTrue(result);
     }
 
-    //TODO Resource does not support this request type!
     public void testStopVerification_P01()
     {
         boolean result = true;
@@ -855,7 +811,6 @@ public class SimulatorRemoteResourceTest extends TestCase
     /**
      * Random id. This is just to check the crash
      */
-    //TODO Resource does not support this request type!
     public void testStopVerification_N01()
     {
         boolean result = true;
index 2f39b3f..2e16ef5 100644 (file)
@@ -1,9 +1,29 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.clientcontroller.test;
 
 import java.util.concurrent.CountDownLatch;
 
 import org.oic.simulator.clientcontroller.IVerificationListener;
 
+/**
+ * This class implements listeners for getting verification
+ * status callbacks.
+ */
 public class VerifyListener implements IVerificationListener
 {
 
index 4ee3039..45a2eaf 100644 (file)
@@ -1,5 +1,25 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.clientcontroller.test;
 
+/**
+ * This class tests the functionality of getting/setting
+ * verification ID.
+ */
 public class VerifyListenerObject
 {
 
index dbe9490..cb545db 100644 (file)
@@ -1,9 +1,28 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.serviceprovider.test;
 
 import java.util.concurrent.CountDownLatch;
-
 import org.oic.simulator.IAutomation;
 
+/**
+ * This class implements methods for receiving notifications on
+ * completion of automation.
+ */
 public class AutomationListener implements IAutomation
 {
 
index 2f13072..9ada5d8 100644 (file)
@@ -1,5 +1,25 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.serviceprovider.test;
 
+/**
+ * This class implements methods for setting/getting URI
+ * and automation ID.
+ */
 public class AutomationObject
 {
 
index 4853ab0..ca69964 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.serviceprovider.test;
 
 import java.util.concurrent.CountDownLatch;
@@ -5,9 +21,12 @@ import java.util.concurrent.CountDownLatch;
 import org.oic.simulator.serviceprovider.IObserver;
 import org.oic.simulator.serviceprovider.ObserverInfo;
 
+/**
+ * This class implements methods for receiving observer
+ * change callbacks.
+ */
 public class Observer implements IObserver
 {
-
     private CountDownLatch lockObject;
     private ObserverObject observerObject;
 
index 6653772..14bd6a1 100644 (file)
@@ -1,10 +1,29 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.serviceprovider.test;
 
 import org.oic.simulator.serviceprovider.ObserverInfo;
 
+/**
+ * This class provides methods to set/get observers and state
+ * information.
+ */
 public class ObserverObject
 {
-
     private String resourceURI;
     private int state;
     private ObserverInfo observer;
index 381453d..0952af1 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.serviceprovider.test;
 
 import java.util.Vector;
@@ -16,6 +32,10 @@ import org.oic.simulator.serviceprovider.SimulatorResourceServer;
 import org.oic.simulator.test.ResourceModelChangeListener;
 import org.oic.simulator.test.ResourceModelObject;
 
+/**
+ * This class tests the functionality of Simulator Resource Server
+ * class APIs.
+ */
 public class SimlatorResourceServerTest extends TestCase
 {
 
@@ -123,7 +143,6 @@ public class SimlatorResourceServerTest extends TestCase
         assertEquals(Double.parseDouble(getValue(KEY) + ""), 4.0);
     }
 
-    //TODO failing
     public void testAddAttributeBoolean_P01()
     {
         try
@@ -211,7 +230,6 @@ public class SimlatorResourceServerTest extends TestCase
         assertTrue(result);
     }
 
-    //TODO failing
     public void testUpdateAttributeBoolean_P01()
     {
         boolean result = true;
@@ -309,7 +327,6 @@ public class SimlatorResourceServerTest extends TestCase
     /**
      * Try to set the value out of range
      */
-    //TODO failing
     public void testSetRange_N01()
     {
         boolean result = true;
@@ -342,7 +359,6 @@ public class SimlatorResourceServerTest extends TestCase
         assertTrue(result);
     }
 
-    //TODO failing
     public void testSetAllowedValuesInteger_P01()
     {
         boolean result = true;
@@ -393,7 +409,6 @@ public class SimlatorResourceServerTest extends TestCase
     /**
      * Try setting with out of range
      */
-    //TODO failing
     public void testSetAllowedValuesInteger_N01()
     {
         boolean result = true;
@@ -444,7 +459,6 @@ public class SimlatorResourceServerTest extends TestCase
     /**
      * Try setting values multiple times
      */
-    //TODO failing
     public void testSetAllowedValuesDouble_P01()
     {
         boolean result = true;
@@ -495,7 +509,6 @@ public class SimlatorResourceServerTest extends TestCase
     /**
      * Try setting with out of range
      */
-    //TODO failing
     public void testSetAllowedValuesDouble_N01()
     {
         boolean result = true;
@@ -543,7 +556,6 @@ public class SimlatorResourceServerTest extends TestCase
         assertTrue(result);
     }
 
-    //TODO failing
     public void testsetAllowedValuesString_P01()
     {
         boolean result = true;
@@ -593,7 +605,6 @@ public class SimlatorResourceServerTest extends TestCase
     /**
      * Set the value that is not in allowed values
      */
-    //TODO failing
     public void testsetAllowedValuesString_N01()
     {
         boolean result = true;
@@ -673,7 +684,6 @@ public class SimlatorResourceServerTest extends TestCase
     /**
      * Try removing the attribute thats not present
      */
-    //TODO failing
     public void testRemoveAttribute_N01()
     {
         boolean result = false;
@@ -712,7 +722,6 @@ public class SimlatorResourceServerTest extends TestCase
     /**
      * Try removing when attribute is empty
      */
-    //TODO failing
     public void testRemoveAttribute_N03()
     {
         boolean result = false;
@@ -729,7 +738,6 @@ public class SimlatorResourceServerTest extends TestCase
         assertTrue(result);
     }
 
-    //TODO failing
     public void testStartResourceAutomation_P01()
     {
         boolean result = true;
@@ -771,7 +779,6 @@ public class SimlatorResourceServerTest extends TestCase
     /**
      * null listener
      */
-    //TODO failing
     public void testStartResourceAutomation_N01()
     {
         boolean result = true;
@@ -787,7 +794,6 @@ public class SimlatorResourceServerTest extends TestCase
         assertTrue(result && id == -1);
     }
 
-    //TODO failing
     public void testStartAttributeAutomation_P01()
     {
         boolean result = true;
@@ -846,7 +852,6 @@ public class SimlatorResourceServerTest extends TestCase
         assertTrue(result && id != -1);
     }
 
-    //TODO failing
     public void testStopAutomation_P01()
     {
         boolean result = true;
@@ -892,7 +897,6 @@ public class SimlatorResourceServerTest extends TestCase
      * checking for crash
      * random id
      */
-    //TODO failing
     public void testStopAutomation_N01()
     {
         boolean result = false;
index ba840b0..a8469aa 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.test;
 
 import java.util.concurrent.CountDownLatch;
@@ -5,6 +21,10 @@ import java.util.concurrent.CountDownLatch;
 import org.oic.simulator.clientcontroller.IFindResourceListener;
 import org.oic.simulator.clientcontroller.SimulatorRemoteResource;
 
+/**
+ * This class implements methods for receiving notification when
+ * resources are discovered in network.
+ */
 public class FindResourceListener implements IFindResourceListener
 {
 
index 6c651c0..9c199b8 100644 (file)
@@ -1,8 +1,28 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.test;
 
 import org.oic.simulator.SimulatorResourceModel;
 import org.oic.simulator.serviceprovider.IResourceModelChangedListener;
 
+/**
+ * This class implements methods for receiving notification when
+ *  resource model is changed.
+ */
 public class ResourceModelChangeListener implements IResourceModelChangedListener
 {
 
index fdea49b..b636d6a 100644 (file)
@@ -1,7 +1,27 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.test;
 
 import org.oic.simulator.SimulatorResourceModel;
 
+/**
+ * This class implements methods for setting/getting
+ * resource model.
+ */
 public class ResourceModelObject
 {
     private String resourceURI;
index 205f383..c46653c 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.test;
 
 import java.util.concurrent.CountDownLatch;
@@ -8,11 +24,15 @@ import org.oic.simulator.PlatformInfo;
 import org.oic.simulator.SimulatorManager;
 import org.oic.simulator.serviceprovider.SimulatorResourceServer;
 
+/**
+ * This class tests the functionality of Simulator Manager
+ * class APIs.
+ */
 public class SimulatorManagerTest extends TestCase
 {
 
     private static final String CONFIG_PATH = "./ramls/simple-light.raml";
-    private static final String RESOURCE_TYPE = "oic.light";
+    private static final String RESOURCE_TYPE = "oic.r.light";
 
     private CountDownLatch lockObject;
     private ResourceModelObject resourceModelObject;
@@ -257,18 +277,6 @@ public class SimulatorManagerTest extends TestCase
         assertTrue(simulatorResourceServers == null);
     }
 
-    /**
-     * When count is set to -ve
-     */
-    //TODO issue. Not coming out of loop
-    /*public void testCreateResourceCount_N05() {
-        int count = -10;
-
-        SimulatorResourceServer[] simulatorResourceServers = createResources(count);
-
-        assertTrue(simulatorResourceServers != null && simulatorResourceServers.length == 0);
-    }*/
-
     public void testDeleteResource_P01()
     {
         boolean result = true;
@@ -375,7 +383,7 @@ public class SimulatorManagerTest extends TestCase
     }
 
     /**
-     *  checkign for crash
+     *  checking for crash
      */
     public void testSetDeviceInfo_P01()
     {
@@ -383,58 +391,16 @@ public class SimulatorManagerTest extends TestCase
     }
 
     /**
-     *  checkign for crash
+     *  checking for crash
      *  Pass empty
      */
-    //TODO failing
     public void testSetDeviceInfo_N01()
     {
         SimulatorManager.setDeviceInfo("");
     }
 
     /**
-     *  checkign for crash
-     * pass null
-     */
-    //TODO failign
-    public void testSetDeviceInfo_N02()
-    {
-        SimulatorManager.setDeviceInfo(null);
-    }
-
-    //TODO crashing
-    /*public void testGetDeviceInfo_P01() {
-
-        lockObject = new CountDownLatch(1);
-
-        SimulatorManager.getDeviceInfo(new IDeviceInfo() {
-
-            @Override
-            public void onDeviceFound(DeviceInfo devInfo) {
-                info = devInfo;
-                lockObject.countDown();
-            }
-        });
-
-        try {
-            lockObject.await(10, TimeUnit.SECONDS);
-        } catch (InterruptedException e) {
-        }
-
-        assertNotNull(info);
-    }*/
-
-    /**
-     * when listener is null
-     * Checkign crash
-     */
-    //TODO crashing
-    /*public void testGetDeviceInfo_N01() {
-        SimulatorManager.getDeviceInfo(null);
-    }*/
-
-    /**
-     * Checkign for crash
+     * Checking for crash
      */
     public void testSetPlatformInfo_P01()
     {
@@ -453,52 +419,4 @@ public class SimulatorManagerTest extends TestCase
 
         SimulatorManager.setPlatformInfo(platformInfo);
     }
-
-    /**
-     * Checkign for crash
-     */
-    //TODO crashing
-    /*public void testSetPlatformInfo_N01() {
-        SimulatorManager.setPlatformInfo(null);
-    }*/
-
-    /**
-     * Checkign for crash
-     */
-    //TODO crashing
-    /*public void testSetPlatformInfo_N02() {
-        SimulatorManager.setPlatformInfo(new PlatformInfo());
-    }*/
-
-    /**
-     * Checkign for crash
-     */
-    //TODO crashing
-    /*public void testGetPlatformInfo_P01() {
-        lockObject = new CountDownLatch(1);
-
-        SimulatorManager.getPlatformInfo(new IPlatformInfo() {
-
-            @Override
-            public void onPlatformFound(PlatformInfo info) {
-                platformInfo = info;
-            }
-        });
-
-        try {
-            lockObject.await(10, TimeUnit.SECONDS);
-        } catch (InterruptedException e) {
-        }
-
-        assertNotNull(platformInfo);
-    }*/
-
-    /**
-     * Setting listener to null
-     * Checkign for crash
-     */
-    //TODO crashing
-    /*public void testGetPlatformInfo_N01() {
-        SimulatorManager.getPlatformInfo(null);
-    }*/
-}
\ No newline at end of file
+}
index 55548cd..17c5196 100644 (file)
@@ -1,7 +1,26 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.test;
 
 import org.oic.simulator.clientcontroller.SimulatorRemoteResource;
 
+/**
+ * This class provides methods to set/get remote resource objects.
+ */
 public class SimulatorRemoteResourceObject
 {
 
index 05b2f3c..23448e4 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator.test;
 
 import java.util.Map;
@@ -7,6 +23,10 @@ import junit.framework.TestCase;
 import org.oic.simulator.ResourceAttribute;
 import org.oic.simulator.SimulatorResourceModel;
 
+/**
+ * This class tests the functionality of Simulator Resource Model
+ * class APIs.
+ */
 public class SimulatorResourceModelTest extends TestCase
 {
 
@@ -183,24 +203,6 @@ public class SimulatorResourceModelTest extends TestCase
         assertTrue(result);
     }
 
-    /**
-     * Crashing. Not handled
-     */
-    //TODO check
-    /*public void testAddAttributeString_N02() {
-        String val = null;
-
-        boolean result = true;
-        try {
-            simulatorResourceModel.addAttributeString(KEY, val);
-            result = result && simulatorResourceModel.getAttribute(KEY).getValue().toString().equals(val);
-        } catch(Exception e) {
-            result = false;
-        }
-
-        assertTrue(result);
-    }*/
-
     public void testAddAttributeString_N03()
     {
         String val = "@#$$&^*^(*^&";
@@ -219,7 +221,6 @@ public class SimulatorResourceModelTest extends TestCase
         assertTrue(result);
     }
 
-    //TODO boolean not able to set
     public void testAddAttributeBoolean_P01()
     {
         boolean result = true;
@@ -269,7 +270,6 @@ public class SimulatorResourceModelTest extends TestCase
         assertTrue(result);
     }
 
-    //TODO boolean not able to set
     public void testGetAttributes_P01()
     {
         boolean result = true;