javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/InstallerEngineTest.java
branchRCL_3
changeset 60 6c158198356e
parent 19 04becd199f91
child 83 26b2b12093af
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/InstallerEngineTest.java	Thu Jul 15 18:31:06 2010 +0300
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/InstallerEngineTest.java	Thu Aug 19 09:48:13 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -52,6 +52,8 @@
     {
         TestSuite suite = new TestSuite(this.getClass().getName());
 
+        String runIndex = System.getProperty("com.nokia.mj.impl.installer.test.param1");
+
         if (Platform.isLinux())
         {
             // In S60 this would be interactive test, so disable it there.
@@ -64,6 +66,9 @@
             }));
         }
 
+        if (runIndex == null || runIndex.equalsIgnoreCase("run1"))
+        {
+        // Run 1
         suite.addTest(new InstallerEngineTest("testMidletMessageOk", new TestMethod()
         {
             public void run(TestCase tc)
@@ -103,7 +108,11 @@
                 ((InstallerEngineTest)tc).test3AppsOk();
             }
         }));
+        }
 
+        if (runIndex == null || runIndex.equalsIgnoreCase("run2"))
+        {
+        // Run 2
         suite.addTest(new InstallerEngineTest("testDownloadJadOk", new TestMethod()
         {
             public void run(TestCase tc)
@@ -215,7 +224,11 @@
                 ((InstallerEngineTest)tc).testNoJavaBinRoot();
             }
         }));
+        }
 
+        if (runIndex == null || runIndex.equalsIgnoreCase("run3"))
+        {
+        // Run 3
         suite.addTest(new InstallerEngineTest("testBlockUninstall", new TestMethod()
         {
             public void run(TestCase tc)
@@ -239,7 +252,11 @@
                 ((InstallerEngineTest)tc).testApplicationInfo();
             }
         }));
+        }
 
+        if (runIndex == null || runIndex.equalsIgnoreCase("run4"))
+        {
+        // Run 4
         suite.addTest(new InstallerEngineTest("testInstallOptions", new TestMethod()
         {
             public void run(TestCase tc)
@@ -255,6 +272,7 @@
                 ((InstallerEngineTest)tc).testInstallAuthAndBig();
             }
         }));
+        }
 
         com.nokia.mj.impl.utils.OmjTestRunner.run(suite);
     }
@@ -310,6 +328,15 @@
     }
 
     /**
+     */
+    public String getTestServer()
+    {
+        String server = System.getProperty("com.nokia.mj.impl.installer.test.server");
+        assertNotNull("-server=<address>:<port> argument required.", server);
+        return server;
+    }
+
+    /**
      * Makes installation, update and uninstallation for given application.
      * Does the following steps:
      * install with cancellation and check that app is not installed,
@@ -410,12 +437,12 @@
         assertNoIsDir();
 
         // List.
-        Log.logOut("InstallerEngineTest.doInstallUninstall: list -v");
-        result = Installer.mainWithResult(new String[] { "list", "-v" });
-        assertResult(result, Installer.ERR_NONE);
-        Log.logOut("InstallerEngineTest.doInstallUninstall: list -otastatus");
-        result = Installer.mainWithResult(new String[] { "list", "-otastatus" });
-        assertResult(result, Installer.ERR_NONE);
+        //Log.logOut("InstallerEngineTest.doInstallUninstall: list -v");
+        //result = Installer.mainWithResult(new String[] { "list", "-v" });
+        //assertResult(result, Installer.ERR_NONE);
+        //Log.logOut("InstallerEngineTest.doInstallUninstall: list -otastatus");
+        //result = Installer.mainWithResult(new String[] { "list", "-otastatus" });
+        //assertResult(result, Installer.ERR_NONE);
 
         // Update with cancellation.
         Log.logOut("InstallerEngineTest.doInstallUninstall: update with cancellation " + aFilename);
@@ -570,38 +597,38 @@
     public void testDownloadJadOk()
     {
         Log.logOut("InstallerEngineTest.testDownloadJadOk begins");
-        SuiteInfo suite = new SuiteInfo("JBenchmark2", "Kishonti LP");
-        doInstallUninstall(suite, "http://195.134.231.83:7070/omjserver/resources/omj/T00000900_JBenchmark2_gcf.jsp", true, iDefaultOptions);
+        SuiteInfo suite = new SuiteInfo("HelloWorld", "Nokia");
+        doInstallUninstall(suite, "http://" + getTestServer() + "/installertest/HelloWorld_ota.jad", true, iDefaultOptions);
     }
 
     public void testDownloadJarOk()
     {
         Log.logOut("InstallerEngineTest.testDownloadJarOk begins");
-        SuiteInfo suite = new SuiteInfo("JBenchmark2", "Kishonti LP");
-        doInstallUninstall(suite, "http://195.134.231.83:7070/omjserver/resources/omj/JBenchmark2.jar", false, iDefaultOptions);
+        SuiteInfo suite = new SuiteInfo("HelloWorld", "Nokia");
+        doInstallUninstall(suite, "http://" + getTestServer() + "/installertest/HelloWorld.jar", false, iDefaultOptions);
     }
 
     public void testDownloadJadHttpRedirectOk()
     {
         Log.logOut("InstallerEngineTest.testDownloadJadHttpRedirectOk begins");
-        SuiteInfo suite = new SuiteInfo("JBenchmark2", "Kishonti LP");
-        doInstallUninstall(suite, "http://195.134.231.83:7070/RedirectServlet/redirect?name=JBenchmark2.jad&count=5", true, iDefaultOptions);
+        SuiteInfo suite = new SuiteInfo("HelloWorld_redirect", "Nokia");
+        doInstallUninstall(suite, "http://" + getTestServer() + "/installertest/redirect?name=HelloWorld_redirect.jad&count=5", true, iDefaultOptions);
     }
 
     public void testDownloadJarHttpRedirectOk()
     {
         Log.logOut("InstallerEngineTest.testDownloadJarHttpRedirectOk begins");
-        SuiteInfo suite = new SuiteInfo("JBenchmark2", "Kishonti LP");
-        doInstallUninstall(suite, "http://195.134.231.83:7070/RedirectServlet/redirect?name=JBenchmark2.jar", false, iDefaultOptions);
+        SuiteInfo suite = new SuiteInfo("HelloWorld_redirect", "Nokia");
+        doInstallUninstall(suite, "http://" + getTestServer() + "/installertest/redirect?name=HelloWorld_redirect.jar", false, iDefaultOptions);
     }
 
     public void testDownloadJadHttpAuthOk()
     {
         Log.logOut("InstallerEngineTest.testDownloadJadHttpAuthOk begins");
-        SuiteInfo suite = new SuiteInfo("DS_Snow_http_auth", "DS_Effects");
+        SuiteInfo suite = new SuiteInfo("HelloWorld_http_auth", "Nokia");
         iDefaultOptions.addElement("-username=guest");
         iDefaultOptions.addElement("-password=guest");
-        doInstallUninstall(suite, "http://195.134.231.83:7070/httpauth/DS_Snow_http_auth.jad", true, iDefaultOptions);
+        doInstallUninstall(suite, "http://" + getTestServer() + "/installertest/httpauth/HelloWorld_http_auth.jad", true, iDefaultOptions);
     }
 
     public void testDownloadJadHttpAuthNok()
@@ -611,7 +638,7 @@
         {
             "install",
             "-silent",
-            "-jad=http://195.134.231.83:7070/httpauth/DS_Snow_http_auth.jad",
+            "-jad=http://" + getTestServer() + "/installertest/httpauth/HelloWorld_http_auth.jad",
         };
         int result = Installer.mainWithResult(args);
         // Check result code.
@@ -622,7 +649,7 @@
                    iItu.isExceptionReason
                    (Installer.getExecuteException(),
                     InstallerErrorMessage.INST_CANCEL,
-                    InstallerDetailedErrorMessage.NO_MSG,
+                    InstallerDetailedErrorMessage.INST_CANCEL,
                     OtaStatusCode.USER_CANCELLED));
         assertTrue("installed app uid should not exist", Installer.iInstalledApps.length == 0);
     }
@@ -634,7 +661,7 @@
         {
             "install",
             "-silent",
-            "-jad=http://195.134.231.83:7070/RedirectServlet/redirect?name=JBenchmark2.jad&count=6",
+            "-jad=http://" + getTestServer() + "/installertest/redirect?name=HelloWorld_redirect.jad&count=6",
         };
         int result = Installer.mainWithResult(args);
         // Check result code.
@@ -677,7 +704,7 @@
         {
             "install",
             "-silent",
-            "-jad=http://195.134.231.83:7070/omjserver/resources/omj/T00000900_JBenchmark2_8mb_gcf.jsp",
+            "-jad=http://" + getTestServer() + "/installertest/HelloWorld_8mb.jad",
         };
         Log.log("InstallerEngineTest.testDownloadJadCancel: installation starts");
         int result = Installer.mainWithResult(args);
@@ -690,7 +717,7 @@
                    iItu.isExceptionReason
                    (Installer.getExecuteException(),
                     InstallerErrorMessage.INST_CANCEL,
-                    InstallerDetailedErrorMessage.NO_MSG,
+                    InstallerDetailedErrorMessage.INST_CANCEL,
                     OtaStatusCode.USER_CANCELLED));
         assertTrue("installed app uid should not exist", Installer.iInstalledApps.length == 0);
         Log.log("InstallerEngineTest.testDownloadJadCancel: end");
@@ -985,7 +1012,7 @@
         callInstallerOk(new String[] { "list", "-systemproperties" });
         callInstallerOk(new String[] { "launch", "-nouid" });
         callInstallerOk(new String[] { "launch", "-uid=invaliduid" });
-        callInstallerOk(new String[] { "uninstallall" });
+        callInstallerOk(new String[] { "uninstallall", "-silent" });
         callInstallerOk(new String[] { "unregister" });
         callInstallerOk(new String[] { "test", "-nomainclass" });
     }
@@ -1106,10 +1133,10 @@
     {
         Log.logOut("InstallerEngineTest.testInstallAuthAndBig begins");
         // Do first installation with doInstallUninstall helper
-        SuiteInfo suite = new SuiteInfo("DS_Snow_http_auth", "DS_Effects");
+        SuiteInfo suite = new SuiteInfo("HelloWorld_http_auth", "Nokia");
         iDefaultOptions.addElement("-username=guest");
         iDefaultOptions.addElement("-password=guest");
-        doInstallUninstall(suite, "http://195.134.231.83:7070/httpauth/DS_Snow_http_auth.jad", true, iDefaultOptions);
+        doInstallUninstall(suite, "http://" + getTestServer() + "/installertest/httpauth/HelloWorld_http_auth.jad", true, iDefaultOptions);
 
         // Then start installation which downloads a large file.
         Log.log("InstallerEngineTest.testInstallAuthAndBig begin to install big app");
@@ -1117,7 +1144,7 @@
         {
             "install",
             "-silent",
-            "-jad=http://195.134.231.83:7070/omjserver/resources/omj/T00000900_JBenchmark2_8mb_gcf.jsp",
+            "-jad=http://" + getTestServer() + "/installertest/HelloWorld_8mb.jad",
         };
         int result = Installer.mainWithResult(args);
         // Check result code.