org.apache.geode.cache.CacheWriterException Java Examples
The following examples show how to use
org.apache.geode.cache.CacheWriterException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExampleCacheWriterTest.java From geode-examples with Apache License 2.0 | 5 votes |
@Test(expected = CacheWriterException.class) public void testBeforeCreateFailsForBadSSN() throws Exception { ExampleCacheWriter writer = new ExampleCacheWriter(); EntryEvent<String, String> event = mock(EntryEvent.class); when(event.getKey()).thenReturn("666-66-6666"); writer.beforeCreate(event); }
Example #2
Source File: ExampleTest.java From geode-examples with Apache License 2.0 | 5 votes |
@Test public void testExample() throws Exception { Example example = new Example(); Region<String, String> region = mock(Region.class); when(region.put(eq("666-66-6666"), any())).thenThrow(new CacheWriterException()); when(region.put(eq("8675309"), any())).thenThrow(new CacheWriterException()); when(region.put(eq("999-000-0000"), any())).thenThrow(new CacheWriterException()); assertEquals(Arrays.asList(new String[] {"Bart Simpson", "Raymond Babbitt"}), example.getValidNames(region)); }
Example #3
Source File: Example.java From geode-examples with Apache License 2.0 | 5 votes |
private void addName(Region<String, String> region, String ssn, String name, List<String> names) { try { region.put(ssn, name); names.add(name); } catch (CacheWriterException | ServerOperationException e) { System.out.println("Invalid SSN: " + ssn); } }
Example #4
Source File: ExampleTest.java From geode-examples with Apache License 2.0 | 5 votes |
@Test public void testExample() throws Exception { Example example = new Example(); Region<String, String> region = mock(Region.class); when(region.put(eq("666-66-6666"), any())).thenThrow(new CacheWriterException()); when(region.put(eq("8675309"), any())).thenThrow(new CacheWriterException()); when(region.put(eq("999-000-0000"), any())).thenThrow(new CacheWriterException()); assertEquals(Arrays.asList(new String[] {"Bart Simpson", "Raymond Babbitt"}), example.getValidNames(region)); }
Example #5
Source File: ExampleCacheWriterTest.java From geode-examples with Apache License 2.0 | 5 votes |
@Test(expected = CacheWriterException.class) public void testBeforeCreateFailsForBadSSN() throws Exception { ExampleCacheWriter writer = new ExampleCacheWriter(); EntryEvent<String, String> event = mock(EntryEvent.class); when(event.getKey()).thenReturn("666-66-6666"); writer.beforeCreate(event); }
Example #6
Source File: RepositoryCacheWriterUnitTests.java From spring-boot-data-geode with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("all") public void newCacheRuntimeExceptionIsCorrect() { RuntimeException cause = new RuntimeException("TEST"); CacheRuntimeException cacheRuntimeException = this.cacheWriter.newCacheRuntimeException(() -> "TEST", cause); assertThat(cacheRuntimeException).isInstanceOf(CacheWriterException.class); assertThat(cacheRuntimeException.getMessage()).isEqualTo("TEST"); assertThat(cacheRuntimeException.getCause()).isEqualTo(cause); }
Example #7
Source File: Example.java From geode-examples with Apache License 2.0 | 5 votes |
private void addName(Region<String, String> region, String ssn, String name, List<String> names) { try { region.put(ssn, name); names.add(name); } catch (CacheWriterException | ServerOperationException e) { System.out.println("Invalid SSN: " + ssn); } }
Example #8
Source File: RepositoryCacheWriter.java From spring-boot-data-geode with Apache License 2.0 | 5 votes |
@Override public void beforeRegionClear(RegionEvent<ID, T> event) throws CacheWriterException { if (isNukeAndPaveEnabled()) { doRepositoryOp(null, FunctionUtils.toNullReturningFunction(it -> getRepository().deleteAll())); } }
Example #9
Source File: ExampleCacheWriter.java From geode-examples with Apache License 2.0 | 4 votes |
@Override public void beforeDestroy(EntryEvent<String, String> event) throws CacheWriterException { // N/A }
Example #10
Source File: CacheWriterSupport.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Override default void beforeRegionClear(RegionEvent<K, V> event) throws CacheWriterException { }
Example #11
Source File: CacheWriterSupport.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Override default void beforeRegionDestroy(RegionEvent<K, V> event) throws CacheWriterException { }
Example #12
Source File: ExampleCacheWriter.java From geode-examples with Apache License 2.0 | 4 votes |
@Override public void beforeUpdate(EntryEvent<String, String> event) throws CacheWriterException { if (!vetter.isValid(event.getKey())) { throw new CacheWriterException("Invalid SSN"); } }
Example #13
Source File: ExampleCacheWriter.java From geode-examples with Apache License 2.0 | 4 votes |
@Override public void beforeCreate(EntryEvent<String, String> event) throws CacheWriterException { if (!vetter.isValid(event.getKey())) { throw new CacheWriterException("Invalid SSN"); } }
Example #14
Source File: CacheWriterSupport.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Override default void beforeCreate(EntryEvent<K, V> event) throws CacheWriterException { }
Example #15
Source File: ExampleCacheWriter.java From geode-examples with Apache License 2.0 | 4 votes |
@Override public void beforeRegionDestroy(RegionEvent<String, String> event) throws CacheWriterException { // N/A }
Example #16
Source File: ExampleCacheWriter.java From geode-examples with Apache License 2.0 | 4 votes |
@Override public void beforeRegionClear(RegionEvent<String, String> event) throws CacheWriterException { // N/A }
Example #17
Source File: CustomerCacheWriter.java From spring-data-examples with Apache License 2.0 | 4 votes |
@Override public void beforeCreate(EntryEvent<Long, Customer> event) throws CacheWriterException { EntryEventImpl e = (EntryEventImpl) event; super.beforeCreate(e); }
Example #18
Source File: CacheWriterSupport.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Override default void beforeDestroy(EntryEvent<K, V> event) throws CacheWriterException { }
Example #19
Source File: CacheWriterSupport.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Override default void beforeUpdate(EntryEvent<K, V> event) throws CacheWriterException { }
Example #20
Source File: RepositoryCacheWriter.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Override protected CacheRuntimeException newCacheRuntimeException(Supplier<String> messageSupplier, Throwable cause) { return new CacheWriterException(messageSupplier.get(), cause); }
Example #21
Source File: RepositoryCacheWriter.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Override public void beforeRegionDestroy(RegionEvent<ID, T> event) throws CacheWriterException { // TODO: perhaps implement by releasing external data source resources // (i.e. destroy database object(s), e.g. DROP TABLE) }
Example #22
Source File: RepositoryCacheWriter.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Override public void beforeDestroy(EntryEvent<ID, T> event) throws CacheWriterException { //doRepositoryOp(event.getOldValue(), FunctionUtils.toNullReturningFunction(getRepository()::delete)); doRepositoryOp(event.getKey(), FunctionUtils.toNullReturningFunction(getRepository()::deleteById)); }
Example #23
Source File: RepositoryCacheWriter.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Override public void beforeUpdate(EntryEvent<ID, T> event) throws CacheWriterException { doRepositoryOp(event.getNewValue(), getRepository()::save); }
Example #24
Source File: RepositoryCacheWriter.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Override public void beforeCreate(EntryEvent<ID, T> event) throws CacheWriterException { doRepositoryOp(event.getNewValue(), getRepository()::save); }
Example #25
Source File: ExampleCacheWriter.java From geode-examples with Apache License 2.0 | 4 votes |
@Override public void beforeRegionClear(RegionEvent<String, String> event) throws CacheWriterException { // N/A }
Example #26
Source File: ExampleCacheWriter.java From geode-examples with Apache License 2.0 | 4 votes |
@Override public void beforeRegionDestroy(RegionEvent<String, String> event) throws CacheWriterException { // N/A }
Example #27
Source File: ExampleCacheWriter.java From geode-examples with Apache License 2.0 | 4 votes |
@Override public void beforeDestroy(EntryEvent<String, String> event) throws CacheWriterException { // N/A }
Example #28
Source File: ExampleCacheWriter.java From geode-examples with Apache License 2.0 | 4 votes |
@Override public void beforeCreate(EntryEvent<String, String> event) throws CacheWriterException { if (!vetter.isValid(event.getKey())) { throw new CacheWriterException("Invalid SSN"); } }
Example #29
Source File: ExampleCacheWriter.java From geode-examples with Apache License 2.0 | 4 votes |
@Override public void beforeUpdate(EntryEvent<String, String> event) throws CacheWriterException { if (!vetter.isValid(event.getKey())) { throw new CacheWriterException("Invalid SSN"); } }