Codota Logo
org.apache.polygene.spi.cache
Code IndexAdd Codota to your IDE (free)

How to use org.apache.polygene.spi.cache

Best Java code snippets using org.apache.polygene.spi.cache (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: apache/attic-polygene-java

@Override
public void tearDownJSONMapES()
  throws Exception
{
  if( caching != null )
  {
    caching.returnCache( cache );
    cache = null;
  }
}
origin: apache/attic-polygene-java

  @Test
  public void givenCacheWithValueWhenDroppingReferenceAndRequestNewCacheAndItsValueExpectItToBeGone()
  {
    cache.put( "Habba", "Zout" );
    assertEquals( "Zout", cache.get( "Habba" ) );
    cachePool.returnCache( cache );
    cache = cachePool.fetchCache( "1", String.class );
    assertNull( "Value not missing", cache.get( "Habba" ) );
  }
}
origin: org.apache.polygene.core/org.apache.polygene.core.spi

@Override
public void setUpJSONMapES()
  throws Exception
{
  uuid = descriptor.identity() + "-" + UUID.randomUUID().toString();
  if( caching != null )
  {
    cache = caching.fetchCache( uuid, CacheState.class );
  }
  else
  {
    cache = new NullCache<>();
  }
}
origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test
public void givenCacheWithAValueWhenReplacingValueExpectNewValue()
{
  cache.put( "Habba", "Zout" );
  assertEquals( "Zout", cache.get( "Habba" ) );
  cache.put( "Habba", "Zout2" );
  assertEquals( "Zout2", cache.get( "Habba" ) );
}
origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test
public void givenLoooongCacheNameWhenFetchingCacheExpectOk()
{
  Random random = new Random();
  StringBuilder longName = new StringBuilder();
  for( int i = 0; i < 10000; i++ )
  {
    longName.append( (char) ( random.nextInt( 26 ) + 65 ) );
  }
  cache = cachePool.fetchCache( longName.toString(), String.class );
}
origin: apache/attic-polygene-java

@Test
public void givenEmptyCacheWhenFetchingValueExpectNull()
{
  assertNull( cache.get( "1" ) );
}
origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

  @Test
  public void givenCacheWithValueWhenDroppingReferenceAndRequestNewCacheAndItsValueExpectItToBeGone()
  {
    cache.put( "Habba", "Zout" );
    assertEquals( "Zout", cache.get( "Habba" ) );
    cachePool.returnCache( cache );
    cache = cachePool.fetchCache( "1", String.class );
    assertNull( "Value not missing", cache.get( "Habba" ) );
  }
}
origin: apache/attic-polygene-java

@Test
public void givenCacheWithAValueWhenReplacingValueExpectNewValue()
{
  cache.put( "Habba", "Zout" );
  assertEquals( "Zout", cache.get( "Habba" ) );
  cache.put( "Habba", "Zout2" );
  assertEquals( "Zout2", cache.get( "Habba" ) );
}
origin: apache/attic-polygene-java

@Test
public void givenLoooongCacheNameWhenFetchingCacheExpectOk()
{
  Random random = new Random();
  StringBuilder longName = new StringBuilder();
  for( int i = 0; i < 10000; i++ )
  {
    longName.append( (char) ( random.nextInt( 26 ) + 65 ) );
  }
  cache = cachePool.fetchCache( longName.toString(), String.class );
}
origin: apache/attic-polygene-java

@Override
public void setUpJSONMapES()
  throws Exception
{
  uuid = descriptor.identity() + "-" + UUID.randomUUID().toString();
  if( caching != null )
  {
    cache = caching.fetchCache( uuid, CacheState.class );
  }
  else
  {
    cache = new NullCache<>();
  }
}
origin: org.apache.polygene.core/org.apache.polygene.core.spi

@Override
public void tearDownJSONMapES()
  throws Exception
{
  if( caching != null )
  {
    caching.returnCache( cache );
    cache = null;
  }
}
origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test
public void givenEmptyCacheWhenFetchingValueExpectNull()
{
  assertNull( cache.get( "1" ) );
}
origin: apache/attic-polygene-java

@Test
public void givenCacheWithAValueWhenRequestingThatValueExpectItBack()
{
  cache.put( "Habba", "Zout" );
  assertEquals( "Zout", cache.get( "Habba" ) );
}
origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test
public void givenInvalidCacheNameWhenFetchingCacheExpectIllegalArgumentException()
{
  try
  {
    cache = cachePool.fetchCache( "", String.class );
    fail( "Expected " + IllegalArgumentException.class.getSimpleName() );
  }
  catch( IllegalArgumentException e )
  {
    // expected
  }
}
origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test
public void givenCacheWithAValueWhenRequestingThatValueExpectItBack()
{
  cache.put( "Habba", "Zout" );
  assertEquals( "Zout", cache.get( "Habba" ) );
}
origin: apache/attic-polygene-java

@Test
public void givenInvalidCacheNameWhenFetchingCacheExpectIllegalArgumentException()
{
  try
  {
    cache = cachePool.fetchCache( "", String.class );
    fail( "Expected " + IllegalArgumentException.class.getSimpleName() );
  }
  catch( IllegalArgumentException e )
  {
    // expected
  }
}
origin: apache/attic-polygene-java

@Override
public void setUp()
  throws Exception
{
  super.setUp();
  cachePool = module.instance().findService( CachePool.class ).get();
  cache = cachePool.fetchCache( "1", String.class );
}
origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
public void setUp()
  throws Exception
{
  super.setUp();
  cachePool = module.instance().findService( CachePool.class ).get();
  cache = cachePool.fetchCache( "1", String.class );
}
origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test
public void givenNullKeyWhenFetchingCacheExpectConstraintViolationException()
{
  try
  {
    cache = cachePool.fetchCache( null, String.class );
    fail( "Expected " + ConstraintViolationException.class.getSimpleName() );
  }
  catch( ConstraintViolationException e )
  {
    // expected
    Collection<ValueConstraintViolation> violations = e.constraintViolations();
    assertEquals( 1, violations.size() );
    ValueConstraintViolation violation = violations.iterator().next();
    assertEquals( "not optional", violation.constraint().toString() );
    assertThat( violation.name(), anyOf(equalTo("cacheId"), equalTo( "arg0" )) );  // depends on whether -parameters was given at compile time.
  }
}
origin: apache/attic-polygene-java

@Test
public void givenNullKeyWhenFetchingCacheExpectConstraintViolationException()
{
  try
  {
    cache = cachePool.fetchCache( null, String.class );
    fail( "Expected " + ConstraintViolationException.class.getSimpleName() );
  }
  catch( ConstraintViolationException e )
  {
    // expected
    Collection<ValueConstraintViolation> violations = e.constraintViolations();
    assertEquals( 1, violations.size() );
    ValueConstraintViolation violation = violations.iterator().next();
    assertEquals( "not optional", violation.constraint().toString() );
    assertThat( violation.name(), anyOf(equalTo("cacheId"), equalTo( "arg0" )) );  // depends on whether -parameters was given at compile time.
  }
}
org.apache.polygene.spi.cache

Most used classes

  • Cache
    Interface to interact with Cache implementations. The Cache interface has the simple put/get/remove
  • CachePool
    A CachePool is a service that manages the Persistence Caches. The CachePool is typically implemented
  • NullCache
    Cache null object.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now