Search in sources :

Example 1 with DataAgentWorkOrder

use of com.hack23.cia.model.internal.application.data.impl.DataAgentWorkOrder in project cia by Hack23.

the class DataAgentApiITest method importWorldbankDataSuccessTest.

@Test
public void importWorldbankDataSuccessTest() throws JMSException {
    final JmsSender jmsSenderMock = mock(JmsSender.class);
    ReflectionTestUtils.setField(dataAgentApi, "jmsSender", jmsSenderMock);
    dataAgentApi.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);
// waitUntilQueueIsEmpty("worldbank");
}
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) AbstractServiceComponentAgentFunctionalIntegrationTest(com.hack23.cia.service.component.agent.impl.AbstractServiceComponentAgentFunctionalIntegrationTest)

Example 2 with DataAgentWorkOrder

use of com.hack23.cia.model.internal.application.data.impl.DataAgentWorkOrder in project cia by Hack23.

the class DataAgentApiITest method importRiksdagenDataSuccessTest.

/**
 * Import riksdagen data success test.
 * @throws JMSException
 */
@Test
public void importRiksdagenDataSuccessTest() throws JMSException {
    final JmsSender jmsSenderMock = mock(JmsSender.class);
    ReflectionTestUtils.setField(dataAgentApi, "jmsSender", jmsSenderMock);
    dataAgentApi.execute(new DataAgentWorkOrder().withOperation(DataAgentOperation.IMPORT).withTarget(DataAgentTarget.MODEL_EXTERNAL_RIKSDAGEN));
    final ArgumentCaptor<Destination> destCaptor = ArgumentCaptor.forClass(Destination.class);
    final ArgumentCaptor<Serializable> stringCaptor = ArgumentCaptor.forClass(Serializable.class);
    verify(jmsSenderMock, times(7)).send(destCaptor.capture(), stringCaptor.capture());
    final List<Serializable> capturedStrings = stringCaptor.getAllValues();
    final List<Destination> capturedDestinations = destCaptor.getAllValues();
    assertNotNull(capturedStrings);
    assertNotNull(capturedDestinations);
// waitUntilQueueIsEmpty("riksdagen");
}
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) AbstractServiceComponentAgentFunctionalIntegrationTest(com.hack23.cia.service.component.agent.impl.AbstractServiceComponentAgentFunctionalIntegrationTest)

Example 3 with DataAgentWorkOrder

use of com.hack23.cia.model.internal.application.data.impl.DataAgentWorkOrder in project cia by Hack23.

the class DataAgentApiTest method importRiksdagenDataSuccessTest.

@Test
public void importRiksdagenDataSuccessTest() 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_RIKSDAGEN));
    final ArgumentCaptor<Destination> destCaptor = ArgumentCaptor.forClass(Destination.class);
    final ArgumentCaptor<Serializable> stringCaptor = ArgumentCaptor.forClass(Serializable.class);
    verify(jmsSenderMock, times(7)).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 4 with DataAgentWorkOrder

use of com.hack23.cia.model.internal.application.data.impl.DataAgentWorkOrder in project cia by Hack23.

the class StartAgentClickListener method buttonClick.

@Override
public void buttonClick(final ClickEvent event) {
    final DataAgentWorkOrder dataAgentWorkOrder = new DataAgentWorkOrder();
    dataAgentWorkOrder.setTarget(dataAgentTarget);
    dataAgentWorkOrder.setOperation(dataAgentOperation);
    LOGGER.info(LOG_MSG_EXECUTE_WORKORDER, dataAgentWorkOrder);
    ApplicationMangerAccess.getApplicationManager().getAgentContainer().execute(dataAgentWorkOrder);
}
Also used : DataAgentWorkOrder(com.hack23.cia.model.internal.application.data.impl.DataAgentWorkOrder)

Example 5 with DataAgentWorkOrder

use of com.hack23.cia.model.internal.application.data.impl.DataAgentWorkOrder 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)

Aggregations

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