congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
AdminBeanUnitTest
Code IndexAdd Tabnine to your IDE (free)

How to use
AdminBeanUnitTest
in
org.apache.commons.jcs.admin

Best Java code snippets using org.apache.commons.jcs.admin.AdminBeanUnitTest (Showing top 8 results out of 315)

origin: org.apache.commons/commons-jcs-core

/**
 * Put a value in a region and verify that it shows up.
 *
 * @throws Exception
 */
public void testGetElementForRegionInfo()
  throws Exception
{
  String regionName = "myRegion";
  CacheAccess<String, String> cache = JCS.getInstance( regionName );
  // clear the region
  cache.clear();
  String key = "myKey";
  cache.put( key, "value" );
  JCSAdminBean admin = new JCSAdminBean();
  CacheElementInfo[] elements = admin.buildElementInfo( regionName );
  assertEquals( "Wrong number of elements in the region.", 1, elements.length );
  CacheElementInfo elementInfo = elements[0];
  assertEquals( "Wrong key." + elementInfo, key, elementInfo.getKey() );
}
origin: org.apache.commons/commons-jcs-core

/**
 * Create a test region and then verify that we get it from the list.
 *
 * @throws Exception
 *
 */
public void testGetRegionInfo()
  throws Exception
{
  String regionName = "myRegion";
  CacheAccess<String, String> cache = JCS.getInstance( regionName );
  cache.put( "key", "value" );
  JCSAdminBean admin = new JCSAdminBean();
  CacheRegionInfo[] regions = admin.buildCacheInfo();
  boolean foundRegion = false;
  for (CacheRegionInfo info : regions)
  {
    if ( info.getCacheName().equals( regionName ) )
    {
      foundRegion = true;
      assertTrue( "Byte count should be greater than 5.", info.getByteCount() > 5 );
      assertNotNull( "Should have stats.", info.getCacheStatistics() );
    }
  }
  assertTrue( "Should have found the region we just created.", foundRegion );
}
origin: org.apache.tomee.patch/commons-jcs-core

/**
 * Create a test region and then verify that we get it from the list.
 *
 * @throws Exception
 *
 */
public void testGetRegionInfo()
  throws Exception
{
  String regionName = "myRegion";
  CacheAccess<String, String> cache = JCS.getInstance( regionName );
  cache.put( "key", "value" );
  JCSAdminBean admin = new JCSAdminBean();
  CacheRegionInfo[] regions = admin.buildCacheInfo();
  boolean foundRegion = false;
  for (CacheRegionInfo info : regions)
  {
    if ( info.getCacheName().equals( regionName ) )
    {
      foundRegion = true;
      assertTrue( "Byte count should be greater than 5.", info.getByteCount() > 5 );
      assertNotNull( "Should have stats.", info.getCacheStatistics() );
    }
  }
  assertTrue( "Should have found the region we just created.", foundRegion );
}
origin: org.apache.commons/commons-jcs-core

/**
 * Remove an item via the remove method.
 *
 * @throws Exception
 */
public void testRemove()
  throws Exception
{
  JCSAdminBean admin = new JCSAdminBean();
  String regionName = "myRegion";
  CacheAccess<String, String> cache = JCS.getInstance( regionName );
  // clear the region
  cache.clear();
  admin.clearRegion( regionName );
  String key = "myKey";
  cache.put( key, "value" );
  CacheElementInfo[] elements = admin.buildElementInfo( regionName );
  assertEquals( "Wrong number of elements in the region.", 1, elements.length );
  CacheElementInfo elementInfo = elements[0];
  assertEquals( "Wrong key.", key, elementInfo.getKey() );
  admin.removeItem( regionName, key );
  CacheElementInfo[] elements2 = admin.buildElementInfo( regionName );
  assertEquals( "Wrong number of elements in the region after remove.", 0, elements2.length );
}
origin: org.apache.tomee.patch/commons-jcs-core

/**
 * Put a value in a region and verify that it shows up.
 *
 * @throws Exception
 */
public void testGetElementForRegionInfo()
  throws Exception
{
  String regionName = "myRegion";
  CacheAccess<String, String> cache = JCS.getInstance( regionName );
  // clear the region
  cache.clear();
  String key = "myKey";
  cache.put( key, "value" );
  JCSAdminBean admin = new JCSAdminBean();
  CacheElementInfo[] elements = admin.buildElementInfo( regionName );
  assertEquals( "Wrong number of elements in the region.", 1, elements.length );
  CacheElementInfo elementInfo = elements[0];
  assertEquals( "Wrong key." + elementInfo, key, elementInfo.getKey() );
}
origin: org.apache.tomee.patch/commons-jcs-core

/**
 * Remove an item via the remove method.
 *
 * @throws Exception
 */
public void testRemove()
  throws Exception
{
  JCSAdminBean admin = new JCSAdminBean();
  String regionName = "myRegion";
  CacheAccess<String, String> cache = JCS.getInstance( regionName );
  // clear the region
  cache.clear();
  admin.clearRegion( regionName );
  String key = "myKey";
  cache.put( key, "value" );
  CacheElementInfo[] elements = admin.buildElementInfo( regionName );
  assertEquals( "Wrong number of elements in the region.", 1, elements.length );
  CacheElementInfo elementInfo = elements[0];
  assertEquals( "Wrong key.", key, elementInfo.getKey() );
  admin.removeItem( regionName, key );
  CacheElementInfo[] elements2 = admin.buildElementInfo( regionName );
  assertEquals( "Wrong number of elements in the region after remove.", 0, elements2.length );
}
origin: org.apache.commons/commons-jcs-core

  /**
   * Add an item to a region. Call clear all and verify that it doesn't exist.
   *
   * @throws Exception
   */
  public void testClearAll()
    throws Exception
  {
    JCSAdminBean admin = new JCSAdminBean();

    String regionName = "myRegion";
    CacheAccess<String, String> cache = JCS.getInstance( regionName );

    String key = "myKey";
    cache.put( key, "value" );

    admin.clearAllRegions();

    CacheElementInfo[] elements2 = admin.buildElementInfo( regionName );
    assertEquals( "Wrong number of elements in the region after remove.", 0, elements2.length );
  }
}
origin: org.apache.tomee.patch/commons-jcs-core

  /**
   * Add an item to a region. Call clear all and verify that it doesn't exist.
   *
   * @throws Exception
   */
  public void testClearAll()
    throws Exception
  {
    JCSAdminBean admin = new JCSAdminBean();

    String regionName = "myRegion";
    CacheAccess<String, String> cache = JCS.getInstance( regionName );

    String key = "myKey";
    cache.put( key, "value" );

    admin.clearAllRegions();

    CacheElementInfo[] elements2 = admin.buildElementInfo( regionName );
    assertEquals( "Wrong number of elements in the region after remove.", 0, elements2.length );
  }
}
org.apache.commons.jcs.adminAdminBeanUnitTest

Javadoc

Test the admin bean that is used by the JCSAdmin.jsp

Most used methods

  • assertEquals
  • assertNotNull
  • assertTrue

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSystemService (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • runOnUiThread (Activity)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • JFrame (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now