Fixing issues

merge-requests/1/head
megala21 8 years ago
parent ee94b8ce8f
commit 976bdb2292

@ -1,8 +1,29 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.wso2.iot.integration.common;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import java.util.ArrayList;
@ -11,7 +32,6 @@ import java.util.ArrayList;
* This is a mqtt subscriber client to receive .
*/
public class MqttSubscriberClient implements MqttCallback {
private static Log log = LogFactory.getLog(MqttSubscriberClient.class);
private ArrayList<MqttMessage> mqttMessages;
@Override
@ -46,6 +66,7 @@ public class MqttSubscriberClient implements MqttCallback {
connectOptions.setUserName(accessToken);
connectOptions.setPassword("".toCharArray());
connectOptions.setCleanSession(true);
connectOptions.setKeepAliveInterval(300);
client.connect(connectOptions);
client.subscribe(topicName);
}

@ -34,11 +34,7 @@ import org.wso2.iot.integration.common.PayloadGenerator;
import org.wso2.iot.integration.common.RestClient;
import org.wso2.iot.integration.common.TestBase;
import org.wso2.iot.integration.samples.VirtualFireAlarmTestCase;
import java.sql.Timestamp;
import static org.wso2.iot.integration.samples.VirtualFireAlarmTestCase.deviceId1;
import static org.wso2.iot.integration.samples.VirtualFireAlarmTestCase.deviceId2;
import static org.wso2.iot.integration.samples.VirtualFireAlarmTestCase.*;
/**
* This class contains integration tests for user management backend services.
@ -175,11 +171,15 @@ public class UserManagement extends TestBase {
@Test(description = "Test whether data that is published is stored in analytics event table", dependsOnMethods =
{"testRemoveUser"} )
public void testBatchDataPersistence() throws Exception {
String deviceId1 =
this.userMode == TestUserMode.TENANT_ADMIN ? tenantDeviceId1 : VirtualFireAlarmTestCase.deviceId1;
String deviceId2 =
this.userMode == TestUserMode.TENANT_ADMIN ? tenantDeviceId2 : VirtualFireAlarmTestCase.deviceId2;
long MilliSecondDifference = System.currentTimeMillis() - VirtualFireAlarmTestCase.currentTime;
if (MilliSecondDifference < 300000) {
Thread.sleep(300000 - MilliSecondDifference);
}
Timestamp timestamp = new Timestamp(System.currentTimeMillis() - 7200000);
String url = Constants.VirtualFireAlarmConstants.STATS_ENDPOINT + "/" + deviceId1;
url += "?from=" + (VirtualFireAlarmTestCase.currentTime - 300000)/1000 + "&to=" + System.currentTimeMillis()
/1000;

@ -33,6 +33,7 @@
<class name="org.wso2.iot.integration.mobileDevice.MobileDeviceManagementWithNoDevices"/>
<class name="org.wso2.iot.integration.jmeter.AndroidDeviceManagementAPIJmeterTestCase"/>
<class name="org.wso2.iot.integration.mobileDevice.MobileDeviceManagement"/>
<class name="org.wso2.iot.integration.jmeter.PolicyManagementJMeterTestCase"/>
<class name="org.wso2.iot.integration.samples.VirtualFireAlarmTestCase"/>
<class name="org.wso2.iot.integration.device.enrollment.AndroidEnrollment"/>
<class name="org.wso2.iot.integration.device.operation.AndroidOperation"/>
@ -41,87 +42,10 @@
<class name="org.wso2.iot.integration.jmeter.GroupManagementJMeterTestCase"/>
<class name="org.wso2.iot.integration.jmeter.DeviceManagementAPINegativeTestCase"/>
<class name="org.wso2.iot.integration.jmeter.NotificationManagementAPIJMeterTestCase"/>
<class name="org.wso2.iot.integration.jmeter.PolicyManagementJMeterTestCase"/>
<class name="org.wso2.iot.integration.jmeter.AppManagerJmeterTestCase"/>
<class name="org.wso2.iot.integration.device.enrollment.AndroidSenseEnrollment"/>
<class name="org.wso2.iot.integration.samples.MobileQSGTestCase"/>
<class name="org.wso2.iot.integration.user.UserManagement"/>
</classes>
</test>
<!--<test name="android-jmeter" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.jmeter.AndroidDeviceManagementAPIJmeterTestCase"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="mobile-device-mgt" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.mobileDevice.MobileDeviceManagement"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="virtual-fire-alarm" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.samples.VirtualFireAlarmTestCase"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="android-enrollment" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.device.enrollment.AndroidEnrollment"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="android-operation" preserve-order="false" parallel="true">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.device.operation.AndroidOperation"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="android-configuration" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.device.configuration.AndroidConfigurationManagement"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="role-mgt" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.role.RoleManagement"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="group-mgt" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.jmeter.GroupManagementJMeterTestCase"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="negative-test" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.jmeter.DeviceManagementAPINegativeTestCase"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="notification-mgt" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.jmeter.NotificationManagementAPIJMeterTestCase"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="policy-mgt" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.jmeter.PolicyManagementJMeterTestCase"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="app-mgt" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.jmeter.AppManagerJmeterTestCase"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="android-sense-enrollment" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.device.enrollment.AndroidSenseEnrollment"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="mobile-qsg" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.samples.MobileQSGTestCase"/>-->
<!--</classes>-->
<!--</test>-->
<!--<test name="user-mgt" preserve-order="true" parallel="false">-->
<!--<classes>-->
<!--<class name="org.wso2.iot.integration.user.UserManagement"/>-->
<!--</classes>-->
<!--</test>-->
</suite>

Loading…
Cancel
Save