Search in sources :

Example 1 with ImageComparatorResult

use of com.att.aro.core.bestpractice.pojo.ImageComparatorResult in project VideoOptimzer by attdevsupport.

the class ImageUIComparatorImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    ImageComparatorResult result = new ImageComparatorResult();
    tracedataResult = tracedata;
    String tracePath = tracedata.getTraceresult().getTraceDirectory() + System.getProperty("file.separator");
    imageFolderPath = tracePath + "Image" + System.getProperty("file.separator");
    originalImageDimensionMap.clear();
    uiComparatorFolderPath = tracePath + "UIComparator" + System.getProperty("file.separator");
    File uiComparatorFolder = new File(uiComparatorFolderPath);
    String windowsCompFolderPath = tracePath + "ARO" + System.getProperty("file.separator") + "UIComparator" + System.getProperty("file.separator");
    if (new File(windowsCompFolderPath).exists()) {
        moveUIXmlFolder(new File(windowsCompFolderPath), uiComparatorFolder, tracePath + "ARO" + System.getProperty("file.separator"));
    }
    if (Util.isFilesforAnalysisAvailable(new File(imageFolderPath))) {
        entrylist = new ArrayList<ImageMdataEntry>();
        if (new File(imageFolderPath).exists()) {
            if (uiComparatorFolder.exists() && uiComparatorFolder.isDirectory()) {
                getImageList();
                Map<String, Integer> xmlUIMap = getUIXmlMap(filemanager.createFile(uiComparatorFolderPath));
                Map<String, String> imageNameMap = parseImageNames(tracePath);
                Map<String, Integer> imageDimensionMap = updateImageDimensionMap(imageNameMap);
                compareImages(imageDimensionMap, xmlUIMap, imageNameMap);
            }
        }
        result.setResults(entrylist);
        String text = "";
        if (entrylist.isEmpty()) {
            result.setResultType(BPResultType.PASS);
            text = MessageFormat.format(textResultPass, entrylist.size());
            result.setResultText(text);
            result.setResultExcelText(BPResultType.PASS.getDescription());
        } else {
            result.setResultType(BPResultType.FAIL);
            text = MessageFormat.format(textResults, entrylist.size());
            result.setResultText(text);
            result.setNumberOfImages(String.valueOf(entrylist.size()));
            result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.FAIL.getDescription(), String.valueOf(entrylist.size())));
        }
    } else {
        result.setResultText(noData);
        result.setResultType(BPResultType.NO_DATA);
        result.setResultExcelText(BPResultType.NO_DATA.getDescription());
    }
    result.setAboutText(aboutText);
    result.setDetailTitle(detailTitle);
    result.setLearnMoreUrl(learnMoreUrl);
    result.setOverviewTitle(overviewTitle);
    return result;
}
Also used : ImageMdataEntry(com.att.aro.core.bestpractice.pojo.ImageMdataEntry) ImageComparatorResult(com.att.aro.core.bestpractice.pojo.ImageComparatorResult) File(java.io.File)

Aggregations

ImageComparatorResult (com.att.aro.core.bestpractice.pojo.ImageComparatorResult)1 ImageMdataEntry (com.att.aro.core.bestpractice.pojo.ImageMdataEntry)1 File (java.io.File)1