Search in sources :

Example 1 with CustomLong

use of com.linkedin.restli.server.custom.types.CustomLong in project rest.li by linkedin.

the class TestRestLiMethodInvocation method testCustomTypeParametersCustomLong.

@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "customLongParam")
public void testCustomTypeParametersCustomLong(ProtocolVersion version, String uri) throws Exception {
    ResourceModel repliesResourceModel = buildResourceModel(RepliesCollectionResource.class);
    ResourceMethodDescriptor methodDescriptor = repliesResourceModel.findFinderMethod("customLong");
    RepliesCollectionResource repliesResource = getMockResource(RepliesCollectionResource.class);
    repliesResource.customLong(new CustomLong(100L));
    EasyMock.expectLastCall().andReturn(null).once();
    checkInvocation(repliesResource, methodDescriptor, "GET", version, uri);
}
Also used : PromiseRepliesCollectionResource(com.linkedin.restli.server.twitter.PromiseRepliesCollectionResource) RepliesCollectionResource(com.linkedin.restli.server.twitter.RepliesCollectionResource) AsyncRepliesCollectionResource(com.linkedin.restli.server.twitter.AsyncRepliesCollectionResource) ResourceMethodDescriptor(com.linkedin.restli.internal.server.model.ResourceMethodDescriptor) ResourceModel(com.linkedin.restli.internal.server.model.ResourceModel) RestLiTestHelper.buildResourceModel(com.linkedin.restli.server.test.RestLiTestHelper.buildResourceModel) CustomLong(com.linkedin.restli.server.custom.types.CustomLong) Test(org.testng.annotations.Test) AfterTest(org.testng.annotations.AfterTest) BeforeTest(org.testng.annotations.BeforeTest)

Example 2 with CustomLong

use of com.linkedin.restli.server.custom.types.CustomLong in project rest.li by linkedin.

the class TestRestLiMethodInvocation method testCustomTypeParametersCustomLongArrayWithDefault.

@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "customLongArrayDefault")
public void testCustomTypeParametersCustomLongArrayWithDefault(ProtocolVersion version, String uri) throws Exception {
    ResourceModel repliesResourceModel = buildResourceModel(RepliesCollectionResource.class);
    ResourceMethodDescriptor methodDescriptor = repliesResourceModel.findFinderMethod("customLongArrayDefault");
    RepliesCollectionResource repliesResource = getMockResource(RepliesCollectionResource.class);
    CustomLong[] longs = { new CustomLong(100L), new CustomLong(200L) };
    CustomLong[] longsFromDefault = { new CustomLong(1235L), new CustomLong(6789L) };
    repliesResource.customLongArrayDefault(EasyMock.aryEq(longs), EasyMock.aryEq(longsFromDefault));
    EasyMock.expectLastCall().andReturn(null).once();
    checkInvocation(repliesResource, methodDescriptor, "GET", version, uri);
}
Also used : PromiseRepliesCollectionResource(com.linkedin.restli.server.twitter.PromiseRepliesCollectionResource) RepliesCollectionResource(com.linkedin.restli.server.twitter.RepliesCollectionResource) AsyncRepliesCollectionResource(com.linkedin.restli.server.twitter.AsyncRepliesCollectionResource) ResourceMethodDescriptor(com.linkedin.restli.internal.server.model.ResourceMethodDescriptor) ResourceModel(com.linkedin.restli.internal.server.model.ResourceModel) RestLiTestHelper.buildResourceModel(com.linkedin.restli.server.test.RestLiTestHelper.buildResourceModel) CustomLong(com.linkedin.restli.server.custom.types.CustomLong) Test(org.testng.annotations.Test) AfterTest(org.testng.annotations.AfterTest) BeforeTest(org.testng.annotations.BeforeTest)

Example 3 with CustomLong

use of com.linkedin.restli.server.custom.types.CustomLong in project rest.li by linkedin.

the class TestRestLiMethodInvocation method testCustomTypeParametersCustomLongArray.

@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "customLongArray")
public void testCustomTypeParametersCustomLongArray(ProtocolVersion version, String uri) throws Exception {
    ResourceModel repliesResourceModel = buildResourceModel(RepliesCollectionResource.class);
    ResourceMethodDescriptor methodDescriptor = repliesResourceModel.findFinderMethod("customLongArray");
    RepliesCollectionResource repliesResource = getMockResource(RepliesCollectionResource.class);
    CustomLong[] longs = { new CustomLong(100L), new CustomLong(200L) };
    repliesResource.customLongArray(EasyMock.aryEq(longs));
    EasyMock.expectLastCall().andReturn(null).once();
    checkInvocation(repliesResource, methodDescriptor, "GET", version, uri);
}
Also used : PromiseRepliesCollectionResource(com.linkedin.restli.server.twitter.PromiseRepliesCollectionResource) RepliesCollectionResource(com.linkedin.restli.server.twitter.RepliesCollectionResource) AsyncRepliesCollectionResource(com.linkedin.restli.server.twitter.AsyncRepliesCollectionResource) ResourceMethodDescriptor(com.linkedin.restli.internal.server.model.ResourceMethodDescriptor) ResourceModel(com.linkedin.restli.internal.server.model.ResourceModel) RestLiTestHelper.buildResourceModel(com.linkedin.restli.server.test.RestLiTestHelper.buildResourceModel) CustomLong(com.linkedin.restli.server.custom.types.CustomLong) Test(org.testng.annotations.Test) AfterTest(org.testng.annotations.AfterTest) BeforeTest(org.testng.annotations.BeforeTest)

Example 4 with CustomLong

use of com.linkedin.restli.server.custom.types.CustomLong in project rest.li by linkedin.

the class TestRestLiMethodInvocation method testCustomTypeParametersCustomLongWithDefault.

@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "customLongDefault")
public void testCustomTypeParametersCustomLongWithDefault(ProtocolVersion version, String uri) throws Exception {
    ResourceModel repliesResourceModel = buildResourceModel(RepliesCollectionResource.class);
    ResourceMethodDescriptor methodDescriptor = repliesResourceModel.findFinderMethod("customLongDefault");
    RepliesCollectionResource repliesResource = getMockResource(RepliesCollectionResource.class);
    repliesResource.customLongDefault(new CustomLong(100L), new CustomLong(1235L));
    EasyMock.expectLastCall().andReturn(null).once();
    checkInvocation(repliesResource, methodDescriptor, "GET", version, uri);
}
Also used : PromiseRepliesCollectionResource(com.linkedin.restli.server.twitter.PromiseRepliesCollectionResource) RepliesCollectionResource(com.linkedin.restli.server.twitter.RepliesCollectionResource) AsyncRepliesCollectionResource(com.linkedin.restli.server.twitter.AsyncRepliesCollectionResource) ResourceMethodDescriptor(com.linkedin.restli.internal.server.model.ResourceMethodDescriptor) ResourceModel(com.linkedin.restli.internal.server.model.ResourceModel) RestLiTestHelper.buildResourceModel(com.linkedin.restli.server.test.RestLiTestHelper.buildResourceModel) CustomLong(com.linkedin.restli.server.custom.types.CustomLong) Test(org.testng.annotations.Test) AfterTest(org.testng.annotations.AfterTest) BeforeTest(org.testng.annotations.BeforeTest)

Example 5 with CustomLong

use of com.linkedin.restli.server.custom.types.CustomLong in project rest.li by linkedin.

the class TestConvertSimpleValue method testConvertCustomLong.

@Test
public void testConvertCustomLong() {
    CustomLong forceRegistration = new CustomLong(0L);
    Class<?> customLongClass = CustomLong.class;
    Object convertedCustomLong = ArgumentUtils.convertSimpleValue("100", DataTemplateUtil.getSchema(CustomLongRef.class), customLongClass);
    Assert.assertTrue(convertedCustomLong.getClass().equals(customLongClass));
    CustomLong customLong = (CustomLong) convertedCustomLong;
    Assert.assertTrue(customLong.toLong().equals(Long.valueOf(100)));
}
Also used : CustomLong(com.linkedin.restli.server.custom.types.CustomLong) CustomLongRef(com.linkedin.restli.server.CustomLongRef) Test(org.testng.annotations.Test)

Aggregations

CustomLong (com.linkedin.restli.server.custom.types.CustomLong)7 Test (org.testng.annotations.Test)7 ResourceMethodDescriptor (com.linkedin.restli.internal.server.model.ResourceMethodDescriptor)4 ResourceModel (com.linkedin.restli.internal.server.model.ResourceModel)4 RestLiTestHelper.buildResourceModel (com.linkedin.restli.server.test.RestLiTestHelper.buildResourceModel)4 AsyncRepliesCollectionResource (com.linkedin.restli.server.twitter.AsyncRepliesCollectionResource)4 PromiseRepliesCollectionResource (com.linkedin.restli.server.twitter.PromiseRepliesCollectionResource)4 RepliesCollectionResource (com.linkedin.restli.server.twitter.RepliesCollectionResource)4 AfterTest (org.testng.annotations.AfterTest)4 BeforeTest (org.testng.annotations.BeforeTest)4 ArrayTest (com.linkedin.pegasus.generator.test.ArrayTest)2 CustomLongRef (com.linkedin.restli.server.CustomLongRef)2 ArrayDataSchema (com.linkedin.data.schema.ArrayDataSchema)1 CustomStringRef (com.linkedin.restli.server.CustomStringRef)1 CustomString (com.linkedin.restli.server.custom.types.CustomString)1