@@ -0,0 +1,1724 @@
+package org.fedorahosted.flies.model;%0A%0Aimport java.util.List;%0A%0Aimport static org.hamcrest.CoreMatchers.*;%0Aimport static org.hamcrest.MatcherAssert.*;%0A%0Aimport org.dbunit.operation.DatabaseOperation;%0Aimport org.fedorahosted.flies.FliesDbunitJpaTest;%0Aimport org.fedorahosted.flies.common.ContentType;%0Aimport org.fedorahosted.flies.common.LocaleId;%0Aimport org.hibernate.Session;%0Aimport org.hibernate.criterion.Restrictions;%0Aimport org.testng.annotations.Test;%0A%0Apublic class HTextFlowTargetHistoryTest extends FliesDbunitJpaTest %7B%0A%0A%09protected void prepareDBUnitOperations() %7B%0A%09%09beforeTestOperations.add(new DataSetOperation(%0A%09%09%09%09%22META-INF/testdata/ProjectsData.dbunit.xml%22,%0A%09%09%09%09DatabaseOperation.CLEAN_INSERT));%0A%09%7D%0A%0A%09@Test%0A%09public void ensureHistoryIsRecorded() %7B%0A%09%09Session session = getSession();%0A%09%09HDocument d = new HDocument(%22/path/to/document.txt%22,%0A%09%09%09%09ContentType.TextPlain, LocaleId.EN);%0A%09%09d.setProjectIteration((HProjectIteration) session.load(%0A%09%09%09%09HProjectIteration.class, 1L));%0A%09%09session.save(d);%0A%09%09session.flush();%0A%0A%09%09HTextFlow tf = new HTextFlow(d, %22mytf%22, %22hello world%22);%0A%09%09d.getTextFlows().add(tf);%0A%09%09session.flush();%0A%0A%09%09HTextFlowTarget target = new HTextFlowTarget(tf, LocaleId.EN_US);%0A%09%09target.setContent(%22helleu world%22);%0A%09%09session.save(target);%0A%09%09session.flush();%0A%09%09%0A%09%09List%3CHTextFlowTargetHistory%3E historyElems = getHistory(target);%0A%09%09assertThat(historyElems.size(), is(0));%0A%0A%09%09target.setContent(%22blah!%22);%0A%09%09session.flush();%0A%0A%09%09historyElems = getHistory(target);%0A%0A%09%09assertThat(historyElems.size(), is(1));%0A%0A%09%7D%0A%0A%09private List%3CHTextFlowTargetHistory%3E getHistory(HTextFlowTarget tft) %7B%0A%09%09return getSession().createCriteria(HTextFlowTargetHistory.class).add(%0A%09%09%09%09Restrictions.eq(%22textFlowTarget%22, tft)).list();%0A%0A%09%7D%0A%7D%0A

add test for TextFlowTarget history