use of org.openscoring.common.EvaluationRequest in project openscoring by openscoring.
the class ModelResourceTest method decisionTreeIris.
@Test
public void decisionTreeIris() throws Exception {
String id = "DecisionTreeIris";
assertEquals("Iris", extractSuffix(id));
BatchModelResponse batchModelResponse = queryBatch();
List<ModelResponse> modelResponses = batchModelResponse.getResponses();
assertNull(modelResponses);
deploy(id);
batchModelResponse = queryBatch();
modelResponses = batchModelResponse.getResponses();
assertEquals(1, modelResponses.size());
download(id);
List<EvaluationRequest> evaluationRequests = loadRecords(id);
EvaluationRequest evaluationRequest = evaluationRequests.get(0);
EvaluationResponse evaluationResponse = evaluate(id, evaluationRequest);
assertEquals(evaluationRequest.getId(), evaluationResponse.getId());
EvaluationRequest invalidEvaluationRequest = invalidate(evaluationRequests.get(50));
evaluationRequests = Arrays.asList(evaluationRequests.get(0), invalidEvaluationRequest, evaluationRequests.get(100));
BatchEvaluationRequest batchEvaluationRequest = new BatchEvaluationRequest();
batchEvaluationRequest.setRequests(evaluationRequests);
BatchEvaluationResponse batchEvaluationResponse = evaluateBatch(id, batchEvaluationRequest);
assertEquals(batchEvaluationRequest.getId(), batchEvaluationResponse.getId());
List<EvaluationResponse> evaluationResponses = batchEvaluationResponse.getResponses();
assertEquals(evaluationRequests.size(), evaluationResponses.size());
EvaluationResponse invalidEvaluationResponse = evaluationResponses.get(1);
assertEquals(invalidEvaluationRequest.getId(), invalidEvaluationResponse.getId());
assertNotNull(invalidEvaluationResponse.getMessage());
undeploy(id);
}
Aggregations