Skip to content

Commit

Permalink
Tests......
Browse files Browse the repository at this point in the history
  • Loading branch information
jyh09001 committed Apr 17, 2015
1 parent 8a42ff5 commit eaafe55
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
Binary file modified datastruct.txt
Binary file not shown.
4 changes: 3 additions & 1 deletion src/InputOutput/DataStructure.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@

public class DataStructure extends Hashtable<String, Hashtable<String, Hashtable<String, String>>> implements Serializable {


/**
*
*/
private static final long serialVersionUID = 1105146094425728795L;
private static final long serialVersionUID = -4390469670958795848L;
//private static final long serialVersionUID = 1105146094425728795L;
//private Hashtable<String, Hashtable<String, String>> internalStructure;
private final String FILE_NAME = "datastruct.txt";
private Thermostatable owner;
Expand Down
5 changes: 3 additions & 2 deletions src/InputOutput/Database.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package InputOutput;

import java.io.Serializable;
import java.util.Hashtable;

//represents local methods for when the server structure calls this

public class Database extends DataStructure implements Thermostatable{
public class Database extends DataStructure implements Thermostatable, Serializable{

public Database(Thermostatable owner){
super(owner);

}

public boolean createUser(String username, String password, String ip, String email){
public boolean createUser(String email, String password, String ip){
this.updateTable("UserTable", email, "email", email);
this.updateTable("UserTable", email, "password", password);
this.updateTable("UserTable", email, "ipaddress", ip);
Expand Down
2 changes: 1 addition & 1 deletion src/InputOutput/Thermostatable.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//Methods for calling thermostat information

public interface Thermostatable {
public boolean createUser(String username, String password, String ip, String email);
public boolean createUser(String email, String password, String ip);

public boolean createThermostat(String serial, String name, String desiredTemp);

Expand Down
5 changes: 2 additions & 3 deletions src/server/server.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@ public server() {
String ip = "127.0.0.1";
String email = "admin@uconn.edu";
Database dataStorage = new Database(this);
dataStorage.createUser(admin, adminpassword, ip, email);
dataStorage.createUser(email, adminpassword, ip);
}

public void receiveCurrentTemp() throws Exception {
super.receiveCurrentTemp(receiveCurrentTempPORT);
}

@Override
public boolean createUser(String username, String password, String ip,
String email) {
public boolean createUser(String email, String password, String ip) {
// TODO Auto-generated method stub
return false;
}
Expand Down
3 changes: 1 addition & 2 deletions src/testing/DataStructureTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ public static void main(String[] args){
}

@Override
public boolean createUser(String username, String password, String ip,
String email) {
public boolean createUser(String email, String password, String ip) {
// TODO Auto-generated method stub
return false;
}
Expand Down
11 changes: 5 additions & 6 deletions src/testing/DatabaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ public class DatabaseTest implements Thermostatable{
*/
public DatabaseTest(){
Database testbase =new Database(this);
assert(testbase.createUser("herp@derp.com", "herpderp", "123456789.0", "herp@derp.com")== true);
Hashtable<String, String> testuser = testbase.getUserFromEmail("herp@derp.com");
assert(testuser.get("email")=="herp@derp.com");
assert(testuser.get("ip")=="123456789.0");
assert(testbase.createUser("herp@derp.com", "herpderp", "123456789.0")== true);
//Hashtable<String, String> testuser = testbase.getUserFromEmail("herp@derp.com");
//assert(testuser.get("email")=="herp@derp.com");
//assert(testuser.get("ip")=="123456789.0");

}

@Override
public boolean createUser(String username, String password, String ip,
String email) {
public boolean createUser(String email, String password, String ip) {
// TODO Auto-generated method stub
return false;
}
Expand Down

0 comments on commit eaafe55

Please sign in to comment.