Search in sources :

Example 6 with JmsSender

use of com.hack23.cia.service.component.agent.impl.common.jms.JmsSender in project cia by Hack23.

the class RiksdagenDocumentStatusWorkGeneratorImplITest method generateWorkOrdersSuccessTest.

/**
 * Generate work orders success test.
 * @throws JMSException
 */
@Test
public void generateWorkOrdersSuccessTest() throws JMSException {
    riksdagenDataSourcesWorkGenerator.generateWorkOrders();
    final JmsSender jmsSenderMock = mock(JmsSender.class);
    ReflectionTestUtils.setField(riksdagenDataSourcesWorkGenerator, "jmsSender", jmsSenderMock);
    riksdagenDataSourcesWorkGenerator.generateWorkOrders();
    final ArgumentCaptor<Destination> destCaptor = ArgumentCaptor.forClass(Destination.class);
    final ArgumentCaptor<Serializable> stringCaptor = ArgumentCaptor.forClass(Serializable.class);
    verify(jmsSenderMock, atLeastOnce()).send(destCaptor.capture(), stringCaptor.capture());
    final List<Serializable> capturedStrings = stringCaptor.getAllValues();
    final List<Destination> capturedDestinations = destCaptor.getAllValues();
    assertNotNull(capturedStrings);
    assertNotNull(capturedDestinations);
}
Also used : Destination(javax.jms.Destination) Serializable(java.io.Serializable) JmsSender(com.hack23.cia.service.component.agent.impl.common.jms.JmsSender) Test(org.junit.Test) AbstractServiceComponentAgentFunctionalIntegrationTest(com.hack23.cia.service.component.agent.impl.AbstractServiceComponentAgentFunctionalIntegrationTest)

Example 7 with JmsSender

use of com.hack23.cia.service.component.agent.impl.common.jms.JmsSender in project cia by Hack23.

the class WorldBankCountryWorkGeneratorImplITest method generateWorkOrdersAllDataIsAlreadyImportedSuccessTest.

/**
 * Generate work orders all data is already imported success test.
 *
 * @throws JMSException
 *             the JMS exception
 */
@Test
public void generateWorkOrdersAllDataIsAlreadyImportedSuccessTest() throws JMSException {
    final JmsSender jmsSenderMock = mock(JmsSender.class);
    ReflectionTestUtils.setField(worldBankDataSourcesWorkGenerator, "jmsSender", jmsSenderMock);
    worldBankDataSourcesWorkGenerator.generateWorkOrders();
    final ArgumentCaptor<Destination> destCaptor = ArgumentCaptor.forClass(Destination.class);
    final ArgumentCaptor<Serializable> stringCaptor = ArgumentCaptor.forClass(Serializable.class);
    verify(jmsSenderMock, never()).send(destCaptor.capture(), stringCaptor.capture());
    final List<Serializable> capturedStrings = stringCaptor.getAllValues();
    final List<Destination> capturedDestinations = destCaptor.getAllValues();
    assertNotNull(capturedStrings);
    assertNotNull(capturedDestinations);
}
Also used : Destination(javax.jms.Destination) Serializable(java.io.Serializable) JmsSender(com.hack23.cia.service.component.agent.impl.common.jms.JmsSender) Test(org.junit.Test) AbstractServiceComponentAgentFunctionalIntegrationTest(com.hack23.cia.service.component.agent.impl.AbstractServiceComponentAgentFunctionalIntegrationTest)

Example 8 with JmsSender

use of com.hack23.cia.service.component.agent.impl.common.jms.JmsSender in project cia by Hack23.

the class DataAgentApiTest method importWorldbankDataSuccessTest.

@Test
public void importWorldbankDataSuccessTest() throws JMSException {
    final DataAgentApiImpl dataAgentApiImpl = new DataAgentApiImpl();
    final JmsSender jmsSenderMock = mock(JmsSender.class);
    ReflectionTestUtils.setField(dataAgentApiImpl, "jmsSender", jmsSenderMock);
    dataAgentApiImpl.execute(new DataAgentWorkOrder().withOperation(DataAgentOperation.IMPORT).withTarget(DataAgentTarget.MODEL_EXTERNAL_WORLDBANK));
    final ArgumentCaptor<Destination> destCaptor = ArgumentCaptor.forClass(Destination.class);
    final ArgumentCaptor<Serializable> stringCaptor = ArgumentCaptor.forClass(Serializable.class);
    verify(jmsSenderMock, times(4)).send(destCaptor.capture(), stringCaptor.capture());
    final List<Serializable> capturedStrings = stringCaptor.getAllValues();
    final List<Destination> capturedDestinations = destCaptor.getAllValues();
    assertNotNull(capturedStrings);
    assertNotNull(capturedDestinations);
}
Also used : DataAgentWorkOrder(com.hack23.cia.model.internal.application.data.impl.DataAgentWorkOrder) Destination(javax.jms.Destination) Serializable(java.io.Serializable) JmsSender(com.hack23.cia.service.component.agent.impl.common.jms.JmsSender) Test(org.junit.Test) AbstractUnitTest(com.hack23.cia.testfoundation.AbstractUnitTest)

Example 9 with JmsSender

use of com.hack23.cia.service.component.agent.impl.common.jms.JmsSender in project cia by Hack23.

the class RiksdagenBallotListWorkGeneratorImplITest method generateWorkOrdersWhenAlreadyExistSuccessTest.

/**
 * Generate work orders when already exist success test.
 *
 * @throws JMSException
 *             the JMS exception
 */
@Test
public void generateWorkOrdersWhenAlreadyExistSuccessTest() throws JMSException {
    riksdagenDataSourcesWorkGenerator.generateWorkOrders();
    final JmsSender jmsSenderMock = mock(JmsSender.class);
    ReflectionTestUtils.setField(riksdagenDataSourcesWorkGenerator, "jmsSender", jmsSenderMock);
    riksdagenDataSourcesWorkGenerator.generateWorkOrders();
    final ArgumentCaptor<Destination> destCaptor = ArgumentCaptor.forClass(Destination.class);
    final ArgumentCaptor<Serializable> stringCaptor = ArgumentCaptor.forClass(Serializable.class);
    verify(jmsSenderMock, never()).send(destCaptor.capture(), stringCaptor.capture());
    final List<Serializable> capturedStrings = stringCaptor.getAllValues();
    final List<Destination> capturedDestinations = destCaptor.getAllValues();
    assertNotNull(capturedStrings);
    assertNotNull(capturedDestinations);
}
Also used : Destination(javax.jms.Destination) Serializable(java.io.Serializable) JmsSender(com.hack23.cia.service.component.agent.impl.common.jms.JmsSender) Test(org.junit.Test) AbstractServiceComponentAgentFunctionalIntegrationTest(com.hack23.cia.service.component.agent.impl.AbstractServiceComponentAgentFunctionalIntegrationTest)

Example 10 with JmsSender

use of com.hack23.cia.service.component.agent.impl.common.jms.JmsSender in project cia by Hack23.

the class RiksdagenDocumentListWorkGeneratorImplITest method generateWorkOrdersSuccessTest.

/**
 * Generate work orders success test.
 * @throws JMSException
 */
@Test
public void generateWorkOrdersSuccessTest() throws JMSException {
    riksdagenDataSourcesWorkGenerator.generateWorkOrders();
    final JmsSender jmsSenderMock = mock(JmsSender.class);
    ReflectionTestUtils.setField(riksdagenDataSourcesWorkGenerator, "jmsSender", jmsSenderMock);
    riksdagenDataSourcesWorkGenerator.generateWorkOrders();
    final ArgumentCaptor<Destination> destCaptor = ArgumentCaptor.forClass(Destination.class);
    final ArgumentCaptor<Serializable> stringCaptor = ArgumentCaptor.forClass(Serializable.class);
    verify(jmsSenderMock, atLeastOnce()).send(destCaptor.capture(), stringCaptor.capture());
    final List<Serializable> capturedStrings = stringCaptor.getAllValues();
    final List<Destination> capturedDestinations = destCaptor.getAllValues();
    assertNotNull(capturedStrings);
    assertNotNull(capturedDestinations);
}
Also used : Destination(javax.jms.Destination) Serializable(java.io.Serializable) JmsSender(com.hack23.cia.service.component.agent.impl.common.jms.JmsSender) Test(org.junit.Test) AbstractServiceComponentAgentFunctionalIntegrationTest(com.hack23.cia.service.component.agent.impl.AbstractServiceComponentAgentFunctionalIntegrationTest)

Aggregations

JmsSender (com.hack23.cia.service.component.agent.impl.common.jms.JmsSender)13 Serializable (java.io.Serializable)13 Destination (javax.jms.Destination)13 Test (org.junit.Test)13 AbstractServiceComponentAgentFunctionalIntegrationTest (com.hack23.cia.service.component.agent.impl.AbstractServiceComponentAgentFunctionalIntegrationTest)11 DataAgentWorkOrder (com.hack23.cia.model.internal.application.data.impl.DataAgentWorkOrder)4 AbstractUnitTest (com.hack23.cia.testfoundation.AbstractUnitTest)2