use of com.att.aro.core.tracemetadata.pojo.MetaDataModel in project VideoOptimzer by attdevsupport.
the class MetaDataReadWrite method readData.
@Override
public MetaDataModel readData(String tracePath) {
File jsonFile = filemanager.createFile(tracePath, JSON_FILE);
if (jsonFile.exists()) {
try {
String jsonDataString = filemanager.readAllData(jsonFile.toString());
metaData = mapper.readValue(jsonDataString, MetaDataModel.class);
jsonDataSaved = serialize(metaData);
} catch (Exception e) {
LOG.debug("failed to load time-range data: " + e.getMessage());
}
} else {
metaData = null;
}
return metaData;
}
use of com.att.aro.core.tracemetadata.pojo.MetaDataModel in project VideoOptimzer by attdevsupport.
the class ARODataCollectorMenu method chooseDevice.
private IAroDevice chooseDevice(IAroDevices aroDevices, List<IDataCollector> collectors) {
ArrayList<IAroDevice> deviceList = aroDevices.getDeviceList();
IAroDevice device = null;
int delayTimeDL = 0;
int throttleDL = 0;
int throttleUL = 0;
boolean throttleDLEnable = false;
boolean throttleULEnable = false;
boolean profileBoolean = false;
String traceFolderName = "";
String profileLocation = "";
if (((MainFrame) parent).getPreviousOptions() != null) {
previousOptions = ((MainFrame) parent).getPreviousOptions();
}
metaDataModel = new MetaDataModel();
DataCollectorSelectNStartDialog dialog = new DataCollectorSelectNStartDialog(((MainFrame) parent).getJFrame(), parent, deviceList, traceFolderName, collectors, true, previousOptions, metaDataModel);
if (dialog.getResponse()) {
device = dialog.getDevice();
traceFolderName = dialog.getTraceFolder();
device.setCollector(dialog.getCollectorOption());
/*debug purpose*/
delayTimeDL = dialog.getDeviceOptionPanel().getAttenuatorModel().getDelayDS();
dialog.getDeviceOptionPanel().getAttenuatorModel().getDelayUS();
throttleDL = dialog.getDeviceOptionPanel().getAttenuatorModel().getThrottleDL();
throttleUL = dialog.getDeviceOptionPanel().getAttenuatorModel().getThrottleUL();
throttleDLEnable = dialog.getDeviceOptionPanel().getAttenuatorModel().isThrottleDLEnabled();
throttleULEnable = dialog.getDeviceOptionPanel().getAttenuatorModel().isThrottleULEnabled();
profileLocation = dialog.getDeviceOptionPanel().getAttenuatorModel().getLocalPath();
profileBoolean = dialog.getDeviceOptionPanel().getAttenuatorModel().isLoadProfile();
LOG.info("set U delay: " + delayTimeDL + ", set D delay: " + delayTimeDL + ", set U throttle: " + throttleUL + ", set D throttle: " + throttleDL + ", set profile: " + profileBoolean + ", set profileLocation: " + profileLocation);
if (device.isPlatform(IAroDevice.Platform.iOS)) {
IDataCollector iosCollector = findIOSCollector(collectors);
if ((throttleDLEnable || throttleULEnable) && !NetworkUtil.isNetworkUp(SharedNetIF)) {
MessageDialogFactory.getInstance().showInformationDialog(((MainFrame) parent).getJFrame(), ResourceBundleHelper.getMessageString("dlog.collector.option.attenuator.attenuation.finalwarning"), ResourceBundleHelper.getMessageString("dlog.collector.option.attenuator.attenuation.noshared"));
return null;
}
if (!checkSetSuPassword(iosCollector)) {
return null;
} else {
LOG.info("pw validated");
}
}
String traceFolderPath = (device.getPlatform().equals(IAroDevice.Platform.Android)) ? Util.getAROTraceDirAndroid() + System.getProperty("file.separator") + traceFolderName : Util.getAROTraceDirIOS() + System.getProperty("file.separator") + traceFolderName;
String currentPath = ((MainFrame) parent).getTracePath();
if (fileManager.directoryExistAndNotEmpty(traceFolderPath)) {
int result = folderExistsDialog();
if (result == JOptionPane.OK_OPTION) {
if (traceFolderPath.equals(currentPath)) {
new MessageDialogFactory().showErrorDialog(null, ResourceBundleHelper.getMessageString("viewer.contentUnwritable"));
return null;
}
File mountPoint = fileManager.createFile(traceFolderPath, IOSCollectorImpl.IOSAPP_MOUNT);
if (fileManager.createFile(traceFolderPath, IOSCollectorImpl.IOSAPP_MOUNT).exists() && device.getPlatform().equals(IAroDevice.Platform.iOS)) {
IExternalProcessRunner runner = new ExternalProcessRunnerImpl();
String results = runner.executeCmd(String.format("umount %s;rmdir %s", mountPoint, mountPoint));
if (!results.isEmpty()) {
new MessageDialogFactory().showErrorDialog(null, traceFolderPath + "/" + IOSCollectorImpl.IOSAPP_MOUNT + " is BUSY");
return null;
} else {
int count = 0;
while (fileManager.directoryExistAndNotEmpty(mountPoint.toString())) {
if (++count > 5) {
new MessageDialogFactory().showErrorDialog(null, traceFolderPath + "/" + IOSCollectorImpl.IOSAPP_MOUNT + " will not release, please detach the iOS device and delete the foldere manually");
return null;
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Log.error("sleep interrupted");
}
}
}
}
fileManager.deleteFolderContents(traceFolderPath);
} else {
return null;
}
}
Hashtable<String, Object> extras = prepareStartCollectorExtras(device, traceFolderName, dialog);
updateMetaData(device, traceFolderName, dialog);
extras.put("DIALOG_SIZE", dialog.getBaseSize());
if (dialog.getDeviceOptionPanel().getLabeledExpandedOptionFields().isVisible()) {
extras.put("MetaDataExpanded", true);
}
((MainFrame) parent).startCollector(device, traceFolderName, extras, metaDataModel);
} else {
traceFolderName = null;
}
dialog.dispose();
return device;
}
use of com.att.aro.core.tracemetadata.pojo.MetaDataModel in project VideoOptimzer by attdevsupport.
the class MetaDataHelper method initMetaData.
@Override
public MetaDataModel initMetaData(String tracePath, String traceDesc, String traceType, String targetedApp, String appProducer) {
metaData = new MetaDataModel();
metaData.setDescription(traceDesc);
metaData.setTargetedApp(targetedApp);
metaData.setTraceType(traceType);
metaData.setApplicationProducer(appProducer);
try {
metaDataReadWrite.save(filemanager.createFile(tracePath), metaData);
} catch (Exception e) {
LOG.error("Faild to save metadata", e);
}
return metaData;
}
use of com.att.aro.core.tracemetadata.pojo.MetaDataModel in project VideoOptimzer by attdevsupport.
the class MetaDataHelper method initMetaData.
@Override
public MetaDataModel initMetaData(PacketAnalyzerResult result) {
String tracePath = result.getTraceresult().getTraceDirectory();
if ((metaData = metaDataReadWrite.readData(tracePath)) == null) {
metaData = new MetaDataModel();
} else {
// metadata.json file did not exist
int pos = tracePath.lastIndexOf(Util.FILE_SEPARATOR);
String description = pos > 0 ? tracePath.substring(pos + 1) : tracePath;
if (!filemanager.createFile(tracePath, METADATA_FILE).exists()) {
metaData = new MetaDataModel();
metaData.setDescription(description);
metaData.setTraceType(UNKNOWN);
metaData.setTargetedApp(UNKNOWN);
metaData.setApplicationProducer(UNKNOWN);
} else {
try {
metaData = loadMetaData(tracePath);
} catch (Exception e) {
LOG.error("error reading data from BufferedReader", e);
}
}
try {
if (updateMetaData(result)) {
saveJSON(tracePath);
}
} catch (Exception e) {
LOG.error("error saving metadata", e);
}
}
return metaData;
}
use of com.att.aro.core.tracemetadata.pojo.MetaDataModel in project VideoOptimzer by attdevsupport.
the class PacketAnalyzerImplTest method Test_analyzeTraceDirectory_returnIsPacketAnalyzerResult.
@Test
public void Test_analyzeTraceDirectory_returnIsPacketAnalyzerResult() throws Exception {
iPacketAnalyzer.setEnergyModelFactory(energymodelfactory);
iPacketAnalyzer.setBurstCollectionAnalayzer(burstcollectionanalyzer);
iPacketAnalyzer.setRrcStateMachineFactory(statemachinefactory);
iPacketAnalyzer.setProfileFactory(profilefactory);
TraceDirectoryResult mockTraceDirResult = mock(TraceDirectoryResult.class);
MetaDataHelper metaDataHelper = mock(MetaDataHelper.class);
MetaDataModel metaDataModel = new MetaDataModel();
AnalysisFilter filter = mock(AnalysisFilter.class);
filter.setIpv4Sel(true);
filter.setIpv6Sel(true);
filter.setUdpSel(true);
CpuActivityList cpuList = new CpuActivityList();
cpuList.add(new CpuActivity());
when(mockTraceDirResult.getCpuActivityList()).thenReturn(cpuList);
when(tracereader.readTraceDirectory(any(String.class))).thenReturn(mockTraceDirResult);
when(metaDataHelper.initMetaData(any(PacketAnalyzerResult.class))).thenReturn(metaDataModel);
ProfileLTE profileLTE = new ProfileLTE();
when(profilefactory.createLTEdefault()).thenReturn(profileLTE);
PacketAnalyzerResult testResult = iPacketAnalyzer.analyzeTraceDirectory("", profileLTE, filter);
assertEquals(null, testResult.getSessionlist());
}
Aggregations