meetup.com/13 example application

46

Upload: jeremiah-patterson

Post on 26-Mar-2015

226 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: meetup.com/13 Example application
Page 2: meetup.com/13 Example application
Page 3: meetup.com/13 Example application
Page 4: meetup.com/13 Example application
Page 5: meetup.com/13 Example application

.meetup.com/13

Page 7: meetup.com/13 Example application
Page 8: meetup.com/13 Example application
Page 9: meetup.com/13 Example application
Page 10: meetup.com/13 Example application
Page 11: meetup.com/13 Example application
Page 12: meetup.com/13 Example application
Page 13: meetup.com/13 Example application
Page 15: meetup.com/13 Example application
Page 16: meetup.com/13 Example application
Page 17: meetup.com/13 Example application
Page 18: meetup.com/13 Example application

Symbolic link

Page 19: meetup.com/13 Example application

port=9090shutdown_port=9190

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

Page 20: meetup.com/13 Example application

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());}

Page 21: meetup.com/13 Example application

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());}

Page 22: meetup.com/13 Example application

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}

Page 23: meetup.com/13 Example application

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}

Page 24: meetup.com/13 Example application
Page 25: meetup.com/13 Example application

<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>

Page 26: meetup.com/13 Example application

<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>

Page 27: meetup.com/13 Example application
Page 28: meetup.com/13 Example application

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}

Page 29: meetup.com/13 Example application

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()));}

Page 30: meetup.com/13 Example application

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()));}

Page 31: meetup.com/13 Example application
Page 32: meetup.com/13 Example application
Page 33: meetup.com/13 Example application
Page 34: meetup.com/13 Example application
Page 35: meetup.com/13 Example application
Page 36: meetup.com/13 Example application
Page 37: meetup.com/13 Example application

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

Page 38: meetup.com/13 Example application

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

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

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

Page 39: meetup.com/13 Example application
Page 40: meetup.com/13 Example application
Page 41: meetup.com/13 Example application

Jetty: 221k

Page 42: meetup.com/13 Example application
Page 43: meetup.com/13 Example application
Page 44: meetup.com/13 Example application

(Okay, then)

Page 45: meetup.com/13 Example application
Page 46: meetup.com/13 Example application