List of usage examples for java.util Date getHours
@Deprecated public int getHours()
From source file:pa_SymposiumPlanner.RuleML2010ProgramChair.java
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try {//from w w w.java2 s .com address = PAConfiguration.getAddress(); port = PAConfiguration.getPort(instantiation); poslAddress = PAConfiguration.getPOSL(instantiation, topic); rdfAddress = PAConfiguration.getRDFTaxonomy(instantiation); messageEndpoint = PAConfiguration.getEndpointName(instantiation, topic); } catch (BadConfigurationException e) { System.out.println(e.getMessage()); e.printStackTrace(); System.exit(0); } try { System.out.println("Panel Chair Servlet"); System.out.println(response.toString()); BufferedReader brd = request.getReader(); String input = ""; String message = ""; while (!input.equals("</RuleML>")) { input = brd.readLine(); message = message + input; } String[] varOrder = getVariableOrder(message); System.out.println("Received Message: " + message); // BackwardReasoner br = new BackwardReasoner(); // Iterator solit =null; // DefiniteClause dc = null; // SymbolTable.reset(); POSLParser pp = new POSLParser(); // String contents = "c(a).\nc(b).\nc(c)."; Date t1 = new GregorianCalendar().getTime(); //System.out.println(t1.getHours() + ":" + t1.getMinutes()); //append time to contents //System.out.println("day: " + t1.getDay()); //System.out.println("day: " + t1.getYear()); //System.out.println("day: " + t1.getMonth()); //time String time = "time(" + t1.getHours() + ":integer)."; System.out.println(time); String url = poslAddress; //String url = "http://www.jdrew.org/oojdrew/test.posl"; String contents = ""; //day of the week int day = t1.getDay(); boolean weekday = true; if (day == 0 || day == 6) { weekday = false; } String dayOfWeek; if (weekday) { dayOfWeek = "day(weekday)."; } else { dayOfWeek = "day(weekend)."; } //full date Calendar cal = new GregorianCalendar(); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH) + 1; int day2 = cal.get(Calendar.DAY_OF_MONTH); String date; String day3 = "" + day2; if (day2 == 1 || day2 == 2 || day2 == 3 || day2 == 4 || day2 == 5 || day2 == 6 || day2 == 7 || day2 == 8 || day2 == 9) { day3 = "0" + day2; } if (month == 10 || month == 11 || month == 12) { date = "" + year + month + day3; } else { date = "" + year + "0" + month + day3; } date = "date(" + date + ":integer)."; System.out.println(date); String url2 = rdfAddress; HttpClient client2 = new HttpClient(); GetMethod method2 = new GetMethod(url2); method2.setFollowRedirects(true); String typestr = ""; // Execute the GET method int statusCode2 = client2.executeMethod(method2); if (statusCode2 != -1) { typestr = method2.getResponseBodyAsString(); } System.out.println("Types: " + typestr); Types.reset(); RDFSParser.parseRDFSString(typestr); try { HttpClient client = new HttpClient(); GetMethod method = new GetMethod(url); method.setFollowRedirects(true); // Execute the GET method int statusCode = client.executeMethod(method); if (statusCode != -1) { contents = method.getResponseBodyAsString(); } } catch (Exception e) { e.printStackTrace(); } contents = contents + "\n" + time; contents = contents + "\n" + dayOfWeek; contents = contents + "\n" + date; BackwardReasoner br = new BackwardReasoner(); Iterator solit = null; DefiniteClause dc = null; SymbolTable.reset(); pp.parseDefiniteClauses(contents); br.loadClauses(pp.iterator()); Iterator it = pp.iterator(); while (it.hasNext()) { DefiniteClause d = (DefiniteClause) it.next(); System.out.println("Loaded clause: " + d.toPOSLString()); } br = new BackwardReasoner(br.clauses, br.oids); MessageParser m = new MessageParser(message); Element atom = null; try { atom = m.parseForContent(); } catch (Exception e) { System.out.println("Invalid Message"); //out.flush(); } QueryBuilder q = new QueryBuilder(atom); String query = q.generateDoc(); System.out.println("ABOUT TO INPUT THIS QUERY:" + query); RuleMLParser qp = new RuleMLParser(); try { dc = qp.parseRuleMLQuery(query); } catch (Exception e) { System.out.println("Invalid Query"); //out.flush(); } //solit = br.iterativeDepthFirstSolutionIterator(dc); solit = br.iterativeDepthFirstSolutionIterator(dc); int varSize = 0; while (solit.hasNext()) { Vector data = new Vector(); BackwardReasoner.GoalList gl = (BackwardReasoner.GoalList) solit.next(); Hashtable varbind = gl.varBindings; javax.swing.tree.DefaultMutableTreeNode root = br.toTree(); root.setAllowsChildren(true); javax.swing.tree.DefaultTreeModel dtm = new DefaultTreeModel(root); int i = 0; Object[][] rowdata = new Object[varbind.size()][2]; varSize = varbind.size(); Enumeration e = varbind.keys(); while (e.hasMoreElements()) { Object k = e.nextElement(); Object val = varbind.get(k); String ks = (String) k; rowdata[i][0] = ks; rowdata[i][1] = val; i++; } data.addElement(rowdata); String[] messages = new String[data.size()]; MessageGenerator g = new MessageGenerator(data, varSize, messageEndpoint, m.getId(), m.getProtocol(), m.getRel(), varOrder); messages = g.Messages2(); String appender = ""; URL sender = new URL(address + ":" + port); HttpMessage msg = new HttpMessage(sender); Properties props = new Properties(); for (int i1 = 0; i1 < data.size(); i1++) { System.out.println(i1 + ")" + messages[i1].toString()); props.put("text", messages[i1].toString()); InputStream in = msg.sendGetMessage(props); } System.out.println("NEXT MESSAGE"); } MessageGenerator g = new MessageGenerator(null, varSize, messageEndpoint, m.getId(), m.getProtocol(), m.getRel()); URL sender = new URL(address + ":" + port); HttpMessage msg = new HttpMessage(sender); Properties props = new Properties(); String finalMessage = g.finalMessage(query); System.out.println(finalMessage); props.put("text", finalMessage); InputStream in = msg.sendGetMessage(props); System.out.println("Stop_Communication"); } catch (Exception e) { System.out.println("ERROR has occured : " + e.toString()); } out.close(); }
From source file:pa_SymposiumPlanner.BRF2011ProgramChair.java
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try {//from w ww. jav a 2 s. c o m address = PAConfiguration.getAddress(); port = PAConfiguration.getPort(instantiation); poslAddress = PAConfiguration.getPOSL(instantiation, topic); rdfAddress = PAConfiguration.getRDFTaxonomy(instantiation); messageEndpoint = PAConfiguration.getEndpointName(instantiation, topic); } catch (BadConfigurationException e) { System.out.println(e.getMessage()); e.printStackTrace(); System.exit(0); } try { System.out.println("Programming Chair Servlet"); System.out.println(response.toString()); BufferedReader brd = request.getReader(); String input = ""; String message = ""; while (!input.equals("</RuleML>")) { input = brd.readLine(); message = message + input; } String[] varOrder = getVariableOrder(message); System.out.println("Received Message: " + message); // BackwardReasoner br = new BackwardReasoner(); // Iterator solit =null; // DefiniteClause dc = null; // SymbolTable.reset(); POSLParser pp = new POSLParser(); // String contents = "c(a).\nc(b).\nc(c)."; Date t1 = new GregorianCalendar().getTime(); //System.out.println(t1.getHours() + ":" + t1.getMinutes()); //append time to contents //System.out.println("day: " + t1.getDay()); //System.out.println("day: " + t1.getYear()); //System.out.println("day: " + t1.getMonth()); //time String time = "time(" + t1.getHours() + ":integer)."; System.out.println(time); String url = poslAddress; //String url = "http://www.jdrew.org/oojdrew/test.posl"; String contents = ""; //day of the week int day = t1.getDay(); boolean weekday = true; if (day == 0 || day == 6) { weekday = false; } String dayOfWeek; if (weekday) { dayOfWeek = "day(weekday)."; } else { dayOfWeek = "day(weekend)."; } //full date Calendar cal = new GregorianCalendar(); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH) + 1; int day2 = cal.get(Calendar.DAY_OF_MONTH); String date; String day3 = "" + day2; if (day2 == 1 || day2 == 2 || day2 == 3 || day2 == 4 || day2 == 5 || day2 == 6 || day2 == 7 || day2 == 8 || day2 == 9) { day3 = "0" + day2; } if (month == 10 || month == 11 || month == 12) { date = "" + year + month + day3; } else { date = "" + year + "0" + month + day3; } date = "date(" + date + ":integer)."; System.out.println(date); String url2 = rdfAddress; HttpClient client2 = new HttpClient(); GetMethod method2 = new GetMethod(url2); method2.setFollowRedirects(true); String typestr = ""; // Execute the GET method int statusCode2 = client2.executeMethod(method2); if (statusCode2 != -1) { typestr = method2.getResponseBodyAsString(); } System.out.println("Types: " + typestr); Types.reset(); RDFSParser.parseRDFSString(typestr); try { HttpClient client = new HttpClient(); GetMethod method = new GetMethod(url); method.setFollowRedirects(true); // Execute the GET method int statusCode = client.executeMethod(method); if (statusCode != -1) { contents = method.getResponseBodyAsString(); } } catch (Exception e) { e.printStackTrace(); } contents = contents + "\n" + time; contents = contents + "\n" + dayOfWeek; contents = contents + "\n" + date; BackwardReasoner br = new BackwardReasoner(); Iterator solit = null; DefiniteClause dc = null; SymbolTable.reset(); pp.parseDefiniteClauses(contents); br.loadClauses(pp.iterator()); Iterator it = pp.iterator(); while (it.hasNext()) { DefiniteClause d = (DefiniteClause) it.next(); System.out.println("Loaded clause: " + d.toPOSLString()); } br = new BackwardReasoner(br.clauses, br.oids); MessageParser m = new MessageParser(message); Element atom = null; try { atom = m.parseForContent(); } catch (Exception e) { System.out.println("Invalid Message"); //out.flush(); } QueryBuilder q = new QueryBuilder(atom); String query = q.generateDoc(); System.out.println("ABOUT TO INPUT THIS QUERY:" + query); RuleMLParser qp = new RuleMLParser(); try { dc = qp.parseRuleMLQuery(query); } catch (Exception e) { System.out.println("Invalid Query"); //out.flush(); } //solit = br.iterativeDepthFirstSolutionIterator(dc); solit = br.iterativeDepthFirstSolutionIterator(dc); int varSize = 0; while (solit.hasNext()) { Vector data = new Vector(); BackwardReasoner.GoalList gl = (BackwardReasoner.GoalList) solit.next(); Hashtable varbind = gl.varBindings; javax.swing.tree.DefaultMutableTreeNode root = br.toTree(); root.setAllowsChildren(true); javax.swing.tree.DefaultTreeModel dtm = new DefaultTreeModel(root); int i = 0; Object[][] rowdata = new Object[varbind.size()][2]; varSize = varbind.size(); Enumeration e = varbind.keys(); while (e.hasMoreElements()) { Object k = e.nextElement(); Object val = varbind.get(k); String ks = (String) k; rowdata[i][0] = ks; rowdata[i][1] = val; i++; } data.addElement(rowdata); String[] messages = new String[data.size()]; MessageGenerator g = new MessageGenerator(data, varSize, messageEndpoint, m.getId(), m.getProtocol(), m.getRel(), varOrder); messages = g.Messages2(); String appender = ""; URL sender = new URL(address + ":" + port); HttpMessage msg = new HttpMessage(sender); Properties props = new Properties(); for (int i1 = 0; i1 < data.size(); i1++) { System.out.println(i1 + ")" + messages[i1].toString()); props.put("text", messages[i1].toString()); InputStream in = msg.sendGetMessage(props); } System.out.println("NEXT MESSAGE"); } MessageGenerator g = new MessageGenerator(null, varSize, messageEndpoint, m.getId(), m.getProtocol(), m.getRel()); URL sender = new URL(address + ":" + port); HttpMessage msg = new HttpMessage(sender); Properties props = new Properties(); String finalMessage = g.finalMessage(query); System.out.println(finalMessage); props.put("text", finalMessage); InputStream in = msg.sendGetMessage(props); System.out.println("Stop_Communication"); } catch (Exception e) { System.out.println("ERROR has occured : " + e.toString()); } out.close(); }
From source file:opensource.zeocompanion.ZeoCompanionApplication.java
private void configAlarmManagerToPrefs() { // setup a daily alarm if auto-emailing is enabled SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean enabledAutoEmail = prefs.getBoolean("email_auto_enable", false); boolean enabledDatabaseReplicate = prefs.getBoolean("database_replicate_zeo", false); long desiredTOD = prefs.getLong("email_auto_send_time", 0); // will default to midnight long configuredTOD = prefs.getLong("email_auto_send_time_configured", 0); // will default to midnight // determine whether there is an active AlarmManager entry that we have established AlarmManager am = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE); Intent intentCheck = new Intent(this, ZeoCompanionApplication.AlarmReceiver.class); intentCheck.setAction(ZeoCompanionApplication.ACTION_ALARMMGR_WAKEUP_RTC); PendingIntent existingPi = PendingIntent.getBroadcast(this, 0, intentCheck, PendingIntent.FLAG_NO_CREATE); if (enabledAutoEmail || enabledDatabaseReplicate) { // Daily AlarmManager is needed if (existingPi != null && desiredTOD != configuredTOD) { // there is an existing AlarmManager entry, but it has the incorrect starting time-of-day; // so cancel it, and rebuild a new one Intent intent1 = new Intent(this, ZeoCompanionApplication.AlarmReceiver.class); intent1.setAction(ZeoCompanionApplication.ACTION_ALARMMGR_WAKEUP_RTC); PendingIntent pi1 = PendingIntent.getBroadcast(this, 0, intent1, PendingIntent.FLAG_CANCEL_CURRENT); am.cancel(pi1);// ww w .j a va 2s . c o m pi1.cancel(); existingPi = null; } if (existingPi == null) { // there is no existing AlarmManager entry, so create it Date dt = new Date(desiredTOD); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, dt.getHours()); calendar.set(Calendar.MINUTE, dt.getMinutes()); calendar.set(Calendar.SECOND, dt.getSeconds()); Intent intent2 = new Intent(this, ZeoCompanionApplication.AlarmReceiver.class); intent2.setAction(ZeoCompanionApplication.ACTION_ALARMMGR_WAKEUP_RTC); PendingIntent pi2 = PendingIntent.getBroadcast(this, 0, intent2, PendingIntent.FLAG_UPDATE_CURRENT); am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pi2); SharedPreferences.Editor editor = prefs.edit(); editor.putLong("email_auto_send_time_configured", desiredTOD); editor.commit(); } } else { // Daily AlarmManager is not needed if (existingPi != null) { // there is an AlarmManager entry pending; need to cancel it Intent intent3 = new Intent(this, ZeoCompanionApplication.AlarmReceiver.class); intent3.setAction(ZeoCompanionApplication.ACTION_ALARMMGR_WAKEUP_RTC); PendingIntent pi3 = PendingIntent.getBroadcast(this, 0, intent3, PendingIntent.FLAG_CANCEL_CURRENT); am.cancel(pi3); pi3.cancel(); } } }
From source file:TimeFormatter.java
/** * Format the given date as a string, according to the given * format string./*from w w w . j a v a 2s . c o m*/ * The format string is of the form used by the strftime(3) UNIX * call. * @param date The date to format * @param format The formatting string * @return the String with the formatted date. */ public static String format(Date date, String format) { StringBuffer buf = new StringBuffer(50); char ch; for (int i = 0; i < format.length(); i++) { ch = format.charAt(i); if (ch == '%') { ++i; if (i == format.length()) break; ch = format.charAt(i); if (ch == 'E') { // Alternate Era ++i; } else if (ch == 'Q') { // Alternate numeric symbols ++i; } if (i == format.length()) break; ch = format.charAt(i); switch (ch) { case 'A': buf.append(fullWeekDays[date.getDay()]); break; case 'a': buf.append(abrWeekDays[date.getDay()]); break; case 'B': buf.append(fullMonths[date.getMonth()]); break; case 'b': case 'h': buf.append(abrMonths[date.getMonth()]); break; case 'C': appendPadded(buf, (date.getYear() + 1900) / 100, 2); break; case 'c': buf.append(date.toLocaleString()); break; case 'D': buf.append(TimeFormatter.format(date, "%m/%d/%y")); break; case 'd': appendPadded(buf, date.getDate(), 2); break; case 'e': appendPadded(buf, date.getMonth() + 1, 2, ' '); break; case 'H': appendPadded(buf, date.getHours(), 2); break; case 'I': case 'l': int a = date.getHours() % 12; if (a == 0) a = 12; appendPadded(buf, a, 2, ch == 'I' ? '0' : ' '); break; case 'j': buf.append("[?]"); // No simple way to get this as of now break; case 'k': appendPadded(buf, date.getHours(), 2, ' '); break; case 'M': appendPadded(buf, date.getMinutes(), 2); break; case 'm': appendPadded(buf, date.getMonth() + 1, 2); break; case 'n': buf.append('\n'); break; case 'p': buf.append(date.getHours() < 12 ? "am" : "pm"); break; case 'R': buf.append(TimeFormatter.format(date, "%H:%M")); break; case 'r': buf.append(TimeFormatter.format(date, "%l:%M%p")); break; case 'S': appendPadded(buf, date.getSeconds(), 2); break; case 'T': buf.append(TimeFormatter.format(date, "%H:%M:%S")); break; case 't': buf.append('\t'); break; case 'U': case 'u': case 'V': case 'W': buf.append("[?]"); // Weekdays are a pain, especially // without day of year (0-365) ; break; case 'w': buf.append(date.getDay()); break; case 'X': buf.append(TimeFormatter.format(date, "%H:%M:%S")); break; case 'x': buf.append(TimeFormatter.format(date, "%B %e, %Y")); break; case 'y': appendPadded(buf, (date.getYear() + 1900) % 100, 2); break; case 'Y': appendPadded(buf, (date.getYear() + 1900), 4); break; case 'Z': String strdate = date.toString(); buf.append(strdate.substring(20, 23)); // (!) // There should be a better way // to do this... break; case '%': buf.append('%'); break; } } else { buf.append(ch); } } return buf.toString(); }
From source file:org.openkoala.koala.monitor.application.MonitorDataManageApplicationImpl.java
@SuppressWarnings("deprecation") @Override//w w w. j a v a 2 s.c o m public Map<Integer, Integer> getJdbcConnTimeStat(String nodeId, long timeoutLimit) { timeoutLimit = timeoutLimit * 1000;//to if (timeoutLimit < 0) { Set<MonitorComponent> conponents = MonitorNode.getAllNodesCache().get(nodeId).getConponents(); for (MonitorComponent com : conponents) { if (com.getType().equals("JDBC")) { timeoutLimit = Long.parseLong(com.getProperties().get("trace-timeout")); break; } } } final Map<Integer, Integer> result = new TreeMap<Integer, Integer>(); Date now = new Date(); Date before24h = DateUtils.addHours(now, -24); String sql = "select m.hour, count(*) from KM_JDBC_CONN_DETAILS c left join KM_MAIN_STAT m on c.THREAD_KEY = m.THREAD_KEY and m.fk_node_id=? and (m.begin_time between ? and ?) and TIME_CONSUME>? group by m.hour order by m.hour"; Object[] params = new Object[] { nodeId, before24h, now, timeoutLimit }; getJdbcTemplate().query(sql, params, new ResultSetExtractor<Object>() { @Override public Object extractData(ResultSet rs) throws SQLException, DataAccessException { while (rs.next()) { if (rs.getObject(1) != null) { result.put(rs.getInt(1), rs.getInt(2)); } } return null; } }); int beginPoint = before24h.getHours() + 1; int endPoint = now.getHours(); int count = 0; for (int i = beginPoint; i < 24; i++) { count = result.containsKey(i) ? result.get(i) : 0; result.put(i, count); } for (int i = 0; i <= endPoint; i++) { count = result.containsKey(i) ? result.get(i) : 0; result.put(i, count); } return result; }
From source file:com.openedit.BaseWebPageRequest.java
public String getHours(String inDate) { if (inDate == null || inDate.length() == 0) { return null; }/*from ww w .ja va 2s . c om*/ Date date = getLocaleManager().getDateStorageUtil().parseFromStorage(inDate); if (date == null) { return null; } return String.valueOf(date.getHours()); }
From source file:org.openmrs.module.dhisconnector.api.impl.DHISConnectorServiceImpl.java
@SuppressWarnings("deprecation") @Override// ww w .jav a 2s . c o m public String getLastSyncedAt() { File backup = new File(OpenmrsUtil.getApplicationDataDirectory() + DHISCONNECTOR_DHIS2BACKUP_FOLDER + File.separator + "api"); if (dhis2BackupExists()) { Date lastModified = new Date(backup.lastModified()); return Context.getDateFormat().format(lastModified) + " " + lastModified.getHours() + ":" + lastModified.getMinutes() + ":" + lastModified.getSeconds(); } else { return ""; } }
From source file:voldemort.store.cachestore.impl.CacheStore.java
public void backup(String path, int threshold) { packLock.lock();/*from w ww .j a v a 2s . co m*/ try { checkPath(path); Date date = new Date(); String filename = path + "/" + getNamePrefix() + getCurIndex() + "." + date.getMonth() + "." + date.getDate() + "." + date.getHours() + "." + date.getMinutes(); backupTask = new BackupThread(this, curIndex, filename); backupTask.run(); //new BackupThread(this, curIndex, filename).start(threshold); } finally { packLock.unlock(); } }
From source file:com.hhunj.hhudata.ForegroundService.java
boolean IsDuringWorkHours(Date dt) { /*/*from w ww . j a v a 2 s. c o m*/ // UTC Calendar calendar = Calendar.getInstance(); int offset = calendar.get(Calendar.ZONE_OFFSET); int dst = calendar.get(Calendar.DST_OFFSET); calendar.setTimeInMillis(dt.getTime()); calendar.add(Calendar.MILLISECOND, (offset + dst)); Date resultDate = calendar.getTime(); // int offset=dt.getTimezoneOffset(); */ int hour = dt.getHours(); int minute = dt.getMinutes(); int ftime = hour * 100 + minute; int fstart = m_workStartTime.getHours() * 100 + m_workStartTime.getMinutes(); int fend = m_workEndTime.getHours() * 100 + m_workEndTime.getMinutes(); return (ftime >= fstart && ftime < fend); }
From source file:org.pentaho.platform.dataaccess.datasource.wizard.service.agile.CsvTransformGeneratorIT.java
public void testLoadTable1() throws Exception { IPentahoSession session = new StandaloneSession("test"); KettleSystemListener.environmentInit(session); ModelInfo info = createModel();/*from www .j a v a2 s . c om*/ CsvTransformGenerator gen = new CsvTransformGenerator(info, getDatabaseMeta()); // create the model String tableName = info.getStageTableName(); try { gen.execSqlStatement(getDropTableStatement(tableName), getDatabaseMeta(), null); } catch (CsvTransformGeneratorException e) { // table might not be there yet, it is OK } // generate the database table gen.createOrModifyTable(session); // load the table loadTable(gen, info, true, session); // check the results long rowCount = this.getRowCount(tableName); assertEquals((long) 235, rowCount); DatabaseMeta databaseMeta = getDatabaseMeta(); assertNotNull(databaseMeta); Database database = new Database(databaseMeta); assertNotNull(database); database.connect(); Connection connection = null; Statement stmt = null; ResultSet sqlResult = null; try { connection = database.getConnection(); assertNotNull(connection); stmt = database.getConnection().createStatement(); // check the first row Date testDate = new Date(); testDate.setDate(1); testDate.setHours(0); testDate.setMinutes(0); testDate.setMonth(0); testDate.setSeconds(0); testDate.setYear(110); boolean ok = stmt.execute("select * from " + tableName); assertTrue(ok); sqlResult = stmt.getResultSet(); assertNotNull(sqlResult); ok = sqlResult.next(); assertTrue(ok); // test the values assertEquals((long) 3, sqlResult.getLong(1)); assertEquals(25677.96525, sqlResult.getDouble(2)); assertEquals((long) 1231, sqlResult.getLong(3)); assertEquals(testDate.getYear(), sqlResult.getDate(4).getYear()); assertEquals(testDate.getMonth(), sqlResult.getDate(4).getMonth()); assertEquals(testDate.getDate(), sqlResult.getDate(4).getDate()); assertEquals(testDate.getHours(), sqlResult.getTime(4).getHours()); // assertEquals( testDate.getMinutes(), ((Date)cells[3]).getMinutes() ); this fails, a bug in the PDI date parsing? assertEquals(testDate.getSeconds(), sqlResult.getTime(4).getSeconds()); // assertEquals( testDate, cells[3] ); assertEquals("Afghanistan", sqlResult.getString(5)); assertEquals((long) 11, sqlResult.getLong(6)); assertEquals(111.9090909, sqlResult.getDouble(7)); assertEquals(false, sqlResult.getBoolean(8)); } finally { sqlResult.close(); stmt.close(); connection.close(); } }