@Test public void runTest_AresultIsPass() { PacketAnalyzerResult tracedata01 = new PacketAnalyzerResult(); Date date = new Date(); List<Burst> burstCollection = new ArrayList<Burst>(); BurstCollectionAnalysisData burstcollectionAnalysisData = new BurstCollectionAnalysisData(); InetAddress remoteIP = null; InetAddress localIP = null; try { localIP = InetAddress.getLocalHost(); remoteIP = InetAddress.getLocalHost(); } catch (UnknownHostException e) { e.printStackTrace(); } int remotePort = 80; int localPort = 80; byte[] d1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 0, 69, 0, 0, 52, -99, -87, 64, 0, 64, 6, -27, -25, 10, -27, 77, 114, 74, 125, 20, 95, -90, 2, 1, -69, -108, -18, 20, 87, -4, -110, -105, -88, -128, 16, 6, 88, 51, 24, 0, 0, 1, 1, 8, 10, -1, -1, -87, 50, 101, -15, -111, -73 }; Packet packet01 = new Packet(1, 1418242722L, 324000, 66, d1); byte[] d2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 0, 69, 0, 0, 52, 0, 0, 64, 0, 64, 6, -125, -111, 74, 125, 20, 95, 10, -27, 77, 114, 1, -69, -90, 2, 0, 0, 0, 0, -108, -18, 20, 87, -128, 4, 0, 0, 119, -98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Packet packet02 = new Packet(1, 1418242722L, 325000, 63, d2); PacketInfo packetInfo01 = new PacketInfo(packet01); PacketInfo packetInfo02 = new PacketInfo(packet02); packetInfo01.setTcpInfo(TcpInfo.TCP_ESTABLISH); packetInfo01.setTimestamp((double) date.getTime()); packetInfo02.setTcpInfo(TcpInfo.TCP_ACK); List<PacketInfo> packetlist = new ArrayList<PacketInfo>(); packetlist.add(packetInfo01); packetlist.add(packetInfo02); Burst burst01 = new Burst(packetlist); burst01.setFirstUplinkDataPacket(packetInfo01); burst01.setBurstInfo(BurstCategory.CLIENT_APP); burstCollection.add(burst01); Session session01 = new Session(localIP, remoteIP, remotePort, localPort, ""); session01.setUdpOnly(false); session01.setPackets(packetlist); HttpRequestResponseInfo httpRequestResponseInfo01 = new HttpRequestResponseInfo(); httpRequestResponseInfo01.setFirstDataPacket(packetInfo01); httpRequestResponseInfo01.setDirection(HttpDirection.REQUEST); httpRequestResponseInfo01.setHostName("yahoo.com"); httpRequestResponseInfo01.setObjName(""); List<HttpRequestResponseInfo> httpRequestResponseInfolist = new ArrayList<HttpRequestResponseInfo>(); httpRequestResponseInfolist.add(httpRequestResponseInfo01); session01.setRequestResponseInfo(httpRequestResponseInfolist); List<Session> sessionlist = new ArrayList<Session>(); sessionlist.add(session01); ProfileLTE profileLTE = new ProfileLTE(); profileLTE.setPeriodMinCycle(10.0); profileLTE.setPeriodCycleTol(1.0); profileLTE.setPeriodMinSamples(3); profileLTE.setCloseSpacedBurstThreshold(0.0); burstcollectionAnalysisData.setBurstCollection(burstCollection); tracedata01.setSessionlist(sessionlist); tracedata01.setBurstCollectionAnalysisData(burstcollectionAnalysisData); tracedata01.setProfile(profileLTE); AbstractBestPracticeResult result01 = periodicTransferImpl.runTest(tracedata01); assertEquals(BPResultType.PASS, result01.getResultType()); }
@Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { periodicCount = 0; diffPeriodicCount = 0; minimumPeriodicRepeatTime = 0.0; PeriodicTransferResult result = new PeriodicTransferResult(); diagnosisPeriodicRequest(tracedata.getSessionlist(), tracedata.getBurstCollectionAnalysisData().getBurstCollection(), tracedata.getProfile()); calculatePeriodicRepeatTime(tracedata.getBurstCollectionAnalysisData().getBurstCollection()); if(this.minimumPeriodicRepeatTime == 0.0){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); String text = MessageFormat.format( diffPeriodicCount > 1 ? this.textResults : this.textResult, this.diffPeriodicCount, this.periodicCount, this.minimumPeriodicRepeatTime); result.setResultText(text); } result.setDiffPeriodicCount(diffPeriodicCount); result.setPeriodicCount(periodicCount); result.setMinimumPeriodicRepeatTime(minimumPeriodicRepeatTime); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setSelfTest(false); result.setExportAllIneffConnDesc(exportAllIneffConnDesc); result.setExportAllIneffConnRptDesc(exportAllIneffConnRptDesc); result.setExportAllIneffConnTimeDesc(exportAllIneffConnTimeDesc); return result; }
PeriodicTransferImpl implements IBestPractice { @Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { periodicCount = 0; diffPeriodicCount = 0; minimumPeriodicRepeatTime = 0.0; PeriodicTransferResult result = new PeriodicTransferResult(); diagnosisPeriodicRequest(tracedata.getSessionlist(), tracedata.getBurstCollectionAnalysisData().getBurstCollection(), tracedata.getProfile()); calculatePeriodicRepeatTime(tracedata.getBurstCollectionAnalysisData().getBurstCollection()); if(this.minimumPeriodicRepeatTime == 0.0){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); String text = MessageFormat.format( diffPeriodicCount > 1 ? this.textResults : this.textResult, this.diffPeriodicCount, this.periodicCount, this.minimumPeriodicRepeatTime); result.setResultText(text); } result.setDiffPeriodicCount(diffPeriodicCount); result.setPeriodicCount(periodicCount); result.setMinimumPeriodicRepeatTime(minimumPeriodicRepeatTime); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setSelfTest(false); result.setExportAllIneffConnDesc(exportAllIneffConnDesc); result.setExportAllIneffConnRptDesc(exportAllIneffConnRptDesc); result.setExportAllIneffConnTimeDesc(exportAllIneffConnTimeDesc); return result; } }
PeriodicTransferImpl implements IBestPractice { @Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { periodicCount = 0; diffPeriodicCount = 0; minimumPeriodicRepeatTime = 0.0; PeriodicTransferResult result = new PeriodicTransferResult(); diagnosisPeriodicRequest(tracedata.getSessionlist(), tracedata.getBurstCollectionAnalysisData().getBurstCollection(), tracedata.getProfile()); calculatePeriodicRepeatTime(tracedata.getBurstCollectionAnalysisData().getBurstCollection()); if(this.minimumPeriodicRepeatTime == 0.0){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); String text = MessageFormat.format( diffPeriodicCount > 1 ? this.textResults : this.textResult, this.diffPeriodicCount, this.periodicCount, this.minimumPeriodicRepeatTime); result.setResultText(text); } result.setDiffPeriodicCount(diffPeriodicCount); result.setPeriodicCount(periodicCount); result.setMinimumPeriodicRepeatTime(minimumPeriodicRepeatTime); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setSelfTest(false); result.setExportAllIneffConnDesc(exportAllIneffConnDesc); result.setExportAllIneffConnRptDesc(exportAllIneffConnRptDesc); result.setExportAllIneffConnTimeDesc(exportAllIneffConnTimeDesc); return result; }  }
PeriodicTransferImpl implements IBestPractice { @Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { periodicCount = 0; diffPeriodicCount = 0; minimumPeriodicRepeatTime = 0.0; PeriodicTransferResult result = new PeriodicTransferResult(); diagnosisPeriodicRequest(tracedata.getSessionlist(), tracedata.getBurstCollectionAnalysisData().getBurstCollection(), tracedata.getProfile()); calculatePeriodicRepeatTime(tracedata.getBurstCollectionAnalysisData().getBurstCollection()); if(this.minimumPeriodicRepeatTime == 0.0){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); String text = MessageFormat.format( diffPeriodicCount > 1 ? this.textResults : this.textResult, this.diffPeriodicCount, this.periodicCount, this.minimumPeriodicRepeatTime); result.setResultText(text); } result.setDiffPeriodicCount(diffPeriodicCount); result.setPeriodicCount(periodicCount); result.setMinimumPeriodicRepeatTime(minimumPeriodicRepeatTime); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setSelfTest(false); result.setExportAllIneffConnDesc(exportAllIneffConnDesc); result.setExportAllIneffConnRptDesc(exportAllIneffConnRptDesc); result.setExportAllIneffConnTimeDesc(exportAllIneffConnTimeDesc); return result; }  @Override AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata); }
PeriodicTransferImpl implements IBestPractice { @Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { periodicCount = 0; diffPeriodicCount = 0; minimumPeriodicRepeatTime = 0.0; PeriodicTransferResult result = new PeriodicTransferResult(); diagnosisPeriodicRequest(tracedata.getSessionlist(), tracedata.getBurstCollectionAnalysisData().getBurstCollection(), tracedata.getProfile()); calculatePeriodicRepeatTime(tracedata.getBurstCollectionAnalysisData().getBurstCollection()); if(this.minimumPeriodicRepeatTime == 0.0){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); String text = MessageFormat.format( diffPeriodicCount > 1 ? this.textResults : this.textResult, this.diffPeriodicCount, this.periodicCount, this.minimumPeriodicRepeatTime); result.setResultText(text); } result.setDiffPeriodicCount(diffPeriodicCount); result.setPeriodicCount(periodicCount); result.setMinimumPeriodicRepeatTime(minimumPeriodicRepeatTime); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setSelfTest(false); result.setExportAllIneffConnDesc(exportAllIneffConnDesc); result.setExportAllIneffConnRptDesc(exportAllIneffConnRptDesc); result.setExportAllIneffConnTimeDesc(exportAllIneffConnTimeDesc); return result; }  @Override AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata);  }