// // GET: /Configuration/ManualSync public ActionResult ManualSync() { IVirtualMachineRepository vmRepo = new VirtualMachineRepository(); vmRepo.ReinitializeAllRegisteredVirtualMachines(); return RedirectToAction("Index"); }
public void PowerOnTest() { VirtualMachineRepository vmr = new VirtualMachineRepository(); VirtualMachine vm = vmr.GetAllRegisteredVirtualMachines().GetEnumerator().Current; // TODO: Initialize to an appropriate value RegisteredVirtualMachineService target = new RegisteredVirtualMachineService(vm); // TODO: Initialize to an appropriate value if (target.GetStatus() == VirtualMachine.STOPPED) { target.PowerOn(); Assert.IsTrue(target.GetStatus() == VirtualMachine.POWERINGON || target.GetStatus() == VirtualMachine.RUNNING); } else Assert.Inconclusive(); }
public void PauseTest() { VirtualMachineRepository vmr = new VirtualMachineRepository(); VirtualMachine vm = vmr.GetAllRegisteredVirtualMachines().GetEnumerator().Current; // TODO: Initialize to an appropriate value RegisteredVirtualMachineService target = new RegisteredVirtualMachineService(vm); // TODO: Initialize to an appropriate value if (target.GetStatus() == VirtualMachine.RUNNING) { target.Pause(); Assert.Equals(target.GetStatus(), VirtualMachine.PAUSED); } else Assert.Inconclusive(); }
public void CreateSnapshotTest() { VirtualMachineRepository target = new VirtualMachineRepository(); // TODO: Initialize to an appropriate value string name = System.Guid.NewGuid().ToString(); VirtualMachine vm = target.GetAllRegisteredVirtualMachines().GetEnumerator().Current; target.CreateSnapshot(vm, name, ""); VMWareVirtualHost virtualHost = new VMWareVirtualHost(); VMWareVirtualMachine vmw = virtualHost.Open(vm.ImagePathName); VMWareSnapshot s = vmw.Snapshots.GetNamedSnapshot(name); //not sure if we need to create a boolean first to see if s is null s.RemoveSnapshot(); Assert.IsNotNull(s); }
public void ToggleVMStatusTest() { VirtualMachineRepository target = new VirtualMachineRepository(); // TODO: Initialize to an appropriate value VirtualMachine vm = target.GetAllRegisteredVirtualMachines().GetEnumerator().Current; var service = new RegisteredVirtualMachineService(vm.ImagePathName); if (service.IsRunning()) { int status = target.ToggleVMStatus(vm.VirtualMachineId); Assert.IsTrue(status == VirtualMachine.STOPPED || status == VirtualMachine.POWERINGOFF); } else { int status = target.ToggleVMStatus(vm.VirtualMachineId); Assert.IsTrue(status == VirtualMachine.RUNNING || status == VirtualMachine.POWERINGON); } }
public void GetNextAvailableIP() { // Arrange var vmRepo = new VirtualMachineRepository(true); var ipList = new List<string>() { "192.168.1.1", "192.168.1.3", "192.168.1.5", "192.168.1.6" }; // Act string nextIP = vmRepo.GetNextAvailableIP(ipList); // Assert Assert.AreEqual(nextIP,"192.168.1.2"); }
public void SetHostnameTest() { VirtualMachineRepository vmr = new VirtualMachineRepository(); VirtualMachine vm = vmr.GetAllRegisteredVirtualMachines().GetEnumerator().Current; // TODO: Initialize to an appropriate value RegisteredVirtualMachineService target = new RegisteredVirtualMachineService(vm); // TODO: Initialize to an appropriate value string hostname = string.Empty; // TODO: Initialize to an appropriate value target.SetHostname(hostname); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void SetIPTest() { VirtualMachineRepository vmr = new VirtualMachineRepository(); VirtualMachine vm = vmr.GetAllRegisteredVirtualMachines().GetEnumerator().Current; // TODO: Initialize to an appropriate value RegisteredVirtualMachineService target = new RegisteredVirtualMachineService(vm); // TODO: Initialize to an appropriate value string oldIP = target.GetIP(); //set the new IP to the same first several sets of characters, but change the last few string value = oldIP.Substring(0, oldIP.LastIndexOf('.')) + ".200"; target.SetIP(value); string newIP = target.GetIP(); target.SetIP(oldIP); Assert.Equals(newIP, value); }