ServerConfiguration conf = new ServerConfiguration();
File serverConfFile = new File(dir,"server.conf");
assertTrue(serverConfFile.exists());
conf.load(serverConfFile.toURI());
StorageFactory storageFactory = new FileStorageFactory();
WebComponent web = new WebComponent(dir,dbList,storageFactory,conf);
for (DB db : dbList.values()) {
db.connect();
}
web.start();
Identity admin = new Identity("admin","admin");
Reference autoRef = new Reference("http://localhost:8080/R/");
FeedClient client = new FeedClient(autoRef,admin);
Status status = client.create("<feed xmlns='http://www.w3.org/2005/Atom'><title>autoconf</title></feed>");
assertTrue(status.isSuccess());
client.createEntry(
"<entry xmlns='http://www.w3.org/2005/Atom'>" +
"<title>test1 db</title>" +
"<category scheme='http://www.atomojo.org/O/configuration/' term='db'/>"+
"<category scheme='http://www.atomojo.org/O/configuration/db/' term='auth' value='auth'/>" +
"<category scheme='http://www.atomojo.org/O/configuration/db/' term='name' value='test1'/>" +
"<category scheme='http://www.atomojo.org/O/configuration/db/' term='group' value='test'/>" +
"<category scheme='http://www.atomojo.org/O/configuration/db/' term='alias' value='web1'/>" +
"</entry>");
client.createEntry(
"<entry xmlns='http://www.w3.org/2005/Atom'>" +
"<title>testweb1 host</title>" +
"<category scheme='http://www.atomojo.org/O/configuration/' term='host'/>"+
"<content type='text/xml'>" +
"<host name='testweb1' xmlns='http://www.atomojo.org/Vocabulary/Admin/2007/1/0' database='test1'/>" +
"</content>" +
"</entry>");
// Wait one minute for autoconf to recognize entries;
Thread.sleep(7000);
Reference testweb1 = new Reference("http://testweb1:8080/");
IntrospectionClient introspect = new IntrospectionClient(LOG,testweb1);
introspect.setIdentity(admin);
introspect.introspect(new IntrospectionClient.ServiceListener() {
public void onStartWorkspace(String title) {}
public void onCollection(EntryCollection collection) {}
public void onEndWorkspace() {}
});
Reference resourceWeb1 = new Reference("http://testweb2:8080/test/web1/");
IntrospectionClient introspect2 = new IntrospectionClient(LOG,resourceWeb1);
introspect2.setIdentity(admin);
introspect2.introspect(new IntrospectionClient.ServiceListener() {
public void onStartWorkspace(String title) {}
public void onCollection(EntryCollection collection) {}
public void onEndWorkspace() {}
});
web.stop();
}