[prev in list] [next in list] [prev in thread] [next in thread] 

List:       turbine-jcs-dev
Subject:    svn commit: r380320 -
From:       asmuts () apache ! org
Date:       2006-02-24 3:24:49
Message-ID: 20060224032449.53543.qmail () minotaur ! apache ! org
[Download RAW message or body]

Author: asmuts
Date: Thu Feb 23 19:24:46 2006
New Revision: 380320

URL: http://svn.apache.org/viewcvs?rev=380320&view=rev
Log:
adding simple unit test for lateral.

Modified:
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java


Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java
                
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary \
/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java?rev=380320&r1=380319&r2=380320&view=diff
 ==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java \
                (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java \
Thu Feb 23 19:24:46 2006 @@ -40,13 +40,58 @@
      * 
      * @throws Exception
      */
-    public void test()
+    public void testPutLocalPutRemoteGetBusyVerifyRemoved()
         throws Exception
     {
         this.runTestForRegion( "region1", 1, 200, 1 );
     }
 
     /**
+     * Verify that a standard put works.
+     * 
+     * Get the cache configured from a file. Create a tcp service to talk to
+     * that cache. Put via the servive. Verify that the cache got the data.
+     * 
+     * @throws Exception
+     * 
+     */
+    public void testStandardPut()
+        throws Exception
+    {
+        String region = "region1";
+
+        JCS cache = JCS.getInstance( region );
+
+        Thread.sleep( 100 );
+
+        TCPLateralCacheAttributes lattr2 = new TCPLateralCacheAttributes();
+        lattr2.setTcpListenerPort( 1102 );
+        lattr2.setTransmissionTypeName( "TCP" );
+        lattr2.setTcpServer( "localhost:1110" );
+        lattr2.setIssueRemoveOnPut( false );
+        // should still try to remove
+        // lattr2.setAllowPut( false );
+
+        // Using the lateral, this service will put to and remove from
+        // the cache instance above.
+        // The cache thinks it is different since the listenerid is different
+        LateralTCPService service = new LateralTCPService( lattr2 );
+        service.setListenerId( 123456 );
+
+        String keyToBeRemovedOnPut = "test1_notremoved";
+
+        ICacheElement element1 = new CacheElement( region, keyToBeRemovedOnPut, \
region +            + ":data-this shouldn't get removed, it should get to the cache." \
); +        service.update( element1 );
+
+        Thread.sleep( 1000 );
+
+        Object testObj = cache.get( keyToBeRemovedOnPut );
+        p( "testStandardPut, test object = " + testObj );
+        assertNotNull( "The test object should not have been removed by a put.", \
testObj ); +    }
+
+    /**
      * This tests issues tons of puts. It also check to see that a key that was
      * put in was removed by the clients remove command.
      * 
@@ -63,7 +108,7 @@
         throws Exception
     {
 
-        boolean show = true;//false;
+        boolean show = true;// false;
 
         JCS cache = JCS.getInstance( region );
 
@@ -77,14 +122,14 @@
         // should still try to remove
         lattr2.setAllowPut( false );
 
-        // this service will put and remove using the lateral to
-        // the cache instance above
-        // the cache thinks it is different since the listenerid is different
+        // Using the lateral, this service will put to and remove from
+        // the cache instance above.
+        // The cache thinks it is different since the listenerid is different
         LateralTCPService service = new LateralTCPService( lattr2 );
         service.setListenerId( 123456 );
 
         String keyToBeRemovedOnPut = "test1";
-        cache.put( keyToBeRemovedOnPut, "this should get remvoed" );
+        cache.put( keyToBeRemovedOnPut, "this should get removed." );
 
         ICacheElement element1 = new CacheElement( region, keyToBeRemovedOnPut, \
region  + ":data-this shouldn't get there" );
@@ -142,15 +187,16 @@
         }
 
         Thread.sleep( 200 );
-        
+
         Object testObj = cache.get( keyToBeRemovedOnPut );
-        p( "test object = " + testObj );
-        assertNull( "The test object should have been remvoed by a put.", testObj );
+        p( "runTestForRegion, test object = " + testObj );
+        assertNull( "The test object should have been removed by a put.", testObj );
 
     }
 
     /**
-     * @param s String to be printed
+     * @param s
+     *            String to be printed
      */
     public static void p( String s )
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic