added unit tst for getProcessStatus(), fixed scoping issue in processmanager
This commit is contained in:
parent
9754f23fd8
commit
d9beaff898
2 changed files with 20 additions and 5 deletions
|
|
@ -264,7 +264,7 @@ class ProcessManager {
|
||||||
* (AKA when user hits control c in the shell)
|
* (AKA when user hits control c in the shell)
|
||||||
* releases resources held in the processController objects
|
* releases resources held in the processController objects
|
||||||
*/
|
*/
|
||||||
private void shutdown() {
|
public void shutdown() {
|
||||||
this.processQueueMutex = true;
|
this.processQueueMutex = true;
|
||||||
|
|
||||||
Iterator<HashMap.Entry<Integer, ProcessController>> iterator = this.processMap.entrySet().iterator();
|
Iterator<HashMap.Entry<Integer, ProcessController>> iterator = this.processMap.entrySet().iterator();
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,27 @@ public class ProcessManagerTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void addProcessesTest() {
|
public void addProcessesTest() {
|
||||||
int pid1 = manager.newProcess("ping google");
|
int pid1 = manager.newProcess("ping google.com");
|
||||||
assertEquals(0, pid1);
|
int pid2 = manager.newProcess("ping google.com");
|
||||||
|
assertEquals(2, pid2);
|
||||||
|
assertEquals(1, pid1);
|
||||||
|
|
||||||
int pid2 = manager.newProcess("ping google");
|
manager.shutdown();
|
||||||
assertEquals(1, pid2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getStatusTest
|
||||||
|
* positive unit test for getStatus
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getStatusTest() {
|
||||||
|
int pid1 = manager.newProcess("ping google.com");
|
||||||
|
assertEquals(0, pid1);
|
||||||
|
|
||||||
|
int status = manager.getProcessStatus(pid1);
|
||||||
|
assertEquals(0, status);
|
||||||
|
|
||||||
|
manager.shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue