diff options
Diffstat (limited to 'src/main/java/org/openslx/dnbd3/Test.java')
-rw-r--r-- | src/main/java/org/openslx/dnbd3/Test.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/dnbd3/Test.java b/src/main/java/org/openslx/dnbd3/Test.java new file mode 100644 index 0000000..c94348c --- /dev/null +++ b/src/main/java/org/openslx/dnbd3/Test.java @@ -0,0 +1,63 @@ +package org.openslx.dnbd3; + +import java.util.List; + +import org.openslx.dnbd3.xml.Client; +import org.openslx.dnbd3.xml.Image; + +public class Test { + + public static void main(String[] args) throws Exception { + + try { + DNBD3Server server = new DNBD3Server(); + + String group = "Test 11.11"; + int vid = 10; + int rid = 0; + String path = "/home/jjl/Data/ISOs/Ubuntu/ubuntu-10.04.3-desktop-i386.iso"; + String servers = "132.230.4.29;132.230.4.220;10.1.1.1"; + String cache = "/tmp/image.iso.cache"; + Image image = new Image(group, vid, rid, path, servers, cache); + server.addImage(image); + + server.doReload(); + + System.out.println("Exported images (group, atime, vid, rid, path, servers, cache):"); + System.out.println("==============================================================="); + List<Image> images = server.getImages(); + for (Image i : images) { + System.out.print(i.getGroup() + "\t"); + System.out.print(i.getAtime() + "\t"); + System.out.print(i.getVid() + "\t"); + System.out.print(i.getRid() + "\t"); + System.out.print(i.getFile() + "\t"); + System.out.print(i.getServers() + "\t"); + System.out.print(i.getCache()); + System.out.println(); + } + System.out.println(); + System.out.println("Number images: " + images.size()); + System.out.println(); + + System.out.println("Connected clients (ip, file)"); + System.out.println("============================"); + List<Client> clients = server.getClients(); + for (Client client : clients) { + System.out.print(client.getIp() + "\t"); + System.out.print(client.getFile()); + System.out.println(); + } + System.out.println(); + System.out.println("Number clients: " + clients.size()); + System.out.println(); + + // server.doShutdown(); + + } catch (DNBD3Exception e) { + System.out.println(e); + + } + } + +} |