assertTrue(status.isSuccess());
*/
for (int j=0; j<10; j++)
for (int i=0; i<10; i++) {
Reference feedRef = new Reference(config.getServerLocation()+"R/"+i+"/");
FeedClient feedClient = new FeedClient(client,feedRef);
feedClient.setIdentity("admin","admin");
log.info("Checking feed "+j+","+i);
Entry entry = null;
final AtomicReference<Entry> theEntry = new AtomicReference<Entry>();
Status status = feedClient.get(new FeedDestination() {
public void onEntry(Document entryDoc) {
Entry entry = new Entry(entryDoc);
entry.index();
theEntry.set(entry);
}
}).getStatus();
if (status.getCode()==404) {
log.info("Creating feed "+j+","+i);
status = feedClient.create("<feed xmlns='http://www.w3.org/2005/Atom'><title>Feed "+j+","+i+"</title></feed>");
if (!status.isSuccess()) {
log.info("Failure, status="+status.getCode());
}
assertTrue(status.isSuccess());
} else if (status.isSuccess()) {
entry = theEntry.get();
} else {
if (!status.isSuccess()) {
log.info("Failure, status="+status.getCode());
}
assertTrue(status.isSuccess());
}
if (entry==null) {
try {
log.info("Creating entry in "+j+","+i);
feedClient.createEntry("<entry xmlns='http://www.w3.org/2005/Atom'><title>Entry "+i+"</title></entry>");
} catch (StatusException ex) {
log.info("Failure, status="+ex.getStatus().getCode());
assertTrue(false);
}
} else {
log.info("Updating entry in "+i);
entry.setTitle("Updated "+entry.getTitle());
EntryClient entryClient = feedClient.getEntryClient(entry);
status = entryClient.update();
if (!status.isSuccess()) {
log.info("Failure, status="+status.getCode());
}
assertTrue(status.isSuccess());