package org.bench4q.master.unitTest.controller;

import static org.junit.Assert.*;

import java.io.IOException;

import javax.xml.bind.JAXBException;

import org.bench4q.share.communication.HttpRequester.HttpResponse;
import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.master.ResultLoadModel;
import org.junit.Before;
import org.junit.Test;

public class Test_TestPlanResultController extends TestBase {
	private static String URL = BASE_URL + "/TestPlanResult";
	private static String testPlanRunId = "0cdc3398-5b61-4bff-be48-8075e5d2fa64";

	@Before
	public void prepare() {
		this.setAccessTocken(this.login());
	}

	@Test
	public void test() {
		fail("Not yet implemented");
	}

	public void testScriptReuslts() throws IOException, JAXBException {
		HttpResponse httpResponse = this.httpRequester.sendGet(URL + "/"
				+ testPlanRunId, null,
				makeAccessTockenMap(this.getAccessTocken()));
		assertTrue(httpResponse != null);
		ResultLoadModel resultModel = (ResultLoadModel) MarshalHelper
				.unmarshal(ResultLoadModel.class, httpResponse.getContent());
		assertTrue(resultModel.getValueTimeModels().size() > 0);
	}
}
