Skip to content

Commit

Permalink
springside#224 导出SpringSide修改过的Eclipse配置项呈文件状
Browse files Browse the repository at this point in the history
  • Loading branch information
calvin1978 committed Jun 21, 2013
1 parent 8628fe9 commit 13ebb8b
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
import org.springside.examples.quickstart.QuickStartServer;
import org.springside.modules.test.data.DataFixtures;
import org.springside.modules.test.jetty.JettyFactory;
import org.springside.modules.test.selenium.Selenium2;
import org.springside.modules.utils.PropertiesLoader;

/**
* 功能测试基类.
*
* 在整个测试期间启动一次Jetty Server和 Selenium,在JVM退出时关闭两者。
* 在整个测试期间启动一次Jetty Server和 Selenium,在JVM退出时关闭两者。
* 在每个TestCase Class执行前重新载入默认数据.
*
*
* @author calvin
*/
public class BaseFunctionalTestCase {
Expand All @@ -30,8 +29,6 @@ public class BaseFunctionalTestCase {

protected static SimpleDriverDataSource dataSource;

protected static Selenium2 s;

protected static PropertiesLoader propertiesLoader = new PropertiesLoader("classpath:/application.properties",
"classpath:/application.functional.properties", "classpath:/application.functional-local.properties");

Expand All @@ -41,8 +38,8 @@ public class BaseFunctionalTestCase {
public static void beforeClass() throws Exception {
baseUrl = propertiesLoader.getProperty("baseUrl");

//如果是目标地址是localhost,则启动嵌入式jetty。如果指向远程地址,则不需要启动Jetty.
Boolean isEmbedded = new URL(baseUrl).getHost().equals("localhost")
// 如果是目标地址是localhost,则启动嵌入式jetty。如果指向远程地址,则不需要启动Jetty.
boolean isEmbedded = new URL(baseUrl).getHost().equals("localhost")
&& propertiesLoader.getBoolean("embeddedForLocal");

if (isEmbedded) {
Expand All @@ -58,7 +55,7 @@ public static void beforeClass() throws Exception {
*/
protected static void startJettyOnce() throws Exception {
if (jettyServer == null) {
//设定Spring的profile
// 设定Spring的profile
System.setProperty("spring.profiles.active", "functional");

jettyServer = JettyFactory.createServerInSource(new URL(baseUrl).getPort(), QuickStartServer.CONTEXT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class TaskRestFT extends BaseFunctionalTestCase {
private final JsonMapper jsonMapper = new JsonMapper();

private static class TaskList extends ArrayList<Task> {
};
}

private static String resoureUrl;

Expand Down Expand Up @@ -68,15 +68,15 @@ public void getTask() {
@Category(Smoke.class)
public void createUpdateAndDeleteTask() {

//create
// create
Task task = TaskData.randomTask();

URI taskUri = restTemplate.postForLocation(resoureUrl, task);
System.out.println(taskUri.toString());
Task createdTask = restTemplate.getForObject(taskUri, Task.class);
assertEquals(task.getTitle(), createdTask.getTitle());

//update
// update
String id = StringUtils.substringAfterLast(taskUri.toString(), "/");
task.setId(new Long(id));
task.setTitle(TaskData.randomTitle());
Expand All @@ -86,7 +86,7 @@ public void createUpdateAndDeleteTask() {
Task updatedTask = restTemplate.getForObject(taskUri, Task.class);
assertEquals(task.getTitle(), updatedTask.getTitle());

//delete
// delete
restTemplate.delete(taskUri);

try {
Expand All @@ -100,7 +100,7 @@ public void createUpdateAndDeleteTask() {
@Test
public void invalidInput() {

//create
// create
Task titleBlankTask = new Task();
try {
restTemplate.postForLocation(resoureUrl, titleBlankTask);
Expand All @@ -112,7 +112,7 @@ public void invalidInput() {
assertEquals("may not be empty", messages.get("title"));
}

//update
// update
titleBlankTask.setId(1L);
try {
restTemplate.put(resoureUrl + "/1", titleBlankTask);
Expand Down
138 changes: 137 additions & 1 deletion support/eclipse/springside.epf

Large diffs are not rendered by default.

0 comments on commit 13ebb8b

Please sign in to comment.