use of org.commonjava.indy.subsys.datafile.change.DataFileEvent in project indy by Commonjava.
the class RevisionsManagerTest method commitTwoDifferentFilesAndRetrieveChangelogForOneOfThem.
@Test
public void commitTwoDifferentFilesAndRetrieveChangelogForOneOfThem() throws Exception {
lcEvents.fireStarted();
final DataFile f1 = dfManager.getDataFile("test/foo.txt");
f1.writeString("this is a test", "UTF-8", new ChangeSummary("test-user", "test for first file."));
final DataFile f2 = dfManager.getDataFile("test/bar.txt");
f2.writeString("this is a test", "UTF-8", new ChangeSummary("test-user", "test for second file."));
f2.writeString("this is another test", "UTF-8", new ChangeSummary("test-user", "test (2) for second file."));
final List<DataFileEvent> events = listener.waitForEvents(3);
System.out.println("Got events:\n " + join(events, "\n "));
final List<ChangeSummary> changeLog = revManager.getDataChangeLog(f2.getPath(), 0, -1);
assertThat(changeLog, notNullValue());
assertThat(changeLog.size(), equalTo(2));
}
use of org.commonjava.indy.subsys.datafile.change.DataFileEvent in project indy by Commonjava.
the class RevisionsManagerTest method commitOneFileTwice_ChangedBeforeServerStart_FirstChangelogAppearsOnServerStart.
@Test
public void commitOneFileTwice_ChangedBeforeServerStart_FirstChangelogAppearsOnServerStart() throws Exception {
revManager.setup();
final DataFile f1 = dfManager.getDataFile("test/foo.txt");
f1.writeString("this is a test", "UTF-8", new ChangeSummary("test-user", "test for first write of file."));
List<DataFileEvent> events = listener.waitForEvents(1);
System.out.println("Got events:\n " + join(events, "\n "));
f1.writeString("this is another test", "UTF-8", new ChangeSummary("test-user", "test for second write of file."));
events = listener.waitForEvents(1);
System.out.println("Got events:\n " + join(events, "\n "));
List<ChangeSummary> changeLog = revManager.getDataChangeLog(f1.getPath(), 0, -1);
assertThat(changeLog, notNullValue());
assertThat(changeLog.size(), equalTo(0));
lcEvents.fireStarted();
changeLog = revManager.getDataChangeLog(f1.getPath(), 0, -1);
assertThat(changeLog, notNullValue());
assertThat(changeLog.size(), equalTo(1));
assertThat(changeLog.get(0).getSummary().contains(RevisionsManager.CATCHUP_CHANGELOG), equalTo(true));
}
use of org.commonjava.indy.subsys.datafile.change.DataFileEvent in project indy by Commonjava.
the class RevisionsManagerTest method commitOneFileTwice_NoChangeSecondTime_RetrieveOneChangelog.
@Test
public void commitOneFileTwice_NoChangeSecondTime_RetrieveOneChangelog() throws Exception {
lcEvents.fireStarted();
revManager.setup();
final DataFile f1 = dfManager.getDataFile("test/foo.txt");
f1.writeString("this is a test", "UTF-8", new ChangeSummary("test-user", "test for first write of file."));
List<DataFileEvent> events = listener.waitForEvents(1);
System.out.println("Got events:\n " + join(events, "\n "));
f1.writeString("this is a test", "UTF-8", new ChangeSummary("test-user", "test for second write of file."));
events = listener.waitForEvents(1);
System.out.println("Got events:\n " + join(events, "\n "));
final List<ChangeSummary> changeLog = revManager.getDataChangeLog(f1.getPath(), 0, -1);
assertThat(changeLog, notNullValue());
assertThat(changeLog.size(), equalTo(1));
assertThat(changeLog.get(0).getSummary().contains("test for first write of file."), equalTo(true));
}
Aggregations