~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to systemtap/org.eclipse.linuxtools.systemtap.ui.structures.tests/src/org/eclipse/linuxtools/systemtap/ui/structures/runnable/CommandTest.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2012-06-29 12:07:30 UTC
  • Revision ID: package-import@ubuntu.com-20120629120730-bfri1xys1i71dpn6
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2006 IBM Corporation.
 
3
 * All rights reserved. This program and the accompanying materials
 
4
 * are made available under the terms of the Eclipse Public License v1.0
 
5
 * which accompanies this distribution, and is available at
 
6
 * http://www.eclipse.org/legal/epl-v10.html
 
7
 *
 
8
 * Contributors:
 
9
 *     IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse
 
10
 *******************************************************************************/
 
11
 
 
12
package org.eclipse.linuxtools.systemtap.ui.structures.runnable;
 
13
 
 
14
import org.eclipse.linuxtools.systemtap.ui.structures.runnable.Command;
 
15
 
 
16
import junit.framework.TestCase;
 
17
 
 
18
public class CommandTest extends TestCase {
 
19
        public CommandTest(String name) {
 
20
                super(name);
 
21
        }
 
22
 
 
23
        protected void setUp() throws Exception {
 
24
                super.setUp();
 
25
                
 
26
                tc = new Command(new String[] {"ls", "/home/"}, null, null);
 
27
        }
 
28
 
 
29
        public void testCommand() {
 
30
                assertNotNull("Command not null", tc);
 
31
 
 
32
                tc = new Command(null, null, null);
 
33
                assertNotNull("Command not null", tc);
 
34
                
 
35
                tc = new Command(new String[] {}, null, null);
 
36
                assertNotNull("Command not null", tc);
 
37
 
 
38
                tc = new Command(new String[] {""}, null, null);
 
39
                assertNotNull("Command not null", tc);
 
40
 
 
41
                tc = new Command(new String[] {"a"}, null, null);
 
42
                assertNotNull("Command not null", tc);
 
43
 
 
44
                tc = new Command(new String[] {"ls", "/"}, null, null);
 
45
                assertNotNull("Command not null", tc);
 
46
        }
 
47
 
 
48
        public void testIsFinished() {
 
49
                assertTrue("Not finished", tc.isRunning());
 
50
                tc.stop();
 
51
                assertFalse("Finished", tc.isRunning());
 
52
        }
 
53
        
 
54
        public void testStop() {
 
55
                assertTrue("Running", tc.isRunning());
 
56
                tc.stop();
 
57
                assertFalse("Not running", tc.isRunning());
 
58
        }
 
59
 
 
60
        public void testGetReturnValue() {
 
61
                assertEquals(-1, tc.getReturnValue());
 
62
        }
 
63
        
 
64
        public void testIsDisposed() {
 
65
                assertFalse(tc.isDisposed());
 
66
                tc.dispose();
 
67
                assertTrue(tc.isDisposed());
 
68
        }
 
69
        
 
70
        public void testDispose() {
 
71
                tc.dispose();
 
72
        }
 
73
 
 
74
        protected void tearDown() throws Exception {
 
75
                super.tearDown();
 
76
        }
 
77
 
 
78
        Command tc;
 
79
}
 
80