Search in sources :

Example 6 with SubmittedResult

use of com.qasymphony.ci.plugin.model.SubmittedResult in project jenkin-qtest-plugin by QASymphony.

the class StatisticsAction method getTreeResult.

/**
 * use to get result in qTest Plugin page
 *
 * @param page page submitted result
 * @return submitted result data
 */
@JavaScriptMethod
public JSONObject getTreeResult(int page) {
    Map<Integer, SubmittedResult> results = null;
    try {
        AbstractProject project = this.getProject();
        results = storeResultService.fetchAll(new ReadSubmitLogRequest().setProject(project).setStart(0).setSize(-1)).getResults();
    } catch (Exception e) {
        LOG.log(Level.WARNING, e.getMessage());
    }
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("data", null == results ? "" : results.values());
    return jsonObject;
}
Also used : SubmittedResult(com.qasymphony.ci.plugin.model.SubmittedResult) JSONObject(net.sf.json.JSONObject) ReadSubmitLogRequest(com.qasymphony.ci.plugin.store.ReadSubmitLogRequest) AbstractProject(hudson.model.AbstractProject) JavaScriptMethod(org.kohsuke.stapler.bind.JavaScriptMethod)

Example 7 with SubmittedResult

use of com.qasymphony.ci.plugin.model.SubmittedResult in project jenkin-qtest-plugin by QASymphony.

the class StoreResultServiceTests method testStore2.

@LocalData
@Test
public void testStore2() throws Exception {
    project.scheduleBuild2(0).get(1, TimeUnit.MINUTES);
    int currentBuild = project.getNextBuildNumber() - 1;
    SubmittedResult result = new SubmittedResult().setSubmitStatus(JunitSubmitterResult.STATUS_SUCCESS).setTestSuiteName(project.getName()).setNumberTestResult(0).setNumberTestLog(0).setBuildNumber(currentBuild).setStatusBuild("SUCCESS");
    storeResultService.store(project, result);
    SubmittedResult result2 = new SubmittedResult().setSubmitStatus(JunitSubmitterResult.STATUS_SUCCESS).setTestSuiteName(project.getName()).setNumberTestResult(2).setNumberTestLog(2).setBuildNumber(++currentBuild).setStatusBuild("FAILED");
    storeResultService.store(project, result2);
    Map<Integer, SubmittedResult> resMap = storeResultService.fetchAll(new ReadSubmitLogRequest().setProject(project)).getResults();
    assertEquals("Result size is: ", 2, resMap.size());
    assertNotNull("Result 0 is: ", resMap.get(1));
    assertNotNull("Result 1 is: ", resMap.get(2));
}
Also used : SubmittedResult(com.qasymphony.ci.plugin.model.SubmittedResult) LocalData(org.jvnet.hudson.test.recipes.LocalData) Test(org.junit.Test)

Aggregations

SubmittedResult (com.qasymphony.ci.plugin.model.SubmittedResult)7 StoreResultException (com.qasymphony.ci.plugin.exception.StoreResultException)3 Configuration (com.qasymphony.ci.plugin.model.Configuration)2 ReadSubmitLogRequest (com.qasymphony.ci.plugin.store.ReadSubmitLogRequest)2 FilePath (hudson.FilePath)2 IOException (java.io.IOException)2 JSONObject (net.sf.json.JSONObject)2 Test (org.junit.Test)2 LocalData (org.jvnet.hudson.test.recipes.LocalData)2 JavaScriptMethod (org.kohsuke.stapler.bind.JavaScriptMethod)2 SubmittedException (com.qasymphony.ci.plugin.exception.SubmittedException)1 FileReader (com.qasymphony.ci.plugin.store.file.FileReader)1 ClientRequestException (com.qasymphony.ci.plugin.utils.ClientRequestException)1 AbstractProject (hudson.model.AbstractProject)1 Job (hudson.model.Job)1 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)1