@Test public void testU5500EquipmentFlashModel() { ListDevicesType listDevicesType = new ListDevicesType(0, 4); ArrayList<Device> deviceList = new ArrayList<Device>(); deviceList.add(new Device(PATH1, 5, TYPE1, 5, BLOCK_SIZE1, START1, LENGTH1)); deviceList.add(new Device(PATH2, 5, TYPE1, 5, BLOCK_SIZE2, START2, LENGTH2)); deviceList.add(new Device(PATH3, 5, TYPE2, 5, BLOCK_SIZE3, START3, LENGTH3)); listDevicesType.addDevice(PATH1, 5, TYPE1, 5, BLOCK_SIZE1, START1, LENGTH1); listDevicesType.addDevice(PATH2, 5, TYPE1, 5, BLOCK_SIZE2, START2, LENGTH2); listDevicesType.addDevice(PATH3, 5, TYPE2, 5, BLOCK_SIZE3, START3, LENGTH3); assertEquals(deviceList.size(), listDevicesType.getDevices().size()); u5500equipmentFlashModel = new U5500EquipmentFlashModel(listDevicesType); assertEquals(3, u5500equipmentFlashModel.getFlashDeviceNames(null).length); assertEquals(2, u5500equipmentFlashModel.getFlashDeviceNames(TYPE1).length); assertEquals(LENGTH1, u5500equipmentFlashModel.getLength(PATH1)); assertEquals(ERROR_CODE, u5500equipmentFlashModel.getLength(ERROR_DEVICE)); assertEquals(START3, u5500equipmentFlashModel.getStart(PATH3)); assertEquals(ERROR_CODE, u5500equipmentFlashModel.getStart(ERROR_DEVICE)); assertEquals(TYPE1, u5500equipmentFlashModel.getType(PATH2)); assertEquals(TYPE_ERROR, u5500equipmentFlashModel.getType(ERROR_DEVICE)); assertEquals(BLOCK_SIZE3, u5500equipmentFlashModel.getBlockSize(PATH3)); assertEquals(ERROR_CODE, u5500equipmentFlashModel.getBlockSize(ERROR_DEVICE)); assertEquals(null, u5500equipmentFlashModel.getReport()); }
/** still similar like u8500 */ private void updateFlashModel() { try { ListDevicesType deviceList = (ListDevicesType) equipment.sendCommand( LCDefinitions.METHOD_NAME_FLASH_LIST_DEVICES, new Object[0], equipment); if (deviceList.getStatus() == 0) { SystemCollectDataType result2 = (SystemCollectDataType) equipment.sendCommand( LCDefinitions.METHOD_NAME_SYSTEM_COLLECT_DATA, new Object[] {2}, equipment); if (result2.getStatus() == 0) { equipment.setModel( EquipmentModel.FLASH, new EquipmentFlashModel(deviceList, result2.getCollectedData())); } else { equipment.setModel(EquipmentModel.FLASH, new EquipmentFlashModel(deviceList, null)); } } else { equipment.setStatus(EquipmentState.ERROR); } } catch (Exception e) { e.printStackTrace(); } }