ZATS Richlet

From Documentation
< User:Paowang
Revision as of 02:59, 20 January 2022 by Hawk (talk | contribs) (correct highlight (via JWB))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

WarningTriangle-32x32.png This page is under construction, so we cannot guarantee the accuracy of the content!


ZATS Mimic also supports to test Richlet[1]. It just needs a few custom configuration for DefaultZatsEnvironment and the test code is no different with testing a ZUML file. The ZATS Mimic built-in web configuration doesn't support Richlet. We can specify the folder contained custom web configuration (web.xml and zk.xml) for the testing environment through the constructor of DefaultZatsEnvironment when testing Richlet.

Following is a simple Richlet example, we assume that the web.xml and zk.xml are placed in the src/main/webapp/WEB-INF folder:





public class MyRichlet extends GenericRichlet {
	public void service(Page page) throws Exception {
		final Label message = new Label("foo");
		Button button = new Button("go");
		button.addEventListener(Events.ON_CLICK, new EventListener() {
			public void onEvent(Event event) throws Exception {
  • Line 12, 14, 16: After clicking the button, the text of label will be changed.

Following is a typical example of testing Richlet:

public void test() {
	DefaultZatsEnvironment env = new DefaultZatsEnvironment("./src/main/webapp/WEB-INF");
	try {
		DesktopAgent desktop = env.newClient().connect("/zk/foo");
		Label msg = desktop.query("#msg").as(Label.class);
		Assert.assertEquals("foo", msg.getValue());
		Assert.assertEquals("bar", msg.getValue());
	finally {
  • Line 12: Specify the folder contains web configuration for testing the Richlet.
  • Line 22: Release the DefaultZatsEnvironment manually when the test finish.


  1. for more detail, please refer to ZK_Developer's_Reference/UI_Composing/Richlet

Last Update : 2022/01/20

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.