Search in sources :

Example 16 with Group

use of com.google.monitoring.v3.Group in project openstack4j by ContainX.

the class KeystoneGroupServiceTests method group_get_byName_byDomainId_NotExist_Test.

public void group_get_byName_byDomainId_NotExist_Test() throws Exception {
    respondWith(JSON_GROUPS_EMPTY_LIST);
    Group group = osv3().identity().groups().getByName(GROUP_NAME, GROUP_DOMAIN_ID);
    assertNull(group);
}
Also used : Group(org.openstack4j.model.identity.v3.Group)

Example 17 with Group

use of com.google.monitoring.v3.Group in project openstack4j by ContainX.

the class KeystoneGroupServiceTests method group_crud_test.

// ------------ Group Tests ------------
// The following tests are to verify the update() method of the GroupService
// using HTTP PATCH, which is not supported by betamax.
// Find more tests in KeystoneGroupServiceSpec in core-integration-test
// module.
public void group_crud_test() throws Exception {
    Group group = Builders.group().name(GROUP_NAME).description(GROUP_DESCRIPTION).domainId(GROUP_DOMAIN_ID).build();
    respondWith(JSON_GROUPS_CREATE);
    Group newGroup = osv3().identity().groups().create(group);
    assertEquals(newGroup.getName(), GROUP_NAME);
    assertEquals(newGroup.getDomainId(), GROUP_DOMAIN_ID);
    assertEquals(newGroup.getDescription(), GROUP_DESCRIPTION);
    String GROUP_ID = newGroup.getId();
    respondWith(JSON_GROUPS_GET_BYID);
    Group group_setToUpdate = osv3().identity().groups().get(GROUP_ID);
    respondWith(JSON_GROUPS_UPDATE);
    Group updatedGroup = osv3.identity().groups().update(group_setToUpdate.toBuilder().description(GROUP_DESCRIPTION_UPDATE).build());
    assertEquals(updatedGroup.getId(), GROUP_ID);
    assertEquals(updatedGroup.getName(), GROUP_NAME);
    assertEquals(updatedGroup.getDomainId(), GROUP_DOMAIN_ID);
    assertEquals(updatedGroup.getDescription(), GROUP_DESCRIPTION_UPDATE);
}
Also used : Group(org.openstack4j.model.identity.v3.Group)

Example 18 with Group

use of com.google.monitoring.v3.Group in project ORCID-Source by ORCID.

the class Api2_0_rc4_LastModifiedDatesHelper method calculateLastModified.

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

Example 19 with Group

use of com.google.monitoring.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)

Example 20 with Group

use of com.google.monitoring.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)

Aggregations

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