package service;
import java.util.Date;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.eaju.bos.dao.mapper.DownloadCenterMapper;
import com.eaju.bos.entity.DownloadCenter;
import com.eaju.bos.entity.DownloadCenterExample;
import com.eaju.bos.entity.DownloadCenterExample.Criteria;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/spring/spring-config.xml")
public class DownloadCenterServiceTest {
@Autowired
private DownloadCenterMapper downloadCenterMapper;
//增 success
@Test
public void testInsert(){
DownloadCenterExample record = new DownloadCenterExample();
Criteria createCriteria = record.createCriteria();
createCriteria.andCreateTimeEqualTo(new Date());
DownloadCenter downloadCenter = new DownloadCenter();
downloadCenter.setCreateTime(new Date());
downloadCenter.setCreator("shun");
downloadCenter.setOperateStatus("2");
downloadCenter.setOperateResult("success");
downloadCenter.setRemark("test");
downloadCenter.setDownloadUrl("http://127.0.0.1:8083/bos/downloadCenter/test0627.txt");
int insertSelective = downloadCenterMapper.insertSelective(downloadCenter);
System.out.println(insertSelective);
}
//删 success
@Test
public void testDelete(){
DownloadCenterExample example = new DownloadCenterExample();
Criteria criteria = example.createCriteria();
criteria.andIdEqualTo(4);
int deleteByExample = downloadCenterMapper.deleteByExample(example);
System.out.println(deleteByExample);
}
//改 success
@Test
public void testUpdate(){
DownloadCenterExample example = new DownloadCenterExample();
DownloadCenter record = new DownloadCenter();
Criteria criteria = example.createCriteria();
criteria.andOperateStatusEqualTo("1");
record.setRemark("test update case");
record.setCreateTime(new Date());
int updateByExample = downloadCenterMapper.updateByExampleSelective(record, example);
System.out.println(updateByExample);
}
//查 success
@Test
public void testSelect(){
DownloadCenterExample example = new DownloadCenterExample();
Criteria criteria = example.createCriteria();
criteria.andOperateStatusEqualTo("1");
List<DownloadCenter> selectByExample = downloadCenterMapper.selectByExample(example);
System.out.println(selectByExample);
}
}