User Tools

Site Tools


at:tutorial:appendix

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
at:tutorial:appendix [2008/07/10 17:33] – added tvcutsemat:tutorial:appendix [2009/01/29 21:25] – * elisag
Line 82: Line 82:
  
 It is also possible to use ''makeFuture()'' to create a fresh future explicitly within the unit test method, and to use the returned resolver to resolve the future at the appropriate time. It is also possible to use ''makeFuture()'' to create a fresh future explicitly within the unit test method, and to use the returned resolver to resolve the future at the appropriate time.
 +
 +<note tip>
 +See the [[distribution#take_offline_remote_objects|distributed programming]] chapter for details about how to simulate network disconnections in distributed unit tests.
 +</note>
  
 ==== Test Suites ==== ==== Test Suites ====
Line 646: Line 650:
  
 ==== Miscellaneous ==== ==== Miscellaneous ====
 +
 +The module ''/.at.support.util'' is a utility module grouping several miscellaneous tasks.
 +
 +=== Random Numbers ===
 +
 +The utility module defines functions for easily generating random numbers. Its implementation uses the random number generators from the underlying JVM. The following functions are the most useful:
 +
 +<code>
 +// generate a random integer in the interval [min, max[
 +def randomNumberBetween(min, max)
 +// generate a random fraction in the interval [min, max[
 +def randomFractionBetween(min, max)
 +</code>
 +
 +=== Custom Object Serialization ===
 +
 +The method ''uponArrivalBecome:'' exported by the utility module creates a transporter object which can be used in ''pass'' meta-level methods to execute code upon deserialization. The closure passed to this function should return the object with which the transported object should be replaced. For example:
 +
 +<code>
 +//inside a mirror
 +def instancevar := ...;
 +def pass() {
 +  uponArrivalBecome: { |instancevar|
 +    // return object to become here
 +  }
 +}
 +</code>
 +
 +The function plays a role similar to ''readResolve'' in the Java object serialization framework.
at/tutorial/appendix.txt · Last modified: 2021/09/24 10:28 by elisag