use of org.orcid.jaxb.model.record_rc3.Group in project ORCID-Source by ORCID.
the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.
public static Date calculateLatest(GroupsContainer groupsContainerRc2) {
Date latestGrp = null;
if (groupsContainerRc2.retrieveGroups() != null && !groupsContainerRc2.retrieveGroups().isEmpty()) {
List<? extends Group> groupsRc1 = new ArrayList<>(groupsContainerRc2.retrieveGroups());
List<org.orcid.jaxb.model.record_rc2.Group> groupsRc2 = new ArrayList<>(groupsContainerRc2.retrieveGroups());
if (groupsRc1.get(0).getActivities() != null && !groupsRc1.get(0).getActivities().isEmpty()) {
for (int index = 0; index < groupsRc2.size(); index++) {
latestGrp = calculateLatest(groupsRc2.get(index));
}
groupsContainerRc2.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendarNoTimeZoneNoMillis(latestGrp)));
}
}
return latestGrp;
}
use of org.orcid.jaxb.model.record_rc3.Group in project camel by apache.
the class GroupProducer method doGet.
private void doGet(Exchange exchange) {
final Message msg = exchange.getIn();
final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(KeystoneConstants.GROUP_ID, String.class), String.class);
ObjectHelper.notEmpty(id, "Group ID");
final Group result = osV3Client.identity().groups().get(id);
msg.setBody(result);
}
use of org.orcid.jaxb.model.record_rc3.Group in project camel by apache.
the class GroupProducer method doCreate.
private void doCreate(Exchange exchange) {
final Group in = messageToGroup(exchange.getIn());
final Group out = osV3Client.identity().groups().create(in);
exchange.getIn().setBody(out);
}
use of org.orcid.jaxb.model.record_rc3.Group in project camel by apache.
the class GroupProducerTest method setUp.
@Before
public void setUp() {
producer = new GroupProducer(endpoint, client);
when(groupService.create(any(Group.class))).thenReturn(testOSgroup);
when(groupService.get(anyString())).thenReturn(testOSgroup);
List<Group> getAllList = new ArrayList<>();
getAllList.add(testOSgroup);
getAllList.add(testOSgroup);
doReturn(getAllList).when(groupService).list();
dummyGroup = createGroup();
when(testOSgroup.getName()).thenReturn(dummyGroup.getName());
when(testOSgroup.getDescription()).thenReturn(dummyGroup.getDescription());
}
use of org.orcid.jaxb.model.record_rc3.Group in project camel by apache.
the class GroupProducerTest method updateTest.
@Test
public void updateTest() throws Exception {
final String id = "myID";
msg.setHeader(OpenstackConstants.OPERATION, OpenstackConstants.UPDATE);
final String newName = "newName";
when(testOSgroup.getId()).thenReturn(id);
when(testOSgroup.getName()).thenReturn(newName);
when(testOSgroup.getDescription()).thenReturn("desc");
when(groupService.update(any(Group.class))).thenReturn(testOSgroup);
msg.setBody(testOSgroup);
producer.process(exchange);
ArgumentCaptor<Group> captor = ArgumentCaptor.forClass(Group.class);
verify(groupService).update(captor.capture());
assertEqualsGroup(testOSgroup, captor.getValue());
assertNotNull(captor.getValue().getId());
assertEquals(newName, msg.getBody(Group.class).getName());
}
Aggregations