final String modSampleString = "Ciao World!";
final boolean modSampleBoolean = true;
final int modSampleInteger = 2048;
final SampleRepositoryFileData modData =
new SampleRepositoryFileData( modSampleString, modSampleBoolean, modSampleInteger );
RepositoryFile.Builder builder = new RepositoryFile.Builder( newFile );
final String desc = "Hello World description";
builder.description( RepositoryFile.DEFAULT_LOCALE, desc );
repo.updateFile( builder.build(), modData, null );
List<VersionSummary> versionSummaries = repo.getVersionSummaries( newFile.getId() );
RepositoryFile v1 = repo.getFileAtVersion( newFile.getId(), versionSummaries.get( 0 ).getId() );
RepositoryFile v2 = repo.getFileAtVersion( newFile.getId(), versionSummaries.get( 1 ).getId() );
assertEquals( fileName, v1.getName() );
assertEquals( fileName, v2.getName() );
assertEquals( fileId, v1.getId() );
assertEquals( fileId, v2.getId() );
assertEquals( "1.0", v1.getVersionId() );
assertEquals( "1.1", v2.getVersionId() );
assertEquals( absolutePath, v1.getPath() );
assertEquals( absolutePath, v2.getPath() );
assertNull( v1.getDescription() );
assertEquals( desc, v2.getDescription() );
System.out.println( "or: " + newFile );
System.out.println( "v1: " + v1 );
System.out.println( "v2: " + v2 );
SampleRepositoryFileData c1 =
repo.getDataAtVersionForRead( v1.getId(), v1.getVersionId(), SampleRepositoryFileData.class );
SampleRepositoryFileData c2 =
repo.getDataAtVersionForRead( v2.getId(), v2.getVersionId(), SampleRepositoryFileData.class );
assertEquals( origSampleString, c1.getSampleString() );
assertEquals( origSampleBoolean, c1.getSampleBoolean() );
assertEquals( origSampleInteger, c1.getSampleInteger() );
assertEquals( modSampleString, c2.getSampleString() );
assertEquals( modSampleBoolean, c2.getSampleBoolean() );
assertEquals( modSampleInteger, c2.getSampleInteger() );
}