Search in sources :

Example 1 with BackingMapContext

use of com.tangosol.net.BackingMapContext in project micronaut-coherence by micronaut-projects.

the class ExtractorFactoriesTest method setup.

@BeforeEach
void setup() {
    phoneNumber = new PhoneNumber(44, "04242424242");
    person = new Person("Arthur", "Dent", LocalDate.of(1978, 3, 8), phoneNumber);
    binaryKey = ExternalizableHelper.toBinary("AD", pofContext);
    binaryPerson = ExternalizableHelper.toBinary(person, pofContext);
    BackingMapContext ctx = mock(BackingMapContext.class);
    Map<ValueExtractor, MapIndex> index = new HashMap<>();
    when(ctx.getIndexMap()).thenReturn(index);
    entry = new BackingMapBinaryEntry(binaryKey, binaryPerson, binaryPerson, null) {

        @Override
        public Object getKey() {
            return "AD";
        }

        @Override
        public Object getValue() {
            return person;
        }

        @Override
        public BackingMapContext getBackingMapContext() {
            return ctx;
        }

        @Override
        public Serializer getSerializer() {
            return pofContext;
        }
    };
}
Also used : BackingMapContext(com.tangosol.net.BackingMapContext) BackingMapBinaryEntry(com.tangosol.net.cache.BackingMapBinaryEntry) HashMap(java.util.HashMap) PhoneNumber(data.PhoneNumber) Person(data.Person) Serializer(com.tangosol.io.Serializer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with BackingMapContext

use of com.tangosol.net.BackingMapContext in project coherence-spring by coherence-community.

the class ExtractorConfigurationTests method setup.

@BeforeEach
void setup() {
    this.phoneNumber = new PhoneNumber(44, "04242424242");
    this.person = new Person("Arthur", "Dent", LocalDate.of(1978, 3, 8), this.phoneNumber);
    this.binaryKey = ExternalizableHelper.toBinary("AD", this.pofContext);
    this.binaryPerson = ExternalizableHelper.toBinary(this.person, this.pofContext);
    BackingMapContext ctx = mock(BackingMapContext.class);
    Map<ValueExtractor, MapIndex> index = new HashMap<>();
    when(ctx.getIndexMap()).thenReturn(index);
    this.entry = new BackingMapBinaryEntry(this.binaryKey, this.binaryPerson, this.binaryPerson, null) {

        @Override
        public Object getKey() {
            return "AD";
        }

        @Override
        public Object getValue() {
            return ExtractorConfigurationTests.this.person;
        }

        @Override
        public BackingMapContext getBackingMapContext() {
            return ctx;
        }

        @Override
        public Serializer getSerializer() {
            return ExtractorConfigurationTests.this.pofContext;
        }
    };
}
Also used : BackingMapContext(com.tangosol.net.BackingMapContext) BackingMapBinaryEntry(com.tangosol.net.cache.BackingMapBinaryEntry) HashMap(java.util.HashMap) PhoneNumber(data.PhoneNumber) ValueExtractor(com.tangosol.util.ValueExtractor) MapIndex(com.tangosol.util.MapIndex) Person(data.Person) Serializer(com.tangosol.io.Serializer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with BackingMapContext

use of com.tangosol.net.BackingMapContext in project coherence-spring by coherence-community.

the class NamespaceHandlerTest method getCacheStore.

Object getCacheStore(String cacheName) {
    NamedCache<Object, Object> cache = this.eccf.ensureCache(cacheName, null);
    BackingMapManager manager = cache.getCacheService().getBackingMapManager();
    BackingMapManagerContext context = manager.getContext();
    BackingMapContext backingMapContext = context.getBackingMapContext(cache.getCacheName());
    ReadWriteBackingMap backingMap = (ReadWriteBackingMap) backingMapContext.getBackingMap();
    ReadWriteBackingMap.StoreWrapper cacheStore = backingMap.getCacheStore();
    return cacheStore.getStore();
}
Also used : BackingMapManager(com.tangosol.net.BackingMapManager) BackingMapContext(com.tangosol.net.BackingMapContext) BackingMapManagerContext(com.tangosol.net.BackingMapManagerContext) ReadWriteBackingMap(com.tangosol.net.cache.ReadWriteBackingMap)

Aggregations

BackingMapContext (com.tangosol.net.BackingMapContext)3 Serializer (com.tangosol.io.Serializer)2 BackingMapBinaryEntry (com.tangosol.net.cache.BackingMapBinaryEntry)2 Person (data.Person)2 PhoneNumber (data.PhoneNumber)2 HashMap (java.util.HashMap)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 BackingMapManager (com.tangosol.net.BackingMapManager)1 BackingMapManagerContext (com.tangosol.net.BackingMapManagerContext)1 ReadWriteBackingMap (com.tangosol.net.cache.ReadWriteBackingMap)1 MapIndex (com.tangosol.util.MapIndex)1 ValueExtractor (com.tangosol.util.ValueExtractor)1