Custom Operation"

From Documentation
(Created page with "{{ZATSEssentialsPageHeader}} Since 1.1.0 Currently, ZATS Mimic supports many operations of ZK components, however, there are still cases where operations are not yet covered. F...")
 
Line 2: Line 2:
 
  Since 1.1.0
 
  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 which receives custom [[ZK_Client-side_Reference/Communication/AU_Requests/Client-side_Firing| 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 <tt>AuAgent</tt> and it can help you perform custom operations with a condition that the custom component must implement a particular interface: <javadoc>org.zkoss.zk.ui.Component</javadoc>. You can then simulate your component's custom operations by constructing your custom event data with <tt>AuData</tt> and send it with <tt>AuAgent.post()</tt>.
+
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 <ref>About creating your components, please refer to [[ZK Component Development Essentials]] </ref> which receives custom [[ZK_Client-side_Reference/Communication/AU_Requests/Client-side_Firing| 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 <tt>AuAgent</tt> and it can help you perform custom operations with a condition that the custom component must implement a particular interface: <javadoc>org.zkoss.zk.ui.Component</javadoc>. You can then simulate your component's custom operations by constructing your custom event data with <tt>AuData</tt> and send it with <tt>AuAgent.post()</tt>.
  
  
Line 29: Line 29:
  
  
 +
<references/>
  
  

Revision as of 06:18, 29 April 2013



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 AuAgent.post().


Application with custom component

<mycomponent id="my" />


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

Test Case

	@Test
	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);
		mycomponent.as(AuAgent.class).post(myEventData);
		//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






Last Update : 2013/04/29

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