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.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;

View File

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