master
parent
c4b6841ee3
commit
0a94406f82
@ -1,5 +0,0 @@ |
|||||||
package web.html; |
|
||||||
|
|
||||||
public interface OtherResult { |
|
||||||
|
|
||||||
} |
|
@ -1,7 +0,0 @@ |
|||||||
package web.html.data; |
|
||||||
|
|
||||||
import web.html.OtherResult; |
|
||||||
|
|
||||||
public class OtherDataResult implements OtherResult { |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,63 @@ |
|||||||
|
import db.model.TaskModel; |
||||||
|
import db.model.bilibili.ScheduledTaskEntity; |
||||||
|
import db.util.ExportUtil; |
||||||
|
import org.apache.logging.log4j.LogManager; |
||||||
|
import org.apache.logging.log4j.Logger; |
||||||
|
import org.hibernate.criterion.DetachedCriteria; |
||||||
|
import org.junit.Test; |
||||||
|
import org.junit.runner.RunWith; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.beans.factory.annotation.Qualifier; |
||||||
|
import org.springframework.orm.hibernate5.HibernateTemplate; |
||||||
|
import org.springframework.test.context.ContextConfiguration; |
||||||
|
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; |
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
||||||
|
import web.config.AppConfig; |
||||||
|
import web.config.SpringConfig; |
||||||
|
import web.model.DataModelForm; |
||||||
|
import web.service.BiliService; |
||||||
|
import web.service.DataService; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.util.ArrayList; |
||||||
|
|
||||||
|
//让测试运行于SpringMVC
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class) |
||||||
|
@SpringJUnitWebConfig |
||||||
|
@ContextConfiguration(classes = {AppConfig.class, SpringConfig.class}) |
||||||
|
public class HibernateTest { |
||||||
|
|
||||||
|
private Logger log=LogManager.getLogger(); |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private DataService dataService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private BiliService biliService; |
||||||
|
|
||||||
|
@Test |
||||||
|
public void count() { |
||||||
|
DataModelForm form=new DataModelForm(); |
||||||
|
form.setTypeIds(new ArrayList<Integer>(){{add(32);add(33);}}); |
||||||
|
long c=dataService.rowCount(form); |
||||||
|
log.info(c); |
||||||
|
} |
||||||
|
|
||||||
|
@Test |
||||||
|
public void exportSql() throws IOException { |
||||||
|
ExportUtil sql=new ExportUtil(biliService.getHibernateTemplate(),"E:\\Projects\\JAVA\\WebCrawler\\init\\typeid"); |
||||||
|
sql.exportType(); |
||||||
|
} |
||||||
|
|
||||||
|
@Test |
||||||
|
public void get(){ |
||||||
|
TaskModel taskModel=new TaskModel(); |
||||||
|
taskModel.setId(3); |
||||||
|
log.info(biliService.get(taskModel)); |
||||||
|
} |
||||||
|
|
||||||
|
@Test |
||||||
|
public void findAll(){ |
||||||
|
biliService.find(DetachedCriteria.forClass(ScheduledTaskEntity.class)).forEach(a->log.info(a)); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,4 @@ |
|||||||
|
public class MainTest { |
||||||
|
public static void main(String[] args) { |
||||||
|
} |
||||||
|
} |
@ -1,3 +1,5 @@ |
|||||||
|
package thrift; |
||||||
|
|
||||||
import core.thrift.comment.QueryComment; |
import core.thrift.comment.QueryComment; |
||||||
import org.apache.thrift.TProcessorFactory; |
import org.apache.thrift.TProcessorFactory; |
||||||
import org.apache.thrift.protocol.TBinaryProtocol; |
import org.apache.thrift.protocol.TBinaryProtocol; |
Loading…
Reference in new issue