2 * ***************************************************************
\r
4 * Copyright 2015 Samsung Electronics All Rights Reserved.
\r
8 * Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * you may not use this file except in compliance with the License.
\r
10 * You may obtain a copy of the License at
\r
12 * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * Unless required by applicable law or agreed to in writing, software
\r
15 * distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * See the License for the specific language governing permissions and
\r
18 * limitations under the License.
\r
20 * ****************************************************************
\r
23 package org.iotivity.service.easysetup.mediator;
\r
25 import android.net.wifi.WifiConfiguration;
\r
26 import android.test.AndroidTestCase;
\r
28 public class EnrolleeDeviceFactoryTest extends AndroidTestCase {
\r
30 EnrolleeDeviceFactory mFactory;
\r
33 protected void setUp() throws Exception {
\r
35 mFactory = EnrolleeDeviceFactory.newInstance(getContext());
\r
36 assertTrue(mFactory != null);
\r
41 protected void tearDown() throws Exception {
\r
47 public void testNewEnrolleeDevice_with_WiFiOnboarding() {
\r
49 /* Create On boarding configuration */
\r
50 WiFiOnBoardingConfig mWiFiOnBoardingConfig = new WiFiOnBoardingConfig();
\r
51 mWiFiOnBoardingConfig.setSSId("EasySetup123");
\r
52 mWiFiOnBoardingConfig.setSharedKey("EasySetup123");
\r
53 mWiFiOnBoardingConfig.setAuthAlgo(WifiConfiguration.AuthAlgorithm.OPEN);
\r
54 mWiFiOnBoardingConfig.setKms(WifiConfiguration.KeyMgmt.WPA_PSK);
\r
56 /* Create provisioning configuration */
\r
57 WiFiProvConfig mWiFiProvConfig = new WiFiProvConfig("hub2.4G", "11112222");
\r
59 /* Create enrolling device */
\r
60 EnrolleeDevice device = mFactory.newEnrolleeDevice(mWiFiOnBoardingConfig, mWiFiProvConfig);
\r
62 /* Check if the the device is created */
\r
63 assertTrue(device != null);
\r
65 /* Check if the the correct device is created as per the given configuration*/
\r
66 assertTrue((device instanceof EnrolleeDeviceWiFiOnboarding));
\r