Formatting the code - Adding final modifier to attributes and indenting the code.
Signed-off-by: Daan Hoogland <daan.hoogl...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/159d8c2c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/159d8c2c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/159d8c2c Branch: refs/heads/master Commit: 159d8c2c977592c3678474a8961954cc3e3682b3 Parents: f92a503 Author: wilderrodrigues <wrodrig...@schubergphilis.com> Authored: Thu Jun 4 08:12:04 2015 +0200 Committer: Daan Hoogland <daan.hoogl...@gmail.com> Committed: Thu Jun 4 12:34:03 2015 +0200 ---------------------------------------------------------------------- .../ovm/src/com/cloud/ovm/object/Test.java | 63 ++++++++++---------- 1 file changed, 32 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/159d8c2c/plugins/hypervisors/ovm/src/com/cloud/ovm/object/Test.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/ovm/src/com/cloud/ovm/object/Test.java b/plugins/hypervisors/ovm/src/com/cloud/ovm/object/Test.java index 080b3cc..f5cecb1 100644 --- a/plugins/hypervisors/ovm/src/com/cloud/ovm/object/Test.java +++ b/plugins/hypervisors/ovm/src/com/cloud/ovm/object/Test.java @@ -21,7 +21,7 @@ import java.util.List; import java.util.Map; public class Test { - public static void main(String[] args) { + public static void main(final String[] args) { try { /*Connection c = new Connection("192.168.105.155", "oracle", "password"); Utils util = new UtilsImpl(c); @@ -56,16 +56,16 @@ public class Test { Pair<Long, Long> spaceInfo = storage.getSrSpaceInfo("192.168.110.232:/export/frank/nfs"); System.out.println("Total:" + spaceInfo.first()); System.out.println("Free:" + spaceInfo.second());*/ - OvmVm.Details vm = new OvmVm.Details(); + final OvmVm.Details vm = new OvmVm.Details(); vm.cpuNum = 1; vm.memory = 512; vm.name = "Test"; vm.uuid = "This-is-a-test"; - OvmDisk.Details rootDisk = new OvmDisk.Details(); + final OvmDisk.Details rootDisk = new OvmDisk.Details(); rootDisk.path = "/root/root.raw"; rootDisk.type = OvmDisk.WRITE; vm.rootDisk = rootDisk; - OvmDisk.Details dataDisk = new OvmDisk.Details(); + final OvmDisk.Details dataDisk = new OvmDisk.Details(); dataDisk.path = "/tmp/data.raw"; dataDisk.type = OvmDisk.SHAREDWRITE; vm.disks.add(dataDisk); @@ -73,7 +73,7 @@ public class Test { vm.disks.add(dataDisk); vm.disks.add(dataDisk); vm.disks.add(dataDisk); - OvmVif.Details vif = new OvmVif.Details(); + final OvmVif.Details vif = new OvmVif.Details(); vif.mac = "00:ff:ff:ff:ff:ee"; vif.bridge = "xenbr0"; vif.type = OvmVif.NETFRONT; @@ -83,34 +83,35 @@ public class Test { vm.vifs.add(vif); vm.vifs.add(vif); //System.out.println(vm.toJson()); - Connection c = new Connection("192.168.189.12", "oracle", "password"); + final Connection c = new Connection("192.168.189.12", "oracle", "password"); //System.out.println(Coder.toJson(OvmHost.getDetails(c))); - String txt = - "{\"MasterIp\": \"192.168.189.12\", \"dom0Memory\": 790626304, \"freeMemory\": 16378757120, \"totalMemory\": 17169383424, \"cpuNum\": 4, \"agentVersion\": \"2.3-38\", \"cpuSpeed\": 2261}"; + final String txt = + "{\"MasterIp\": \"192.168.189.12\", \"dom0Memory\": 790626304, \"freeMemory\": 16378757120, \"totalMemory\": 17169383424, \"cpuNum\": 4, \"agentVersion\": \"2.3-38\", \"cpuSpeed\": 2261}"; + //OvmHost.Details d = new GsonBuilder().create().fromJson(txt, OvmHost.Details.class); //OvmHost.Details d = Coder.fromJson(txt, OvmHost.Details.class); //OvmHost.Details d = OvmHost.getDetails(c); //System.out.println(Coder.toJson(d)); -// OvmStoragePool.Details pool = new OvmStoragePool.Details(); -// pool.path = "192.168.110.232:/export/frank/ovs"; -// pool.type = OvmStoragePool.NFS; -// pool.uuid = "123"; -// System.out.println(pool.toJson()); + // OvmStoragePool.Details pool = new OvmStoragePool.Details(); + // pool.path = "192.168.110.232:/export/frank/ovs"; + // pool.type = OvmStoragePool.NFS; + // pool.uuid = "123"; + // System.out.println(pool.toJson()); String cmd = null; System.out.println(args.length); if (args.length >= 1) { cmd = args[0]; - OvmVm.Details d = new OvmVm.Details(); + final OvmVm.Details d = new OvmVm.Details(); d.cpuNum = 1; d.memory = 512 * 1024 * 1024; d.name = "MyTest"; d.uuid = "1-2-3-4-5"; - OvmDisk.Details r = new OvmDisk.Details(); + final OvmDisk.Details r = new OvmDisk.Details(); r.path = "/var/ovs/mount/60D0985974CA425AAF5D01A1F161CC8B/running_pool/36_systemvm/System.img"; r.type = OvmDisk.WRITE; d.rootDisk = r; - OvmVif.Details v = new OvmVif.Details(); + final OvmVif.Details v = new OvmVif.Details(); v.mac = "00:16:3E:5C:B1:D1"; v.bridge = "xenbr0"; v.type = OvmVif.NETFRONT; @@ -123,55 +124,55 @@ public class Test { OvmVm.create(c, d); // c.call("OvmVm.echo", new Object[]{s}); } else if (cmd.equalsIgnoreCase("reboot")) { - Map<String, String> res = OvmVm.reboot(c, "MyTest"); + final Map<String, String> res = OvmVm.reboot(c, "MyTest"); System.out.println(res.get("vncPort")); //OvmVm.stop(c, "MyTest"); //OvmVm.create(c, d); } else if (cmd.equalsIgnoreCase("stop")) { OvmVm.stop(c, "MyTest"); } else if (cmd.equalsIgnoreCase("details")) { - OvmVm.Details ddd = OvmVm.getDetails(c, "MyTest"); + final OvmVm.Details ddd = OvmVm.getDetails(c, "MyTest"); System.out.println(ddd.vifs.size()); System.out.println(ddd.rootDisk.path); System.out.println(ddd.powerState); } else if (cmd.equalsIgnoreCase("all")) { System.out.println(OvmHost.getAllVms(c)); } else if (cmd.equalsIgnoreCase("createBridge")) { - OvmBridge.Details bd = new OvmBridge.Details(); + final OvmBridge.Details bd = new OvmBridge.Details(); bd.name = "xenbr10"; bd.attach = args[1]; OvmBridge.create(c, bd); } else if (cmd.equalsIgnoreCase("createVlan")) { - OvmVlan.Details vd = new OvmVlan.Details(); + final OvmVlan.Details vd = new OvmVlan.Details(); vd.pif = "eth0"; vd.vid = 1000; - String vname = OvmVlan.create(c, vd); + final String vname = OvmVlan.create(c, vd); System.out.println(vname); } else if (cmd.equalsIgnoreCase("delVlan")) { OvmVlan.delete(c, args[1]); } else if (cmd.equalsIgnoreCase("delBr")) { OvmBridge.delete(c, args[1]); } else if (cmd.equalsIgnoreCase("getBrs")) { - List<String> brs = OvmBridge.getAllBridges(c); + final List<String> brs = OvmBridge.getAllBridges(c); System.out.println(brs); } else if (cmd.equalsIgnoreCase("getBrDetails")) { - OvmBridge.Details brd = OvmBridge.getDetails(c, args[1]); + final OvmBridge.Details brd = OvmBridge.getDetails(c, args[1]); System.out.println(brd.interfaces); } } - List<String> l = new ArrayList<String>(); + final List<String> l = new ArrayList<String>(); l.add("4b4d8951-f0b6-36c5-b4f3-a82ff2611c65"); System.out.println(Coder.toJson(l)); -// Map<String, String> res = OvmHost.getPerformanceStats(c, "xenbr0"); -// System.out.println(res.toString()); -// String stxt = "{\"vifs\": [{\"bridge\": \"xenbr0\", \"mac\": \"00:16:3E:5C:B1:D1\", \"type\": \"netfront\"}], \"powerState\": \"RUNNING\", \"disks\": [], \"cpuNum\": 1, \"memory\": 536870912, \"rootDisk\": {\"path\": \"/var/ovs/mount/60D0985974CA425AAF5D01A1F161CC8B/running_pool/MyTest/System.img\", \"type\": \"w\"}}"; -// OvmVm.Details ddd = Coder.fromJson(stxt, OvmVm.Details.class); -// System.out.println(ddd.vifs.size()); -// System.out.println(ddd.rootDisk.path); - } catch (Exception e) { + // Map<String, String> res = OvmHost.getPerformanceStats(c, "xenbr0"); + // System.out.println(res.toString()); + // String stxt = "{\"vifs\": [{\"bridge\": \"xenbr0\", \"mac\": \"00:16:3E:5C:B1:D1\", \"type\": \"netfront\"}], \"powerState\": \"RUNNING\", \"disks\": [], \"cpuNum\": 1, \"memory\": 536870912, \"rootDisk\": {\"path\": \"/var/ovs/mount/60D0985974CA425AAF5D01A1F161CC8B/running_pool/MyTest/System.img\", \"type\": \"w\"}}"; + // OvmVm.Details ddd = Coder.fromJson(stxt, OvmVm.Details.class); + // System.out.println(ddd.vifs.size()); + // System.out.println(ddd.rootDisk.path); + } catch (final Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }