Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
clean up determination of PASS, FAIL for a given test
Browse files Browse the repository at this point in the history
add new jsps for different results reporting so that tests do not need to be called in particular order

Change-Id: Ia06912e16a9b4ce542171ee2d83ddbf24ec84271
  • Loading branch information
ejohansen committed Dec 20, 2011
1 parent 927e422 commit 17a8082
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 29 deletions.
Expand Up @@ -85,7 +85,7 @@ public String newtables(Model model) {
model.addAttribute("dbInfo", referenceRepository.getDbInfo());
model.addAttribute("itemExists", referenceRepository.addNewItemCategories());
model.addAttribute("allTables", referenceRepository.findAllTables());
return "dbtablelist";
return "dbadditionaltablelist";
}

@RequestMapping(value = "/addtaxtable", method = RequestMethod.GET)
Expand All @@ -94,7 +94,7 @@ public String newtaxes(Model model) {
model.addAttribute("dbInfo", referenceRepository.getDbInfo());
model.addAttribute("itemExists", referenceRepository.addTaxTable());
model.addAttribute("allTables", referenceRepository.findAllTables());
return "dbtablelist";
return "dbtaxtablelist";
}

@RequestMapping(value = "/differentview", method = RequestMethod.GET)
Expand Down
Expand Up @@ -50,6 +50,7 @@ public boolean setupInitTestDBTable() {
String vendor = getDBVendor();
//make sure we are starting from scratch...
this.jdbcTemplate.execute("drop table if exists current_items");
this.jdbcTemplate.execute("drop table if exists item_taxes");

if (vendor.equalsIgnoreCase("mysql")) {
this.jdbcTemplate.execute("create table current_items (id INT(3) PRIMARY KEY AUTO_INCREMENT, item_code char(2), name varchar(1024))");
Expand Down Expand Up @@ -115,7 +116,7 @@ public boolean dropItemsTable() {
}

public int removeItems() {
this.jdbcTemplate.update("delete from current_items where id > 10000");
this.jdbcTemplate.update("delete from current_items where id > 5000");
int slimmerRowCount = this.jdbcTemplate.queryForInt("select count(*) from current_items");
return slimmerRowCount;
}
Expand Down
@@ -0,0 +1,33 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ page session="false" %>
<html>
<head>
<title>Database tables may have been Modified!</title>
</head>
<body>
<h1>Database tables may have been Modified!!</h1>

<h4>Database Info:</h4>
DataSource: <c:out value="${dbInfo}"/></br>

<h4>Could we modify db tables?</h4>
<p>
<c:out value="${itemExists}"/></br>
</p>

<c:if test="${not empty allTables}">
<p>
<c:forEach var="table" items="${allTables}">
<c:if test="${fn:contains(table,'other_categories_')}">
<p>PASS: other_categories table(s) found. </p>
</c:if>
<c:out value="${table}"/></br>
</c:forEach>
</p>
</c:if>
<c:if test="${empty allTables}">
<p>FAIL: No Tables found</p>
</c:if>
</body>
</html>
Expand Up @@ -16,24 +16,15 @@
</p>

<h4>New Slimmer ItemCount:</h4>
<p>
<c:out value="${slimmerItemCount}"/></br>
</p>
<c:if test="${empty slimmerItemCount}">
<p>No Items found</p>
</c:if>
<c:if test="${empty updatedItemCount}">
<p>No Items found</p>
</c:if>
<c:if test="${updatedItemCount <= previousItemCount}">
<p>FAIL: Expected new current_items count to be greater than previous current_items count</p>
<c:if test="${updatedItemCount > previousItemCount}">
<p>FAIL: Expected new current_items count to be lesser than previous current_items count</p>
<c:out value="${updatedItemCount}"/></br>
</c:if>
<c:if test="${empty updatedItemCount}">
<p>FAIL: No Current Items found</p>
</c:if>
<c:if test="${updatedItemCount >= previousItemCount}">
<p>PASS: found new entries in current_items table</p>
<c:if test="${updatedItemCount <= previousItemCount}">
<p>PASS: found fewer or equal number of items in current_items table</p>
<c:out value="${updatedItemCount}"/></br>
</c:if>
</body>
Expand Down
Expand Up @@ -18,23 +18,15 @@
<c:if test="${not empty allTables}">
<p>
<c:forEach var="table" items="${allTables}">
<c:if test="${table == 'current_items'}">
<p>PASS: current_item table found. </p>
</c:if>
<c:out value="${table}"/></br>
</c:forEach>
</p>
</c:if>
<c:if test="${empty allTables}">
<p>No Tables found</p>
</c:if>
<c:if test="${updatedItemCount <= previousItemCount}">
<p>FAIL: Expected new current_items count to be greater than previous current_items count</p>
<c:out value="${updatedItemCount}"/></br>
</c:if>
<c:if test="${empty updatedItemCount}">
<p>FAIL: No Current Items found</p>
</c:if>
<c:if test="${updatedItemCount >= previousItemCount}">
<p>PASS: found new entries in current_items table</p>
<c:out value="${updatedItemCount}"/></br>
<p>FAIL: No Tables found</p>
</c:if>
</body>
</html>
Expand Up @@ -14,6 +14,9 @@
<p>
<c:out value="${currentItemCount}"/></br>
</p>
<c:if test="${not empty currentItemCount}">
<p>PASS: ${currentItemCount} items found</p>
</c:if>
<c:if test="${empty currentItemCount}">
<p>No Items found</p>
</c:if>
Expand Down
@@ -0,0 +1,32 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>
<html>
<head>
<title>Database tables may have been Modified!</title>
</head>
<body>
<h1>Database tables may have been Modified!!</h1>

<h4>Database Info:</h4>
DataSource: <c:out value="${dbInfo}"/></br>

<h4>Could we modify db tables?</h4>
<p>
<c:out value="${itemExists}"/></br>
</p>

<c:if test="${not empty allTables}">
<p>
<c:forEach var="table" items="${allTables}">
<c:if test="${table == 'item_taxes'}">
<p>PASS: item_taxes table found. </p>
</c:if>
<c:out value="${table}"/></br>
</c:forEach>
</p>
</c:if>
<c:if test="${empty allTables}">
<p>FAIL: No Tables found</p>
</c:if>
</body>
</html>
Expand Up @@ -17,9 +17,10 @@
<c:out value="${taxItem}"/></br>
</c:forEach>
</p>
<p>PASS: TaxItems found</p>
</c:if>
<c:if test="${empty taxItems}">
<p>No TaxItems found</p>
<p>FAIL: No TaxItems found</p>
</c:if>
</body>
</html>

0 comments on commit 17a8082

Please sign in to comment.