public void test_create_empty(){
  final String id="test";
  final Map<String,Object> metadata=new HashMap<String,Object>();
  metadata.put(FileMetadataSchema.ID,id);
  metadata.put("foo","bar");
  final int version=repo.create(metadata);
  metadata.put(FileMetadataSchema.VERSION,Integer.valueOf(version));
  assertEquals("version",0,version);
  RepositoryDocumentImpl doc=(RepositoryDocumentImpl)repo.read(id);
  assertTrue("exists",doc.exists());
  assertEquals("version",version,doc.getVersion());
  assertNotSame("versionCreateTime",0L,doc.getVersionCreateTime());
  assertEquals("earliestVersionCreateTime",doc.getVersionCreateTime(),doc.getEarliestVersionCreateTime());
  assertEquals("metadataUpdateTime",doc.getVersionCreateTime(),doc.getMetadataUpdateTime());
  Map<String,Object> actual=doc.asMap();
  assertEquals("id",id,actual.get(FileMetadataSchema.ID));
  assertEquals("version",version,actual.get(FileMetadataSchema.VERSION));
  assertEquals("user property","bar",actual.get("foo"));
  assertEquals("size",metadata.size(),actual.size());
}

public void test_create_empty ( ) { final String id = "test" ; final Map < String , Object > metadata = new HashMap < String , Object > ( ) ; metadata . put ( FileMetadataSchema . ID , id ) ; metadata . put ( "foo" , "bar" ) ; final int version = repo . create ( metadata ) ; metadata . put ( FileMetadataSchema . VERSION , Integer . valueOf ( version ) ) ; assertEquals ( "version" , 0 , version ) ; RepositoryDocumentImpl doc = ( RepositoryDocumentImpl ) repo . read ( id ) ; assertTrue ( "exists" , doc . exists ( ) ) ; assertEquals ( "version" , version , doc . getVersion ( ) ) ; assertNotSame ( "versionCreateTime" , 0L , doc . getVersionCreateTime ( ) ) ; assertEquals ( "earliestVersionCreateTime" , doc . getVersionCreateTime ( ) , doc . getEarliestVersionCreateTime ( ) ) ; assertEquals ( "metadataUpdateTime" , doc . getVersionCreateTime ( ) , doc . getMetadataUpdateTime ( ) ) ; Map < String , Object > actual = doc . asMap ( ) ; assertEquals ( "id" , id , actual . get ( FileMetadataSchema . ID ) ) ; assertEquals ( "version" , version , actual . get ( FileMetadataSchema . VERSION ) ) ; assertEquals ( "user property" , "bar" , actual . get ( "foo" ) ) ; assertEquals ( "size" , metadata . size ( ) , actual . size ( ) ) ; }
create an empty file and verify its metadata .
