Added copying mobile db scripts to bin.xml & refactored code

revert-dabc3590
harshanL 10 years ago
parent b03443a30f
commit e40424c758

@ -19,6 +19,8 @@
package org.wso2.carbon.device.mgt.mobile.impl.dao;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Parameters;
@ -44,6 +46,7 @@ import java.util.List;
public class MobileFeatureDAOTestSuite {
private static final Log log = LogFactory.getLog(MobileFeatureDAOTestSuite.class);
public static final String MBL_FEATURE_NAME = "Camera";
private static final String MBL_FEATURE_CODE = "500A";
public static final String MBL_FEATURE_DESCRIPTION = "Camera enable or disable";
@ -139,6 +142,7 @@ public class MobileFeatureDAOTestSuite {
}
conn.close();
} catch (SQLException e) {
log.error("Error in retrieving Mobile Feature data ", e);
throw new MobileDeviceManagementDAOException("Error in retrieving Mobile Feature data ",
e);
} finally {
@ -182,6 +186,7 @@ public class MobileFeatureDAOTestSuite {
}
conn.close();
} catch (SQLException e) {
log.error("Error in deleting Mobile Feature data ", e);
throw new MobileDeviceManagementDAOException("Error in deleting Mobile Feature data ",
e);
} finally {
@ -228,6 +233,7 @@ public class MobileFeatureDAOTestSuite {
}
conn.close();
} catch (SQLException e) {
log.error("Error in deleting Mobile Feature data ", e);
throw new MobileDeviceManagementDAOException("Error in deleting Mobile Feature data ",
e);
} finally {
@ -252,8 +258,8 @@ public class MobileFeatureDAOTestSuite {
stmt = conn.createStatement();
ResultSet resultSet = stmt
.executeQuery(
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE CODE = " +
MBL_FEATURE_UPDATED_CODE);
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE CODE = '" +
MBL_FEATURE_UPDATED_CODE + "'");
while (resultSet.next()) {
testMblFeature.setId(resultSet.getInt(1));
testMblFeature.setCode(resultSet.getString(2));
@ -262,6 +268,7 @@ public class MobileFeatureDAOTestSuite {
}
conn.close();
} catch (SQLException e) {
log.error("Error in updating Mobile Feature data ", e);
throw new MobileDeviceManagementDAOException("Error in updating Mobile Feature data ",
e);
} finally {

@ -210,7 +210,7 @@
<!-- Copying Device Management related dbscripts -->
<fileSet>
<directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm</directory>
<directory>../distribution/src/repository/dbscripts/cdm</directory>
<outputDirectory>wso2mdm-${project.version}/dbscripts/cdm</outputDirectory>
<includes>
<include>*/**</include>

@ -1,45 +0,0 @@
/*
*
* * Copyright (c) 2015, 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.
* /
*/
import org.wso2.cdmserver.mobileservices.android.common.AndroidAgentException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.License;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
/**
* License Management related JAX RS APIs
*/
@Produces({ "application/json", "application/xml" })
@Consumes({ "application/json", "application/xml" })
public class Licenses {
private static Log log = LogFactory.getLog(Licenses.class);
@GET
public License getLicense(String deviceType) throws AndroidAgentException {
return null;
}
}

@ -1,35 +0,0 @@
package org.wso2.cdmserver.mobileservices.android;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.Device;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;
/**
* This is a Test class
*/
@Produces({"application/json", "application/xml"})
@Consumes({"application/json", "application/xml"})
public class Test {
@GET
public List<org.wso2.carbon.device.mgt.common.Device> getAllDevices() throws DeviceManagementException{
Device dev = new Device();
dev.setName("test1");
dev.setDateOfEnrolment(11111111L);
dev.setDateOfLastUpdate(992093209L);
dev.setDescription("sassasaas");
ArrayList<Device> listdevices = new ArrayList<Device>();
listdevices.add(dev);
throw new DeviceManagementException("test ex");
}
}
Loading…
Cancel
Save