Search in sources :

Example 16 with Aggregation

use of org.nhindirect.monitor.dao.entity.Aggregation in project nhin-d by DirectProject.

the class AggregationDAOImpl_getAggregationKeysTest method testGetAggregationKeys_multipleEntriesInRepository_assertKeysRetrieved.

@Test
public void testGetAggregationKeys_multipleEntriesInRepository_assertKeysRetrieved() throws Exception {
    final Aggregation insert = new Aggregation();
    insert.setExchangeBlob(new byte[] { 0, 3, 2 });
    insert.setId("12345");
    insert.setVersion(0);
    notifDao.addUpdateAggregation(insert);
    final Aggregation insert2 = new Aggregation();
    insert2.setExchangeBlob(new byte[] { 0, 3, 2 });
    insert2.setId("123456");
    insert2.setVersion(0);
    notifDao.addUpdateAggregation(insert2);
    final List<String> keys = notifDao.getAggregationKeys();
    assertEquals(2, keys.size());
    final Iterator<String> iter = keys.iterator();
    assertEquals("12345", iter.next());
    assertEquals("123456", iter.next());
}
Also used : Aggregation(org.nhindirect.monitor.dao.entity.Aggregation) Test(org.junit.Test)

Example 17 with Aggregation

use of org.nhindirect.monitor.dao.entity.Aggregation in project nhin-d by DirectProject.

the class AggregationDAOImpl_getAggregationTest method testGetAggregation_emptyRepository_assertNoAggregation.

@Test
public void testGetAggregation_emptyRepository_assertNoAggregation() throws Exception {
    final Aggregation aggr = notifDao.getAggregation("doenst matter");
    assertNull(aggr);
}
Also used : Aggregation(org.nhindirect.monitor.dao.entity.Aggregation) Test(org.junit.Test)

Example 18 with Aggregation

use of org.nhindirect.monitor.dao.entity.Aggregation in project nhin-d by DirectProject.

the class AggregationDAOImpl_getAggregationTest method testGetAggregation_nonEmptyRepository_keyExists_assertAggregationFound.

@Test
public void testGetAggregation_nonEmptyRepository_keyExists_assertAggregationFound() throws Exception {
    final Aggregation insert = new Aggregation();
    insert.setExchangeBlob(new byte[] { 0, 3, 2 });
    insert.setId("12345");
    insert.setVersion(0);
    notifDao.addUpdateAggregation(insert);
    final Aggregation aggr = notifDao.getAggregation("12345");
    assertNotNull(aggr);
    assertEquals(aggr, insert);
}
Also used : Aggregation(org.nhindirect.monitor.dao.entity.Aggregation) Test(org.junit.Test)

Example 19 with Aggregation

use of org.nhindirect.monitor.dao.entity.Aggregation in project nhin-d by DirectProject.

the class AggregationDAOImpl_getAggregationTest method testGetAggregation_nonEmptyRepository_keyDoesntExist_assertNoAggregation.

@Test
public void testGetAggregation_nonEmptyRepository_keyDoesntExist_assertNoAggregation() throws Exception {
    final Aggregation insert = new Aggregation();
    insert.setExchangeBlob(new byte[] { 0, 3, 2 });
    insert.setId("12345");
    insert.setVersion(0);
    notifDao.addUpdateAggregation(insert);
    final Aggregation aggr = notifDao.getAggregation("doenst matter");
    assertNull(aggr);
}
Also used : Aggregation(org.nhindirect.monitor.dao.entity.Aggregation) Test(org.junit.Test)

Example 20 with Aggregation

use of org.nhindirect.monitor.dao.entity.Aggregation in project nhin-d by DirectProject.

the class AggregationDAOImpl_removeAggregationTest method testRemoveAggregation_emptyRepository_assertExcpetion.

@Test
public void testRemoveAggregation_emptyRepository_assertExcpetion() throws Exception {
    final Aggregation remove = new Aggregation();
    remove.setExchangeBlob(new byte[] { 0, 3, 2 });
    remove.setId("12345");
    remove.setVersion(0);
    boolean exceptionOccured = false;
    try {
        notifDao.removeAggregation(remove, "12345");
    } catch (AggregationDAOException e) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : Aggregation(org.nhindirect.monitor.dao.entity.Aggregation) AggregationDAOException(org.nhindirect.monitor.dao.AggregationDAOException) Test(org.junit.Test)

Aggregations

Aggregation (org.nhindirect.monitor.dao.entity.Aggregation)25 Test (org.junit.Test)20 AggregationDAOException (org.nhindirect.monitor.dao.AggregationDAOException)7 AggregationCompleted (org.nhindirect.monitor.dao.entity.AggregationCompleted)6 OptimisticLockException (javax.persistence.OptimisticLockException)3 AggregationVersionException (org.nhindirect.monitor.dao.AggregationVersionException)3 EntityManager (javax.persistence.EntityManager)2 AggregationDAOImpl (org.nhindirect.monitor.dao.impl.AggregationDAOImpl)2 Transactional (org.springframework.transaction.annotation.Transactional)2 Exchange (org.apache.camel.Exchange)1 Buffer (org.fusesource.hawtbuf.Buffer)1