save
Showing
8 changed files
with
243 additions
and
70 deletions
| ... | @@ -41,8 +41,6 @@ public class UtilsController { | ... | @@ -41,8 +41,6 @@ public class UtilsController { |
| 41 | @RequestMapping(value="utils/ping" , method = RequestMethod.POST) | 41 | @RequestMapping(value="utils/ping" , method = RequestMethod.POST) |
| 42 | public @ResponseBody Vector<String> getResultPing(@RequestBody String host) { | 42 | public @ResponseBody Vector<String> getResultPing(@RequestBody String host) { |
| 43 | 43 | ||
| 44 | |||
| 45 | |||
| 46 | return UtilsService.INSTANCE.Ping(host); | 44 | return UtilsService.INSTANCE.Ping(host); |
| 47 | /* | 45 | /* |
| 48 | Vector<String> results=new Vector<String>(); | 46 | Vector<String> results=new Vector<String>(); | ... | ... |
| ... | @@ -245,10 +245,6 @@ Ext.application({ | ... | @@ -245,10 +245,6 @@ Ext.application({ |
| 245 | ] | 245 | ] |
| 246 | }, | 246 | }, |
| 247 | 247 | ||
| 248 | |||
| 249 | |||
| 250 | |||
| 251 | |||
| 252 | { | 248 | { |
| 253 | title: 'ЖУРНАЛ', | 249 | title: 'ЖУРНАЛ', |
| 254 | items:[ | 250 | items:[ |
| ... | @@ -304,6 +300,9 @@ Ext.application({ | ... | @@ -304,6 +300,9 @@ Ext.application({ |
| 304 | 300 | ||
| 305 | }); | 301 | }); |
| 306 | 302 | ||
| 303 | |||
| 304 | |||
| 305 | |||
| 307 | Ext.getBody().unmask(); | 306 | Ext.getBody().unmask(); |
| 308 | } | 307 | } |
| 309 | }); | 308 | }); | ... | ... |
| ... | @@ -11,54 +11,127 @@ Ext.define('App.controller.NetworkSetting', { | ... | @@ -11,54 +11,127 @@ Ext.define('App.controller.NetworkSetting', { |
| 11 | 11 | ||
| 12 | 'toolbar button[action=showformping]' : { | 12 | 'toolbar button[action=showformping]' : { |
| 13 | click : this.OpenPingPanel | 13 | click : this.OpenPingPanel |
| 14 | }, | ||
| 15 | 'toolbar button[action=loadEth]' : { | ||
| 16 | click : this.ReloadData | ||
| 17 | }, | ||
| 18 | 'toolbar button[action=rebootEth]' : { | ||
| 19 | click : this.RebootEth | ||
| 14 | } | 20 | } |
| 15 | 21 | ||
| 22 | }); | ||
| 16 | 23 | ||
| 17 | 24 | ||
| 18 | }); | ||
| 19 | 25 | ||
| 26 | Ext.Ajax.request({ | ||
| 27 | method: "GET", | ||
| 28 | url: 'api/eth/byeth/eth0', | ||
| 29 | headers: { | ||
| 30 | 'Accept': 'application/json', | ||
| 31 | 'Content-Type': 'application/json' | ||
| 32 | }, | ||
| 20 | 33 | ||
| 34 | success: function(response, opts) { | ||
| 21 | 35 | ||
| 36 | var result = Ext.JSON.decode(response.responseText); | ||
| 22 | 37 | ||
| 38 | Ext.getCmp('cbxeth').setValue("eth0"); | ||
| 23 | 39 | ||
| 24 | }, | 40 | Ext.getCmp("dhcp").setValue(result.dhcp); |
| 25 | 41 | ||
| 42 | Ext.getCmp('mac').setValue(result.mac); | ||
| 43 | Ext.getCmp('ip').setValue(result.ip); | ||
| 44 | Ext.getCmp('gateway').setValue(result.gateway); | ||
| 45 | Ext.getCmp('netmask').setValue(result.netmask); | ||
| 26 | 46 | ||
| 27 | OpenPingPanel:function() { | 47 | var str=""; |
| 48 | for(var i in result.info){ | ||
| 49 | str=str+result.info[i]+"\n"; | ||
| 50 | } | ||
| 51 | Ext.getCmp('extinfo').setValue(str); | ||
| 52 | |||
| 53 | }, failure: function(response, opts) { | ||
| 54 | Ext.Msg.alert('Ошибка', 'Сервер недоступен'); | ||
| 55 | } | ||
| 56 | }); | ||
| 57 | }, | ||
| 28 | 58 | ||
| 29 | 59 | ||
| 60 | OpenPingPanel:function() { | ||
| 30 | var panel = Ext.create("App.view.PingUtil"); | 61 | var panel = Ext.create("App.view.PingUtil"); |
| 31 | |||
| 32 | panel.show(); | 62 | panel.show(); |
| 33 | 63 | ||
| 34 | }, | 64 | }, |
| 35 | 65 | ||
| 66 | RebootEth:function(btn) { | ||
| 67 | |||
| 68 | |||
| 69 | var networksettingView = btn.up('mvvm-NetworkSettingView'); | ||
| 70 | |||
| 71 | //mask | ||
| 72 | networksettingView.mask("Перезагрузка сетевого интерфейса..."); | ||
| 36 | 73 | ||
| 37 | 74 | ||
| 38 | ReloadData: function() { | 75 | var dhcp=Ext.getCmp("dhcp").getValue(); |
| 76 | var ip=Ext.getCmp('ip').getValue(); | ||
| 77 | var gateway=Ext.getCmp('gateway').getValue(); | ||
| 78 | var netmask=Ext.getCmp('netmask').getValue(); | ||
| 79 | var name=Ext.getCmp('cbxeth').getValue(); | ||
| 39 | 80 | ||
| 40 | var combo=Ext.getCmp('cbxeth'); | ||
| 41 | if (typeof combo.getStore().lastOptions !== "undefined") { | ||
| 42 | 81 | ||
| 82 | var record={ | ||
| 83 | id:0, | ||
| 84 | name:name, | ||
| 85 | info:null, | ||
| 86 | mac:"", | ||
| 87 | ip:ip, | ||
| 88 | netmask:netmask, | ||
| 89 | dhcp:dhcp, | ||
| 90 | gateway:gateway, | ||
| 91 | broadcast:"" | ||
| 92 | }; | ||
| 93 | |||
| 94 | if (record) { | ||
| 43 | 95 | ||
| 44 | var value = combo.getValue(); | 96 | var data=Ext.util.JSON.encode(record); |
| 45 | var valueField = combo.valueField; | 97 | |
| 46 | var record; | 98 | Ext.Ajax.request({ |
| 47 | combo.getStore().each(function(r){ | 99 | method: "POST", |
| 48 | if(r.data[valueField] == value){ | 100 | url: 'api/eth/reload', |
| 49 | record = r; | 101 | timeout:60000, |
| 50 | return false; | 102 | headers: { |
| 103 | 'Accept': 'application/json', | ||
| 104 | 'Content-Type': 'application/json' | ||
| 105 | }, | ||
| 106 | params: data, | ||
| 107 | success: function(response, opts) { | ||
| 108 | networksettingView.unmask(); | ||
| 109 | |||
| 110 | var result = Ext.JSON.decode(response.responseText); | ||
| 111 | Ext.Msg.alert(result.type+" "+"Код-"+result.code,result.message); | ||
| 112 | |||
| 113 | }, failure: function(response, opts) { | ||
| 114 | networksettingView.unmask(); | ||
| 115 | Ext.Msg.alert('Ошибка', 'Сервер недоступен'); | ||
| 51 | } | 116 | } |
| 52 | }); | 117 | }); |
| 53 | var eth=record ? record.get(combo.displayField) : null; | ||
| 54 | 118 | ||
| 119 | } | ||
| 55 | 120 | ||
| 121 | }, | ||
| 122 | |||
| 123 | ReloadData: function(btn) { | ||
| 124 | |||
| 125 | var networksettingView = btn.up('mvvm-NetworkSettingView'); | ||
| 126 | |||
| 127 | //mask | ||
| 128 | networksettingView.mask("Загрузка..."); | ||
| 56 | 129 | ||
| 57 | 130 | ||
| 58 | 131 | ||
| 59 | Ext.Ajax.request({ | 132 | Ext.Ajax.request({ |
| 60 | method: "GET", | 133 | method: "GET", |
| 61 | url: 'api/net/byeth/'+eth, | 134 | url: 'api/eth/byeth/eth0', |
| 62 | headers: { | 135 | headers: { |
| 63 | 'Accept': 'application/json', | 136 | 'Accept': 'application/json', |
| 64 | 'Content-Type': 'application/json' | 137 | 'Content-Type': 'application/json' |
| ... | @@ -66,40 +139,65 @@ Ext.define('App.controller.NetworkSetting', { | ... | @@ -66,40 +139,65 @@ Ext.define('App.controller.NetworkSetting', { |
| 66 | 139 | ||
| 67 | success: function(response, opts) { | 140 | success: function(response, opts) { |
| 68 | 141 | ||
| 142 | networksettingView.unmask(); | ||
| 143 | |||
| 69 | var result = Ext.JSON.decode(response.responseText); | 144 | var result = Ext.JSON.decode(response.responseText); |
| 70 | 145 | ||
| 71 | Ext.getCmp('fromnetwork').viewModel.setData(result); | 146 | Ext.getCmp('cbxeth').setValue("eth0"); |
| 147 | |||
| 148 | Ext.getCmp("dhcp").setValue(result.dhcp); | ||
| 72 | 149 | ||
| 150 | Ext.getCmp('mac').setValue(result.mac); | ||
| 151 | Ext.getCmp('ip').setValue(result.ip); | ||
| 152 | Ext.getCmp('gateway').setValue(result.gateway); | ||
| 153 | Ext.getCmp('netmask').setValue(result.netmask); | ||
| 73 | 154 | ||
| 155 | var str=""; | ||
| 156 | for(var i in result.info){ | ||
| 157 | str=str+result.info[i]+"\n"; | ||
| 158 | } | ||
| 159 | Ext.getCmp('extinfo').setValue(str); | ||
| 74 | 160 | ||
| 75 | Ext.getCmp('mac').setDisabled(true); | 161 | Ext.Msg.alert('Успешно', 'Загрузка данных выполнена'); |
| 76 | 162 | ||
| 77 | }, failure: function(response, opts) { | 163 | }, failure: function(response, opts) { |
| 164 | Ext.Msg.alert('Ошибка', 'Сервер недоступен'); | ||
| 78 | } | 165 | } |
| 79 | }); | 166 | }); |
| 80 | 167 | ||
| 81 | //unmask | ||
| 82 | |||
| 83 | 168 | ||
| 84 | } | ||
| 85 | }, | 169 | }, |
| 86 | 170 | ||
| 87 | onSaveButtonClick : function(btn) { | 171 | onSaveButtonClick : function(btn) { |
| 88 | 172 | ||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | var networksettingView = btn.up('mvvm-NetworkSettingView'); | 173 | var networksettingView = btn.up('mvvm-NetworkSettingView'); |
| 93 | 174 | ||
| 94 | //mask | 175 | //mask |
| 95 | networksettingView.mask("Сохранение..."); | 176 | networksettingView.mask("Сохранение..."); |
| 96 | 177 | ||
| 97 | var record = networksettingView.getViewModel().getData(); | 178 | var dhcp=Ext.getCmp("dhcp").getValue(); |
| 179 | var ip=Ext.getCmp('ip').getValue(); | ||
| 180 | var gateway=Ext.getCmp('gateway').getValue(); | ||
| 181 | var netmask=Ext.getCmp('netmask').getValue(); | ||
| 182 | var name=Ext.getCmp('cbxeth').getValue(); | ||
| 183 | |||
| 184 | |||
| 185 | var record={ | ||
| 186 | id:0, | ||
| 187 | name:name, | ||
| 188 | info:null, | ||
| 189 | mac:"", | ||
| 190 | ip:ip, | ||
| 191 | netmask:netmask, | ||
| 192 | dhcp:dhcp, | ||
| 193 | gateway:gateway, | ||
| 194 | broadcast:"" | ||
| 195 | }; | ||
| 196 | |||
| 98 | if (record) { | 197 | if (record) { |
| 99 | 198 | ||
| 100 | var data=Ext.util.JSON.encode(record); | 199 | var data=Ext.util.JSON.encode(record); |
| 101 | 200 | ||
| 102 | |||
| 103 | Ext.Ajax.request({ | 201 | Ext.Ajax.request({ |
| 104 | method: "POST", | 202 | method: "POST", |
| 105 | url: 'api/eth/update', | 203 | url: 'api/eth/update', |
| ... | @@ -109,26 +207,18 @@ Ext.define('App.controller.NetworkSetting', { | ... | @@ -109,26 +207,18 @@ Ext.define('App.controller.NetworkSetting', { |
| 109 | }, | 207 | }, |
| 110 | params: data, | 208 | params: data, |
| 111 | success: function(response, opts) { | 209 | success: function(response, opts) { |
| 210 | networksettingView.unmask(); | ||
| 112 | 211 | ||
| 113 | var result = Ext.JSON.decode(response.responseText); | 212 | var result = Ext.JSON.decode(response.responseText); |
| 114 | 213 | Ext.Msg.alert(result.type+" "+"Код-"+result.code,result.message); | |
| 115 | if(result) { | ||
| 116 | |||
| 117 | } | ||
| 118 | 214 | ||
| 119 | }, failure: function(response, opts) { | 215 | }, failure: function(response, opts) { |
| 120 | 216 | networksettingView.unmask(); | |
| 121 | Ext.Msg.alert('Failure', 'Обновление конфигурации не выполнено!'); | 217 | Ext.Msg.alert('Ошибка', 'Сервер недоступен'); |
| 122 | } | 218 | } |
| 123 | }); | 219 | }); |
| 124 | 220 | ||
| 125 | |||
| 126 | |||
| 127 | } | 221 | } |
| 128 | |||
| 129 | networksettingView.unmask(); | ||
| 130 | |||
| 131 | |||
| 132 | } | 222 | } |
| 133 | }); | 223 | }); |
| 134 | 224 | ... | ... |
| ... | @@ -80,16 +80,12 @@ Ext.define('App.controller.Proxy', { | ... | @@ -80,16 +80,12 @@ Ext.define('App.controller.Proxy', { |
| 80 | params: data, | 80 | params: data, |
| 81 | success: function(response, opts) { | 81 | success: function(response, opts) { |
| 82 | 82 | ||
| 83 | var Ok = Ext.JSON.decode(response.responseText); | 83 | var result = Ext.JSON.decode(response.responseText); |
| 84 | if (Ok) { | 84 | Ext.Msg.alert(result.type+" "+"Код-"+result.code,result.message); |
| 85 | Ext.Msg.alert('Success', 'Сохранение выполнено успешно'); | ||
| 86 | }else { | ||
| 87 | Ext.Msg.alert('Failure', 'Ошибка сохранения'); | ||
| 88 | } | ||
| 89 | 85 | ||
| 90 | }, failure: function(response, opts) { | 86 | }, failure: function(response, opts) { |
| 91 | 87 | networksettingView.unmask(); | |
| 92 | Ext.Msg.alert('Failure', 'Ошибка сохранения'); | 88 | Ext.Msg.alert('Ошибка', 'Сервер недоступен'); |
| 93 | } | 89 | } |
| 94 | }); | 90 | }); |
| 95 | 91 | ||
| ... | @@ -117,7 +113,11 @@ Ext.define('App.controller.Proxy', { | ... | @@ -117,7 +113,11 @@ Ext.define('App.controller.Proxy', { |
| 117 | enabled=fsHttps.checkboxCmp.getValue(); | 113 | enabled=fsHttps.checkboxCmp.getValue(); |
| 118 | 114 | ||
| 119 | host=fsHttps.down('#'+protocol+'Adress').getValue(); | 115 | host=fsHttps.down('#'+protocol+'Adress').getValue(); |
| 120 | port=fsHttps.down('#'+protocol+'Port').getValue(); | 116 | port=parseInt(fsHttps.down('#'+protocol+'Port').getValue()); |
| 117 | |||
| 118 | if(port==null) { | ||
| 119 | port=0; | ||
| 120 | } | ||
| 121 | 121 | ||
| 122 | var fsHttpsAuth=fsHttps.down('#fs'+protocol+'Auth'); | 122 | var fsHttpsAuth=fsHttps.down('#fs'+protocol+'Auth'); |
| 123 | 123 | ||
| ... | @@ -133,7 +133,7 @@ Ext.define('App.controller.Proxy', { | ... | @@ -133,7 +133,7 @@ Ext.define('App.controller.Proxy', { |
| 133 | id:id, | 133 | id:id, |
| 134 | protocol:protocol, | 134 | protocol:protocol, |
| 135 | host:host, | 135 | host:host, |
| 136 | port:parseInt(port), | 136 | port:0, |
| 137 | login:login, | 137 | login:login, |
| 138 | pass:pass, | 138 | pass:pass, |
| 139 | enabled:enabled, | 139 | enabled:enabled, | ... | ... |
| ... | @@ -49,8 +49,6 @@ Ext.define('App.view.NetworkSetting', { | ... | @@ -49,8 +49,6 @@ Ext.define('App.view.NetworkSetting', { |
| 49 | xtype : 'mvvm-EthView', | 49 | xtype : 'mvvm-EthView', |
| 50 | id:'cbxeth' | 50 | id:'cbxeth' |
| 51 | }, | 51 | }, |
| 52 | |||
| 53 | |||
| 54 | { | 52 | { |
| 55 | xtype : 'checkboxfield', | 53 | xtype : 'checkboxfield', |
| 56 | 54 | ||
| ... | @@ -80,8 +78,6 @@ Ext.define('App.view.NetworkSetting', { | ... | @@ -80,8 +78,6 @@ Ext.define('App.view.NetworkSetting', { |
| 80 | fieldLabel : 'IP', | 78 | fieldLabel : 'IP', |
| 81 | id:'ip', | 79 | id:'ip', |
| 82 | margin:'5 5 10 3' | 80 | margin:'5 5 10 3' |
| 83 | |||
| 84 | |||
| 85 | }, | 81 | }, |
| 86 | { | 82 | { |
| 87 | xtype : 'textfield', | 83 | xtype : 'textfield', |
| ... | @@ -89,8 +85,6 @@ Ext.define('App.view.NetworkSetting', { | ... | @@ -89,8 +85,6 @@ Ext.define('App.view.NetworkSetting', { |
| 89 | fieldLabel : 'GATEWAY', | 85 | fieldLabel : 'GATEWAY', |
| 90 | id:'gateway', | 86 | id:'gateway', |
| 91 | margin:'5 5 10 3' | 87 | margin:'5 5 10 3' |
| 92 | |||
| 93 | |||
| 94 | }, | 88 | }, |
| 95 | { | 89 | { |
| 96 | xtype : 'textfield', | 90 | xtype : 'textfield', |
| ... | @@ -99,15 +93,13 @@ Ext.define('App.view.NetworkSetting', { | ... | @@ -99,15 +93,13 @@ Ext.define('App.view.NetworkSetting', { |
| 99 | id:'netmask', | 93 | id:'netmask', |
| 100 | margin:'5 5 10 3' | 94 | margin:'5 5 10 3' |
| 101 | }, | 95 | }, |
| 102 | |||
| 103 | { | 96 | { |
| 104 | xtype : 'textarea', | 97 | xtype : 'textarea', |
| 105 | bind : '{info}', | 98 | bind : '{info}', |
| 106 | id:'ttt', | 99 | id:'extinfo', |
| 107 | fieldLabel : 'СТАТУС', | 100 | fieldLabel : 'СТАТУС', |
| 108 | margin:'5 5 10 3', | 101 | margin:'5 5 10 3', |
| 109 | allowBlank : false, | 102 | allowBlank : false, |
| 110 | |||
| 111 | width:700, | 103 | width:700, |
| 112 | height:100, | 104 | height:100, |
| 113 | 105 | ... | ... |
| ... | @@ -41,9 +41,9 @@ public class EthLinux implements IEth { | ... | @@ -41,9 +41,9 @@ public class EthLinux implements IEth { |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | try { | 43 | try { |
| 44 | Vector<String> buff=cmdexec.Run("ifdown "+name); | 44 | Vector<String> buff=cmdexec.Run("ifdown"+" "+name); |
| 45 | Thread.sleep(5000); | 45 | Thread.sleep(5000); |
| 46 | buff=cmdexec.Run("ifup "+name); | 46 | buff=cmdexec.Run("ifup"+" "+name); |
| 47 | Thread.sleep(5000); | 47 | Thread.sleep(5000); |
| 48 | Msg msg=Msg.RestartEthSucc; | 48 | Msg msg=Msg.RestartEthSucc; |
| 49 | 49 | ||
| ... | @@ -62,6 +62,7 @@ public class EthLinux implements IEth { | ... | @@ -62,6 +62,7 @@ public class EthLinux implements IEth { |
| 62 | * Список интерфейсов Ethernet на данном устройстве | 62 | * Список интерфейсов Ethernet на данном устройстве |
| 63 | * @see org.emercit.ethmanager.service.IEth#getListEth() | 63 | * @see org.emercit.ethmanager.service.IEth#getListEth() |
| 64 | */ | 64 | */ |
| 65 | |||
| 65 | public Vector<String> getListEth() { | 66 | public Vector<String> getListEth() { |
| 66 | 67 | ||
| 67 | Vector<String> result=new Vector<String>(); | 68 | Vector<String> result=new Vector<String>(); |
| ... | @@ -109,6 +110,7 @@ public class EthLinux implements IEth { | ... | @@ -109,6 +110,7 @@ public class EthLinux implements IEth { |
| 109 | 110 | ||
| 110 | String addr=cmdexec.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'").firstElement(); | 111 | String addr=cmdexec.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'").firstElement(); |
| 111 | String mask=cmdexec.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f4 | awk '{ print $1}'").firstElement(); | 112 | String mask=cmdexec.Run("ifconfig"+" "+eb.getName()+" "+"| grep 'inet addr:' | cut -d: -f4 | awk '{ print $1}'").firstElement(); |
| 113 | |||
| 112 | //String gateway=cmdexec.Run("/sbin/route -n | grep 'UG' | awk '{print $2}'").firstElement(); | 114 | //String gateway=cmdexec.Run("/sbin/route -n | grep 'UG' | awk '{print $2}'").firstElement(); |
| 113 | 115 | ||
| 114 | eb.setIp(addr); | 116 | eb.setIp(addr); |
| ... | @@ -168,10 +170,8 @@ public class EthLinux implements IEth { | ... | @@ -168,10 +170,8 @@ public class EthLinux implements IEth { |
| 168 | bw.write("\n"); | 170 | bw.write("\n"); |
| 169 | bw.write("\n"); | 171 | bw.write("\n"); |
| 170 | 172 | ||
| 171 | |||
| 172 | for (EthBean eb:ebs) { | 173 | for (EthBean eb:ebs) { |
| 173 | 174 | ||
| 174 | |||
| 175 | if (!eb.getDhcp()) { | 175 | if (!eb.getDhcp()) { |
| 176 | 176 | ||
| 177 | bw.write("auto "+eb.getName()); | 177 | bw.write("auto "+eb.getName()); |
| ... | @@ -194,8 +194,6 @@ public class EthLinux implements IEth { | ... | @@ -194,8 +194,6 @@ public class EthLinux implements IEth { |
| 194 | 194 | ||
| 195 | bw.write("\n"); | 195 | bw.write("\n"); |
| 196 | bw.write("\n"); | 196 | bw.write("\n"); |
| 197 | |||
| 198 | |||
| 199 | } | 197 | } |
| 200 | 198 | ||
| 201 | bw.close(); | 199 | bw.close(); | ... | ... |
| ... | @@ -6,14 +6,17 @@ import junit.framework.Test; | ... | @@ -6,14 +6,17 @@ import junit.framework.Test; |
| 6 | import junit.framework.TestCase; | 6 | import junit.framework.TestCase; |
| 7 | import junit.framework.TestSuite; | 7 | import junit.framework.TestSuite; |
| 8 | import static org.junit.Assert.*; | 8 | import static org.junit.Assert.*; |
| 9 | |||
| 9 | import java.util.Vector; | 10 | import java.util.Vector; |
| 11 | |||
| 10 | import org.emercit.utilstools.config.Msg; | 12 | import org.emercit.utilstools.config.Msg; |
| 11 | import org.junit.Before; | 13 | import org.junit.Before; |
| 12 | import org.junit.After; | 14 | import org.junit.After; |
| 15 | import org.junit.Ignore; | ||
| 13 | import org.emercit.ethmanager.model.EthBean; | 16 | import org.emercit.ethmanager.model.EthBean; |
| 14 | import org.emercit.ethmanager.service.EthLinux; | 17 | import org.emercit.ethmanager.service.EthLinux; |
| 15 | 18 | ||
| 16 | 19 | @Ignore | |
| 17 | public class TestEthLinux extends TestCase { | 20 | public class TestEthLinux extends TestCase { |
| 18 | 21 | ||
| 19 | 22 | ... | ... |
| 1 | package org.emercit.utilstools; | ||
| 2 | |||
| 3 | |||
| 4 | import junit.framework.Test; | ||
| 5 | import junit.framework.TestCase; | ||
| 6 | import junit.framework.TestSuite; | ||
| 7 | import static org.junit.Assert.*; | ||
| 8 | import java.util.Vector; | ||
| 9 | import org.emercit.utilstools.config.Msg; | ||
| 10 | import org.junit.Before; | ||
| 11 | import org.junit.After; | ||
| 12 | |||
| 13 | import org.emercit.proxymanager.model.ProxyBean; | ||
| 14 | |||
| 15 | import org.emercit.proxymanager.service.ProxyLinux; | ||
| 16 | |||
| 17 | import org.emercit.utilstools.config.Msg; | ||
| 18 | |||
| 19 | |||
| 20 | public class TestProxyLinux extends TestCase { | ||
| 21 | |||
| 22 | |||
| 23 | private Vector<ProxyBean> beans; | ||
| 24 | private ProxyLinux proxylinux; | ||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | public TestProxyLinux( String testName ) | ||
| 29 | { | ||
| 30 | super( testName ); | ||
| 31 | } | ||
| 32 | |||
| 33 | |||
| 34 | public static Test suite() | ||
| 35 | { | ||
| 36 | return new TestSuite( TestProxyLinux.class ); | ||
| 37 | } | ||
| 38 | |||
| 39 | @Before | ||
| 40 | public void upTestProxyLinux() | ||
| 41 | { | ||
| 42 | |||
| 43 | } | ||
| 44 | |||
| 45 | @After | ||
| 46 | public void downTestProxyLinux() | ||
| 47 | { | ||
| 48 | |||
| 49 | } | ||
| 50 | |||
| 51 | |||
| 52 | public void testProxyLinux() | ||
| 53 | { | ||
| 54 | |||
| 55 | proxylinux=new ProxyLinux(); | ||
| 56 | |||
| 57 | int value=proxylinux.init(); | ||
| 58 | |||
| 59 | Msg msg=Msg.getByCode(value); | ||
| 60 | |||
| 61 | if (msg.getTypeVariable().getCode()==1) { | ||
| 62 | fail("Инициализация настроек прокси не выполнена"); | ||
| 63 | } | ||
| 64 | |||
| 65 | |||
| 66 | beans=proxylinux.getProxyBeans(); | ||
| 67 | |||
| 68 | assertNotNull(beans); | ||
| 69 | |||
| 70 | for (ProxyBean bean:beans) { | ||
| 71 | |||
| 72 | bean.setHost("127.127.127.127"); | ||
| 73 | } | ||
| 74 | |||
| 75 | value=proxylinux.Config(beans); | ||
| 76 | msg=Msg.getByCode(value); | ||
| 77 | |||
| 78 | if (msg.getTypeVariable().getCode()==1) { | ||
| 79 | fail("Изменение параметров прокси не выполнено"); | ||
| 80 | } | ||
| 81 | |||
| 82 | assertTrue( true ); | ||
| 83 | } | ||
| 84 | |||
| 85 | |||
| 86 | } | ||
| 87 | |||
| 88 | //assertFalse(!stservice.IsRun("start.jar")); // Если true - то тест завален | ||
| 89 | // assertEquals(stservice.IsRun("start.jar")); // Если не равны - тест завален | ||
| 90 | // assertNotNull(stservice.IsRun("start.jar"))); // Если null - тест завален | ||
| 91 | //assertNull(stservice.IsRun("start.jar"))); // Если не null - тест завален | ||
| 92 | //assertNotSame(stservice.IsRun("start.jar")); // Если оба объекта являются одинаковыми(не одно и то же, что равны) - тест завален | ||
| 93 | //assertSame(stservice.IsRun("start.jar")); // Если оба объекта не являются одинаковыми - тест завален |
-
Please register or sign in to post a comment