Repository repository = getRepository();
for (int i = 0; i < 10; i++) {
try {
RepositoryItem item = repository.findRepositoryItemById("File"
+ i + ".txt");
repository.remove(item);
} catch (NoSuchElementException e) {
// Do nothing if repository item doesn't exist
}
}
for (int i = 0; i < 10; i++) {
RepositoryItem item = repository.createRepositoryItem("File" + i
+ ".txt");
item.putMetadataEntry("numFile", Integer.toString(i));
item.putMetadataEntry("att", "value");
item.putMetadataEntry("regexAtt", "token" + Integer.toString(i));
OutputStream os = item.createOutputStreamToWrite();
os.write(0);
os.close();
}
for (int i = 0; i < 10; i++) {
try {
RepositoryItem item = repository.findRepositoryItemById("File"
+ i + ".txt");
String numString = item.getMetadata().get("numFile");
assertEquals(numString, Integer.toString(i));
assertEquals(item.getMetadata().get("att"), "value");
} catch (NoSuchElementException e) {
fail("Element 'File" + i + ".txt' doesn't exist");
}