[seam-commits] Seam SVN: r14577 - branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Apr 13 11:25:06 EDT 2012


Author: maschmid
Date: 2012-04-13 11:25:03 -0400 (Fri, 13 Apr 2012)
New Revision: 14577

Modified:
   branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test/ProductUnitTest.java
   branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test/SearchTest.java
   branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test/StoreManagerTest.java
Log:
dvdstore test fixes


Modified: branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test/ProductUnitTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test/ProductUnitTest.java	2012-04-13 14:17:23 UTC (rev 14576)
+++ branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test/ProductUnitTest.java	2012-04-13 15:25:03 UTC (rev 14577)
@@ -49,13 +49,14 @@
                 Product p = new Product();
 
                 EntityManager em = (EntityManager) getValue("#{entityManager}");
+                
                 try {
-                    em.persist(p);
-                    Assert.fail("empty product persisted");
+                   em.persist(p);
+                   Assert.fail("empty product persisted");
                 } catch (PersistenceException e) {
                     // good
-                }                 
-            }            
+                }
+            }
         }.run();
     }
 
@@ -69,8 +70,8 @@
          new FacesRequest() {
             protected void invokeApplication()
             {
-                EntityManager em = (EntityManager) getValue("#{entityManager}");                
-                em.persist(p);            
+                EntityManager em = (EntityManager) getValue("#{entityManager}");
+                em.persist(p);
             }
             
            
@@ -85,7 +86,7 @@
                  Assert.assertEquals("id", p.getProductId(), found.getProductId());
                  Assert.assertEquals("title", "test", found.getTitle());
          
-                 em.remove(found);             
+                 em.remove(found);
              }
           }.run();
          
@@ -95,7 +96,7 @@
                   EntityManager em = (EntityManager) getValue("#{entityManager}");
                   Product found = em.find(Product.class ,p.getProductId());
 
-                  Assert.assertEquals("deleted product", found);             
+                  Assert.assertNull("deleted product", found);
               }
            }.run();
           

Modified: branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test/SearchTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test/SearchTest.java	2012-04-13 14:17:23 UTC (rev 14576)
+++ branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test/SearchTest.java	2012-04-13 15:25:03 UTC (rev 14577)
@@ -40,6 +40,8 @@
     public void testNoParamSearch() 
         throws Exception
     {
+        // Wait a while for the indexing
+        Thread.sleep(10000);
         
         new FacesRequest() {
            FullTextSearch search;
@@ -61,11 +63,13 @@
                 ListDataModel model = (ListDataModel) lookup("searchResults");
                 //exact number of matches depends on search algorithm,
                 //so we only check that at least something was found:
-                Assert.assertEquals("should have found something",model.isRowAvailable());
+                
+                
+                Assert.assertTrue("should have found something", model.isRowAvailable());
                 Product firstMatch = (Product) model.getRowData();
-                Assert.assertEquals("at least top match should have keyword in title",
+                Assert.assertTrue("at least top match should have keyword in title",
                       firstMatch.getTitle().toLowerCase().contains("king"));
-                Assert.assertEquals("in conversation", isLongRunningConversation());
+                Assert.assertTrue("in conversation", isLongRunningConversation());
             }
         }.run();
     }

Modified: branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test/StoreManagerTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test/StoreManagerTest.java	2012-04-13 14:17:23 UTC (rev 14576)
+++ branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-tests/src/test/java/com/jboss/dvd/seam/test/StoreManagerTest.java	2012-04-13 15:25:03 UTC (rev 14577)
@@ -54,7 +54,7 @@
                 Assert.assertEquals("total sales",     BigDecimal.ZERO,   manager.getTotalSales());
 
                 // these are from inventory
-                Assert.assertEquals("units sold",      5734,  manager.getUnitsSold());
+                Assert.assertEquals("units sold",      5735,  manager.getUnitsSold());
                 Assert.assertEquals("total inventory", 23432, manager.getTotalInventory());
             }               
         }.run();



More information about the seam-commits mailing list