package org.jerrymouse.chineseCalendar.controller;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jerrymouse.chineseCalendar.model.birthday.BirthdayEncoder;
import org.jerrymouse.chineseCalendar.test.TestDataProvier;
import org.jerrymouse.chineseCalendar.test.TestInfo;
import org.jerrymouse.chineseCalendar.view.FeedView;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedOutput;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { TestInfo.ApplicationContentPath })
public class FeedControlerTest {
	Log logger = LogFactory.getLog(FeedControlerTest.class);
	@Autowired
	FeedView feedControler;

	@Autowired
	BirthdayEncoder birthdayEncoder;

	@Autowired
	TestDataProvier dataProvier;

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testCreatFeed() throws FeedException {

		SyndFeed feed = feedControler.creatFeed(birthdayEncoder
				.encode(dataProvier.generateTestData2()));
		SyndFeedOutput output = new SyndFeedOutput();
		logger.trace(output.outputString(feed));
	}

}
