meetup.com/13 example application

Post on 26-Mar-2015

226 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

.meetup.com/13

Symbolic link

port=9090shutdown_port=9190

datasource.url=jdbc:mysql://localhost/nocontainer_devdatasource.username=johannesdatasource.password=johannes

public void testDeleteCategory() throws Exception { // Insert test data Category category = new Category(uniqueName()); Serializable key = getRepo().insert(category); getRepo().writeChanges();

// Ensure that data is displayed in index beginAt("categories/list.html"); assertTextPresent("Showing all categories"); assertLinkPresentWithText(category.getName());

// Delete it beginAt("categories/edit.html?id=" + key); submit("delete");

// Ensure that after delete, we go to index assertTextPresent("Showing all categories");

// Ensure that the category is no longer there assertLinkNotPresentWithText(category.getName());}

public void testDeleteCategory() throws Exception { // Insert test data Category category = new Category(uniqueName()); Serializable key = getRepo().insert(category); getRepo().writeChanges();

// Ensure that data is displayed in index beginAt("categories/list.html"); assertTextPresent("Showing all categories"); assertLinkPresentWithText(category.getName());

// Delete it

// Ensure that the category is no longer there assertLinkNotPresentWithText(category.getName());}

public void testDeleteCategory() throws Exception { // Insert test data

// Ensure that data is displayed in index

// Delete it beginAt("categories/edit.html?id=" + key); submit("delete");

// Ensure that after delete, we go to index assertTextPresent("Showing all categories");

// Ensure that the category is no longer there}

public void testDeleteCategory() throws Exception { // Insert test data

// Ensure that data is displayed in index

// Delete it beginAt("categories/edit.html?id=" + key); submit("delete");

// Ensure that after delete, we go to index assertTextPresent("Showing all categories");

// Ensure that the category is no longer there}

<html>

<body> <h2 id="name">${category.name}</h2>

#showErrors("category")

<form method="POST"> <p><strong>Parent:</strong> #selectForObject("category.parent" $allCategories)</p> <p>Description: #springFormInput("category.description" "") #springShowErrors("<br>" "")</p> <p>Type: #selectForEnum("category.type" $categoryTypes)</p>

<input type="submit" value="Submit" /> </form>

<p><a href="list.html">List all</a></p>

</body></html>

<html>

<body> <h2 id="name">${category.name}</h2>

#showErrors("category")

<form method="POST"> <p><strong>Parent:</strong> #selectForObject("category.parent" $allCategories)</p> <p>Description: #springFormInput("category.description" "") #springShowErrors("<br>" "")</p> <p>Type: #selectForEnum("category.type" $categoryTypes)</p>

<input type="submit" value="Submit" /> </form>

<form method="POST"> <input type="submit" name="delete" value="Delete" /> </form>

<p><a href="list.html">List all</a></p>

</body></html>

public void testDeleteCategory() throws Exception { // Insert test data

// Ensure that data is displayed in index

// Delete it beginAt("categories/edit.html?id=" + key); submit("delete");

// Ensure that after delete, we go to index assertTextPresent("Showing all categories");

// Ensure that the category is no longer there}

protected ModelAndView onSubmit( HttpServletRequest req, HttpServletResponse resp, Object command, BindException errors) { Category category = (Category)command; if (category.getId() == null) { Serializable key = repository.insert(category); return new ModelAndView(new RedirectView("show.html?id=" + key)); }

repository.update(category); // Redirect on post - go back to the same page return new ModelAndView(

new RedirectView(req.getRequestURI() + "?" + req.getQueryString()));}

protected ModelAndView onSubmit( HttpServletRequest req, HttpServletResponse resp, Object command, BindException errors) { Category category = (Category)command; if (category.getId() == null) { Serializable key = repository.insert(category); return new ModelAndView(new RedirectView("show.html?id=" + key)); } if (req.getParameter("delete") != null) { repository.delete(Category.class, category.getId()); return new ModelAndView(new RedirectView("list.html")); } repository.update(category); // Redirect on post - go back to the same page return new ModelAndView(

new RedirectView(req.getRequestURI() + "?" + req.getQueryString()));}

Mon Sep 10 18:37:02 EDT 2007: Not upgraded, skipping restartMon Sep 10 18:38:13 EDT 2007: Installed new versionStoppingStartingTesting connection (user=johannes, url=jdbc:mysql://localhost/nocontainer_dev)...OK!Deploy 'nocontainer' from /home/nocontainer/test/nocontainer-app/curr/repo/com/brodwall/nocontainer/nocontainer-web/1.1-SNAPSHOT/nocontainer-web-1.1-SNAPSHOT.warServer started on http://localhost:9090 in 12.547sMon Sep 10 18:39:02 EDT 2007: Not upgraded, skipping restart

./prod/nocontainer-app/operate.sh start

./prod/nocontainer-app/operate.sh stop

./prod/nocontainer-app/operate.sh status

Jetty: 221k

(Okay, then)

top related