package org.jerrymouse.cc.site.convert;

import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jerrymouse.cc.site.bean.Format;
import org.jerrymouse.cc.site.bean.Resource;
import org.jerrymouse.cc.site.bean.Type;
import org.jerrymouse.cc.site.bean.User;
import org.jerrymouse.cc.site.convert.image.ImageConvertor;
import org.jerrymouse.cc.site.convert.image.SvgConvertor;
import org.jerrymouse.cc.site.database.UserDao;
import org.jerrymouse.cc.site.test.BaseTest;
import org.jerrymouse.cc.utils.ResourceBuilder;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

public class ImageConvertorTest extends BaseTest {
	@Autowired
	UserDao userDao;
	Resource resource;
	Convertor convertor;
	Log log = LogFactory.getLog(ImageConvertorTest.class);

	@Override
	protected void onSetUp() throws Exception {
		super.onSetUp();
		User user = userDao.getUserByName("yankai");
		resource = user.getStorage().getResourceByName("Cloud_computing");
		convertor = new CommonConvertor();
		resource.setFormat(new Format(new Type("png")));
	}

	@Test
	public void testConvert() throws Exception {
		// log.debug(new String(src));
		log.debug(convertor.convert(resource));
	}
}
