use of com.hack23.cia.model.external.riksdagen.personlista.impl.PersonElement in project cia by Hack23.
the class RiksdagenPersonApiImplITest method getPersonMixedTest.
/**
* Gets the person mixed test.
*
* @return the person mixed test
* @throws Exception
* the exception
*/
@Test
public void getPersonMixedTest() throws Exception {
final PersonContainerElement personList = riksdagenApi.getPersonList();
assertNotNull(personList);
assertTrue(personList.getPerson().size() >= 1291);
final PersonElement person = personList.getPerson().get(0);
assertNotNull("Missing id : " + person.getLastName(), person.getId());
final PersonData personDetail = riksdagenApi.getPerson(person.getId());
assertNotNull("Missing personDetail : " + person.getLastName(), personDetail);
assertNotNull("Missing personDetail.person : " + person.getLastName(), personDetail.getLastName());
assertNotNull("Missing personDetail.person.id : " + person.getLastName(), personDetail.getId());
assertNotNull(personDetail.getFirstName());
assertNotNull(personDetail.getLastName());
}
use of com.hack23.cia.model.external.riksdagen.personlista.impl.PersonElement in project cia by Hack23.
the class RiksdagenPersonsWorkGeneratorImpl method generateWorkOrders.
@Override
public void generateWorkOrders() {
try {
final List<PersonElement> personList = riksdagenApi.getPersonList().getPerson();
final Map<String, String> currentSaved = getImportService().getPersonMap();
for (final PersonElement personElement : personList) {
if (!currentSaved.containsKey(personElement.getId())) {
LOGGER.info("Send Load Order:{}", personElement.getPersonUrlXml());
getJmsSender().send(personElementWorkdestination, personElement);
currentSaved.put(personElement.getId(), personElement.getId());
}
}
for (final String personId : readMissingPersonList()) {
if (!currentSaved.containsKey(personId)) {
LOGGER.info("Send Load Order:{}{}", "https://data.riksdagen.se/person/", personId);
getJmsSender().send(personElementWorkdestination, new PersonElement().withId(personId));
}
}
} catch (final DataFailureException exception) {
LOGGER.warn("Problem during generate work orders", exception);
}
}
use of com.hack23.cia.model.external.riksdagen.personlista.impl.PersonElement in project cia by Hack23.
the class RiksdagenPersonApiImplITest method getPersonTest.
/**
* Gets the person test.
*
* @return the person test
* @throws Exception
* the exception
*/
@Test
public void getPersonTest() throws Exception {
final PersonData personElement = riksdagenApi.getPerson("0389619060499");
assertNotNull(personElement);
assertEquals("Bohman", personElement.getLastName());
}
use of com.hack23.cia.model.external.riksdagen.personlista.impl.PersonElement in project cia by Hack23.
the class RiksdagenPersonElementWorkConsumerImplITest method onMessageSuccessTest.
/**
* On message success test.
*
* @throws JMSException
* the JMS exception
*/
@Test
@Transactional
public void onMessageSuccessTest() throws JMSException {
final ObjectMessage message = mock(ObjectMessage.class);
when(message.getObject()).thenReturn(new PersonElement().withId("0542160909628"));
messsageListener.onMessage(message);
verify(message, atLeastOnce()).getObject();
}
Aggregations