use of org.orcid.jaxb.model.record_v2.Group in project google-cloud-java by GoogleCloudPlatform.
the class GroupServiceClientTest method updateGroupExceptionTest.
@Test
@SuppressWarnings("all")
public void updateGroupExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockGroupService.addException(exception);
try {
Group group = Group.newBuilder().build();
client.updateGroup(group);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of org.orcid.jaxb.model.record_v2.Group in project google-cloud-java by GoogleCloudPlatform.
the class GroupServiceClientTest method getGroupTest.
@Test
@SuppressWarnings("all")
public void getGroupTest() {
GroupName name2 = GroupName.create("[PROJECT]", "[GROUP]");
String displayName = "displayName1615086568";
GroupName parentName = GroupName.create("[PROJECT]", "[GROUP]");
String filter = "filter-1274492040";
boolean isCluster = false;
Group expectedResponse = Group.newBuilder().setNameWithGroupName(name2).setDisplayName(displayName).setParentNameWithGroupName(parentName).setFilter(filter).setIsCluster(isCluster).build();
mockGroupService.addResponse(expectedResponse);
GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
Group actualResponse = client.getGroup(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetGroupRequest actualRequest = (GetGroupRequest) actualRequests.get(0);
Assert.assertEquals(name, actualRequest.getNameAsGroupName());
}
use of org.orcid.jaxb.model.record_v2.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);
}
use of org.orcid.jaxb.model.record_v2.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);
}
use of org.orcid.jaxb.model.record_v2.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);
}
}
}
Aggregations