Search in sources :

Example 1 with MarshalledEntryFactoryImpl

use of org.infinispan.marshall.persistence.impl.MarshalledEntryFactoryImpl in project infinispan by infinispan.

the class BaseNonBlockingStoreTest method setUp.

// alwaysRun = true otherwise, when we run unstable tests, this method is not invoked (because it belongs to the unit group)
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception {
    marshaller = new TestObjectStreamMarshaller(getSerializationContextInitializer());
    timeService = getTimeService();
    internalEntryFactory = new InternalEntryFactoryImpl();
    TestingUtil.inject(internalEntryFactory, timeService);
    marshallableEntryFactory = new MarshalledEntryFactoryImpl();
    TestingUtil.inject(marshallableEntryFactory, marshaller);
    try {
        NonBlockingStore<Object, Object> nonBlockingStore = createStore();
        // Make sure all store methods don't block when we invoke them
        store = new EnsureNonBlockingStore<>(nonBlockingStore, keyPartitioner);
        startStore(store);
    } catch (Exception e) {
        log.error("Error creating store", e);
        throw e;
    }
}
Also used : InternalEntryFactoryImpl(org.infinispan.container.impl.InternalEntryFactoryImpl) TestObjectStreamMarshaller(org.infinispan.marshall.TestObjectStreamMarshaller) PersistenceException(org.infinispan.persistence.spi.PersistenceException) IOException(java.io.IOException) MarshalledEntryFactoryImpl(org.infinispan.marshall.persistence.impl.MarshalledEntryFactoryImpl) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with MarshalledEntryFactoryImpl

use of org.infinispan.marshall.persistence.impl.MarshalledEntryFactoryImpl in project infinispan by infinispan.

the class AsyncStoreStressTest method createAsyncStore.

private AsyncNonBlockingStore<Object, Object> createAsyncStore(NonBlockingStore backendStore, StoreConfiguration storeConfiguration) throws PersistenceException {
    AsyncNonBlockingStore<Object, Object> store = new AsyncNonBlockingStore<>(backendStore);
    BlockingManager blockingManager = new BlockingManagerImpl();
    TestingUtil.inject(blockingManager, new TestComponentAccessors.NamedComponent(KnownComponentNames.NON_BLOCKING_EXECUTOR, nonBlockingExecutor), new TestComponentAccessors.NamedComponent(KnownComponentNames.BLOCKING_EXECUTOR, blockingExecutor));
    TestingUtil.startComponent(blockingManager);
    Cache cacheMock = Mockito.mock(Cache.class, Mockito.RETURNS_DEEP_STUBS);
    Mockito.when(cacheMock.getAdvancedCache().getComponentRegistry().getComponent(KeyPartitioner.class)).thenReturn(SingleSegmentKeyPartitioner.getInstance());
    CompletionStages.join(store.start(new DummyInitializationContext(storeConfiguration, cacheMock, marshaller, new ByteBufferFactoryImpl(), new MarshalledEntryFactoryImpl(marshaller), nonBlockingExecutor, new GlobalConfigurationBuilder().globalState().persistentLocation(location).build(), blockingManager, null, new DefaultTimeService())));
    return store;
}
Also used : BlockingManagerImpl(org.infinispan.util.concurrent.BlockingManagerImpl) DummyInitializationContext(org.infinispan.persistence.DummyInitializationContext) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) ByteBufferFactoryImpl(org.infinispan.commons.io.ByteBufferFactoryImpl) BlockingManager(org.infinispan.util.concurrent.BlockingManager) TestComponentAccessors(org.infinispan.factories.impl.TestComponentAccessors) DefaultTimeService(org.infinispan.commons.time.DefaultTimeService) MarshalledEntryFactoryImpl(org.infinispan.marshall.persistence.impl.MarshalledEntryFactoryImpl) AsyncNonBlockingStore(org.infinispan.persistence.async.AsyncNonBlockingStore) Cache(org.infinispan.Cache)

Example 3 with MarshalledEntryFactoryImpl

use of org.infinispan.marshall.persistence.impl.MarshalledEntryFactoryImpl in project infinispan by infinispan.

the class JCacheLoaderAdapterTest method setUpClass.

@BeforeClass
public static void setUpClass() {
    TimeService timeService = new EmbeddedTimeService();
    marshaller = new TestObjectStreamMarshaller();
    MarshallableEntryFactory marshalledEntryFactory = new MarshalledEntryFactoryImpl(marshaller);
    ctx = new DummyInitializationContext() {

        @Override
        public TimeService getTimeService() {
            return timeService;
        }

        @Override
        public MarshallableEntryFactory getMarshallableEntryFactory() {
            return marshalledEntryFactory;
        }
    };
}
Also used : DummyInitializationContext(org.infinispan.persistence.DummyInitializationContext) EmbeddedTimeService(org.infinispan.util.EmbeddedTimeService) EmbeddedTimeService(org.infinispan.util.EmbeddedTimeService) TimeService(org.infinispan.commons.time.TimeService) MarshallableEntryFactory(org.infinispan.persistence.spi.MarshallableEntryFactory) TestObjectStreamMarshaller(org.infinispan.marshall.TestObjectStreamMarshaller) MarshalledEntryFactoryImpl(org.infinispan.marshall.persistence.impl.MarshalledEntryFactoryImpl) BeforeClass(org.testng.annotations.BeforeClass)

Example 4 with MarshalledEntryFactoryImpl

use of org.infinispan.marshall.persistence.impl.MarshalledEntryFactoryImpl in project infinispan by infinispan.

the class AbstractJpaStoreTest method setUp.

@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception {
    try {
        cm = createCacheManager();
        marshaller = TestingUtil.extractPersistenceMarshaller(cm);
        entryFactory = new MarshalledEntryFactoryImpl(marshaller);
        blockingManager = TestingUtil.extractGlobalComponent(cm, BlockingManager.class);
        cs = createCacheStore(cm.getCacheManagerConfiguration());
        cs.clear();
    } catch (Exception e) {
        log.warn("Error during test setup", e);
        throw e;
    }
}
Also used : BlockingManager(org.infinispan.util.concurrent.BlockingManager) MarshalledEntryFactoryImpl(org.infinispan.marshall.persistence.impl.MarshalledEntryFactoryImpl) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

MarshalledEntryFactoryImpl (org.infinispan.marshall.persistence.impl.MarshalledEntryFactoryImpl)4 TestObjectStreamMarshaller (org.infinispan.marshall.TestObjectStreamMarshaller)2 DummyInitializationContext (org.infinispan.persistence.DummyInitializationContext)2 BlockingManager (org.infinispan.util.concurrent.BlockingManager)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 IOException (java.io.IOException)1 Cache (org.infinispan.Cache)1 ByteBufferFactoryImpl (org.infinispan.commons.io.ByteBufferFactoryImpl)1 DefaultTimeService (org.infinispan.commons.time.DefaultTimeService)1 TimeService (org.infinispan.commons.time.TimeService)1 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)1 InternalEntryFactoryImpl (org.infinispan.container.impl.InternalEntryFactoryImpl)1 TestComponentAccessors (org.infinispan.factories.impl.TestComponentAccessors)1 AsyncNonBlockingStore (org.infinispan.persistence.async.AsyncNonBlockingStore)1 MarshallableEntryFactory (org.infinispan.persistence.spi.MarshallableEntryFactory)1 PersistenceException (org.infinispan.persistence.spi.PersistenceException)1 EmbeddedTimeService (org.infinispan.util.EmbeddedTimeService)1 BlockingManagerImpl (org.infinispan.util.concurrent.BlockingManagerImpl)1 BeforeClass (org.testng.annotations.BeforeClass)1