From: Markus Jung Date: Tue, 2 Feb 2016 00:48:36 +0000 (+0900) Subject: Unit tests for android extension of resource contianer X-Git-Tag: 1.2.0+RC1~634^2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6f235d6981f4d241479c59d6b27e862dc4135a6;p=platform%2Fupstream%2Fiotivity.git Unit tests for android extension of resource contianer Added simple unit tests that have to be executed manually. Change-Id: I03759a8c8ba865a26488508899991e24686df64b Signed-off-by: Markus Jung Reviewed-on: https://gerrit.iotivity.org/gerrit/4909 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- diff --git a/service/resource-container/examples/android/RCSampleServerApp/app/src/androidTest/assets/lib/ResourceContainerConfig.xml b/service/resource-container/examples/android/RCSampleServerApp/app/src/androidTest/assets/lib/ResourceContainerConfig.xml new file mode 100755 index 0000000..4c52d93 --- /dev/null +++ b/service/resource-container/examples/android/RCSampleServerApp/app/src/androidTest/assets/lib/ResourceContainerConfig.xml @@ -0,0 +1,105 @@ + + + oic.bundle.discomfortIndexSensor + /data/local/tmp/org.iotivity.service.sample.resourcecontainer.test/files/libSoftSensorBundle.so + disensor + 1.0.0 + + + DiscomfortIndexSensor1 + oic.r.sensor + + + discomfortIndex + int + + + humidity + double + + + temperature + double + + + + + humidity + double + oic.r.humidity + + + temperature + double + oic.r.temperature + + + + + + + \ No newline at end of file diff --git a/service/resource-container/examples/android/RCSampleServerApp/app/src/androidTest/java/org/iotivity/service/sample/container/ResourceContainerTest.java b/service/resource-container/examples/android/RCSampleServerApp/app/src/androidTest/java/org/iotivity/service/sample/container/ResourceContainerTest.java new file mode 100755 index 0000000..53e4113 --- /dev/null +++ b/service/resource-container/examples/android/RCSampleServerApp/app/src/androidTest/java/org/iotivity/service/sample/container/ResourceContainerTest.java @@ -0,0 +1,73 @@ +/****************************************************************** + * + * 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.iotivity.service.sample.container; + +import android.test.InstrumentationTestCase; +import android.util.Log; + +import org.iotivity.service.resourcecontainer.RcsResourceContainer; + +import java.util.HashMap; + +public class ResourceContainerTest extends InstrumentationTestCase { + private RcsResourceContainer resourceContainerInstance; + private final String sdCardDir = + "/data/local/tmp/org.iotivity.service.sample.resourcecontainer.test/files/"; + + @Override + public void setUp(){ + resourceContainerInstance = new RcsResourceContainer(getInstrumentation().getContext()); + } + + public void testStartContainer() { + resourceContainerInstance.startContainer(""); + assertTrue(resourceContainerInstance.listBundles().size() == 0); + resourceContainerInstance.stopContainer(); + } + + public void testAddConfig(){ + resourceContainerInstance.startContainer(""); + //resourceContainerInstance.addBundle(""); + assertTrue(resourceContainerInstance.listBundles().size() == 0); + resourceContainerInstance.stopContainer(); + } + + public void testStartBundle(){ + resourceContainerInstance.startBundle("not.existing"); + assertEquals(0, resourceContainerInstance.listBundles().size()); + } + + public void testStopBundle(){ + resourceContainerInstance.startBundle("not.existing"); + assertEquals(0, resourceContainerInstance.listBundles().size()); + } + + public void testAddBundle(){ + resourceContainerInstance.startContainer( + ""); + + resourceContainerInstance.addBundle("oic.bundle.test", "", + sdCardDir + "libSoftSensorBundle.so", + "disensor", new HashMap()); + resourceContainerInstance.startBundle("oic.bundle.test"); + resourceContainerInstance.stopContainer(); + } +} \ No newline at end of file