001 package org.hackystat.dailyprojectdata.frontsidecache; 002 003 import static org.junit.Assert.assertNull; 004 import org.hackystat.dailyprojectdata.test.DailyProjectDataTestHelper; 005 import org.junit.Test; 006 007 /** 008 * Simple test class to make sure FrontSideCaching works. 009 * @author Philip Johnson 010 */ 011 public class TestFrontSideCache extends DailyProjectDataTestHelper { 012 013 /** 014 * Check to make sure FrontSideCache instantiation, put, get, and clear work. 015 */ 016 @Test 017 public void testFrontSideCache() { 018 019 String user = "user"; 020 String uri = "uri"; 021 String dpd = "dpd"; 022 String project = "project"; 023 FrontSideCache cache = new FrontSideCache(getDpdServer()); 024 cache.put(user, project, uri, dpd); 025 // The following is the most important test. It's commented out because front side caching 026 // is disabled for the rest of testing. To run the following line, you must edit 027 // ServerProperties, change the test value of TESTFRONTSIDECACHE_ENABLED to true. 028 // Then you can uncomment this line and run the test. 029 // Pretty bogus, but I can't think of a good way around it at the moment. 030 //assertEquals("testing frontside get", dpd, cache.get(user, uri)); 031 assertNull("Testing frontside get null", cache.get(user, project, "foo")); 032 cache.clear(user); 033 assertNull("Testing frontside clear", cache.get(user, project, "foo")); 034 } 035 }