Update of 
/var/cvs/speeltuin/ernst/vpro-wizards/tests/org/mmbase/applications/vprowizards/spring/cache
In directory 
james.mmbase.org:/tmp/cvs-serv1609/applications/vpro-wizards/tests/org/mmbase/applications/vprowizards/spring/cache

Modified Files:
        CacheInterceptorTest.java TokenizerCacheNameResolverTest.java 
Added Files:
        applicationContext.xml 
Log Message:
work in progress on the cache flush code (and tests)


See also: 
http://cvs.mmbase.org/viewcvs/speeltuin/ernst/vpro-wizards/tests/org/mmbase/applications/vprowizards/spring/cache


applicationContext.xml is new



Index: CacheInterceptorTest.java
===================================================================
RCS file: 
/var/cvs/speeltuin/ernst/vpro-wizards/tests/org/mmbase/applications/vprowizards/spring/cache/CacheInterceptorTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- CacheInterceptorTest.java   3 Nov 2008 17:12:32 -0000       1.1
+++ CacheInterceptorTest.java   6 Nov 2008 10:17:23 -0000       1.2
@@ -16,12 +16,12 @@
     
     public void test_application_context(){
         assertNotNull(context.getBean("handlerInterceptor"));
-        assertNotNull(context.getBean("cachewrapper"));
-        assertNotNull(context.getBean("flushHintCacheNameResolverFactory"));
+        assertNotNull(context.getBean("dummyCacheWrapper"));
         BasicCacheHandlerInterceptor handlerInterceptor = 
(BasicCacheHandlerInterceptor) context.getBean("handlerInterceptor");
-        
assertTrue(DummyCacheWrapper.class.isAssignableFrom(handlerInterceptor.getCacheWrapper().getClass()));
-        FlushHintCacheNameResolverFactory x = 
(FlushHintCacheNameResolverFactory) 
context.getBean("flushHintCacheNameResolverFactory");
-        assertEquals(x.getClass(), 
handlerInterceptor.getCacheNameResolverFactory().getClass());
+        assertNotNull(handlerInterceptor.getCacheNameResolverFactory());
+        
+        
assertTrue(DummyCacheWrapper.class.isInstance(handlerInterceptor.getCacheWrapper()));
+        assertEquals(TokenizerCacheNameResolver.class, 
handlerInterceptor.getCacheNameResolverFactory().getClazz());
     }
 
 }


Index: TokenizerCacheNameResolverTest.java
===================================================================
RCS file: 
/var/cvs/speeltuin/ernst/vpro-wizards/tests/org/mmbase/applications/vprowizards/spring/cache/TokenizerCacheNameResolverTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- TokenizerCacheNameResolverTest.java 3 Nov 2008 17:12:32 -0000       1.1
+++ TokenizerCacheNameResolverTest.java 6 Nov 2008 10:17:23 -0000       1.2
@@ -14,17 +14,15 @@
     }
 
 public void 
assert_asking_values_for_namespace_that_has_no_values_should_return_empty_list(){
-        tcnr.setNameSpace("twee");
         tcnr.setInput("foo,bar drie:hallo");
-        List<String> l = tcnr.getNames();
+        List<String> l = tcnr.getNames("twee");
         assertEquals(0, l.size());
     }
 
 
     public void test_values_without_namespace_should_become_global() {
-        tcnr.setNameSpace("twee");
         tcnr.setInput("foo,bar drie:hallo");
-        List<String> l = tcnr.getNames();
+        List<String> l = tcnr.getNames("twee");
         assertEquals(2, l.size());
         assertEquals("foo", l.get(0));
         assertEquals("bar", l.get(1));
@@ -33,35 +31,34 @@
     
 
     public void test_value_with_matching_namespace_should_be_returned() {
-        tcnr.setNameSpace("drie");
         tcnr.setInput("drie:hallo vier:noop,noppes");
-        List<String> l = tcnr.getNames();
+        List<String> l = tcnr.getNames("drie");
         assertEquals(1, l.size());
         assertNotNull(l.contains("hallo"));
     }
     
     public void test_values_with_matching_namespace_should_be_returned() {
-        tcnr.setNameSpace("vier");
         tcnr.setInput("drie:hallo vier:noop,noppes");
-        List<String> l = tcnr.getNames();
+        List<String> l = tcnr.getNames("vier");
         assertEquals(2, l.size());
         assertNotNull(l.contains("noop"));
         assertNotNull(l.contains("noppes"));
+        l = tcnr.getNames("drie");
+        assertEquals(1, l.size());
+        
     }
     
     public void 
test_global_value_and_values_with_matching_namespace_should_be_returned() {
-        tcnr.setNameSpace("drie");
         tcnr.setInput("foo drie:hallo vier:noop,noppes");
-        List<String> l = tcnr.getNames();
+        List<String> l = tcnr.getNames("drie");
         assertEquals(2, l.size());
         assertNotNull(l.contains("foo"));
         assertNotNull(l.contains("hallo"));
     }
     
     public void 
test_global_values_and_values_with_matching_namespace_should_be_returned() {
-        tcnr.setNameSpace("drie");
         tcnr.setInput("foo,bar,again drie:hallo vier:noop,noppes");
-        List<String> l = tcnr.getNames();
+        List<String> l = tcnr.getNames("drie");
         assertEquals(4, l.size());
         assertNotNull(l.contains("foo"));
         assertNotNull(l.contains("bar"));
@@ -70,9 +67,8 @@
     }
 
     public void test_just_global_values() {
-            tcnr.setNameSpace("drie");
             tcnr.setInput("foo,bar,again vier:noop,noppes");
-            List<String> l = tcnr.getNames();
+            List<String> l = tcnr.getNames("drie");
             assertEquals(3, l.size());
             assertNotNull(l.contains("foo"));
             assertNotNull(l.contains("bar"));
@@ -81,20 +77,26 @@
     
     
     public void test_simple_templates(){
-        tcnr.setNameSpace("vier");
         tcnr.setInput("vier:noop[test],noppes");
-        List<String> l = tcnr.getNames();
+        List<String> l = tcnr.getNames("vier");
         assertEquals(2, l.size());
         assertNotNull(l.contains("noop[test]"));
         assertNotNull(l.contains("noppes"));
     }
     
     public void test_template_with_nodenr(){
-        tcnr.setNameSpace("vier");
         tcnr.setInput("vier:noop[test:4576],noppes[jaja]");
-        List<String> l = tcnr.getNames();
+        List<String> l = tcnr.getNames("vier");
         assertEquals(2, l.size());
         assertNotNull(l.contains("noop[test:4576]"));
         assertNotNull(l.contains("noppes[jaja]"));
     }
+    
+    public void test_tokenizer_resets_with_new_input(){
+        tcnr.setInput("een:a,b twee:c");
+        tcnr.getNames("een");
+        tcnr.setInput("een:a,b,x,d twee:c");
+        List<String> l = tcnr.getNames("een");
+        assertEquals(4, l.size());
+    }
 }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to