⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 helperactiontest.java

📁 OBPM是一个开源
💻 JAVA
字号:
package cn.myapps.core.helper.action;

import java.util.HashMap;
import java.util.Map;

import junit.framework.TestCase;
import cn.myapps.core.helper.ejb.HelperVO;
/**
 * 
 * @author yecp
 *
 */
public class HelperActionTest extends TestCase {

	private HelperAction action;

	

	protected void setUp() throws Exception {
		super.setUp();
		action = new HelperAction();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testDoSave() {
		try {
			//add a Helper
			HelperVO vo = new HelperVO();
			vo.setUrl("hero");
			vo.setTitle("test yecp");
			vo.setContext("test test");
			action.setContent(vo);
			action.doSave();

		
			//find it byName
			HelperVO vo2p = action.getHelperByname("hero", null);
			assertEquals("hero",vo2p.getUrl());
			assertEquals("test yecp",vo2p.getTitle());
			assertEquals("test test",vo2p.getContext());		
			String[] id={vo2p.getId()};//get its ID
			
			//and edit it
			vo2p.setUrl("hero edit");
			vo2p.setTitle("yecp edit");
			vo2p.setContext("test edit");
			action.setContent(vo2p);
			action.doSave();
			Map params=new HashMap();
			params.put("id",id);
			action.getContext().setParameters(params);
			action.doView();//find it by ID
			HelperVO vo2e=(HelperVO)action.getContent();
			assertEquals("hero edit",vo2e.getUrl());
			assertEquals("yecp edit",vo2e.getTitle());
			assertEquals("test edit",vo2e.getContext());
			
			//then delete it
			action.set_selects(id);
			action.doDelete();
			action.doView();
			assertNull(action.getContent());
			System.out.print("$$$$$$$$$$---SUCCESS---$$$$$$$$");
			
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
	

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -