public class CliInstall {
private static final String DISTRIBUTION_INFO = "distribution.info";
private static final String ESSENTIAL_COMPONENT = "ESSENTIAL-COMPONENT";
+ private static final int NETWORK_RETRY_COUNT = 10;
private static ViewController controller = null;
private static ProxyType proxyType = ProxyType.AUTOMATIC;
private static String proxyHost = "";
private static String proxyPort = "";
+
/**
* Works for command line installation
private static boolean installPackages(PackageSet installablePackages, String targetDir)
throws IMExitException {
- int repeatCount = installablePackages.size();
+ int repeatCount = NETWORK_RETRY_COUNT;
for (int i = repeatCount; i > 0; i--) {
try {
if (InstallManager.getInstance().install(installablePackages, targetDir, null)) {
}
} catch (IMNetworkException e) {
Log.ExceptionLog(e);
- System.out.println("Network error has occured. retry the download => " + repeatCount);
+ ErrorController.setNetworkRetryCount(NETWORK_RETRY_COUNT - i);
+ System.out.println("Network error has occured. retry the download => " + (NETWORK_RETRY_COUNT - i));
continue;
}
}
\r
boolean result = false;\r
\r
- if (Options.doTest && Performance.getDownloadStartTime() == null) {\r
+ if (Options.doTest && !Performance.existDownloadStartTime()) {\r
Performance.setDownloadStartTime();\r
}\r
\r
import java.text.SimpleDateFormat;\r
import java.util.Date;\r
\r
+import org.tizen.installmanager.lib.ErrorController;\r
import org.tizen.installmanager.lib.Log;\r
import org.tizen.installmanager.util.PathUtil;\r
\r
downloadStartTime = new Date();\r
}\r
\r
+ public static boolean existDownloadStartTime() {\r
+ if (downloadStartTime != null) {\r
+ return true;\r
+ } else {\r
+ return false;\r
+ }\r
+ }\r
+ \r
public static Date getDownloadStartTime() {\r
return downloadStartTime;\r
}\r
out.newLine();\r
out.write(getTestCaseXml("DownloadTest", "The download time", getDownloadTime()));\r
out.newLine();\r
+ out.write(getTestCaseXml("DownloadRetry", "Download retry count", ErrorController.getNetworkRetryCount()));\r
+ out.newLine();\r
out.write(getTestCaseXml("InstallTest", "The installation time", getInstallationTime()));\r
out.newLine();\r
out.write(getTestCaseXml("TotalInstallationTest", "Total installation time", getTotalInstallationTime()));\r
return (size/1024/seconds);\r
}\r
}\r
-}\r
+}
static private InfoCode infoCode = null;\r
\r
private static int exitCode = Config.EXITCODE_NORMAL;\r
+ private static int retryCount = 0;\r
\r
/**\r
* Set error code.\r
public static int getExitCode() {\r
return ErrorController.exitCode;\r
}\r
+ \r
+ public static void setNetworkRetryCount(int cnt) {\r
+ retryCount = cnt;\r
+ }\r
+ \r
+ public static int getNetworkRetryCount(int cnt) {\r
+ return retryCount;\r
+ }\r
}\r