InstallerJUnit195123
Because of remove JUnit library from NetBeans 7.0 distribution we need allow IDE users to use testing infrastructure smoothly.
One of solution is use NetBeans installer to install JUnit libs on user's confirmation.
Tracked as Issue 195123
Contents |
Possible solutions:
Summary of benefits and open issues of each particular solutions:
Using updater.jar
- Get org-netbeans-libs-junit4.nbm and org-netbeans-modules-junitlib.nbm from the Stable UC and just place them in the NBM download dir so that the IDE on first start will install them itself, just as if you had downloaded them using Plugin Manager in a prior IDE session. You just need to have prompted the user to accept the CPL in the installer wizard.
- https://hg.netbeans.org/core-main/raw-file/default/maven.junit/src/org/netbeans/modules/maven/junit/libdef/JUnitLibraryDefiner.java
Problems:
- Need to solve possible network problems while downloading
- Need to handle Network Proxy settings
- In case of run the installer as root, unable to run updater.jar on 1st start due to lack of write permission
==> Unfeasible
Using Autoupdate Services API
- Run NetBeans platform from installer and install JUnit lib using autoupdate.services API
Open Issues:
- Run NB Platform in headless mode?
- If headless mode, lack of UI for solving Network Proxy settings
- Need new CLI option in NB launcher
Via the AutoUpdate Ant task
- The download of JUnit shall be available only in Java based distributions and they are known to have Ant inside the Java cluster. Thus the whole code simplest to invoking Ant from installer (either with premade build.xml or directly).
<taskdef name="autoupdate" classpath="${netbeans}/harness/tasks.jar"
classname="org.netbeans.nbbuild.AutoUpdate"/>
<autoupdate installdir="${netbeans}"
updatecenter="http://bits.netbeans.org/netbeans/6.9.2/fixes/latest/uc/catalog.xml.gz"
force="false">
<modules includes=".*junit.*" clusters="platform[0-9]*"/>
</autoupdate>
- exec NB launcher to detect Proxy settings from system
Problems:
- Need to solve possible network problems while downloading
- Need to handle Network Proxy settings
- Make a copy Network Proxy (own java.net.ProxySelector) from Platform into installer
Library registration
- Write the module files to nb/config directory in IDE installation. I.e. the installer would write nb/config/org-netbeans-api-project-libraries/Libraries/junit-*.xml. This is a solution that we already use for registering bundled runtimes (GlassFish, Tomcat, JavaDB).
Problems:
- Application built on NB Platform needs libs.junit4, adding the JUnit library is not enough for them
- dtto - solve network problems while downloading jars
Create JUnit files directly
- For various reasons the modules (o.n.libs.junit4, o.n.m.junitlib) actually have to be installed, not just the library definitions. Of course the installer could create the appropriate files directly rather than going through AU:
java/config/Modules/org-netbeans-modules-junitlib.xml java/docs/junit-3.8.2-api.zip java/docs/junit-3.8.2-src.jar java/docs/junit-4.8.2-api.zip java/docs/junit-4.8.2-src.jar java/modules/ext/junit-3.8.2.jar java/modules/org-netbeans-modules-junitlib.jar java/update_tracking/org-netbeans-modules-junitlib.xml platform/config/Modules/org-netbeans-libs-junit4.xml platform/modules/ext/junit-4.8.2.jar platform/modules/org-netbeans-libs-junit4.jar platform/update_tracking/org-netbeans-libs-junit4.xml
Problems:
- dtto - solve network problems while downloading jars
- much more error-prone that just getting the NBMs from the Stable UC, since the installer would need to track every minor change in the content of these modules.
Installer just makes a flag
- The installer just makes a flag according of user's confirmation, then in the first run of IDE the installation will be completed
- download&install in the background
Open Issues:
- how to notify users while download&install?
- which module will handle it? autoupdate? junit wrapper? but the wrapper is usually turned off in the first start of full IDE
UI
Jano Rojcek's Mockup:
1. The installer would show a special JUnit license panel as a next step following the IDE license panel. In addition to the JUnit license, it would contain two radio button options similar to: ( ) I accept the terms in the JUnit license agreement. Install JUnit. ( ) Do not install JUnit 2. The actual download and installation would happen after pressing the Install button on the summary panel. Perhaps as a continuing progress after the IDE installation. No special step is necessary. If download fails for some reason, it would give the user option to fix the internet connection or skip the download and JUnit installation.
Open Issues in UI:
- would be useful to also have a Set Proxy... button. Often installation will fail because proxy was not detected correctly, so we may want to give the user the option to specify it manually.
