Search in sources :

Example 16 with Group

use of org.openstack4j.model.identity.v3.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());
}
Also used : Group(org.openstack4j.model.identity.v3.Group) GroupProducer(org.apache.camel.component.openstack.keystone.producer.GroupProducer) ArrayList(java.util.ArrayList) Before(org.junit.Before)

Example 17 with Group

use of org.openstack4j.model.identity.v3.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());
}
Also used : Group(org.openstack4j.model.identity.v3.Group) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 18 with Group

use of org.openstack4j.model.identity.v3.Group in project ORCID-Source by ORCID.

the class Api2_0_rc3_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(GroupsContainer groupsContainerRc3) {
    if (groupsContainerRc3.retrieveGroups() != null && !groupsContainerRc3.retrieveGroups().isEmpty()) {
        List<? extends Group> groupsRc1 = new ArrayList<>(groupsContainerRc3.retrieveGroups());
        List<org.orcid.jaxb.model.record_rc3.Group> groupsRc3 = new ArrayList<>(groupsContainerRc3.retrieveGroups());
        if (groupsRc1.get(0).getActivities() != null && !groupsRc1.get(0).getActivities().isEmpty()) {
            LastModifiedDate latest = null;
            for (Group group : groupsRc3) {
                calculateLastModified(group);
                if (group.getLastModifiedDate() != null && group.getLastModifiedDate().after(latest)) {
                    latest = group.getLastModifiedDate();
                }
            }
            groupsContainerRc3.setLastModifiedDate(latest);
        }
    }
}
Also used : Group(org.orcid.jaxb.model.record_rc3.Group) LastModifiedDate(org.orcid.jaxb.model.common_rc3.LastModifiedDate) ArrayList(java.util.ArrayList)

Example 19 with Group

use of org.openstack4j.model.identity.v3.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;
}
Also used : Group(org.orcid.jaxb.model.record_rc2.Group) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) ArrayList(java.util.ArrayList) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Date(java.util.Date)

Example 20 with Group

use of org.openstack4j.model.identity.v3.Group in project ORCID-Source by ORCID.

the class PublicAPISecurityManagerV2Test method setVisibility.

private void setVisibility(GroupsContainer container, Visibility... vs) {
    assertEquals(container.retrieveGroups().size(), vs.length);
    int idx = 0;
    for (Group g : container.retrieveGroups()) {
        // Every group have just one element
        assertEquals(1, g.getActivities().size());
        for (Filterable f : g.getActivities()) {
            f.setVisibility(vs[idx++]);
        }
    }
}
Also used : WorkGroup(org.orcid.jaxb.model.record.summary_v2.WorkGroup) PeerReviewGroup(org.orcid.jaxb.model.record.summary_v2.PeerReviewGroup) FundingGroup(org.orcid.jaxb.model.record.summary_v2.FundingGroup) Group(org.orcid.jaxb.model.record_v2.Group) Filterable(org.orcid.jaxb.model.common_v2.Filterable)

Aggregations

Group (org.gluu.oxtrust.model.scim2.Group)9 GluuGroup (org.gluu.oxtrust.model.GluuGroup)8 DuplicateEntryException (org.gluu.site.ldap.exception.DuplicateEntryException)8 Group (org.openstack4j.model.identity.v3.Group)8 EntryPersistenceException (org.gluu.site.ldap.persistence.exception.EntryPersistenceException)7 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)6 Group (com.google.monitoring.v3.Group)5 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)4 URI (java.net.URI)4 DefaultValue (javax.ws.rs.DefaultValue)4 HeaderParam (javax.ws.rs.HeaderParam)4 Produces (javax.ws.rs.Produces)4 Response (javax.ws.rs.core.Response)4 ListResponse (org.gluu.oxtrust.model.scim2.ListResponse)4 VirtualListViewResponse (org.xdi.ldap.model.VirtualListViewResponse)4 GroupName (com.google.monitoring.v3.GroupName)3 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)3 Date (java.util.Date)3 ApiException (com.google.api.gax.grpc.ApiException)2