Refactoring, moved some files and renamed some classes

Former-commit-id: bdba0e95af5560f5e72cf0e45bed257ca29dc4a2
This commit is contained in:
Ziver Koc 2015-12-15 21:44:42 +01:00
parent 2bc4607ad1
commit 70f9bb1681
19 changed files with 164 additions and 152 deletions

View file

@ -7,7 +7,7 @@ import se.koc.hal.plugin.tellstick.TellstickChangeListener;
import se.koc.hal.plugin.tellstick.TellstickProtocol;
import se.koc.hal.plugin.tellstick.TellstickSerialComm;
import se.koc.hal.plugin.tellstick.protocols.NexaSelfLearning;
import se.koc.hal.struct.Switch;
import se.koc.hal.struct.SwitchEvent;
import se.koc.hal.intf.HalSpeachToText;
import se.koc.hal.stt.ManualSTTClient;
import se.koc.hal.tts.MaryRemoteTTSClient;
@ -24,7 +24,7 @@ import java.util.regex.Pattern;
* Time: 10:59
*/
public class HALClient{
private static HashMap<String, Switch> switches = new HashMap<String, Switch>();
private static HashMap<String, SwitchEvent> switches = new HashMap<String, SwitchEvent>();
public static void main(String[] args){
@ -57,22 +57,22 @@ public class HALClient{
NexaSelfLearning nexa1 = new NexaSelfLearning();
nexa1.setHouse(15087918);
nexa1.setUnit(0);
switches.put("livingroom", new Switch("livingroom", nexa1));
switches.put("livingroom", new SwitchEvent("livingroom", nexa1));
NexaSelfLearning nexa2 = new NexaSelfLearning();
nexa2.setHouse(15087918);
nexa2.setUnit(1);
switches.put("bedroom", new Switch("bedroom", nexa2));
switches.put("bedroom", new SwitchEvent("bedroom", nexa2));
NexaSelfLearning nexa3 = new NexaSelfLearning();
nexa3.setHouse(15087918);
nexa3.setUnit(3);
switches.put("kitchen", new Switch("kitchen", nexa3));
switches.put("kitchen", new SwitchEvent("kitchen", nexa3));
TellstickSerialComm.getInstance().setListener(new TellstickChangeListener() {
@Override
public void stateChange(TellstickProtocol protocol) {
for(Switch s : switches.values()) {
for(SwitchEvent s : switches.values()) {
if(s.equals(protocol)) {
String response = s.getName()+" window is "+(((NexaSelfLearning)protocol).isEnabled() ? "open": "closed");
System.out.println(">>> " + response);
@ -122,7 +122,7 @@ public class HALClient{
if(m.find()){
String name = m.group(1);
if(name.equals("all")){
for(Switch s : switches.values())
for(SwitchEvent s : switches.values())
s.turnOn();
return "I've turned everything on for you";
}
@ -136,7 +136,7 @@ public class HALClient{
if(m.find()){
String name = m.group(1);
if(name.equals("all")){
for(Switch s : switches.values())
for(SwitchEvent s : switches.values())
s.turnOff();
return "I turned everything off";
}

View file

@ -5,8 +5,8 @@ import se.koc.hal.deamon.DataAggregatorDaemon;
import se.koc.hal.deamon.DataDeletionDaemon;
import se.koc.hal.deamon.DataSynchronizationClient;
import se.koc.hal.deamon.DataSynchronizationDaemon;
import se.koc.hal.deamon.HalDaemon;
import se.koc.hal.page.HalHttpPage;
import se.koc.hal.intf.HalDaemon;
import se.koc.hal.intf.HalHttpPage;
import se.koc.hal.page.PCConfigureHttpPage;
import se.koc.hal.page.PCHeatMapHttpPage;
import se.koc.hal.page.PCOverviewHttpPage;

View file

@ -11,7 +11,9 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import se.koc.hal.HalContext;
import se.koc.hal.struct.Sensor;
import se.koc.hal.intf.HalDaemon;
import se.koc.hal.struct.HalSensor;
import se.koc.hal.util.TimeUtility;
import zutil.db.DBConnection;
import zutil.db.SQLResultHandler;
import zutil.db.handler.SimpleSQLResult;
@ -32,8 +34,8 @@ public class DataAggregatorDaemon extends TimerTask implements HalDaemon {
@Override
public void run(){
try {
List<Sensor> sensorList = Sensor.getLocalSensors(HalContext.getDB());
for(Sensor sensor : sensorList){
List<HalSensor> sensorList = HalSensor.getLocalSensors(HalContext.getDB());
for(HalSensor sensor : sensorList){
logger.fine("Aggregating sensor_id: " + sensor.getId());
aggregateSensor(sensor);
}
@ -43,7 +45,7 @@ public class DataAggregatorDaemon extends TimerTask implements HalDaemon {
}
}
public void aggregateSensor(Sensor sensor) {
public void aggregateSensor(HalSensor sensor) {
logger.fine("The sensor is of type: " + sensor.getType());
if(sensor.getType().equals("PowerMeter")){
logger.fine("aggregating raw data to five minute periods");
@ -154,8 +156,9 @@ public class DataAggregatorDaemon extends TimerTask implements HalDaemon {
int sum = 0;
float confidenceSum = 0;
int samples = 0;
long highestSequenceId = Sensor.getHighestSequenceId(sensorId);
PreparedStatement preparedInsertStmt = HalContext.getDB().getPreparedStatement("INSERT INTO sensor_data_aggr(sensor_id, sequence_id, timestamp_start, timestamp_end, data, confidence) VALUES(?, ?, ?, ?, ?, ?)");
long highestSequenceId = HalSensor.getHighestSequenceId(sensorId);
PreparedStatement preparedInsertStmt = HalContext.getDB().getPreparedStatement(
"INSERT INTO sensor_data_aggr(sensor_id, sequence_id, timestamp_start, timestamp_end, data, confidence) VALUES(?, ?, ?, ?, ?, ?)");
while(result.next()){
if(sensorId != result.getInt("sensor_id")){
throw new IllegalArgumentException("found entry for aggregation for the wrong sensorId (expecting: "+sensorId+", but was: "+result.getInt("sensor_id")+")");

View file

@ -11,7 +11,9 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import se.koc.hal.HalContext;
import se.koc.hal.struct.Sensor;
import se.koc.hal.intf.HalDaemon;
import se.koc.hal.struct.HalSensor;
import se.koc.hal.util.TimeUtility;
import zutil.db.DBConnection;
import zutil.db.SQLResultHandler;
import zutil.db.handler.SimpleSQLResult;
@ -27,8 +29,8 @@ public class DataDeletionDaemon extends TimerTask implements HalDaemon {
@Override
public void run(){
try {
List<Sensor> sensorList = Sensor.getSensors(HalContext.getDB());
for(Sensor sensor : sensorList){
List<HalSensor> sensorList = HalSensor.getSensors(HalContext.getDB());
for(HalSensor sensor : sensorList){
logger.fine("Deleting old data for sensor id: " + sensor.getId());
cleanupSensor(sensor);
}
@ -38,7 +40,7 @@ public class DataDeletionDaemon extends TimerTask implements HalDaemon {
}
}
public void cleanupSensor(Sensor sensor) {
public void cleanupSensor(HalSensor sensor) {
logger.fine("The sensor is of type: " + sensor.getType());
if(sensor.getType().equals("PowerMeter")){
//if(sensor.isInternal()){ //TODO

View file

@ -16,12 +16,13 @@ import java.util.logging.Logger;
import se.koc.hal.HalContext;
import se.koc.hal.deamon.DataSynchronizationDaemon.SensorDataDTO;
import se.koc.hal.deamon.DataSynchronizationDaemon.SensorDataListDTO;
import se.koc.hal.struct.Sensor;
import se.koc.hal.intf.HalDaemon;
import se.koc.hal.struct.HalSensor;
import se.koc.hal.struct.User;
import zutil.db.DBConnection;
import zutil.log.LogUtil;
public class DataSynchronizationClient extends TimerTask implements HalDaemon{
public class DataSynchronizationClient extends TimerTask implements HalDaemon {
private static final Logger logger = LogUtil.getLogger();
private static final long SYNC_INTERVALL = 5 * 60 * 1000; // 5 min
@ -46,12 +47,12 @@ public class DataSynchronizationClient extends TimerTask implements HalDaemon{
ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
ObjectInputStream in = new ObjectInputStream(s.getInputStream());
List<Sensor> sensors = Sensor.getSensors(db, user);
for(Sensor sensor : sensors){
List<HalSensor> sensors = HalSensor.getSensors(db, user);
for(HalSensor sensor : sensors){
if(sensor.isSynced()) {
PeerDataReqDTO req = new PeerDataReqDTO();
req.sensorId = sensor.getExternalId();
req.offsetSequenceId = Sensor.getHighestSequenceId(sensor.getId());
req.offsetSequenceId = HalSensor.getHighestSequenceId(sensor.getId());
out.writeObject(req);
SensorDataListDTO dataList = (SensorDataListDTO) in.readObject();

View file

@ -15,13 +15,14 @@ import java.util.logging.Logger;
import se.koc.hal.HalContext;
import se.koc.hal.deamon.DataSynchronizationClient.PeerDataReqDTO;
import se.koc.hal.intf.HalDaemon;
import zutil.db.DBConnection;
import zutil.db.SQLResultHandler;
import zutil.log.LogUtil;
import zutil.net.threaded.ThreadedTCPNetworkServer;
import zutil.net.threaded.ThreadedTCPNetworkServerThread;
public class DataSynchronizationDaemon extends ThreadedTCPNetworkServer implements HalDaemon{
public class DataSynchronizationDaemon extends ThreadedTCPNetworkServer implements HalDaemon {
private static final Logger logger = LogUtil.getLogger();

View file

@ -1,4 +1,4 @@
package se.koc.hal.deamon;
package se.koc.hal.intf;
import java.util.Timer;

View file

@ -1,7 +1,6 @@
package se.koc.hal.page;
package se.koc.hal.intf;
import se.koc.hal.HalContext;
import se.koc.hal.struct.Sensor;
import se.koc.hal.struct.User;
import zutil.db.DBConnection;
import zutil.io.file.FileUtil;
@ -11,7 +10,6 @@ import zutil.net.http.HttpPrintStream;
import zutil.parser.Templator;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Map;

View file

@ -3,7 +3,8 @@ package se.koc.hal.page;
import java.util.Map;
import se.koc.hal.HalContext;
import se.koc.hal.struct.Sensor;
import se.koc.hal.intf.HalHttpPage;
import se.koc.hal.struct.HalSensor;
import se.koc.hal.struct.User;
import zutil.db.DBConnection;
import zutil.io.file.FileUtil;
@ -29,7 +30,7 @@ public class PCConfigureHttpPage extends HalHttpPage {
if(request.containsKey("action")){
String action = request.get("action");
int id = (request.containsKey("id") ? Integer.parseInt(request.get("id")) : -1);
Sensor sensor;
HalSensor sensor;
User user;
switch(action) {
// Local User
@ -41,7 +42,7 @@ public class PCConfigureHttpPage extends HalHttpPage {
// Local Sensors
case "create_local_sensor":
sensor = new Sensor();
sensor = new HalSensor();
sensor.setName(request.get("name"));
sensor.setType(request.get("type"));
sensor.setConfig(request.get("config"));
@ -49,7 +50,7 @@ public class PCConfigureHttpPage extends HalHttpPage {
sensor.setSynced(true);
sensor.save(db);
case "modify_local_sensor":
sensor = Sensor.getSensor(db, id);
sensor = HalSensor.getSensor(db, id);
if(sensor != null){
sensor.setName(request.get("name"));
sensor.setType(request.get("type"));
@ -58,7 +59,7 @@ public class PCConfigureHttpPage extends HalHttpPage {
}
break;
case "remove_local_sensor":
sensor = Sensor.getSensor(db, id);
sensor = HalSensor.getSensor(db, id);
if(sensor != null)
sensor.delete(db);
break;
@ -87,7 +88,7 @@ public class PCConfigureHttpPage extends HalHttpPage {
// External Sensors
case "modify_external_sensor":
sensor = Sensor.getSensor(db, id);
sensor = HalSensor.getSensor(db, id);
if(sensor != null){
sensor.setSynced(Boolean.parseBoolean(request.get("sync")));
sensor.save(db);
@ -99,9 +100,9 @@ public class PCConfigureHttpPage extends HalHttpPage {
// Output
Templator tmpl = new Templator(FileUtil.find("web-resource/configure.tmpl"));
tmpl.set("user", localUser);
tmpl.set("localSensor", Sensor.getLocalSensors(db));
tmpl.set("localSensor", HalSensor.getLocalSensors(db));
tmpl.set("extUsers", User.getExternalUsers(db));
tmpl.set("extSensor", Sensor.getExternalSensors(db));
tmpl.set("extSensor", HalSensor.getExternalSensors(db));
return tmpl;

View file

@ -1,12 +1,9 @@
package se.koc.hal.page;
import java.io.IOException;
import java.util.Map;
import se.koc.hal.intf.HalHttpPage;
import zutil.io.file.FileUtil;
import zutil.net.http.HttpHeaderParser;
import zutil.net.http.HttpPage;
import zutil.net.http.HttpPrintStream;
import zutil.parser.Templator;
public class PCHeatMapHttpPage extends HalHttpPage {

View file

@ -8,7 +8,8 @@ import java.util.ArrayList;
import java.util.Map;
import se.koc.hal.HalContext;
import se.koc.hal.deamon.TimeUtility;
import se.koc.hal.util.TimeUtility;
import se.koc.hal.intf.HalHttpPage;
import zutil.db.DBConnection;
import zutil.db.SQLResultHandler;
import zutil.io.file.FileUtil;

View file

@ -1,29 +1,29 @@
/*
* Copyright (c) 2015 Ziver
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package se.koc.hal.struct;
/**
* Created by Ziver on 2015-05-07.
*/
public class Dimmer {
}
/*
* Copyright (c) 2015 Ziver
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package se.koc.hal.struct;
/**
* Created by Ziver on 2015-05-07.
*/
public class DimmerEvent extends HalEvent{
}

View file

@ -0,0 +1,7 @@
package se.koc.hal.struct;
/**
* Created by Ziver on 2015-12-15.
*/
public class HalEvent {
}

View file

@ -11,7 +11,7 @@ import zutil.db.bean.DBBeanSQLResultHandler;
import zutil.db.handler.SimpleSQLResult;
@DBBean.DBTable("sensor")
public class Sensor extends DBBean{
public class HalSensor extends DBBean{
// Sensor specific data
private String name;
private String type;
@ -25,29 +25,29 @@ public class Sensor extends DBBean{
public static List<Sensor> getExternalSensors(DBConnection db) throws SQLException{
public static List<HalSensor> getExternalSensors(DBConnection db) throws SQLException{
PreparedStatement stmt = db.getPreparedStatement( "SELECT sensor.* FROM sensor,user WHERE user.external == 1 AND user.id == sensor.user_id" );
return DBConnection.exec(stmt, DBBeanSQLResultHandler.createList(Sensor.class, db) );
return DBConnection.exec(stmt, DBBeanSQLResultHandler.createList(HalSensor.class, db) );
}
public static List<Sensor> getLocalSensors(DBConnection db) throws SQLException{
public static List<HalSensor> getLocalSensors(DBConnection db) throws SQLException{
PreparedStatement stmt = db.getPreparedStatement( "SELECT sensor.* FROM sensor,user WHERE user.external == 0 AND user.id == sensor.user_id" );
return DBConnection.exec(stmt, DBBeanSQLResultHandler.createList(Sensor.class, db) );
return DBConnection.exec(stmt, DBBeanSQLResultHandler.createList(HalSensor.class, db) );
}
public static List<Sensor> getSensors(DBConnection db, User user) throws SQLException{
public static List<HalSensor> getSensors(DBConnection db, User user) throws SQLException{
PreparedStatement stmt = db.getPreparedStatement( "SELECT * FROM sensor WHERE user_id == ?" );
stmt.setLong(1, user.getId());
return DBConnection.exec(stmt, DBBeanSQLResultHandler.createList(Sensor.class, db) );
return DBConnection.exec(stmt, DBBeanSQLResultHandler.createList(HalSensor.class, db) );
}
public static List<Sensor> getSensors(DBConnection db) throws SQLException{
public static List<HalSensor> getSensors(DBConnection db) throws SQLException{
PreparedStatement stmt = db.getPreparedStatement( "SELECT * FROM sensor" );
return DBConnection.exec(stmt, DBBeanSQLResultHandler.createList(Sensor.class, db) );
return DBConnection.exec(stmt, DBBeanSQLResultHandler.createList(HalSensor.class, db) );
}
public static Sensor getSensor(DBConnection db, int id) throws SQLException{
return DBBean.load(db, Sensor.class, id);
public static HalSensor getSensor(DBConnection db, int id) throws SQLException{
return DBBean.load(db, HalSensor.class, id);
}

View file

@ -3,5 +3,5 @@ package se.koc.hal.struct;
/**
* Created by Ziver on 2015-12-03.
*/
public class PowerMeterSensor extends Sensor{
public class PowerConsumptionSensor extends HalSensor {
}

View file

@ -1,65 +1,65 @@
/*
* Copyright (c) 2015 Ziver
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package se.koc.hal.struct;
import se.koc.hal.plugin.tellstick.TellstickSerialComm;
import se.koc.hal.plugin.tellstick.protocols.NexaSelfLearning;
/**
* Created by Ziver on 2015-05-07.
*/
public class Switch {
private String name;
private NexaSelfLearning nexa;
public Switch(String name, NexaSelfLearning nexa){
this.name = name;
this.nexa = nexa;
}
public String getName() {
return name;
}
public boolean isOn(){
return nexa.isEnabled();
}
public void turnOn(){
nexa.setEnable(true);
TellstickSerialComm.getInstance().write(nexa);
}
public void turnOff(){
nexa.setEnable(false);
TellstickSerialComm.getInstance().write(nexa);
}
public boolean equals(Object obj){
if(obj instanceof String)
return name.equals(obj);
if(obj instanceof NexaSelfLearning)
return nexa.equals(obj);
return this == obj;
}
}
/*
* Copyright (c) 2015 Ziver
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package se.koc.hal.struct;
import se.koc.hal.plugin.tellstick.TellstickSerialComm;
import se.koc.hal.plugin.tellstick.protocols.NexaSelfLearning;
/**
* Created by Ziver on 2015-05-07.
*/
public class SwitchEvent extends HalEvent{
private String name;
private NexaSelfLearning nexa;
public SwitchEvent(String name, NexaSelfLearning nexa){
this.name = name;
this.nexa = nexa;
}
public String getName() {
return name;
}
public boolean isOn(){
return nexa.isEnabled();
}
public void turnOn(){
nexa.setEnable(true);
TellstickSerialComm.getInstance().write(nexa);
}
public void turnOff(){
nexa.setEnable(false);
TellstickSerialComm.getInstance().write(nexa);
}
public boolean equals(Object obj){
if(obj instanceof String)
return name.equals(obj);
if(obj instanceof NexaSelfLearning)
return nexa.equals(obj);
return this == obj;
}
}

View file

@ -3,5 +3,5 @@ package se.koc.hal.struct;
/**
* Created by Ziver on 2015-12-03.
*/
public class TemperatureSensor extends Sensor {
public class TemperatureSensor extends HalSensor {
}

View file

@ -1,4 +1,4 @@
package se.koc.hal.deamon;
package se.koc.hal.util;
import java.util.Calendar;

View file

@ -1,4 +1,4 @@
package se.koc.hal.deamon;
package se.koc.hal.util;
import static org.junit.Assert.*;
@ -6,6 +6,7 @@ import java.util.Calendar;
import org.junit.Before;
import org.junit.Test;
import se.koc.hal.util.TimeUtility;
public class TimeUtilityTest {
private long currentTime;