add config file to test

This commit is contained in:
fanfuxiaoran 2014-03-20 15:20:17 +08:00
parent e0e3c9c184
commit fec13cab15
2 changed files with 29 additions and 56 deletions

View File

@ -3,7 +3,6 @@ package org.bench4q.web.service;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

View File

@ -13,7 +13,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.ContextConfiguration;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "file:src/main/resources/bench4qweb-servlet.xml" })
@ContextConfiguration(locations = { "file:src/test/resources/bench4qweb-servlet.xml" })
public class AuthorizeActionControllerTest {
@Autowired
@ -29,64 +29,38 @@ public class AuthorizeActionControllerTest {
@Test
public void loginTest() throws CustomGenericException {
// // right
// this.user.setUserName("www");
// this.user.setPassword("www");
//
// Assert.assertTrue(this.authorizeActionController.login(user,
// modelMap)
// .isSuccess());
// // null
// this.user.setUserName(null);
// this.user.setPassword(null);
// Assert.assertFalse(this.authorizeActionController.login(user,
// modelMap)
// .isSuccess());
//
// this.user.setUserName("");
// this.user.setPassword("");
// Assert.assertFalse(this.authorizeActionController.login(user,
// modelMap)
// .isSuccess());
// this.user.setUserName("www");
// this.user.setPassword("123");
// Assert.assertFalse(this.authorizeActionController.login(user,
// modelMap)
// .isSuccess());
// Assert.assertFalse(this.authorizeActionController.login(null,
// modelMap)
// .isSuccess());
// right
this.user.setUserName("www");
this.user.setPassword("www");
Assert.assertTrue(this.authorizeActionController.login(user,
modelMap)
.isSuccess());
this.user.setUserName("www");
this.user.setPassword("123");
Assert.assertFalse(this.authorizeActionController.login(user,
modelMap)
.isSuccess());
}
@Test
public void adminLoginTest() {
// try {
// // right
// this.user.setUserName("www");
// this.user.setPassword("www");
//
// Assert.assertTrue(this.authorizeActionController.adminLogin(user,
// modelMap).isSuccess());
// // null
// this.user.setUserName(null);
// this.user.setPassword(null);
// Assert.assertFalse(this.authorizeActionController.adminLogin(user,
// modelMap).isSuccess());
//
// this.user.setUserName("");
// this.user.setPassword("");
// Assert.assertFalse(this.authorizeActionController.adminLogin(user,
// modelMap).isSuccess());
// this.user.setUserName("www");
// this.user.setPassword("123");
// Assert.assertFalse(this.authorizeActionController.adminLogin(user,
// modelMap).isSuccess());
// Assert.assertFalse(this.authorizeActionController.adminLogin(null,
// modelMap).isSuccess());
// } catch (CustomGenericException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
try {
// right
this.user.setUserName("www");
this.user.setPassword("www");
this.user.setUserName("www");
this.user.setPassword("123");
Assert.assertFalse(this.authorizeActionController.adminLogin(user,
modelMap).isSuccess());
Assert.assertFalse(this.authorizeActionController.adminLogin(null,
modelMap).isSuccess());
} catch (CustomGenericException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}