1 7 package test.enterprise.deploy.shared; 8 9 import javax.enterprise.deploy.shared.ActionType ; 10 import javax.enterprise.deploy.shared.CommandType ; 11 import javax.enterprise.deploy.shared.DConfigBeanVersionType ; 12 import javax.enterprise.deploy.shared.ModuleType ; 13 import javax.enterprise.deploy.shared.StateType ; 14 15 import junit.framework.TestCase; 16 17 21 public class TypeTest extends TestCase 22 { 23 24 public TypeTest() 25 { 26 super(); 27 } 28 29 30 35 public TypeTest(String name) 36 { 37 super(name); 38 } 39 40 41 42 public void testActionType() 43 { 44 assertEquals("ActionType.EXECUTE value is not correct", ActionType.EXECUTE, ActionType.getActionType(0)); 45 assertEquals("ActionType.EXECUTE value is not correct", ActionType.EXECUTE.getValue(), 0); 46 assertEquals("ActionType.EXECUTE string is not correct", ActionType.EXECUTE.toString(), "execute"); 47 48 assertEquals("ActionType.CANCEL value is not correct", ActionType.CANCEL, ActionType.getActionType(1)); 49 assertEquals("ActionType.CANCEL value is not correct", ActionType.CANCEL.getValue(), 1); 50 assertEquals("ActionType.CANCEL string is not correct", ActionType.CANCEL.toString(), "cancel"); 51 52 assertEquals("ActionType.STOP value is not correct", ActionType.STOP, ActionType.getActionType(2)); 53 assertEquals("ActionType.STOP value is not correct", ActionType.STOP.getValue(), 2); 54 assertEquals("ActionType.STOP string is not correct", ActionType.STOP.toString(), "stop"); 55 } 56 57 58 59 public void testDConfigBeanVersionType() 60 { 61 assertEquals("DConfigBeanVersionType.V1_3 value is not correct", DConfigBeanVersionType.V1_3, DConfigBeanVersionType.getDConfigBeanVersionType(0)); 62 assertEquals("DConfigBeanVersionType.V1_3 value is not correct", DConfigBeanVersionType.V1_3.getValue(), 0); 63 assertEquals("DConfigBeanVersionType.V1_3 string is not correct", DConfigBeanVersionType.V1_3.toString(), "V1_3"); 64 65 assertEquals("DConfigBeanVersionType.V1_3_1 value is not correct", DConfigBeanVersionType.V1_3_1, DConfigBeanVersionType.getDConfigBeanVersionType(1)); 66 assertEquals("DConfigBeanVersionType.V1_3_1 value is not correct", DConfigBeanVersionType.V1_3_1.getValue(), 1); 67 assertEquals("DConfigBeanVersionType.V1_3_1 string is not correct", DConfigBeanVersionType.V1_3_1.toString(), "V1_3_1"); 68 69 assertEquals("DConfigBeanVersionType.V1_4 value is not correct", DConfigBeanVersionType.V1_4, DConfigBeanVersionType.getDConfigBeanVersionType(2)); 70 assertEquals("DConfigBeanVersionType.V1_4 value is not correct", DConfigBeanVersionType.V1_4.getValue(), 2); 71 assertEquals("DConfigBeanVersionType.V1_4 string is not correct", DConfigBeanVersionType.V1_4.toString(), "V1_4"); 72 } 73 74 75 76 public void testModuleType() 77 { 78 assertEquals("ModuleType.EAR value is not correct", ModuleType.EAR, ModuleType.getModuleType(0)); 79 assertEquals("ModuleType.EAR value is not correct", ModuleType.EAR.getValue(), 0); 80 assertEquals("ModuleType.EAR string is not correct", ModuleType.EAR.toString(), "EAR"); 81 assertEquals("ModuleType.EAR extension is not correct", ModuleType.EAR.getModuleExtension(), "ear"); 82 83 assertEquals("ModuleType.EJB value is not correct", ModuleType.EJB, ModuleType.getModuleType(1)); 84 assertEquals("ModuleType.EJB value is not correct", ModuleType.EJB.getValue(), 1); 85 assertEquals("ModuleType.EJB string is not correct", ModuleType.EJB.toString(), "EJB"); 86 assertEquals("ModuleType.EJB extension is not correct", ModuleType.EJB.getModuleExtension(), "jar"); 87 88 assertEquals("ModuleType.CAR value is not correct", ModuleType.CAR, ModuleType.getModuleType(2)); 89 assertEquals("ModuleType.CAR value is not correct", ModuleType.CAR.getValue(), 2); 90 assertEquals("ModuleType.CAR string is not correct", ModuleType.CAR.toString(), "CAR"); 91 assertEquals("ModuleType.CAR extension is not correct", ModuleType.CAR.getModuleExtension(), "car"); 92 93 assertEquals("ModuleType.RAR value is not correct", ModuleType.RAR, ModuleType.getModuleType(3)); 94 assertEquals("ModuleType.RAR value is not correct", ModuleType.RAR.getValue(), 3); 95 assertEquals("ModuleType.RAR string is not correct", ModuleType.RAR.toString(), "RAR"); 96 assertEquals("ModuleType.RAR extension is not correct", ModuleType.RAR.getModuleExtension(), "rar"); 97 98 assertEquals("ModuleType.WAR value is not correct", ModuleType.WAR, ModuleType.getModuleType(4)); 99 assertEquals("ModuleType.WAR value is not correct", ModuleType.WAR.getValue(), 4); 100 assertEquals("ModuleType.WAR string is not correct", ModuleType.WAR.toString(), "WAR"); 101 assertEquals("ModuleType.WAR extension is not correct", ModuleType.WAR.getModuleExtension(), "war"); 102 103 } 104 105 106 107 public void testStateType() 108 { 109 assertEquals("StateType.RUNNING value is not correct", StateType.RUNNING, StateType.getModuleType(0)); 110 assertEquals("StateType.RUNNING value is not correct", StateType.RUNNING.getValue(), 0); 111 assertEquals("StateType.RUNNING string is not correct", StateType.RUNNING.toString(), "running"); 112 113 assertEquals("StateType.COMPLETED value is not correct", StateType.COMPLETED, StateType.getModuleType(1)); 114 assertEquals("StateType.COMPLETED value is not correct", StateType.COMPLETED.getValue(), 1); 115 assertEquals("StateType.COMPLETED string is not correct", StateType.COMPLETED.toString(), "completed"); 116 117 assertEquals("StateType.FAILED value is not correct", StateType.FAILED, StateType.getModuleType(2)); 118 assertEquals("StateType.FAILED value is not correct", StateType.FAILED.getValue(), 2); 119 assertEquals("StateType.FAILED string is not correct", StateType.FAILED.toString(), "failed"); 120 121 assertEquals("StateType.RELEASED value is not correct", StateType.RELEASED, StateType.getModuleType(3)); 122 assertEquals("StateType.RELEASED value is not correct", StateType.RELEASED.getValue(), 3); 123 assertEquals("StateType.RELEASED string is not correct", StateType.RELEASED.toString(), "released"); 124 } 125 126 127 128 public void testcCommandType() 129 { 130 assertEquals("CommandType.DISTRIBUTE value is not correct", CommandType.DISTRIBUTE, CommandType.getCommandType(0)); 131 assertEquals("CommandType.DISTRIBUTE value is not correct", CommandType.DISTRIBUTE.getValue(), 0); 132 assertEquals("CommandType.DISTRIBUTE string is not correct", CommandType.DISTRIBUTE.toString(), "distribute"); 133 134 assertEquals("CommandType.START value is not correct", CommandType.START, CommandType.getCommandType(1)); 135 assertEquals("CommandType.START value is not correct", CommandType.START.getValue(), 1); 136 assertEquals("CommandType.START string is not correct", CommandType.START.toString(), "start"); 137 138 assertEquals("CommandType.STOP value is not correct", CommandType.STOP, CommandType.getCommandType(2)); 139 assertEquals("CommandType.STOP value is not correct", CommandType.STOP.getValue(), 2); 140 assertEquals("CommandType.STOP string is not correct", CommandType.STOP.toString(), "stop"); 141 142 assertEquals("CommandType.UNDEPLOY value is not correct", CommandType.UNDEPLOY, CommandType.getCommandType(3)); 143 assertEquals("CommandType.UNDEPLOY value is not correct", CommandType.UNDEPLOY.getValue(), 3); 144 assertEquals("CommandType.UNDEPLOY string is not correct", CommandType.UNDEPLOY.toString(), "undeploy"); 145 146 assertEquals("CommandType.REDEPLOY value is not correct", CommandType.REDEPLOY, CommandType.getCommandType(4)); 147 assertEquals("CommandType.REDEPLOY value is not correct", CommandType.REDEPLOY.getValue(), 4); 148 assertEquals("CommandType.REDEPLOY string is not correct", CommandType.REDEPLOY.toString(), "redeploy"); 149 } 150 } 151 | Popular Tags |