package org.bench4q.master.unitTest.report;

import static org.junit.Assert.*;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import org.bench4q.master.domain.service.report.ReportService;
import org.jfree.data.time.Second;
import org.jfree.data.time.TimeSeries;
import org.junit.Test;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.pdf.PdfWriter;

public class ReportFontTest {

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

	public void createReportTest() throws FileNotFoundException,
			DocumentException {

		Document document = new Document();
		PdfWriter.getInstance(
				document,
				new FileOutputStream(ReportService.buildFilePath(UUID
						.randomUUID())));
		document.open();

	}

	public void createTestImage(UUID id, Document document) throws IOException,
			Exception {
		List<TimeSeries> timeSeriesList = new ArrayList<TimeSeries>();
		TimeSeries timeSeries = new TimeSeries("test");
		long now = System.currentTimeMillis();
		timeSeries.add(new Second(new Date(now)), 3000);
		timeSeries.add(new Second(new Date(now + 100)), 4000);
		timeSeriesList.add(timeSeries);
		ReportService.buildSeries(1, "test");
		ReportService.writeImageIntoPdf(
				ReportService.buildChartStream(document, 1, timeSeriesList,
						"test").toByteArray(), document);
	}
}
