ORCentral

src/eu/coform/test/IsValidSessionCommandTest.java

Go to the documentation of this file.
00001 package eu.coform.test;
00002 
00003 import java.sql.ResultSet;
00004 import java.text.SimpleDateFormat;
00005 
00006 import eu.coform.DateTime;
00007 import eu.coform.database.Database;
00008 import eu.coform.database.Query;
00009 import junit.framework.TestCase;
00010 
00011 public class IsValidSessionCommandTest extends TestCase {
00012 
00013    public void testExecute() throws Exception {
00014       Query newQuery = Database.getInstance().getNewQuery();
00015       newQuery.setQuery("SELECT hex(UUID) from `session`;");
00016       ResultSet rs = Database.getInstance().query(newQuery);
00017       while (rs.next()) {
00018          System.out.println(rs.getString("hex(UUID)"));
00019       }
00020 //      query.next();
00021 //      assertEquals("706F6975C3B66C6B6A6173646671776572000000000000000000000000000000", query.getString("hex(UUID)"));
00022       
00023       newQuery.setQuery("SELECT ExpirationDate from `session` WHERE hex(UUID) = '617364667177657279787663C3B66C6B'");
00024       rs = Database.getInstance().query(newQuery);
00025       rs.next();
00026       System.out.println(rs.getString("ExpirationDate"));
00027 
00028       java.sql.Timestamp sqlDateTime = rs.getTimestamp("ExpirationDate");
00029       
00030       DateTime d = new DateTime();
00031       d.setDatetime(sqlDateTime.getTime());
00032    }
00033 
00034 }
 All Classes Namespaces Files Functions Variables Enumerations