package com.zhiwei;

import javax.annotation.Resource;

import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Component;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.zhiwei.manage.bean.Channel;
import com.zhiwei.manage.bean.FieldBean;
import com.zhiwei.manage.dao.FieldBeanDao;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({ "classpath:applicationContext.xml" })
@Component
public class FieldTest {

	@Resource(name="mongoTemplate")
	private MongoTemplate mongo;
	@Autowired
	private FieldBeanDao fd;
	
	
	public void insert(){
		FieldBean f=new FieldBean();
		f.setCollection("data");
		f.setDbName("dataTest");
		f.setField("id,type");
		f.setFieldSize(2);
		f.setPt("网媒");
		f.setDbId("5a265ede60a2feb6dc575436");
		fd.insert(f);
	}
	@org.junit.Test
	public void inserssssst(){
		Channel c=new Channel();
		c.setPt("微信");
		c.setValue("wechat");
		mongo.insert(c);
	}
}
