Custom Operation

From Documentation

Since 1.1.0

Currently, ZATS Mimic supports many operations of ZK components, however, there are still cases where operations are not yet covered. For example, you create a custom component [1] which receives custom AU requests, or a new ZK component in which Mimic doesn't support yet. In such cases, existing operation agents are not able to help you to test it. Therefore, in ZATS Mimic1.1.0 we introduce a new agent called AuAgent and it can help you perform custom operations with a condition that the custom component must implement a particular interface: Component. You can then simulate your component's custom operations by constructing your custom event data with AuData and send it with

Application with custom component

<mycomponent id="my" />

This test case simulates custom operation supported by your custom component and verifies the result.

Test Case

	public void test() throws Exception{
		DesktopAgent desktop = Zats.newClient().connect("/essentials/custom.zul");
		ComponentAgent mycomponent = desktop.query("mycomponent");
		AuData myEventData = new AuData("onMyEventName");
		myEventData.setData("mykey", "myvalue").setData("data", 10);;
		//verify result
  • Line 14,15: Construct the data carried by an AU request first, which would depend on how you design the component.
  • Line 16: Like using other operation agents, get AuAgent from the component and invoke post() to perform an operation.

  1. About creating your components, please refer to ZK Component Development Essentials

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