Search in sources :

Example 11 with ConcurrentJPAAggregationRepository

use of org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository in project nhin-d by DirectProject.

the class ConcurrentJPAAggregationRepository_getKeysTest method testGetKeys_multipleEntries_assertMultipleKeys.

@Test
public void testGetKeys_multipleEntries_assertMultipleKeys() {
    final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository(notifDao);
    final Tx tx1 = TestUtils.makeMessage(TxMessageType.IMF, "12345", "", "me@test.com", "you@test.com", "", "", "");
    final Exchange exchange1 = new DefaultExchange(context);
    exchange1.getIn().setBody(tx1);
    repo.add(context, "12345", exchange1);
    final Tx tx2 = TestUtils.makeMessage(TxMessageType.IMF, "123456", "", "me@test.com", "you@test.com", "", "", "");
    final Exchange exchange2 = new DefaultExchange(context);
    exchange2.getIn().setBody(tx2);
    repo.add(context, "123456", exchange2);
    final Set<String> keys = repo.getKeys();
    assertEquals(2, keys.size());
    Iterator<String> iter = keys.iterator();
    assertEquals("12345", iter.next());
    assertEquals("123456", iter.next());
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) Tx(org.nhindirect.common.tx.model.Tx) ConcurrentJPAAggregationRepository(org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository) Test(org.junit.Test)

Example 12 with ConcurrentJPAAggregationRepository

use of org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository in project nhin-d by DirectProject.

the class ConcurrentJPAAggregationRepository_getKeysTest method testGetKeys_singleEntry_assertSingleKey.

@Test
public void testGetKeys_singleEntry_assertSingleKey() {
    final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository(notifDao);
    final Tx tx = TestUtils.makeMessage(TxMessageType.IMF, "12345", "", "me@test.com", "you@test.com", "", "", "");
    final Exchange exchange = new DefaultExchange(context);
    exchange.getIn().setBody(tx);
    repo.add(context, "12345", exchange);
    final Set<String> keys = repo.getKeys();
    assertEquals(1, keys.size());
    assertEquals("12345", keys.iterator().next());
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) Tx(org.nhindirect.common.tx.model.Tx) ConcurrentJPAAggregationRepository(org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository) Test(org.junit.Test)

Example 13 with ConcurrentJPAAggregationRepository

use of org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository in project nhin-d by DirectProject.

the class ConcurrentJPAAggregationRepository_getSetPropertiesTest method testGetSetMaxDeliveries.

@Test
public void testGetSetMaxDeliveries() {
    ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository();
    repo.setMaximumRedeliveries(10);
    assertEquals(10, repo.getMaximumRedeliveries());
    repo.setMaximumRedeliveries(100);
    assertEquals(100, repo.getMaximumRedeliveries());
}
Also used : ConcurrentJPAAggregationRepository(org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository) Test(org.junit.Test)

Example 14 with ConcurrentJPAAggregationRepository

use of org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository in project nhin-d by DirectProject.

the class ConcurrentJPAAggregationRepository_getSetPropertiesTest method testGetSetRecoveryInterval.

@Test
public void testGetSetRecoveryInterval() {
    ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository();
    assertEquals(5000, repo.getRecoveryIntervalInMillis());
    repo.setRecoveryInterval(10);
    assertEquals(10, repo.getRecoveryIntervalInMillis());
    repo.setRecoveryInterval(10, TimeUnit.SECONDS);
    assertEquals(10000, repo.getRecoveryIntervalInMillis());
}
Also used : ConcurrentJPAAggregationRepository(org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository) Test(org.junit.Test)

Example 15 with ConcurrentJPAAggregationRepository

use of org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository in project nhin-d by DirectProject.

the class ConcurrentJPAAggregationRepository_getSetPropertiesTest method testGetSetUseRecover.

@Test
public void testGetSetUseRecover() {
    ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository();
    repo.setUseRecovery(true);
    assertTrue(repo.isUseRecovery());
    repo.setUseRecovery(false);
    assertFalse(repo.isUseRecovery());
}
Also used : ConcurrentJPAAggregationRepository(org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository) Test(org.junit.Test)

Aggregations

ConcurrentJPAAggregationRepository (org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository)33 Test (org.junit.Test)32 Exchange (org.apache.camel.Exchange)15 DefaultExchange (org.apache.camel.impl.DefaultExchange)15 Tx (org.nhindirect.common.tx.model.Tx)15 AggregationDAO (org.nhindirect.monitor.dao.AggregationDAO)9 Collection (java.util.Collection)4