assertEquals( false, file1Data.getNode().getProperty( "prop2" ).getBoolean() );
assertEquals( DataPropertyType.BOOLEAN, file1Data.getNode().getProperty( "prop2" ).getType() );
assertEquals( 12L, file1Data.getNode().getProperty( "prop3" ).getLong() );
logger.info( "createFile (binary)" );
SimpleRepositoryFileData simpleData =
new SimpleRepositoryFileData( new ByteArrayInputStream( "Hello World!".getBytes( "UTF-8" ) ), "UTF-8",
"text/plain" );
RepositoryFile simpleFile =
repo.createFile( folder1.getId(), new RepositoryFile.Builder( "file2.whatever" ).versioned( true ).build(),
simpleData, null );
Serializable simpleVersion = simpleFile.getVersionId();
logger.info( "getDataForRead (binary)" );
SimpleRepositoryFileData simpleFileData = repo.getDataForRead( simpleFile.getId(), SimpleRepositoryFileData.class );
assertNotNull( simpleFileData );
assertEquals( "Hello World!", IOUtils.toString( simpleFileData.getInputStream(), simpleFileData.getEncoding() ) );
assertEquals( "text/plain", simpleFileData.getMimeType() );
assertEquals( "UTF-8", simpleFileData.getEncoding() );
logger.info( "updateFile (binary)" );
simpleData =
new SimpleRepositoryFileData( new ByteArrayInputStream( "Ciao World!".getBytes( "UTF-8" ) ), "UTF-8",
"text/plain" );
simpleFile = repo.updateFile( simpleFile, simpleData, null );
assertNotNull( simpleFile.getLastModifiedDate() );
logger.info( "getDataForRead (binary)" );
simpleFileData = repo.getDataForRead( simpleFile.getId(), SimpleRepositoryFileData.class );
assertNotNull( simpleFileData );
assertEquals( "Ciao World!", IOUtils.toString( simpleFileData.getInputStream(), simpleFileData.getEncoding() ) );
logger.info( "getDataForReadAtVersion (binary)" );
simpleFileData = repo.getDataAtVersionForRead( simpleFile.getId(), simpleVersion, SimpleRepositoryFileData.class );
assertNotNull( simpleFileData );
assertEquals( "Hello World!", IOUtils.toString( simpleFileData.getInputStream(), simpleFileData.getEncoding() ) );
logger.info( "getChildren" );
List<RepositoryFile> folder1Children = repo.getChildren( new RepositoryRequest( String.valueOf( folder1.getId() ), true, -1, null ) );
assertNotNull( folder1Children );
assertEquals( 2, folder1Children.size() );