hotswap: New patch. Main changes are:
- Improved instance update performance (mark&compact modification, compressed storage of instance update information)
- Improved stability (increased own test suite, more tests of the standard class redefinition test suite passing)
- Correct handling of static fields: Values are copied from old class instead of reexecuting the static initializer of the new class.
- Introduction of mutator methods: On every changed instance the method $mutator() is executed if available.
- Rebiased to jdk7-b81
1 diff -r 1999f5b12482 .hgignore
2 --- a/.hgignore Thu Jan 28 11:26:42 2010 -0800
3 +++ b/.hgignore Tue Feb 02 16:40:23 2010 +0100
8 -^src/share/tools/hsdis/build/
9 -^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
10 -^src/share/tools/IdealGraphVisualizer/build/
11 -^src/share/tools/IdealGraphVisualizer/dist/
19 +^src/share/tools/hsdis/build/
30 +^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
31 +^src/share/tools/IdealGraphVisualizer/build/
32 +^src/share/tools/IdealGraphVisualizer/dist/
33 diff -r 1999f5b12482 build.cmd
34 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
35 +++ b/build.cmd Tue Feb 02 16:40:23 2010 +0100
37 +set HotSpotMksHome=C:\Cygwin\bin
38 +set path=%JAVA_HOME%;C:\Cygwin\bin
39 +call "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"
44 +call build.bat product compiler1 %OrigPath% %JAVA_HOME%
45 +call build.bat fastdebug compiler1 %OrigPath% %JAVA_HOME%
49 diff -r 1999f5b12482 create.cmd
50 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
51 +++ b/create.cmd Tue Feb 02 16:40:23 2010 +0100
53 +set HotSpotMksHome=C:\Cygwin\bin
54 +set path=%JAVA_HOME%\bin;C:\Cygwin\bin
55 +call "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"
60 +mkdir %OrigPath%\work
61 +call create.bat %OrigPath% %OrigPath%\work %OrigPath%\java
65 diff -r 1999f5b12482 hotswaptest/HotSwapTests/manifest.mf
66 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
67 +++ b/hotswaptest/HotSwapTests/manifest.mf Tue Feb 02 16:40:23 2010 +0100
69 +Manifest-Version: 1.0
70 +X-COMMENT: Main-Class will be added automatically by build
72 diff -r 1999f5b12482 hotswaptest/HotSwapTests/nbbuild.xml
73 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
74 +++ b/hotswaptest/HotSwapTests/nbbuild.xml Tue Feb 02 16:40:23 2010 +0100
76 +<?xml version="1.0" encoding="UTF-8"?>
77 +<!-- You may freely edit this file. See commented blocks below for -->
78 +<!-- some examples of how to customize the build. -->
79 +<!-- (If you delete it and reopen the project it will be recreated.) -->
80 +<!-- By default, only the Clean and Build commands use this build script. -->
81 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
82 +<!-- the Compile on Save feature is turned off for the project. -->
83 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
84 +<!-- in the project's Project Properties dialog box.-->
85 +<project name="HotSwapTests" default="default" basedir=".">
86 + <description>Builds, tests, and runs the project HotSwapTests.</description>
87 + <import file="nbproject/build-impl.xml"/>
90 + There exist several targets which are by default empty and which can be
91 + used for execution of your tasks. These targets are usually executed
92 + before and after some main targets. They are:
94 + -pre-init: called before initialization of project properties
95 + -post-init: called after initialization of project properties
96 + -pre-compile: called before javac compilation
97 + -post-compile: called after javac compilation
98 + -pre-compile-single: called before javac compilation of single file
99 + -post-compile-single: called after javac compilation of single file
100 + -pre-compile-test: called before javac compilation of JUnit tests
101 + -post-compile-test: called after javac compilation of JUnit tests
102 + -pre-compile-test-single: called before javac compilation of single JUnit test
103 + -post-compile-test-single: called after javac compilation of single JUunit test
104 + -pre-jar: called before JAR building
105 + -post-jar: called after JAR building
106 + -post-clean: called after cleaning build products
108 + (Targets beginning with '-' are not intended to be called on their own.)
110 + Example of inserting an obfuscator after compilation could look like this:
112 + <target name="-post-compile">
114 + <fileset dir="${build.classes.dir}"/>
118 + For list of available properties check the imported
119 + nbproject/build-impl.xml file.
122 + Another way to customize the build is by overriding existing main targets.
123 + The targets of interest are:
125 + -init-macrodef-javac: defines macro for javac compilation
126 + -init-macrodef-junit: defines macro for junit execution
127 + -init-macrodef-debug: defines macro for class debugging
128 + -init-macrodef-java: defines macro for class execution
129 + -do-jar-with-manifest: JAR building (if you are using a manifest)
130 + -do-jar-without-manifest: JAR building (if you are not using a manifest)
131 + run: execution of project
132 + -javadoc-build: Javadoc generation
133 + test-report: JUnit report generation
135 + An example of overriding the target for project execution could look like this:
137 + <target name="run" depends="HotSwapTests-impl.jar">
138 + <exec dir="bin" executable="launcher.exe">
139 + <arg file="${dist.jar}"/>
143 + Notice that the overridden target depends on the jar target and not only on
144 + the compile target as the regular run target does. Again, for a list of available
145 + properties which you can use, check the target you are overriding in the
146 + nbproject/build-impl.xml file.
150 diff -r 1999f5b12482 hotswaptest/HotSwapTests/nbproject/build-impl.xml
151 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
152 +++ b/hotswaptest/HotSwapTests/nbproject/build-impl.xml Tue Feb 02 16:40:23 2010 +0100
154 +<?xml version="1.0" encoding="UTF-8"?>
156 +*** GENERATED FROM project.xml - DO NOT EDIT ***
157 +*** EDIT ../build.xml INSTEAD ***
159 +For the purpose of easier reading the script
160 +is divided into following sections:
168 + - junit compilation
175 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="HotSwapTests-impl">
176 + <fail message="Please build using Ant 1.7.1 or higher.">
179 + <antversion atleast="1.7.1"/>
183 + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
185 + ======================
186 + INITIALIZATION SECTION
187 + ======================
189 + <target name="-pre-init">
190 + <!-- Empty placeholder for easier customization. -->
191 + <!-- You can override this target in the ../build.xml file. -->
193 + <target depends="-pre-init" name="-init-private">
194 + <property file="nbproject/private/config.properties"/>
195 + <property file="nbproject/private/configs/${config}.properties"/>
196 + <property file="nbproject/private/private.properties"/>
198 + <target depends="-pre-init,-init-private" name="-init-user">
199 + <property file="${user.properties.file}"/>
200 + <!-- The two properties below are usually overridden -->
201 + <!-- by the active platform. Just a fallback. -->
202 + <property name="default.javac.source" value="1.4"/>
203 + <property name="default.javac.target" value="1.4"/>
205 + <target depends="-pre-init,-init-private,-init-user" name="-init-project">
206 + <property file="nbproject/configs/${config}.properties"/>
207 + <property file="nbproject/project.properties"/>
209 + <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
210 + <available file="${manifest.file}" property="manifest.available"/>
211 + <condition property="main.class.available">
213 + <isset property="main.class"/>
215 + <equals arg1="${main.class}" arg2="" trim="true"/>
219 + <condition property="manifest.available+main.class">
221 + <isset property="manifest.available"/>
222 + <isset property="main.class.available"/>
225 + <condition property="do.mkdist">
227 + <isset property="libs.CopyLibs.classpath"/>
229 + <istrue value="${mkdist.disabled}"/>
233 + <condition property="manifest.available+main.class+mkdist.available">
235 + <istrue value="${manifest.available+main.class}"/>
236 + <isset property="do.mkdist"/>
239 + <condition property="manifest.available+mkdist.available">
241 + <istrue value="${manifest.available}"/>
242 + <isset property="do.mkdist"/>
245 + <condition property="manifest.available-mkdist.available">
247 + <istrue value="${manifest.available}"/>
248 + <isset property="do.mkdist"/>
251 + <condition property="manifest.available+main.class-mkdist.available">
253 + <istrue value="${manifest.available+main.class}"/>
254 + <isset property="do.mkdist"/>
257 + <condition property="have.tests">
260 + <condition property="have.sources">
262 + <available file="${src.dir}"/>
265 + <condition property="netbeans.home+have.tests">
267 + <isset property="netbeans.home"/>
268 + <isset property="have.tests"/>
271 + <condition property="no.javadoc.preview">
273 + <isset property="javadoc.preview"/>
274 + <isfalse value="${javadoc.preview}"/>
277 + <property name="run.jvmargs" value=""/>
278 + <property name="javac.compilerargs" value=""/>
279 + <property name="work.dir" value="${basedir}"/>
280 + <condition property="no.deps">
282 + <istrue value="${no.dependencies}"/>
285 + <property name="javac.debug" value="true"/>
286 + <property name="javadoc.preview" value="true"/>
287 + <property name="application.args" value=""/>
288 + <property name="source.encoding" value="${file.encoding}"/>
289 + <property name="runtime.encoding" value="${source.encoding}"/>
290 + <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
292 + <isset property="javadoc.encoding"/>
294 + <equals arg1="${javadoc.encoding}" arg2=""/>
298 + <property name="javadoc.encoding.used" value="${source.encoding}"/>
299 + <property name="includes" value="**"/>
300 + <property name="excludes" value=""/>
301 + <property name="do.depend" value="false"/>
302 + <condition property="do.depend.true">
303 + <istrue value="${do.depend}"/>
305 + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
306 + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
307 + <length length="0" string="${endorsed.classpath}" when="greater"/>
309 + <property name="javac.fork" value="false"/>
311 + <target name="-post-init">
312 + <!-- Empty placeholder for easier customization. -->
313 + <!-- You can override this target in the ../build.xml file. -->
315 + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
316 + <fail unless="src.dir">Must set src.dir</fail>
317 + <fail unless="build.dir">Must set build.dir</fail>
318 + <fail unless="dist.dir">Must set dist.dir</fail>
319 + <fail unless="build.classes.dir">Must set build.classes.dir</fail>
320 + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
321 + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
322 + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
323 + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
324 + <fail unless="dist.jar">Must set dist.jar</fail>
326 + <target name="-init-macrodef-property">
327 + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
328 + <attribute name="name"/>
329 + <attribute name="value"/>
331 + <property name="@{name}" value="${@{value}}"/>
335 + <target name="-init-macrodef-javac">
336 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
337 + <attribute default="${src.dir}" name="srcdir"/>
338 + <attribute default="${build.classes.dir}" name="destdir"/>
339 + <attribute default="${javac.classpath}" name="classpath"/>
340 + <attribute default="${includes}" name="includes"/>
341 + <attribute default="${excludes}" name="excludes"/>
342 + <attribute default="${javac.debug}" name="debug"/>
343 + <attribute default="${empty.dir}" name="sourcepath"/>
344 + <attribute default="${empty.dir}" name="gensrcdir"/>
345 + <element name="customize" optional="true"/>
347 + <property location="${build.dir}/empty" name="empty.dir"/>
348 + <mkdir dir="${empty.dir}"/>
349 + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
351 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
352 + <include name="*"/>
356 + <path path="@{classpath}"/>
358 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
359 + <compilerarg line="${javac.compilerargs}"/>
364 + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
365 + <attribute default="${src.dir}" name="srcdir"/>
366 + <attribute default="${build.classes.dir}" name="destdir"/>
367 + <attribute default="${javac.classpath}" name="classpath"/>
369 + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
371 + <path path="@{classpath}"/>
376 + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
377 + <attribute default="${build.classes.dir}" name="destdir"/>
379 + <fail unless="javac.includes">Must set javac.includes</fail>
380 + <pathconvert pathsep="," property="javac.includes.binary">
382 + <filelist dir="@{destdir}" files="${javac.includes}"/>
384 + <globmapper from="*.java" to="*.class"/>
387 + <files includes="${javac.includes.binary}"/>
392 + <target name="-init-macrodef-junit">
393 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
394 + <attribute default="${includes}" name="includes"/>
395 + <attribute default="${excludes}" name="excludes"/>
396 + <attribute default="**" name="testincludes"/>
398 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
399 + <batchtest todir="${build.test.results.dir}"/>
401 + <path path="${run.test.classpath}"/>
404 + <propertyref prefix="test-sys-prop."/>
405 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
407 + <formatter type="brief" usefile="false"/>
408 + <formatter type="xml"/>
409 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
410 + <jvmarg line="${run.jvmargs}"/>
415 + <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
416 + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
417 + <attribute default="${main.class}" name="name"/>
418 + <attribute default="${debug.classpath}" name="classpath"/>
419 + <attribute default="" name="stopclassname"/>
421 + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
423 + <path path="@{classpath}"/>
428 + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
429 + <attribute default="${build.classes.dir}" name="dir"/>
432 + <fileset dir="@{dir}" includes="${fix.classes}">
433 + <include name="${fix.includes}*.class"/>
439 + <target name="-init-debug-args">
440 + <property name="version-output" value="java version "${ant.java.version}"/>
441 + <condition property="have-jdk-older-than-1.4">
443 + <contains string="${version-output}" substring="java version "1.0"/>
444 + <contains string="${version-output}" substring="java version "1.1"/>
445 + <contains string="${version-output}" substring="java version "1.2"/>
446 + <contains string="${version-output}" substring="java version "1.3"/>
449 + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
450 + <istrue value="${have-jdk-older-than-1.4}"/>
452 + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
453 + <os family="windows"/>
455 + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
456 + <isset property="debug.transport"/>
459 + <target depends="-init-debug-args" name="-init-macrodef-debug">
460 + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
461 + <attribute default="${main.class}" name="classname"/>
462 + <attribute default="${debug.classpath}" name="classpath"/>
463 + <element name="customize" optional="true"/>
465 + <java classname="@{classname}" dir="${work.dir}" fork="true">
466 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
467 + <jvmarg line="${debug-args-line}"/>
468 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
469 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
470 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
471 + <jvmarg line="${run.jvmargs}"/>
473 + <path path="@{classpath}"/>
476 + <propertyref prefix="run-sys-prop."/>
477 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
484 + <target name="-init-macrodef-java">
485 + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
486 + <attribute default="${main.class}" name="classname"/>
487 + <attribute default="${run.classpath}" name="classpath"/>
488 + <element name="customize" optional="true"/>
490 + <java classname="@{classname}" dir="${work.dir}" fork="true">
491 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
492 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
493 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
494 + <jvmarg line="${run.jvmargs}"/>
496 + <path path="@{classpath}"/>
499 + <propertyref prefix="run-sys-prop."/>
500 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
507 + <target name="-init-presetdef-jar">
508 + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
509 + <jar compress="${jar.compress}" jarfile="${dist.jar}">
510 + <j2seproject1:fileset dir="${build.classes.dir}"/>
514 + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
516 + ===================
517 + COMPILATION SECTION
518 + ===================
520 + <target name="-deps-jar-init" unless="built-jar.properties">
521 + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
522 + <delete file="${built-jar.properties}" quiet="true"/>
524 + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
525 + <echo level="warn" message="Cycle detected: HotSwapTests was already built"/>
527 + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
528 + <mkdir dir="${build.dir}"/>
529 + <touch file="${built-jar.properties}" verbose="false"/>
530 + <property file="${built-jar.properties}" prefix="already.built.jar."/>
531 + <antcall target="-warn-already-built-jar"/>
532 + <propertyfile file="${built-jar.properties}">
533 + <entry key="${basedir}" value=""/>
535 + <antcall target="-maybe-call-dep">
536 + <param name="call.built.properties" value="${built-jar.properties}"/>
537 + <param location="${project.HotSwapTool}" name="call.subproject"/>
538 + <param location="${project.HotSwapTool}/build.xml" name="call.script"/>
539 + <param name="call.target" value="jar"/>
540 + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
543 + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
544 + <target depends="init" name="-check-automatic-build">
545 + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
547 + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
548 + <antcall target="clean"/>
550 + <target depends="init,deps-jar" name="-pre-pre-compile">
551 + <mkdir dir="${build.classes.dir}"/>
553 + <target name="-pre-compile">
554 + <!-- Empty placeholder for easier customization. -->
555 + <!-- You can override this target in the ../build.xml file. -->
557 + <target if="do.depend.true" name="-compile-depend">
558 + <pathconvert property="build.generated.subdirs">
559 + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
560 + <include name="*"/>
563 + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
565 + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
566 + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
567 + <copy todir="${build.classes.dir}">
568 + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
571 + <target name="-post-compile">
572 + <!-- Empty placeholder for easier customization. -->
573 + <!-- You can override this target in the ../build.xml file. -->
575 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
576 + <target name="-pre-compile-single">
577 + <!-- Empty placeholder for easier customization. -->
578 + <!-- You can override this target in the ../build.xml file. -->
580 + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
581 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
582 + <j2seproject3:force-recompile/>
583 + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
585 + <target name="-post-compile-single">
586 + <!-- Empty placeholder for easier customization. -->
587 + <!-- You can override this target in the ../build.xml file. -->
589 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
591 + ====================
592 + JAR BUILDING SECTION
593 + ====================
595 + <target depends="init" name="-pre-pre-jar">
596 + <dirname file="${dist.jar}" property="dist.jar.dir"/>
597 + <mkdir dir="${dist.jar.dir}"/>
599 + <target name="-pre-jar">
600 + <!-- Empty placeholder for easier customization. -->
601 + <!-- You can override this target in the ../build.xml file. -->
603 + <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
604 + <j2seproject1:jar/>
606 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
607 + <j2seproject1:jar manifest="${manifest.file}"/>
609 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
610 + <j2seproject1:jar manifest="${manifest.file}">
611 + <j2seproject1:manifest>
612 + <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
613 + </j2seproject1:manifest>
614 + </j2seproject1:jar>
615 + <echo>To run this application from the command line without Ant, try:</echo>
616 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
617 + <property location="${dist.jar}" name="dist.jar.resolved"/>
618 + <pathconvert property="run.classpath.with.dist.jar">
619 + <path path="${run.classpath}"/>
620 + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
622 + <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
624 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
625 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
626 + <pathconvert property="run.classpath.without.build.classes.dir">
627 + <path path="${run.classpath}"/>
628 + <map from="${build.classes.dir.resolved}" to=""/>
630 + <pathconvert pathsep=" " property="jar.classpath">
631 + <path path="${run.classpath.without.build.classes.dir}"/>
634 + <globmapper from="*" to="lib/*"/>
637 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
638 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
639 + <fileset dir="${build.classes.dir}"/>
641 + <attribute name="Main-Class" value="${main.class}"/>
642 + <attribute name="Class-Path" value="${jar.classpath}"/>
645 + <echo>To run this application from the command line without Ant, try:</echo>
646 + <property location="${dist.jar}" name="dist.jar.resolved"/>
647 + <echo>java -jar "${dist.jar.resolved}"</echo>
649 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available">
650 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
651 + <pathconvert property="run.classpath.without.build.classes.dir">
652 + <path path="${run.classpath}"/>
653 + <map from="${build.classes.dir.resolved}" to=""/>
655 + <pathconvert pathsep=" " property="jar.classpath">
656 + <path path="${run.classpath.without.build.classes.dir}"/>
659 + <globmapper from="*" to="lib/*"/>
662 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
663 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
664 + <fileset dir="${build.classes.dir}"/>
666 + <attribute name="Class-Path" value="${jar.classpath}"/>
670 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available">
671 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
672 + <pathconvert property="run.classpath.without.build.classes.dir">
673 + <path path="${run.classpath}"/>
674 + <map from="${build.classes.dir.resolved}" to=""/>
676 + <pathconvert pathsep=" " property="jar.classpath">
677 + <path path="${run.classpath.without.build.classes.dir}"/>
680 + <globmapper from="*" to="lib/*"/>
683 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
684 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
685 + <fileset dir="${build.classes.dir}"/>
687 + <attribute name="Class-Path" value="${jar.classpath}"/>
691 + <target name="-post-jar">
692 + <!-- Empty placeholder for easier customization. -->
693 + <!-- You can override this target in the ../build.xml file. -->
695 + <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar" description="Build JAR." name="jar"/>
701 + <target depends="init,compile" description="Run a main class." name="run">
702 + <j2seproject1:java>
704 + <arg line="${application.args}"/>
706 + </j2seproject1:java>
708 + <target name="-do-not-recompile">
709 + <property name="javac.includes.binary" value=""/>
711 + <target depends="init,compile-single" name="run-single">
712 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
713 + <j2seproject1:java classname="${run.class}"/>
715 + <target depends="init,compile-test-single" name="run-test-with-main">
716 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
717 + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
724 + <target depends="init" if="netbeans.home" name="-debug-start-debugger">
725 + <j2seproject1:nbjpdastart name="${debug.class}"/>
727 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
728 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
730 + <target depends="init,compile" name="-debug-start-debuggee">
731 + <j2seproject3:debug>
733 + <arg line="${application.args}"/>
735 + </j2seproject3:debug>
737 + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
738 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
739 + <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
741 + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
742 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
743 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
744 + <j2seproject3:debug classname="${debug.class}"/>
746 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
747 + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
748 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
749 + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
751 + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
752 + <target depends="init" name="-pre-debug-fix">
753 + <fail unless="fix.includes">Must set fix.includes</fail>
754 + <property name="javac.includes" value="${fix.includes}.java"/>
756 + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
757 + <j2seproject1:nbjpdareload/>
759 + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
765 + <target depends="init" name="-javadoc-build">
766 + <mkdir dir="${dist.javadoc.dir}"/>
767 + <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
769 + <path path="${javac.classpath}"/>
771 + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
772 + <filename name="**/*.java"/>
774 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
775 + <include name="**/*.java"/>
779 + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
780 + <nbbrowse file="${dist.javadoc.dir}/index.html"/>
782 + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
784 + =========================
785 + JUNIT COMPILATION SECTION
786 + =========================
788 + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
789 + <mkdir dir="${build.test.classes.dir}"/>
791 + <target name="-pre-compile-test">
792 + <!-- Empty placeholder for easier customization. -->
793 + <!-- You can override this target in the ../build.xml file. -->
795 + <target if="do.depend.true" name="-compile-test-depend">
796 + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir=""/>
798 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
799 + <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir=""/>
800 + <copy todir="${build.test.classes.dir}"/>
802 + <target name="-post-compile-test">
803 + <!-- Empty placeholder for easier customization. -->
804 + <!-- You can override this target in the ../build.xml file. -->
806 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
807 + <target name="-pre-compile-test-single">
808 + <!-- Empty placeholder for easier customization. -->
809 + <!-- You can override this target in the ../build.xml file. -->
811 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
812 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
813 + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
814 + <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="" srcdir=""/>
815 + <copy todir="${build.test.classes.dir}"/>
817 + <target name="-post-compile-test-single">
818 + <!-- Empty placeholder for easier customization. -->
819 + <!-- You can override this target in the ../build.xml file. -->
821 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
823 + =======================
824 + JUNIT EXECUTION SECTION
825 + =======================
827 + <target depends="init" if="have.tests" name="-pre-test-run">
828 + <mkdir dir="${build.test.results.dir}"/>
830 + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
831 + <j2seproject3:junit testincludes="**/*Test.java"/>
833 + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
834 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
836 + <target depends="init" if="have.tests" name="test-report"/>
837 + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
838 + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
839 + <target depends="init" if="have.tests" name="-pre-test-run-single">
840 + <mkdir dir="${build.test.results.dir}"/>
842 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
843 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
844 + <j2seproject3:junit excludes="" includes="${test.includes}"/>
846 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
847 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
849 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
851 + =======================
852 + JUNIT DEBUGGING SECTION
853 + =======================
855 + <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
856 + <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
857 + <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
858 + <delete file="${test.report.file}"/>
859 + <mkdir dir="${build.test.results.dir}"/>
860 + <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
863 + <propertyref prefix="test-sys-prop."/>
864 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
866 + <arg value="${test.class}"/>
867 + <arg value="showoutput=true"/>
868 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
869 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
871 + </j2seproject3:debug>
873 + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
874 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
876 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
877 + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
878 + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
880 + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
882 + =========================
883 + APPLET EXECUTION SECTION
884 + =========================
886 + <target depends="init,compile-single" name="run-applet">
887 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
888 + <j2seproject1:java classname="sun.applet.AppletViewer">
890 + <arg value="${applet.url}"/>
892 + </j2seproject1:java>
895 + =========================
896 + APPLET DEBUGGING SECTION
897 + =========================
899 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
900 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
901 + <j2seproject3:debug classname="sun.applet.AppletViewer">
903 + <arg value="${applet.url}"/>
905 + </j2seproject3:debug>
907 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
913 + <target name="-deps-clean-init" unless="built-clean.properties">
914 + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
915 + <delete file="${built-clean.properties}" quiet="true"/>
917 + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
918 + <echo level="warn" message="Cycle detected: HotSwapTests was already built"/>
920 + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
921 + <mkdir dir="${build.dir}"/>
922 + <touch file="${built-clean.properties}" verbose="false"/>
923 + <property file="${built-clean.properties}" prefix="already.built.clean."/>
924 + <antcall target="-warn-already-built-clean"/>
925 + <propertyfile file="${built-clean.properties}">
926 + <entry key="${basedir}" value=""/>
928 + <antcall target="-maybe-call-dep">
929 + <param name="call.built.properties" value="${built-clean.properties}"/>
930 + <param location="${project.HotSwapTool}" name="call.subproject"/>
931 + <param location="${project.HotSwapTool}/build.xml" name="call.script"/>
932 + <param name="call.target" value="clean"/>
933 + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
936 + <target depends="init" name="-do-clean">
937 + <delete dir="${build.dir}"/>
938 + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
940 + <target name="-post-clean">
941 + <!-- Empty placeholder for easier customization. -->
942 + <!-- You can override this target in the ../build.xml file. -->
944 + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
945 + <target name="-check-call-dep">
946 + <property file="${call.built.properties}" prefix="already.built."/>
947 + <condition property="should.call.dep">
949 + <isset property="already.built.${call.subproject}"/>
953 + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
954 + <ant antfile="${call.script}" inheritall="false" target="${call.target}">
956 + <propertyref prefix="transfer."/>
957 + <mapper from="transfer.*" to="*" type="glob"/>
962 diff -r 1999f5b12482 hotswaptest/HotSwapTests/nbproject/genfiles.properties
963 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
964 +++ b/hotswaptest/HotSwapTests/nbproject/genfiles.properties Tue Feb 02 16:40:23 2010 +0100
966 +nbbuild.xml.data.CRC32=c8ab650e
967 +nbbuild.xml.script.CRC32=2ea92a55
968 +nbbuild.xml.stylesheet.CRC32=958a1d3e@1.32.1.45
969 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
970 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
971 +nbproject/build-impl.xml.data.CRC32=c8ab650e
972 +nbproject/build-impl.xml.script.CRC32=2e435115
973 +nbproject/build-impl.xml.stylesheet.CRC32=576378a2@1.32.1.45
974 diff -r 1999f5b12482 hotswaptest/HotSwapTests/nbproject/project.properties
975 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
976 +++ b/hotswaptest/HotSwapTests/nbproject/project.properties Tue Feb 02 16:40:23 2010 +0100
978 +application.title=HotSwapTests
979 +application.vendor=Thomas
980 +build.classes.dir=${build.dir}/classes
981 +build.classes.excludes=**/*.java,**/*.form
982 +# This directory is removed when the project is cleaned:
984 +build.generated.dir=${build.dir}/generated
985 +build.generated.sources.dir=${build.dir}/generated-sources
986 +# Only compile against the classpath explicitly listed here:
987 +build.sysclasspath=ignore
988 +build.test.classes.dir=${build.dir}/test/classes
989 +build.test.results.dir=${build.dir}/test/results
990 +buildfile=nbbuild.xml
991 +# Uncomment to specify the preferred debugger connection transport:
992 +#debug.transport=dt_socket
995 +debug.test.classpath=\
996 + ${run.test.classpath}
997 +# This directory is removed when the project is cleaned:
999 +dist.jar=${dist.dir}/HotSwapTests.jar
1000 +dist.javadoc.dir=${dist.dir}/javadoc
1001 +endorsed.classpath=
1003 +file.reference.bcel-5.2.jar=..\\..\\..\\..\\Java\\bcel-5.2\\bcel-5.2.jar
1004 +file.reference.HotSwapTests-src=src
1008 + ${libs.junit_4.classpath}:\
1009 + ${reference.HotSwapTool.jar}
1010 +# Space-separated list of extra javac options
1011 +javac.compilerargs=
1012 +javac.deprecation=false
1015 +javac.test.classpath=\
1016 + ${javac.classpath}:\
1017 + ${build.classes.dir}:\
1018 + ${libs.junit.classpath}:\
1019 + ${libs.junit_4.classpath}
1020 +javadoc.additionalparam=
1021 +javadoc.author=false
1022 +javadoc.encoding=${source.encoding}
1023 +javadoc.noindex=false
1024 +javadoc.nonavbar=false
1025 +javadoc.notree=false
1026 +javadoc.private=false
1027 +javadoc.splitindex=true
1029 +javadoc.version=false
1030 +javadoc.windowtitle=
1031 +jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
1032 +main.class=at.ssw.hotswap.test.Main
1033 +manifest.file=manifest.mf
1034 +meta.inf.dir=${src.dir}/META-INF
1035 +platform.active=default_platform
1036 +project.HotSwapTool=../HotSwapTool
1037 +reference.HotSwapTool.jar=${project.HotSwapTool}/dist/HotSwapTool.jar
1039 + ${javac.classpath}:\
1040 + ${build.classes.dir}
1041 +run.test.classpath=\
1042 + ${javac.test.classpath}:\
1043 + ${build.test.classes.dir}
1044 +source.encoding=UTF-8
1045 +src.dir=${file.reference.HotSwapTests-src}
1046 diff -r 1999f5b12482 hotswaptest/HotSwapTests/nbproject/project.xml
1047 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1048 +++ b/hotswaptest/HotSwapTests/nbproject/project.xml Tue Feb 02 16:40:23 2010 +0100
1050 +<?xml version="1.0" encoding="UTF-8"?>
1051 +<project xmlns="http://www.netbeans.org/ns/project/1">
1052 + <type>org.netbeans.modules.java.j2seproject</type>
1054 + <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
1055 + <name>HotSwapTests</name>
1056 + <minimum-ant-version>1.6.5</minimum-ant-version>
1058 + <root id="src.dir"/>
1062 + <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
1064 + <foreign-project>HotSwapTool</foreign-project>
1065 + <artifact-type>jar</artifact-type>
1066 + <script>build.xml</script>
1067 + <target>jar</target>
1068 + <clean-target>clean</clean-target>
1074 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/CompleteTestSuite.java
1075 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1076 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/CompleteTestSuite.java Tue Feb 02 16:40:23 2010 +0100
1079 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
1080 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1082 + * This code is free software; you can redistribute it and/or modify it
1083 + * under the terms of the GNU General Public License version 2 only, as
1084 + * published by the Free Software Foundation.
1086 + * This code is distributed in the hope that it will be useful, but WITHOUT
1087 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1088 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1089 + * version 2 for more details (a copy is included in the LICENSE file that
1090 + * accompanied this code).
1092 + * You should have received a copy of the GNU General Public License version
1093 + * 2 along with this work; if not, write to the Free Software Foundation,
1094 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1096 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1097 + * CA 95054 USA or visit www.sun.com if you need additional information or
1098 + * have any questions.
1102 +package at.ssw.hotswap.test;
1104 +import org.junit.runner.RunWith;
1105 +import org.junit.runners.Suite;
1107 +import at.ssw.hotswap.test.body.BodyTestSuite;
1108 +import at.ssw.hotswap.test.eval.EvalTestSuite;
1109 +import at.ssw.hotswap.test.fields.FieldsTestSuite;
1110 +import at.ssw.hotswap.test.methods.MethodsTestSuite;
1111 +import at.ssw.hotswap.test.mutator.MutatorTestSuite;
1112 +import at.ssw.hotswap.test.structural.StructuralTestSuite;
1115 + * Summarizes all available test suites.
1117 + * @author Thomas Wuerthinger
1119 +@RunWith(Suite.class)
1120 +@Suite.SuiteClasses({
1121 + BodyTestSuite.class,
1122 + EvalTestSuite.class,
1123 + MethodsTestSuite.class,
1124 + FieldsTestSuite.class,
1125 + StructuralTestSuite.class,
1126 + MutatorTestSuite.class
1128 +public class CompleteTestSuite {
1130 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/Main.java
1131 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1132 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/Main.java Tue Feb 02 16:40:23 2010 +0100
1135 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
1136 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1138 + * This code is free software; you can redistribute it and/or modify it
1139 + * under the terms of the GNU General Public License version 2 only, as
1140 + * published by the Free Software Foundation.
1142 + * This code is distributed in the hope that it will be useful, but WITHOUT
1143 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1144 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1145 + * version 2 for more details (a copy is included in the LICENSE file that
1146 + * accompanied this code).
1148 + * You should have received a copy of the GNU General Public License version
1149 + * 2 along with this work; if not, write to the Free Software Foundation,
1150 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1152 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1153 + * CA 95054 USA or visit www.sun.com if you need additional information or
1154 + * have any questions.
1158 +package at.ssw.hotswap.test;
1160 +import org.junit.runner.Description;
1161 +import org.junit.runner.JUnitCore;
1162 +import org.junit.runner.Request;
1163 +import org.junit.runner.manipulation.Filter;
1164 +import org.junit.runner.notification.Failure;
1165 +import org.junit.runner.notification.RunListener;
1168 + * Main class for running class redefinition tests. Make sure that the execution directory is set such that this class file
1169 + * can be reached via "at/ssw/hotswap/test/Main.class".
1171 + * There are different levels of redefinition:
1172 + * BodyTestSuite < MethodsTestSuite < FieldsTestSuite < StructuralTestSuite
1174 + * Make sure that the application is started with a Java debug agent on port 4000. If you specify an argument, only tests
1175 + * containing the specified string are executed.
1178 + * <pre>java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4000,suspend=n at.ssw.hotswap.test.Main SimpleTest</pre>
1180 + * @author Thomas Wuerthinger
1183 +public class Main {
1185 + private static int failedCount;
1186 + private static int finishedCount;
1187 + private static String failureString = "";
1189 + public static void main(final String[] args) {
1190 + System.out.println("Running JUnit tests: ");
1192 + JUnitCore core = new JUnitCore();
1193 + core.addListener(runListener);
1195 + Request request = Request.classes(CompleteTestSuite.class);
1197 + // Filter the request?
1198 + if (args.length == 1) {
1200 + System.out.println("Only run tests containing \"" + args[0] + "\"");
1202 + request = request.filterWith(new Filter() {
1205 + public String describe() {
1210 + public boolean shouldRun(Description d) {
1212 + if (d.getDisplayName().contains(args[0])) {
1216 + // explicitly check if any children want to run
1217 + for (Description each : d.getChildren()) {
1218 + if (shouldRun(each)) {
1228 + long startTime = System.currentTimeMillis();
1229 + core.run(request);
1230 + long time = System.currentTimeMillis() - startTime;
1232 + System.out.println("" + (finishedCount - failedCount) + " of " + finishedCount + " tests are OK!");
1233 + System.out.println("Time: " + ((double) time) / 1000);
1234 + if (failedCount == 0) {
1235 + System.out.println("ALL OK");
1237 + System.out.println(failedCount + " FAILURES: " + failureString);
1240 + private static RunListener runListener = new RunListener() {
1243 + public void testStarted(Description description) throws Exception {
1244 + System.out.println("============================================================");
1245 + System.out.println("Test started: " + description.getDisplayName());
1249 + public void testFailure(Failure failure) throws Exception {
1250 + System.out.println("Test failure: " + failure.getMessage());
1251 + failure.getException().printStackTrace();
1253 + failureString += failure.getDescription().getDisplayName() + " ";
1257 + public void testFinished(Description description) throws Exception {
1258 + System.out.println("Test finished: " + description.getDisplayName());
1263 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/TestUtil.java
1264 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1265 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/TestUtil.java Tue Feb 02 16:40:23 2010 +0100
1268 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
1269 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1271 + * This code is free software; you can redistribute it and/or modify it
1272 + * under the terms of the GNU General Public License version 2 only, as
1273 + * published by the Free Software Foundation.
1275 + * This code is distributed in the hope that it will be useful, but WITHOUT
1276 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1277 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1278 + * version 2 for more details (a copy is included in the LICENSE file that
1279 + * accompanied this code).
1281 + * You should have received a copy of the GNU General Public License version
1282 + * 2 along with this work; if not, write to the Free Software Foundation,
1283 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1285 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1286 + * CA 95054 USA or visit www.sun.com if you need additional information or
1287 + * have any questions.
1291 +package at.ssw.hotswap.test;
1293 +import junit.framework.Assert;
1297 + * Utility methods for unit testing.
1299 + * @author Thomas Wuerthinger
1301 +public class TestUtil {
1303 + public static void assertException(Class exceptionClass, Runnable run) {
1307 + } catch(Throwable t) {
1308 + if (t.getClass().equals(exceptionClass)) {
1311 + Assert.assertTrue("An exception of type " + t.getClass().getSimpleName() + " instead of " + exceptionClass.getSimpleName() + " has been thrown!", false);
1314 + Assert.assertTrue("No exception has been thrown!", false);
1317 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/BodyTestSuite.java
1318 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1319 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/BodyTestSuite.java Tue Feb 02 16:40:23 2010 +0100
1322 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
1323 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1325 + * This code is free software; you can redistribute it and/or modify it
1326 + * under the terms of the GNU General Public License version 2 only, as
1327 + * published by the Free Software Foundation.
1329 + * This code is distributed in the hope that it will be useful, but WITHOUT
1330 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1331 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1332 + * version 2 for more details (a copy is included in the LICENSE file that
1333 + * accompanied this code).
1335 + * You should have received a copy of the GNU General Public License version
1336 + * 2 along with this work; if not, write to the Free Software Foundation,
1337 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1339 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1340 + * CA 95054 USA or visit www.sun.com if you need additional information or
1341 + * have any questions.
1345 +package at.ssw.hotswap.test.body;
1347 +import org.junit.runner.RunWith;
1348 +import org.junit.runners.Suite;
1352 + * Class redefinition tests that swap only method bodies and change nothing else. This test cases should also
1353 + * run with the current version of HotSpot.
1355 + * @author Thomas Wuerthinger
1358 +@RunWith(Suite.class)
1359 +@Suite.SuiteClasses(
1362 + SimpleStaticTest.class,
1363 + MultipleThreadsTest.class,
1364 + OldActivationTest.class,
1365 + RefactorActiveMethodTest.class,
1369 + RedefinePrivateMethodTest.class
1371 +public class BodyTestSuite {
1373 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FacTest.java
1374 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1375 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FacTest.java Tue Feb 02 16:40:23 2010 +0100
1378 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
1379 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1381 + * This code is free software; you can redistribute it and/or modify it
1382 + * under the terms of the GNU General Public License version 2 only, as
1383 + * published by the Free Software Foundation.
1385 + * This code is distributed in the hope that it will be useful, but WITHOUT
1386 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1387 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1388 + * version 2 for more details (a copy is included in the LICENSE file that
1389 + * accompanied this code).
1391 + * You should have received a copy of the GNU General Public License version
1392 + * 2 along with this work; if not, write to the Free Software Foundation,
1393 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1395 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1396 + * CA 95054 USA or visit www.sun.com if you need additional information or
1397 + * have any questions.
1401 +package at.ssw.hotswap.test.body;
1403 +import static org.junit.Assert.*;
1405 +import org.junit.Before;
1407 +import org.junit.Test;
1409 +import at.ssw.hotswap.HotSwapTool;
1412 + * Recursive implementation of the factorial function using class redefinition.
1414 + * @author Thomas Wuerthinger
1416 +public class FacTest {
1418 + public static abstract class Base {
1420 + protected int calc() {
1421 + return calc(HotSwapTool.getCurrentVersion(FacTest.class));
1424 + public int calcAt(int version) {
1425 + HotSwapTool.toVersion(FacTest.class, version);
1426 + int result = calc();
1427 + HotSwapTool.toVersion(FacTest.class, 0);
1431 + protected int calc(int version) {
1436 + public static class Factorial extends Base {
1439 + protected int calc(int n) {
1440 + return n * calcAt(n - 1);
1444 + public static class Factorial___1 extends Base {
1447 + protected int calc() {
1453 + public void setUp() throws Exception {
1454 + HotSwapTool.toVersion(FacTest.class, 0);
1458 + public void testFac() {
1460 + assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
1461 + Factorial f = new Factorial();
1463 + assertEquals(1, f.calcAt(1));
1465 + assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
1466 + assertEquals(2, f.calcAt(2));
1468 + assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
1469 + assertEquals(6, f.calcAt(3));
1471 + assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
1472 + assertEquals(24, f.calcAt(4));
1474 + assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
1475 + assertEquals(120, f.calcAt(5));
1477 + assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
1478 + assertEquals(479001600, f.calcAt(12));
1481 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FibTest.java
1482 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1483 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FibTest.java Tue Feb 02 16:40:23 2010 +0100
1486 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
1487 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1489 + * This code is free software; you can redistribute it and/or modify it
1490 + * under the terms of the GNU General Public License version 2 only, as
1491 + * published by the Free Software Foundation.
1493 + * This code is distributed in the hope that it will be useful, but WITHOUT
1494 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1495 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1496 + * version 2 for more details (a copy is included in the LICENSE file that
1497 + * accompanied this code).
1499 + * You should have received a copy of the GNU General Public License version
1500 + * 2 along with this work; if not, write to the Free Software Foundation,
1501 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1503 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1504 + * CA 95054 USA or visit www.sun.com if you need additional information or
1505 + * have any questions.
1509 +package at.ssw.hotswap.test.body;
1511 +import static org.junit.Assert.*;
1513 +import org.junit.Before;
1515 +import org.junit.Test;
1517 +import at.ssw.hotswap.HotSwapTool;
1520 + * Recursive implementation of the fibonacci function using class redefinition.
1522 + * @author Thomas Wuerthinger
1524 +public class FibTest {
1526 + public static abstract class Base {
1528 + protected int calc() {
1529 + return calc(HotSwapTool.getCurrentVersion(FibTest.class));
1532 + public int calcAt(int version) {
1533 + HotSwapTool.toVersion(FibTest.class, version);
1534 + int result = calc();
1535 + HotSwapTool.toVersion(FibTest.class, 0);
1539 + protected int calc(int version) {
1544 + public static class Fib extends Base {
1547 + protected int calc(int n) {
1548 + return calcAt(n - 1) + calcAt(n - 2);
1552 + public static class Fib___1 extends Base {
1555 + protected int calc() {
1560 + public static class Fib___2 extends Base {
1563 + protected int calc() {
1569 + public void setUp() throws Exception {
1570 + HotSwapTool.toVersion(FibTest.class, 0);
1574 + public void testFib() {
1578 + assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
1579 + Fib f = new Fib();
1581 + assertEquals(1, f.calcAt(1));
1583 + assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
1584 + assertEquals(2, f.calcAt(2));
1586 + assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
1587 + assertEquals(3, f.calcAt(3));
1589 + assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
1590 + assertEquals(5, f.calcAt(4));
1592 + assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
1593 + assertEquals(8, f.calcAt(5));
1596 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/MultipleThreadsTest.java
1597 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1598 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/MultipleThreadsTest.java Tue Feb 02 16:40:23 2010 +0100
1601 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
1602 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1604 + * This code is free software; you can redistribute it and/or modify it
1605 + * under the terms of the GNU General Public License version 2 only, as
1606 + * published by the Free Software Foundation.
1608 + * This code is distributed in the hope that it will be useful, but WITHOUT
1609 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1610 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1611 + * version 2 for more details (a copy is included in the LICENSE file that
1612 + * accompanied this code).
1614 + * You should have received a copy of the GNU General Public License version
1615 + * 2 along with this work; if not, write to the Free Software Foundation,
1616 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1618 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1619 + * CA 95054 USA or visit www.sun.com if you need additional information or
1620 + * have any questions.
1624 +package at.ssw.hotswap.test.body;
1626 +import static org.junit.Assert.*;
1628 +import org.junit.Before;
1629 +import org.junit.Test;
1631 +import at.ssw.hotswap.HotSwapTool;
1632 +import at.ssw.hotswap.test.methods.OverrideMethodTest;
1635 + * Class for testing redefining methods of classes that extend the Thread class. In the test setup the run method
1636 + * calls the doit method in a loop until this methods returns false.
1638 + * @author Thomas Wuerthinger
1640 +public class MultipleThreadsTest {
1642 + public static final int COUNT = 10;
1645 + public static class A extends Thread {
1647 + private int value;
1648 + private int value2;
1651 + public void run() {
1656 + public boolean doit() {
1659 + } catch (InterruptedException e) {
1666 + public int getValue() {
1670 + public int getValue2() {
1676 + public static class A___1 extends Thread {
1678 + private int value;
1679 + private int value2;
1682 + public void run() {
1687 + public boolean doit() {
1690 + } catch (InterruptedException e) {
1697 + public int getValue() {
1701 + public int getValue2() {
1707 + public static class A___2 extends Thread {
1709 + private int value;
1710 + private int value2;
1713 + public void run() {
1718 + public boolean doit() {
1722 + public int getValue() {
1726 + public int getValue2() {
1732 + public void setUp() throws Exception {
1733 + HotSwapTool.toVersion(MultipleThreadsTest.class, 0);
1737 + public void testOneThread() {
1742 + public void testThreads() {
1746 + private void test(int count) {
1748 + assert HotSwapTool.getCurrentVersion(MultipleThreadsTest.class) == 0;
1750 + A[] arr = new A[count];
1751 + for (int i = 0; i < count; i++) {
1757 + Thread.sleep(500);
1758 + } catch (InterruptedException e) {
1761 + for (int i = 0; i < count; i++) {
1762 + assertTrue(arr[i].getValue() > 0);
1765 + HotSwapTool.toVersion(MultipleThreadsTest.class, 1);
1768 + Thread.sleep(500);
1769 + } catch (InterruptedException e) {
1772 + for (int i = 0; i < count; i++) {
1773 + assertTrue(arr[i].getValue2() > 0);
1776 + HotSwapTool.toVersion(MultipleThreadsTest.class, 2);
1779 + Thread.sleep(500);
1780 + } catch (InterruptedException e) {
1784 + for (int i = 0; i < count; i++) {
1785 + assertFalse(arr[i].isAlive());
1788 + HotSwapTool.toVersion(OverrideMethodTest.class, 0);
1793 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/OldActivationTest.java
1794 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1795 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/OldActivationTest.java Tue Feb 02 16:40:23 2010 +0100
1798 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
1799 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1801 + * This code is free software; you can redistribute it and/or modify it
1802 + * under the terms of the GNU General Public License version 2 only, as
1803 + * published by the Free Software Foundation.
1805 + * This code is distributed in the hope that it will be useful, but WITHOUT
1806 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1807 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1808 + * version 2 for more details (a copy is included in the LICENSE file that
1809 + * accompanied this code).
1811 + * You should have received a copy of the GNU General Public License version
1812 + * 2 along with this work; if not, write to the Free Software Foundation,
1813 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1815 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1816 + * CA 95054 USA or visit www.sun.com if you need additional information or
1817 + * have any questions.
1821 +package at.ssw.hotswap.test.body;
1823 +import static org.junit.Assert.*;
1825 +import org.junit.Before;
1826 +import org.junit.Test;
1828 +import at.ssw.hotswap.HotSwapTool;
1831 + * Stress test for the number of old activations on the stack. In the test setup 10 different versions of the method A.value will be on the stack.
1833 + * @author Thomas Wuerthinger
1835 +public class OldActivationTest {
1838 + public static class A {
1840 + public int value() {
1841 + HotSwapTool.toVersion(OldActivationTest.class, 1);
1842 + return 1 + this.value();
1847 + public static class A___1 {
1849 + public int value() {
1850 + HotSwapTool.toVersion(OldActivationTest.class, 2);
1851 + return 2 + this.value();
1856 + public static class A___2 {
1858 + public int value() {
1859 + HotSwapTool.toVersion(OldActivationTest.class, 3);
1860 + return 3 + this.value();
1865 + public static class A___3 {
1867 + public int value() {
1868 + HotSwapTool.toVersion(OldActivationTest.class, 4);
1869 + return 4 + this.value();
1874 + public static class A___4 {
1876 + public int value() {
1877 + HotSwapTool.toVersion(OldActivationTest.class, 5);
1878 + return 5 + this.value();
1883 + public static class A___5 {
1885 + public int value() {
1886 + HotSwapTool.toVersion(OldActivationTest.class, 6);
1887 + return 6 + this.value();
1892 + public static class A___6 {
1894 + public int value() {
1895 + HotSwapTool.toVersion(OldActivationTest.class, 7);
1896 + return 7 + this.value();
1901 + public static class A___7 {
1903 + public int value() {
1904 + HotSwapTool.toVersion(OldActivationTest.class, 8);
1905 + return 8 + this.value();
1910 + public static class A___8 {
1912 + public int value() {
1913 + HotSwapTool.toVersion(OldActivationTest.class, 9);
1914 + return 9 + this.value();
1919 + public static class A___9 {
1921 + public int value() {
1922 + HotSwapTool.toVersion(OldActivationTest.class, 0);
1928 + public void setUp() throws Exception {
1929 + HotSwapTool.toVersion(OldActivationTest.class, 0);
1933 + public void testOldActivationTest() {
1935 + assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
1939 + assertEquals(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10, a.value());
1940 + assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
1942 + HotSwapTool.toVersion(OldActivationTest.class, 1);
1943 + assertEquals(2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10, a.value());
1944 + assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
1946 + HotSwapTool.toVersion(OldActivationTest.class, 8);
1947 + assertEquals(9 + 10, a.value());
1948 + assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
1950 + HotSwapTool.toVersion(OldActivationTest.class, 4);
1951 + assertEquals(5 + 6 + 7 + 8 + 9 + 10, a.value());
1952 + assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
1955 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RedefinePrivateMethodTest.java
1956 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1957 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RedefinePrivateMethodTest.java Tue Feb 02 16:40:23 2010 +0100
1960 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
1961 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1963 + * This code is free software; you can redistribute it and/or modify it
1964 + * under the terms of the GNU General Public License version 2 only, as
1965 + * published by the Free Software Foundation.
1967 + * This code is distributed in the hope that it will be useful, but WITHOUT
1968 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1969 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1970 + * version 2 for more details (a copy is included in the LICENSE file that
1971 + * accompanied this code).
1973 + * You should have received a copy of the GNU General Public License version
1974 + * 2 along with this work; if not, write to the Free Software Foundation,
1975 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1977 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1978 + * CA 95054 USA or visit www.sun.com if you need additional information or
1979 + * have any questions.
1983 +package at.ssw.hotswap.test.body;
1985 +import static org.junit.Assert.*;
1987 +import org.junit.Before;
1988 +import org.junit.Test;
1990 +import at.ssw.hotswap.HotSwapTool;
1993 + * Tests redefinition of a class such that old code still accesses a redefined private method.
1995 + * @author Thomas Wuerthinger
1997 +public class RedefinePrivateMethodTest {
2000 + public static class A {
2002 + public int foo() {
2003 + int result = bar();
2004 + HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 1);
2009 + private int bar() {
2015 + public static class A___1 {
2017 + public int foo() {
2021 + private int bar() {
2027 + public void setUp() throws Exception {
2028 + HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 0);
2032 + public void testRedefinePrivateMethod() {
2034 + assert HotSwapTool.getCurrentVersion(RedefinePrivateMethodTest.class) == 0;
2038 + assertEquals(3, a.foo());
2040 + assert HotSwapTool.getCurrentVersion(RedefinePrivateMethodTest.class) == 1;
2042 + assertEquals(-1, a.foo());
2044 + HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 0);
2046 + assertEquals(3, a.foo());
2048 + assert HotSwapTool.getCurrentVersion(RedefinePrivateMethodTest.class) == 1;
2050 + assertEquals(-1, a.foo());
2052 + HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 0);
2055 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RefactorActiveMethodTest.java
2056 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2057 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RefactorActiveMethodTest.java Tue Feb 02 16:40:23 2010 +0100
2060 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
2061 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2063 + * This code is free software; you can redistribute it and/or modify it
2064 + * under the terms of the GNU General Public License version 2 only, as
2065 + * published by the Free Software Foundation.
2067 + * This code is distributed in the hope that it will be useful, but WITHOUT
2068 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2069 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2070 + * version 2 for more details (a copy is included in the LICENSE file that
2071 + * accompanied this code).
2073 + * You should have received a copy of the GNU General Public License version
2074 + * 2 along with this work; if not, write to the Free Software Foundation,
2075 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2077 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
2078 + * CA 95054 USA or visit www.sun.com if you need additional information or
2079 + * have any questions.
2083 +package at.ssw.hotswap.test.body;
2085 +import static org.junit.Assert.*;
2087 +import org.junit.Before;
2088 +import org.junit.Test;
2090 +import at.ssw.hotswap.HotSwapTool;
2093 + * @author Thomas Wuerthinger
2095 +public class RefactorActiveMethodTest {
2098 + public static class A {
2100 + public int value() {
2101 + HotSwapTool.toVersion(RefactorActiveMethodTest.class, 1);
2105 + public int secondValue() {
2111 + public static class A___1 {
2113 + public int value() {
2114 + return secondValue() * 2;
2117 + public int secondValue() {
2123 + public void setUp() throws Exception {
2124 + HotSwapTool.toVersion(RefactorActiveMethodTest.class, 0);
2128 + public void testActiveMethodReplacement() {
2130 + assert HotSwapTool.getCurrentVersion(RefactorActiveMethodTest.class) == 0;
2134 + assertEquals(5, a.value());
2136 + assert HotSwapTool.getCurrentVersion(RefactorActiveMethodTest.class) == 1;
2138 + assertEquals(2, a.secondValue());
2139 + assertEquals(4, a.value());
2140 + assertEquals(2, a.secondValue());
2142 + assert HotSwapTool.getCurrentVersion(RefactorActiveMethodTest.class) == 1;
2144 + HotSwapTool.toVersion(RefactorActiveMethodTest.class, 0);
2146 + assertEquals(1, a.secondValue());
2147 + assertEquals(5, a.value());
2148 + assertEquals(4, a.value());
2150 + HotSwapTool.toVersion(RefactorActiveMethodTest.class, 0);
2152 + assertEquals(1, a.secondValue());
2155 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/SimpleStaticTest.java
2156 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2157 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/SimpleStaticTest.java Tue Feb 02 16:40:23 2010 +0100
2160 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
2161 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2163 + * This code is free software; you can redistribute it and/or modify it
2164 + * under the terms of the GNU General Public License version 2 only, as
2165 + * published by the Free Software Foundation.
2167 + * This code is distributed in the hope that it will be useful, but WITHOUT
2168 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2169 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2170 + * version 2 for more details (a copy is included in the LICENSE file that
2171 + * accompanied this code).
2173 + * You should have received a copy of the GNU General Public License version
2174 + * 2 along with this work; if not, write to the Free Software Foundation,
2175 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2177 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
2178 + * CA 95054 USA or visit www.sun.com if you need additional information or
2179 + * have any questions.
2183 +package at.ssw.hotswap.test.body;
2185 +import static org.junit.Assert.*;
2187 +import org.junit.Before;
2188 +import org.junit.Test;
2190 +import at.ssw.hotswap.HotSwapTool;
2191 +import at.ssw.hotswap.test.TestUtil;
2194 + * @author Thomas Wuerthinger
2196 +public class SimpleStaticTest {
2199 + public void setUp() throws Exception {
2200 + HotSwapTool.toVersion(SimpleStaticTest.class, 0);
2202 + // E and Helper must be loaded and initialized
2204 + Helper h = new Helper();
2209 + public static class Helper {
2210 + public static int getIntegerField() {
2211 + return E___2.integerField;
2214 + public static void setIntegerField(int x) {
2215 + E___2.integerField = x;
2218 + public static int getFinalIntegerField() {
2219 + return E___2.finalIntegerField;
2223 + public static class Helper___1 {
2224 + public static int getIntegerField() {
2225 + return E___2.integerField;
2228 + public static void setIntegerField(int x) {
2229 + E___2.integerField = x;
2232 + public static int getFinalIntegerField() {
2233 + return E___2.finalIntegerField;
2237 + public static class E {
2240 + public static class E___1 {
2244 + public static class E___2 {
2245 + public static int integerField = 10;
2247 + // javac will generate "ConstantValue" attribute for this field!
2248 + public static final int finalIntegerField = 7;
2252 + public void testSimpleNewStaticField() {
2254 + assert HotSwapTool.getCurrentVersion(SimpleStaticTest.class) == 0;
2256 + HotSwapTool.toVersion(SimpleStaticTest.class, 1);
2258 + TestUtil.assertException(NoSuchFieldError.class, new Runnable(){
2260 + public void run() {
2261 + Helper.getIntegerField();
2265 + HotSwapTool.toVersion(SimpleStaticTest.class, 2);
2267 + assertEquals(0, Helper.getIntegerField());
2268 + assertEquals(7, Helper.getFinalIntegerField());
2269 + Helper.setIntegerField(1000);
2270 + assertEquals(1000, Helper.getIntegerField());
2272 + HotSwapTool.toVersion(SimpleStaticTest.class, 1);
2274 + TestUtil.assertException(NoSuchFieldError.class, new Runnable(){
2276 + public void run() {
2277 + Helper.getIntegerField();
2281 + HotSwapTool.toVersion(SimpleStaticTest.class, 2);
2283 + assertEquals(0, Helper.getIntegerField());
2284 + assertEquals(7, Helper.getFinalIntegerField());
2286 + HotSwapTool.toVersion(SimpleStaticTest.class, 0);
2288 + TestUtil.assertException(NoSuchFieldError.class, new Runnable(){
2290 + public void run() {
2291 + Helper.getIntegerField();
2296 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/StaticTest.java
2297 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2298 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/StaticTest.java Tue Feb 02 16:40:23 2010 +0100
2301 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
2302 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2304 + * This code is free software; you can redistribute it and/or modify it
2305 + * under the terms of the GNU General Public License version 2 only, as
2306 + * published by the Free Software Foundation.
2308 + * This code is distributed in the hope that it will be useful, but WITHOUT
2309 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2310 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2311 + * version 2 for more details (a copy is included in the LICENSE file that
2312 + * accompanied this code).
2314 + * You should have received a copy of the GNU General Public License version
2315 + * 2 along with this work; if not, write to the Free Software Foundation,
2316 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2318 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
2319 + * CA 95054 USA or visit www.sun.com if you need additional information or
2320 + * have any questions.
2324 +package at.ssw.hotswap.test.body;
2326 +import static org.junit.Assert.*;
2328 +import org.junit.Before;
2329 +import org.junit.Test;
2331 +import at.ssw.hotswap.HotSwapTool;
2332 +import java.util.ArrayList;
2333 +import java.util.List;
2336 + * @author Thomas Wuerthinger
2338 +public class StaticTest {
2341 + public void setUp() throws Exception {
2342 + HotSwapTool.toVersion(StaticTest.class, 0);
2344 + // C and D must be loaded and initialized
2352 + public static class Helper {
2353 + public static int getAdditionalField() {
2354 + return D___5.additionalField;
2357 + public static void setAdditionalField(int x) {
2358 + D___5.additionalField = x;
2362 + public static class A {
2364 + public static int value() {
2369 + public static class B {
2371 + public static int value() {
2376 + public static class C {
2378 + System.out.println("Static initializer of C");
2381 + public static int value = 5;
2384 + public static class D {
2385 + public static List objectField = new ArrayList();
2386 + public static int[] arrayField = new int[10];
2387 + public static int integerField = 5;
2388 + public static char characterField = 6;
2389 + public static short shortField = 7;
2390 + public static double doubleField = 1.0;
2391 + public static float floatField = 2.0f;
2392 + public static long longField = 8;
2393 + public static boolean booleanField = true;
2397 + public static class A___1 {
2399 + public static int value() {
2400 + return B.value() * 2;
2405 + public static class B___2 {
2407 + public static int value() {
2413 + public static class A___3 {
2415 + public static int value() {
2420 + public static class B___3 {
2422 + public static int value() {
2423 + return A.value() * 2;
2428 + public static class C___4 {
2431 + System.out.println("Static initializer of C-4");
2434 + public static int value = 6;
2438 + public static class D___5 {
2439 + public static int additionalField;
2441 + public static List objectField;
2442 + public static long longField;
2443 + public static short shortField = 10;
2444 + public static float floatField;
2445 + public static int[] arrayField;
2446 + public static int integerField;
2447 + public static char characterField;
2448 + public static double doubleField;
2449 + public static boolean booleanField;
2453 + public void testBase() {
2455 + assert HotSwapTool.getCurrentVersion(StaticTest.class) == 0;
2458 + assertEquals(1, A.value());
2459 + assertEquals(2, B.value());
2461 + HotSwapTool.toVersion(StaticTest.class, 1);
2463 + assertEquals(4, A.value());
2464 + assertEquals(2, B.value());
2466 + HotSwapTool.toVersion(StaticTest.class, 2);
2468 + assertEquals(6, A.value());
2469 + assertEquals(3, B.value());
2471 + HotSwapTool.toVersion(StaticTest.class, 3);
2473 + assertEquals(5, A.value());
2474 + assertEquals(10, B.value());
2476 + HotSwapTool.toVersion(StaticTest.class, 0);
2478 + assertEquals(1, A.value());
2479 + assertEquals(2, B.value());
2483 + public void testStaticField() {
2485 + assert HotSwapTool.getCurrentVersion(StaticTest.class) == 0;
2486 + assertEquals(5, C.value);
2488 + HotSwapTool.toVersion(StaticTest.class, 4);
2489 + assertEquals(5, C.value);
2491 + HotSwapTool.toVersion(StaticTest.class, 0);
2492 + assertEquals(5, C.value);
2497 + public void testManyStaticFields() {
2499 + assert HotSwapTool.getCurrentVersion(StaticTest.class) == 0;
2500 + assertTrue(D.objectField != null);
2501 + assertTrue(D.arrayField != null);
2502 + assertEquals(5, D.integerField);
2503 + assertEquals(6, D.characterField);
2504 + assertEquals(7, D.shortField);
2505 + assertEquals(1.0, D.doubleField, 0.0);
2506 + assertEquals(2.0f, D.floatField, 0.0);
2507 + assertEquals(8, D.longField);
2508 + assertEquals(true, D.booleanField);
2510 + HotSwapTool.toVersion(StaticTest.class, 5);
2511 + assertTrue(D.objectField != null);
2512 + assertTrue(D.arrayField != null);
2513 + assertEquals(5, D.integerField);
2514 + assertEquals(6, D.characterField);
2515 + assertEquals(7, D.shortField);
2516 + assertEquals(1.0, D.doubleField, 0.0);
2517 + assertEquals(2.0f, D.floatField, 0.0);
2518 + assertEquals(8, D.longField);
2519 + assertEquals(true, D.booleanField);
2521 + assertEquals(0, Helper.getAdditionalField());
2522 + Helper.setAdditionalField(1000);
2523 + assertEquals(1000, Helper.getAdditionalField());
2526 + HotSwapTool.toVersion(StaticTest.class, 0);
2528 + assertTrue(D.objectField != null);
2529 + assertTrue(D.arrayField != null);
2530 + assertEquals(5, D.integerField);
2531 + assertEquals(6, D.characterField);
2532 + assertEquals(7, D.shortField);
2533 + assertEquals(1.0, D.doubleField, 0.0);
2534 + assertEquals(2.0f, D.floatField, 0.0);
2535 + assertEquals(8, D.longField);
2536 + assertEquals(true, D.booleanField);
2538 + HotSwapTool.toVersion(StaticTest.class, 5);
2539 + assertTrue(D.objectField != null);
2540 + assertTrue(D.arrayField != null);
2541 + assertEquals(5, D.integerField);
2542 + assertEquals(6, D.characterField);
2543 + assertEquals(7, D.shortField);
2544 + assertEquals(1.0, D.doubleField, 0.0);
2545 + assertEquals(2.0f, D.floatField, 0.0);
2546 + assertEquals(8, D.longField);
2547 + assertEquals(true, D.booleanField);
2549 + assertEquals(0, Helper.getAdditionalField());
2551 + HotSwapTool.toVersion(StaticTest.class, 0);
2552 + assertTrue(D.objectField != null);
2553 + assertTrue(D.arrayField != null);
2554 + assertEquals(5, D.integerField);
2555 + assertEquals(6, D.characterField);
2556 + assertEquals(7, D.shortField);
2557 + assertEquals(1.0, D.doubleField, 0.0);
2558 + assertEquals(2.0f, D.floatField, 0.0);
2559 + assertEquals(8, D.longField);
2560 + assertEquals(true, D.booleanField);
2564 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/StressTest.java
2565 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2566 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/StressTest.java Tue Feb 02 16:40:23 2010 +0100
2569 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
2570 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2572 + * This code is free software; you can redistribute it and/or modify it
2573 + * under the terms of the GNU General Public License version 2 only, as
2574 + * published by the Free Software Foundation.
2576 + * This code is distributed in the hope that it will be useful, but WITHOUT
2577 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2578 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2579 + * version 2 for more details (a copy is included in the LICENSE file that
2580 + * accompanied this code).
2582 + * You should have received a copy of the GNU General Public License version
2583 + * 2 along with this work; if not, write to the Free Software Foundation,
2584 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2586 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
2587 + * CA 95054 USA or visit www.sun.com if you need additional information or
2588 + * have any questions.
2592 +package at.ssw.hotswap.test.body;
2594 +import static org.junit.Assert.*;
2596 +import org.junit.Before;
2597 +import org.junit.Test;
2599 +import at.ssw.hotswap.HotSwapTool;
2602 + * @author Thomas Wuerthinger
2604 +public class StressTest {
2606 + public final static int COUNT = 10;
2609 + public static class A {
2611 + public int value() {
2617 + public static class A___1 {
2619 + public int value() {
2625 + public void setUp() throws Exception {
2626 + HotSwapTool.toVersion(StressTest.class, 0);
2630 + public void testStressSwap() {
2632 + assert HotSwapTool.getCurrentVersion(StressTest.class) == 0;
2636 + for (int i = 0; i < COUNT; i++) {
2638 + assertEquals(1, a.value());
2640 + HotSwapTool.toVersion(StressTest.class, 1);
2642 + assertEquals(2, a.value());
2644 + HotSwapTool.toVersion(StressTest.class, 0);
2647 + assertEquals(1, a.value());
2650 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/eval/AddingInterfaceTest.java
2651 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2652 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/eval/AddingInterfaceTest.java Tue Feb 02 16:40:23 2010 +0100
2655 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
2656 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2658 + * This code is free software; you can redistribute it and/or modify it
2659 + * under the terms of the GNU General Public License version 2 only, as
2660 + * published by the Free Software Foundation.
2662 + * This code is distributed in the hope that it will be useful, but WITHOUT
2663 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2664 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2665 + * version 2 for more details (a copy is included in the LICENSE file that
2666 + * accompanied this code).
2668 + * You should have received a copy of the GNU General Public License version
2669 + * 2 along with this work; if not, write to the Free Software Foundation,
2670 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2672 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
2673 + * CA 95054 USA or visit www.sun.com if you need additional information or
2674 + * have any questions.
2678 +package at.ssw.hotswap.test.eval;
2680 +import at.ssw.hotswap.HotSwapTool;
2681 +import java.util.ArrayList;
2682 +import java.util.List;
2683 +import org.junit.Before;
2684 +import org.junit.Test;
2687 + * Adds an implemented interface to a class and tests whether an instance of this class can then really be treated as an instance of the interface.
2688 + * Additionally, performs performance measurements of a call to this interface compared to a proxy object.
2690 + * @author Thomas Wuerthinger
2692 +public class AddingInterfaceTest {
2695 + public void setUp() throws Exception {
2696 + HotSwapTool.toVersion(AddingInterfaceTest.class, 0);
2697 + assert HotSwapTool.getCurrentVersion(AddingInterfaceTest.class) == 0;
2700 + public static class A {
2702 + public int getValue() {
2707 + public static interface I {
2709 + public int getValue();
2712 + public static class A___1 implements I {
2714 + public int getValue() {
2719 + public static class Proxy implements I {
2723 + public Proxy(A a) {
2727 + public int getValue() {
2728 + return a.getValue();
2733 + public void testAddInterface() {
2736 + Proxy p = new Proxy(a);
2738 + final int N = 100000;
2743 + HotSwapTool.toVersion(AddingInterfaceTest.class, 1);
2746 + long startTime = System.currentTimeMillis();
2747 + for (int j = 0; j < Z; j++) {
2748 + calculateSum(N, i);
2750 + long time = System.currentTimeMillis() - startTime;
2751 + System.out.println(time);
2753 + HotSwapTool.toVersion(AddingInterfaceTest.class, 0);
2755 + startTime = System.currentTimeMillis();
2756 + for (int j = 0; j < Z; j++) {
2757 + calculateSum(N, p);
2759 + time = System.currentTimeMillis() - startTime;
2760 + System.out.println(time);
2763 + public int calculateSum(int n, I i) {
2765 + for (int j = 0; j < n; j++) {
2766 + sum += i.getValue();
2771 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/eval/EvalTestSuite.java
2772 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2773 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/eval/EvalTestSuite.java Tue Feb 02 16:40:23 2010 +0100
2776 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
2777 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2779 + * This code is free software; you can redistribute it and/or modify it
2780 + * under the terms of the GNU General Public License version 2 only, as
2781 + * published by the Free Software Foundation.
2783 + * This code is distributed in the hope that it will be useful, but WITHOUT
2784 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2785 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2786 + * version 2 for more details (a copy is included in the LICENSE file that
2787 + * accompanied this code).
2789 + * You should have received a copy of the GNU General Public License version
2790 + * 2 along with this work; if not, write to the Free Software Foundation,
2791 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2793 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
2794 + * CA 95054 USA or visit www.sun.com if you need additional information or
2795 + * have any questions.
2799 +package at.ssw.hotswap.test.eval;
2801 +import org.junit.runner.RunWith;
2802 +import org.junit.runners.Suite;
2806 + * Tests used for evaluation purposes (especially performance measurements).
2808 + * @author Thomas Wuerthinger
2811 +@RunWith(Suite.class)
2812 +@Suite.SuiteClasses({
2813 + FractionTest.class,
2814 + AddingInterfaceTest.class
2816 +public class EvalTestSuite {
2818 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/eval/FractionTest.java
2819 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2820 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/eval/FractionTest.java Tue Feb 02 16:40:23 2010 +0100
2823 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
2824 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2826 + * This code is free software; you can redistribute it and/or modify it
2827 + * under the terms of the GNU General Public License version 2 only, as
2828 + * published by the Free Software Foundation.
2830 + * This code is distributed in the hope that it will be useful, but WITHOUT
2831 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2832 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2833 + * version 2 for more details (a copy is included in the LICENSE file that
2834 + * accompanied this code).
2836 + * You should have received a copy of the GNU General Public License version
2837 + * 2 along with this work; if not, write to the Free Software Foundation,
2838 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2840 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
2841 + * CA 95054 USA or visit www.sun.com if you need additional information or
2842 + * have any questions.
2846 +package at.ssw.hotswap.test.eval;
2848 +import java.lang.Runnable;
2849 +import java.util.ArrayList;
2850 +import java.util.List;
2851 +import org.junit.Before;
2852 +import org.junit.Test;
2854 +import at.ssw.hotswap.HotSwapTool;
2857 + * @author Thomas Wuerthinger
2859 +public class FractionTest {
2862 + public void setUp() throws Exception {
2863 + HotSwapTool.toVersion(FractionTest.class, 0);
2864 + assert HotSwapTool.getCurrentVersion(FractionTest.class) == 0;
2868 + public static class NoChange {
2878 + public static class Change {
2889 + public static class Change___1 {
2901 + public static class Change___2 {
2910 + public static class Change___3 {
2921 + public static class Change___4 {
2930 + private static List<Long> measurements = new ArrayList<Long>();
2931 + private final int BASE = 10;
2932 + private Object[] objects;
2934 + private void clear() {
2938 + HotSwapTool.toVersion(FractionTest.class, 0);
2944 + private void init(int count, int percent) {
2945 + objects = new Object[count];
2947 + int unchanged = 0;
2948 + for (int k = 0; k < count; k++) {
2949 + if ((count / BASE) * percent <= k/* && k >= 200000*/) {
2950 + objects[k] = new NoChange();
2953 + objects[k] = new Change();
2960 + System.out.println(changed + " changed objects allocated");
2964 + public void testBase() {
2966 + assert HotSwapTool.getCurrentVersion(FractionTest.class) == 0;
2969 + final int INC = 4;
2971 + int[] benchmarking = new int[]{40000};
2975 + MicroBenchmark[] benchmarks = new MicroBenchmark[]{new GCMicroBenchmark(), new IncreaseMicroBenchmark(), new DecreaseMicroBenchmark(), new ReorderMicroBenchmark(), new NoRealChangeMicroBenchmark()};
2978 + for (int k = 0; k < N; k++) {
2979 + for (MicroBenchmark m : benchmarks) {
2980 + for (int i : benchmarking) {
2981 + System.out.println(m.getClass().getName() + " with " + i + " objects");
2982 + for (int j = start; j <= base; j += INC) {
2983 + System.out.println(j);
2986 + m.doit(i, measurements);
2993 + System.out.println("Results:");
2994 + for (long l : measurements) {
2995 + System.out.println(l);
2997 + measurements.clear();
3001 +abstract class MicroBenchmark {
3003 + public void init(int count) {
3006 + public abstract void doit(int count, List<Long> measurements);
3009 +class GCMicroBenchmark extends MicroBenchmark {
3011 + public void doit(int count, List<Long> measurements) {
3012 + long startTime = System.currentTimeMillis();
3014 + long curTime = System.currentTimeMillis() - startTime;
3015 + measurements.add(curTime);
3019 +class IncreaseMicroBenchmark extends MicroBenchmark {
3021 + public void doit(int count, List<Long> measurements) {
3022 + HotSwapTool.resetTimings();
3023 + HotSwapTool.toVersion(FractionTest.class, 1);
3024 + measurements.add(HotSwapTool.getTotalTime());
3028 +class DecreaseMicroBenchmark extends MicroBenchmark {
3030 + public void doit(int count, List<Long> measurements) {
3031 + HotSwapTool.resetTimings();
3032 + HotSwapTool.toVersion(FractionTest.class, 2);
3033 + measurements.add(HotSwapTool.getTotalTime());
3037 +class ReorderMicroBenchmark extends MicroBenchmark {
3039 + public void doit(int count, List<Long> measurements) {
3040 + HotSwapTool.resetTimings();
3041 + HotSwapTool.toVersion(FractionTest.class, 3);
3042 + measurements.add(HotSwapTool.getTotalTime());
3046 +class NoRealChangeMicroBenchmark extends MicroBenchmark {
3048 + public void doit(int count, List<Long> measurements) {
3049 + HotSwapTool.resetTimings();
3050 + HotSwapTool.toVersion(FractionTest.class, 4);
3051 + measurements.add(HotSwapTool.getTotalTime());
3054 diff -r 1999f5b12482 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/AccessDeletedFieldTest.java
3055 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3056 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/fields/AccessDeletedFieldTest.java Tue Feb 02 16:40:23 2010 +0100