package com.blueland.ebpm.engine.config.service;

import static junit.framework.Assert.assertNotNull;
/**
 * @author lw
 * @version 1.0
 * @since  
 */


import com.blueland.bpm.engine.config.service.GloblBizProcessHandlerManager;
import com.blueland.ebpm.engine.BaseManagerTestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;

import com.blueland.bpm.engine.config.model.GloblBizProcessHandler;
import org.springframework.test.context.junit4.SpringRunner;

@SpringBootTest
@RunWith(SpringRunner.class)
public class GloblBizProcessHandlerManagerTest extends BaseManagerTestCase {

	private GloblBizProcessHandlerManager manager;
	
	@Autowired
	public void setGloblBizProcessHandlerManager(GloblBizProcessHandlerManager manager) {
		this.manager = manager;
	}

	//数据库单元测试前会开始事务，结束时会回滚事务，所以测试方法可以不用关心测试数据的删除
	@Test
	public void crud() {

		GloblBizProcessHandler obj = newGloblBizProcessHandler();
		manager.save(obj);
		//manager.getEntityDao().flush();
		
		manager.update(obj);
		//manager.getEntityDao().flush();
		
		assertNotNull(obj.getGbphId());
		
		manager.removeById(obj.getGbphId());
		//manager.getEntityDao().flush();
	
	}
	
	public static GloblBizProcessHandler newGloblBizProcessHandler() {
		GloblBizProcessHandler obj = new GloblBizProcessHandler();
		obj.setGbphId(java.util.UUID.randomUUID().toString());
	  	obj.setGbphName(new String("1"));
	  	obj.setGbphType(new String("1"));
	  	obj.setGbphSort(new Integer("1"));
	  	obj.setGbphStatus(new String("1"));
	  	obj.setGbphClassName(new String("1"));
	  	obj.setGbphRemark(new String("1"));
		return obj;
	}
}
