Search in sources :

Example 1 with GroupContact

use of com.linkedin.restli.examples.groups.api.GroupContact in project rest.li by linkedin.

the class TestGroupsRequestBuilders method requestContactsBuilderDataProviderAction.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestContactsBuilderDataProviderAction")
private static Object[][] requestContactsBuilderDataProviderAction() {
    // Sample URIs:
    // "groups/42/contacts?action=spamContacts"
    // "groups/42/contacts?action=spamContacts"
    final Map<String, String> queryParamsMap = new HashMap<>();
    queryParamsMap.put("action", "spamContacts");
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "groups/42/contacts", null, queryParamsMap, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "groups/42/contacts", null, queryParamsMap, null);
    return new Object[][] { { new RootBuilderWrapper<Integer, GroupContact>(new ContactsBuilders()), uriDetails1 }, { new RootBuilderWrapper<Integer, GroupContact>(new ContactsBuilders()), uriDetails2 }, { new RootBuilderWrapper<Integer, GroupContact>(new ContactsRequestBuilders()), uriDetails1 }, { new RootBuilderWrapper<Integer, GroupContact>(new ContactsRequestBuilders()), uriDetails2 } };
}
Also used : URIDetails(com.linkedin.restli.internal.testutils.URIDetails) HashMap(java.util.HashMap) ContactsRequestBuilders(com.linkedin.restli.examples.groups.client.ContactsRequestBuilders) ContactsBuilders(com.linkedin.restli.examples.groups.client.ContactsBuilders) GroupContact(com.linkedin.restli.examples.groups.api.GroupContact) DataProvider(org.testng.annotations.DataProvider)

Example 2 with GroupContact

use of com.linkedin.restli.examples.groups.api.GroupContact in project rest.li by linkedin.

the class TestGroupsRequestBuilders method testSubResourceCreate.

@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestContactsBuilderDataProviderNonEntity")
public void testSubResourceCreate(URIDetails expectedURIDetails) throws IOException, RestException {
    GroupContact contact = new GroupContact();
    contact.setContactID(3);
    contact.setGroupID(1);
    contact.setMemberID(3);
    contact.setFirstName("Laura");
    contact.setLastName("Smith");
    contact.setIsPreapproved(true);
    contact.setIsInvited(true);
    Request<EmptyRecord> oldRequest = new ContactsBuilders().create().groupIdKey(1).input(contact).build();
    checkRequestBuilder(oldRequest, ResourceMethod.CREATE, CreateResponseDecoder.class, expectedURIDetails, contact);
}
Also used : EmptyRecord(com.linkedin.restli.common.EmptyRecord) ContactsBuilders(com.linkedin.restli.examples.groups.client.ContactsBuilders) GroupContact(com.linkedin.restli.examples.groups.api.GroupContact) Test(org.testng.annotations.Test)

Example 3 with GroupContact

use of com.linkedin.restli.examples.groups.api.GroupContact in project rest.li by linkedin.

the class TestGroupsRequestBuilders method requestSpecialBuilderDataProvider.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestSpecialBuilderDataProvider")
private static Object[][] requestSpecialBuilderDataProvider() {
    // Sample URIs:
    // "SpecialGroups/42"
    // "SpecialGroups/1/contacts/42"
    // "SpecialGroups/42"
    // "SpecialGroups/1/contacts/42"
    final URIDetails uriDetailsV1_1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "SpecialGroups/42", null, null, null);
    final URIDetails uriDetailsV1_2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "SpecialGroups/1/contacts/42", null, null, null);
    final URIDetails uriDetailsV2_1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "SpecialGroups/42", null, null, null);
    final URIDetails uriDetailsV2_2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "SpecialGroups/1/contacts/42", null, null, null);
    return new Object[][] { { new RootBuilderWrapper<Integer, Group>(new GroupsBuilders("SpecialGroups")), new RootBuilderWrapper<Integer, GroupContact>(new ContactsBuilders("SpecialGroups")), uriDetailsV1_1, uriDetailsV1_2 }, { new RootBuilderWrapper<Integer, Group>(new GroupsBuilders("SpecialGroups")), new RootBuilderWrapper<Integer, GroupContact>(new ContactsBuilders("SpecialGroups")), uriDetailsV2_1, uriDetailsV2_2 }, { new RootBuilderWrapper<Integer, Group>(new GroupsRequestBuilders("SpecialGroups")), new RootBuilderWrapper<Integer, GroupContact>(new ContactsRequestBuilders("SpecialGroups")), uriDetailsV1_1, uriDetailsV1_2 }, { new RootBuilderWrapper<Integer, Group>(new GroupsRequestBuilders("SpecialGroups")), new RootBuilderWrapper<Integer, GroupContact>(new ContactsRequestBuilders("SpecialGroups")), uriDetailsV2_1, uriDetailsV2_2 } };
}
Also used : Group(com.linkedin.restli.examples.groups.api.Group) URIDetails(com.linkedin.restli.internal.testutils.URIDetails) GroupsRequestBuilders(com.linkedin.restli.examples.groups.client.GroupsRequestBuilders) GroupsBuilders(com.linkedin.restli.examples.groups.client.GroupsBuilders) ContactsRequestBuilders(com.linkedin.restli.examples.groups.client.ContactsRequestBuilders) ContactsBuilders(com.linkedin.restli.examples.groups.client.ContactsBuilders) GroupContact(com.linkedin.restli.examples.groups.api.GroupContact) DataProvider(org.testng.annotations.DataProvider)

Example 4 with GroupContact

use of com.linkedin.restli.examples.groups.api.GroupContact in project rest.li by linkedin.

the class TestGroupsRequestBuilders method requestContactsBuilderDataProviderEntity.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestContactsBuilderDataProviderEntity")
private static Object[][] requestContactsBuilderDataProviderEntity() {
    // Sample URIs:
    // "groups/1/contacts/1"
    // "groups/1/contacts/1"
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "groups/1/contacts/1", null, null, null);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "groups/1/contacts/1", null, null, null);
    return new Object[][] { { new RootBuilderWrapper<Integer, GroupContact>(new ContactsBuilders()), uriDetails1 }, { new RootBuilderWrapper<Integer, GroupContact>(new ContactsBuilders()), uriDetails2 }, { new RootBuilderWrapper<Integer, GroupContact>(new ContactsRequestBuilders()), uriDetails1 }, { new RootBuilderWrapper<Integer, GroupContact>(new ContactsRequestBuilders()), uriDetails2 } };
}
Also used : URIDetails(com.linkedin.restli.internal.testutils.URIDetails) ContactsRequestBuilders(com.linkedin.restli.examples.groups.client.ContactsRequestBuilders) ContactsBuilders(com.linkedin.restli.examples.groups.client.ContactsBuilders) GroupContact(com.linkedin.restli.examples.groups.api.GroupContact) DataProvider(org.testng.annotations.DataProvider)

Example 5 with GroupContact

use of com.linkedin.restli.examples.groups.api.GroupContact in project rest.li by linkedin.

the class TestGroupsRequestBuilders method requestContactsBuilderDataProviderEntityWithFields.

@DataProvider(name = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestContactsBuilderDataProviderEntityWithFields")
private static Object[][] requestContactsBuilderDataProviderEntityWithFields() {
    // Sample URIs:
    // "groups/1/contacts/1?fields=lastName,firstName"
    // "groups/1/contacts/1?fields=lastName,firstName"
    final Set<String> fieldSet = new HashSet<>();
    fieldSet.add("lastName");
    fieldSet.add("firstName");
    final URIDetails uriDetails1 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), "groups/1/contacts/1", null, null, fieldSet);
    final URIDetails uriDetails2 = new URIDetails(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), "groups/1/contacts/1", null, null, fieldSet);
    return new Object[][] { { new RootBuilderWrapper<Integer, GroupContact>(new ContactsBuilders()), uriDetails1 }, { new RootBuilderWrapper<Integer, GroupContact>(new ContactsBuilders()), uriDetails2 }, { new RootBuilderWrapper<Integer, GroupContact>(new ContactsRequestBuilders()), uriDetails1 }, { new RootBuilderWrapper<Integer, GroupContact>(new ContactsRequestBuilders()), uriDetails2 } };
}
Also used : URIDetails(com.linkedin.restli.internal.testutils.URIDetails) ContactsRequestBuilders(com.linkedin.restli.examples.groups.client.ContactsRequestBuilders) ContactsBuilders(com.linkedin.restli.examples.groups.client.ContactsBuilders) HashSet(java.util.HashSet) GroupContact(com.linkedin.restli.examples.groups.api.GroupContact) DataProvider(org.testng.annotations.DataProvider)

Aggregations

GroupContact (com.linkedin.restli.examples.groups.api.GroupContact)7 ContactsBuilders (com.linkedin.restli.examples.groups.client.ContactsBuilders)5 ContactsRequestBuilders (com.linkedin.restli.examples.groups.client.ContactsRequestBuilders)5 URIDetails (com.linkedin.restli.internal.testutils.URIDetails)4 DataProvider (org.testng.annotations.DataProvider)4 Test (org.testng.annotations.Test)3 EmptyRecord (com.linkedin.restli.common.EmptyRecord)2 Group (com.linkedin.restli.examples.groups.api.Group)1 GroupsBuilders (com.linkedin.restli.examples.groups.client.GroupsBuilders)1 GroupsRequestBuilders (com.linkedin.restli.examples.groups.client.GroupsRequestBuilders)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1