Search in sources :

Example 6 with ImageMdataEntry

use of com.att.aro.core.bestpractice.pojo.ImageMdataEntry 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

ImageMdataEntry (com.att.aro.core.bestpractice.pojo.ImageMdataEntry)6 File (java.io.File)5 HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)3 Session (com.att.aro.core.packetanalysis.pojo.Session)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 ByteSourceFile (org.apache.commons.imaging.common.bytesource.ByteSourceFile)2 DisplayNoneInCSSEntry (com.att.aro.core.bestpractice.pojo.DisplayNoneInCSSEntry)1 ForwardSecrecyEntry (com.att.aro.core.bestpractice.pojo.ForwardSecrecyEntry)1 HttpEntry (com.att.aro.core.bestpractice.pojo.HttpEntry)1 ImageComparatorResult (com.att.aro.core.bestpractice.pojo.ImageComparatorResult)1 ImageCompressionEntry (com.att.aro.core.bestpractice.pojo.ImageCompressionEntry)1 ImageFormatResult (com.att.aro.core.bestpractice.pojo.ImageFormatResult)1 ImageMdtaResult (com.att.aro.core.bestpractice.pojo.ImageMdtaResult)1 MultipleConnectionsEntry (com.att.aro.core.bestpractice.pojo.MultipleConnectionsEntry)1 SpriteImageEntry (com.att.aro.core.bestpractice.pojo.SpriteImageEntry)1 TransmissionPrivateDataEntry (com.att.aro.core.bestpractice.pojo.TransmissionPrivateDataEntry)1 UnnecessaryConnectionEntry (com.att.aro.core.bestpractice.pojo.UnnecessaryConnectionEntry)1 UnsecureSSLVersionEntry (com.att.aro.core.bestpractice.pojo.UnsecureSSLVersionEntry)1 CacheEntry (com.att.aro.core.packetanalysis.pojo.CacheEntry)1