Implement DAO unit tests

merge-requests/1/head
manoj 10 years ago
parent c4e2722586
commit 8ad13b6d0a

@ -15,7 +15,6 @@
*/
package org.wso2.carbon.device.mgt.common;
import java.util.Date;
import java.util.List;
public class Device {
@ -28,9 +27,9 @@ public class Device {
private String name;
private Date dateOfEnrolment;
private Long dateOfEnrolment;
private Date dateOfLastUpdate;
private Long dateOfLastUpdate;
private String ownership;
@ -70,19 +69,19 @@ public class Device {
this.name = name;
}
public Date getDateOfEnrolment() {
public Long getDateOfEnrolment() {
return dateOfEnrolment;
}
public void setDateOfEnrolment(Date dateOfEnrolment) {
public void setDateOfEnrolment(Long dateOfEnrolment) {
this.dateOfEnrolment = dateOfEnrolment;
}
public Date getDateOfLastUpdate() {
public Long getDateOfLastUpdate() {
return dateOfLastUpdate;
}
public void setDateOfLastUpdate(Date dateOfLastUpdate) {
public void setDateOfLastUpdate(Long dateOfLastUpdate) {
this.dateOfLastUpdate = dateOfLastUpdate;
}

@ -119,6 +119,19 @@
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.1_spec</artifactId>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database.wso2</groupId>
<artifactId>h2-database-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>

@ -44,6 +44,10 @@ public class DeviceManagementDAOFactory {
dataSource = resolveDataSource(config);
}
public static void init(DataSource dtSource) {
dataSource = dtSource;
}
/**
* Resolve data source from the data source definition
*
@ -78,4 +82,7 @@ public class DeviceManagementDAOFactory {
return dataSource;
}
public static DataSource getDataSource() {
return dataSource;
}
}

@ -19,7 +19,6 @@
package org.wso2.carbon.device.mgt.core.dto;
import java.io.Serializable;
import java.util.Date;
public class Device implements Serializable {
@ -27,8 +26,8 @@ public class Device implements Serializable {
private String id;
private String description;
private String name;
private Date dateOfEnrollment;
private Date dateOfLastUpdate;
private Long dateOfEnrollment;
private Long dateOfLastUpdate;
private String deviceIdentificationId;
private Status status;
private String ownerId;
@ -68,19 +67,19 @@ public class Device implements Serializable {
this.name = name;
}
public Date getDateOfEnrollment() {
public Long getDateOfEnrollment() {
return dateOfEnrollment;
}
public void setDateOfEnrollment(Date dateOfEnrollment) {
public void setDateOfEnrollment(Long dateOfEnrollment) {
this.dateOfEnrollment = dateOfEnrollment;
}
public Date getDateOfLastUpdate() {
public Long getDateOfLastUpdate() {
return dateOfLastUpdate;
}
public void setDateOfLastUpdate(Date dateOfLastUpdate) {
public void setDateOfLastUpdate(Long dateOfLastUpdate) {
this.dateOfLastUpdate = dateOfLastUpdate;
}

@ -69,6 +69,11 @@
<artifactId>org.eclipse.osgi.services</artifactId>
<version>3.3.100.v20120522-1822</version>
</dependency>
<dependency>
<groupId>com.h2database.wso2</groupId>
<artifactId>h2-database-engine</artifactId>
<version>${orbit.version.h2.engine}</version>
</dependency>
</dependencies>
</dependencyManagement>
@ -91,5 +96,7 @@
</plugins>
</pluginManagement>
</build>
<properties>
<orbit.version.h2.engine>1.2.140.wso2v3</orbit.version.h2.engine>
</properties>
</project>

Loading…
Cancel
Save