/** * Contacts Hackystat services, gets data, and returns a summary as a string. * * @return The summary of Hackystat activity. */ public String getInfo() { // First, validate that we are authorized for these Hackystat services. SensorBaseClient sensorbaseClient; DailyProjectDataClient dpdClient; try { sensorbaseClient = new SensorBaseClient(sensorbaseHost, user, password); dpdClient = new DailyProjectDataClient(dpdHost, user, password); sensorbaseClient.authenticate(); dpdClient.authenticate(); } catch (Exception e) { return "Error getting Hackystat info. Message is: " + e.getMessage(); } // Second, validate that we can get info about the specified project. try { sensorbaseClient.inProject(projectName, projectOwner); } catch (Exception e) { return String.format("%s is not in project %s", user, projectName); } // We're OK, so figure out the time interval of interest. XMLGregorianCalendar endTime = Tstamp.makeTimestamp(); XMLGregorianCalendar startTime = Tstamp.incrementMinutes(endTime, (-1 * interval)); // Now get information. StringBuffer info = new StringBuffer(); info.append(getDevEventInfo(sensorbaseClient, startTime, endTime)).append(' '); info.append(getCommitInfo(sensorbaseClient, startTime, endTime)).append(' '); info.append(getUnitTestInfo(sensorbaseClient, startTime, endTime)).append(' '); info.append(getBuildInfo(sensorbaseClient, startTime, endTime)).append(' '); info.append(getCoverageInfo(sensorbaseClient, dpdClient, startTime, endTime)).append(' '); info.append(getSizeInfo(sensorbaseClient, dpdClient, startTime, endTime)).append(' '); // Return the info we've found. return info.toString().trim().replace(" ", " "); }
/** * Test that PUT {host}/db/compress compresses the database tables. * * @throws Exception If problems occur. */ @Test public void testCompress() throws Exception { // NOPMD SensorBaseClient client = new SensorBaseClient(getHostName(), adminEmail, adminPassword); client.authenticate(); client.setTimeout(200000); client.compressTables(); }