Web??ò????bookstore?????????
???????????? ???????[ 2016/6/14 11:27:32 ] ??????????????? WEB????
package org.easybooks.bookstore.action;
import org.easybooks.bookstore.service.IUserService;
import org.easybooks.bookstore.vo.User;
import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/*
* ??????????
* ??????????????????????????
* Actor???????
* */
public class UserActionTest {
@Test
public void testRegisterSuccess() throws Exception {
BeanFactory factory = new ClassPathXmlApplicationContext("applicationContext.xml");
User user=new User();
user.setUsername("WYH");
user.setPassword("");
user.setSex("?");
user.setAge(23);
UserAction userAction=new UserAction();
userAction.setUser(user);
userAction.setUserService((IUserService)factory.getBean( "userService" ));
String result=userAction.register();
System.out.println("???:"+user.getUsername()+"???"+result);
}
}
????2????д????????????????????????DAO????в???????????????????????????????????
??????TestUserDAO()?м??????????????
@Test
public void testUserReg(){
User user= new User();
user.setUsername("?????");
user.setSex("?");
user.setPassword("123456");
user.setAge(22);
try {
if(userDAO.exitUser(user.getUsername())){
System.out.println("???????"+user.getUsername()+"????????????????????????");
}else{
userDAO.saveUser(user);
System.out.println("????????"+user.getUsername()+"???");
}
} catch (Exception e) {
System.out.println("??????");
}
}
?????????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11