javaWeb服务详解【客户端调用】(含源代码,测试通过,注释) ——测试

来源:互联网 发布:淘宝裂变有危险吗 编辑:程序博客网 时间:2024/06/08 06:34

Dept测试

@Testpublic void test() {ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");IDeptService deptService = (IDeptService) ctx.getBean("wsClient");List<Dept> depts = deptService.getDepts();for (Dept dept : depts) {System.out.println("部门名称:"+dept.getDname()+",部门地址:"+dept.getLoc());System.out.println("员工表:"+dept.getEmps());}}

Emp测试

IEmpService empService;@Beforepublic void init(){ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml"); empService=(IEmpService)ctx.getBean("wsClientEmp");}@Testpublic void testGetEmps() {List<Emp> getEmps= empService.getEmps();for (Emp emp : getEmps) {System.out.println(emp.getEname());System.out.print("\t"+emp.getJob());System.out.print("\t"+emp.getComm());System.out.print("\t"+emp.getDept().getDname());}}@Testpublic void testGetEmpById() {Emp emp = empService.getEmpById(7369);System.out.println(emp.getEname()+"*********"+emp.getEmpno()+"*********"+emp.getDept().getDname());}


阅读全文
0 0
原创粉丝点击