Package com.gemstone.gemfire.cache.asyncqueue

Examples of com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueueFactory


  @Override
  protected void doInit() {
    Assert.notNull(this.asyncEventListener, "The AsyncEventListener cannot be null.");

    AsyncEventQueueFactory asyncEventQueueFactory = (this.factory != null ? (AsyncEventQueueFactory) factory
      : cache.createAsyncEventQueueFactory());

    if (batchSize != null) {
      asyncEventQueueFactory.setBatchSize(batchSize);
    }

    if (batchTimeInterval != null) {
      asyncEventQueueFactory.setBatchTimeInterval(batchTimeInterval);
    }

    if (batchConflationEnabled != null) {
      asyncEventQueueFactory.setBatchConflationEnabled(batchConflationEnabled);
    }

    if (dispatcherThreads != null) {
      asyncEventQueueFactory.setDispatcherThreads(dispatcherThreads);
    }

    if (diskStoreReference != null) {
      asyncEventQueueFactory.setDiskStoreName(diskStoreReference);
    }

    if (diskSynchronous != null) {
      asyncEventQueueFactory.setDiskSynchronous(diskSynchronous);
    }

    if (maximumQueueMemory != null) {
      asyncEventQueueFactory.setMaximumQueueMemory(maximumQueueMemory);
    }

    asyncEventQueueFactory.setParallel(isParallelEventQueue());

    if (orderPolicy != null) {
      Assert.isTrue(isSerialEventQueue(), "Order Policy cannot be used with a Parallel Event Queue.");

      Assert.isTrue(VALID_ORDER_POLICIES.contains(orderPolicy.toUpperCase()), String.format(
        "The value of Order Policy '$1%s' is invalid.", orderPolicy));

      asyncEventQueueFactory.setOrderPolicy(Gateway.OrderPolicy.valueOf(orderPolicy.toUpperCase()));
    }

    if (persistent != null) {
      asyncEventQueueFactory.setPersistent(persistent);
    }

    asyncEventQueue = asyncEventQueueFactory.create(getName(), this.asyncEventListener);
  }
View Full Code Here


    when((mockCache.createAsyncEventQueueFactory())).thenReturn(mockAsynEventQueueFactory);
    return mockCache;
  }

  protected AsyncEventQueueFactory createMockAsyncEventQueueFactory(final String asyncEventQueueId) {
    AsyncEventQueueFactory mockAsyncEventQueueFactory = mock(AsyncEventQueueFactory.class);
    AsyncEventQueue mockAsyncEventQueue = mock(AsyncEventQueue.class);

    when(mockAsyncEventQueue.getId()).thenReturn(asyncEventQueueId);
    when(mockAsyncEventQueueFactory.create(eq(asyncEventQueueId), notNull(AsyncEventListener.class)))
      .thenReturn(mockAsyncEventQueue);

    return mockAsyncEventQueueFactory;
  }
View Full Code Here

    }
  }

  @Test
  public void testConcurrentParallelAsyncEventQueue() throws Exception {
    AsyncEventQueueFactory mockAsyncEventQueueFactory = createMockAsyncEventQueueFactory("000");

    AsyncEventQueueFactoryBean factoryBean = new AsyncEventQueueFactoryBean(
      createMockCacheWithAsyncEventQueueInfrastructure(mockAsyncEventQueueFactory));

    factoryBean.setName("000");
View Full Code Here

    assertEquals("000", eventQueue.getId());
  }

  @Test
  public void testParallelAsyncEventQueue() throws Exception {
    AsyncEventQueueFactory mockAsyncEventQueueFactory = createMockAsyncEventQueueFactory("123");

    AsyncEventQueueFactoryBean factoryBean = new AsyncEventQueueFactoryBean(
      createMockCacheWithAsyncEventQueueInfrastructure(mockAsyncEventQueueFactory));

    factoryBean.setName("123");
View Full Code Here

    assertEquals("123", eventQueue.getId());
  }

  @Test(expected = IllegalArgumentException.class)
  public void testParallelAsyncEventQueueWithOrderPolicy() {
    AsyncEventQueueFactory mockAsyncEventQueueFactory = createMockAsyncEventQueueFactory("456");

    AsyncEventQueueFactoryBean factoryBean = new AsyncEventQueueFactoryBean(
      createMockCacheWithAsyncEventQueueInfrastructure(mockAsyncEventQueueFactory));

    factoryBean.setName("456");
View Full Code Here

    }
  }

  @Test
  public void testSerialAsyncEventQueueWithOrderPolicy() throws Exception {
    AsyncEventQueueFactory mockAsyncEventQueueFatory = createMockAsyncEventQueueFactory("789");

    AsyncEventQueueFactoryBean factoryBean = new AsyncEventQueueFactoryBean(
      createMockCacheWithAsyncEventQueueInfrastructure(mockAsyncEventQueueFatory));

    factoryBean.setName("789");
View Full Code Here

    assertEquals("789", eventQueue.getId());
  }

  @Test
  public void testAsyncEventQueueWithOrderPolicyAndDispatcherThreads() throws Exception {
    AsyncEventQueueFactory mockAsyncEventQueueFatory = createMockAsyncEventQueueFactory("abc");

    AsyncEventQueueFactoryBean factoryBean = new AsyncEventQueueFactoryBean(
      createMockCacheWithAsyncEventQueueInfrastructure(mockAsyncEventQueueFatory));

    factoryBean.setName("abc");
View Full Code Here

    assertEquals("abc", eventQueue.getId());
  }

  @Test
  public void testAsyncEventQueueWithOverflowDiskStoreNoPersistence() throws Exception {
    AsyncEventQueueFactory mockAsyncEventQueueFactory = createMockAsyncEventQueueFactory("123abc");

    AsyncEventQueueFactoryBean factoryBean = new AsyncEventQueueFactoryBean(
      createMockCacheWithAsyncEventQueueInfrastructure(mockAsyncEventQueueFactory));

    factoryBean.setName("123abc");
View Full Code Here

    assertEquals("123abc", evenQueue.getId());
  }

  @Test
  public void testAsyncEventQueueWithDiskSynchronousSetPersistenceUnset() throws Exception {
    AsyncEventQueueFactory mockAsyncEventQueueFactory = createMockAsyncEventQueueFactory("12345");

    AsyncEventQueueFactoryBean factoryBean = new AsyncEventQueueFactoryBean(
      createMockCacheWithAsyncEventQueueInfrastructure(mockAsyncEventQueueFactory));

    factoryBean.setName("12345");
View Full Code Here

TOP

Related Classes of com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueueFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.