本文整理汇总了Java中com.desk.java.apiclient.model.SortDirection类的典型用法代码示例。如果您正苦于以下问题:Java SortDirection类的具体用法?Java SortDirection怎么用?Java SortDirection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SortDirection类属于com.desk.java.apiclient.model包,在下文中一共展示了SortDirection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: searchCasesById
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@GET(CASES_URI + "/search")
Call<ApiResponse<Case>> searchCasesById(@Query("since_id") int since_id, @Query("per_page") int perPage,
@Query("page") int page, @Query("sort_field") String sortField,
@Query("sort_direction") SortDirection sortDirection, @Query("embed") Embed embed,
@Query("fields") Fields fields);
示例2: getArticlesNotifiesCallbackOnSuccess
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Test
public void getArticlesNotifiesCallbackOnSuccess() throws Exception {
final Call mockCall = mock(Call.class);
when(mockArticleService.getArticles(
anyString(),
anyInt(),
anyInt(),
eq(true), // testing that this is true
any(TopicIds.class),
any(BrandIds.class),
anyString(),
any(SortDirection.class))).thenReturn(mockCall);
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
((RetrofitCallback) invocation.getArguments()[0]).onResponse(mockCall, Response.success(new ApiResponse<Article>()));
return null;
}
}).when(mockCall).enqueue(any(Callback.class));
articleProvider.getArticles(ALL_TOPICS, ALL_BRANDS, 1, callback);
verify(callback).onArticlesLoaded(anyInt(), anyListOf(Article.class), anyBoolean());
}
示例3: getArticlesNotifiesCallbackOnError
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Test
public void getArticlesNotifiesCallbackOnError() throws Exception {
final Call mockCall = mock(Call.class);
when(mockArticleService.getArticles(
anyString(),
anyInt(),
anyInt(),
eq(true), // testing that this is true
any(TopicIds.class),
any(BrandIds.class),
anyString(),
any(SortDirection.class))).thenReturn(mockCall);
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
((RetrofitCallback) invocation.getArguments()[0]).onFailure(mockCall, new RuntimeException());
return null;
}
}).when(mockCall).enqueue(any(Callback.class));
articleProvider.getArticles(ALL_TOPICS, ALL_BRANDS, 1, callback);
verify(callback).onArticlesLoadError(any(ErrorResponse.class));
}
示例4: findArticlesNotifiesCallbackOnError
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Test
public void findArticlesNotifiesCallbackOnError() throws Exception {
final Call mockCall = mock(Call.class);
when(mockArticleService.searchArticles(
anyString(),
anyInt(),
anyInt(),
isNull(TopicIds.class), // testing that this is null
any(BrandIds.class),
anyBoolean(),
anyString(),
any(SortDirection.class),
anyString())).thenReturn(mockCall);
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
((RetrofitCallback) invocation.getArguments()[0]).onFailure(mockCall, new RuntimeException());
return null;
}
}).when(mockCall).enqueue(any(Callback.class));
articleProvider.findArticles(ALL_TOPICS, ALL_BRANDS, "query", 1, callback);
verify(callback).onArticlesLoadError(any(ErrorResponse.class));
}
示例5: getArticlesNotifiesCallbackOnSuccess
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Test
public void getArticlesNotifiesCallbackOnSuccess() throws Exception {
final Call mockCall = mock(Call.class);
when(mockTopicService.getTopics(
anyString(),
anyBoolean(),
anyInt(),
anyString(),
any(SortDirection.class))).thenReturn(mockCall);
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
((TopicProvider.RetrofitCallback) invocation.getArguments()[0]).onResponse(mockCall, Response.success(new ApiResponse<Topic>()));
return null;
}
}).when(mockCall).enqueue(any(Callback.class));
topicProvider.getTopics(ALL_BRANDS, callbacks);
verify(callbacks).onTopicsLoaded(anyListOf(Topic.class));
}
示例6: getArticlesNotifiesCallbackOnError
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Test
public void getArticlesNotifiesCallbackOnError() throws Exception {
final Call mockCall = mock(Call.class);
when(mockTopicService.getTopics(
anyString(),
anyBoolean(),
anyInt(),
anyString(),
any(SortDirection.class))).thenReturn(mockCall);
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
((TopicProvider.RetrofitCallback) invocation.getArguments()[0]).onFailure(mockCall, new RuntimeException());
return null;
}
}).when(mockCall).enqueue(any(Callback.class));
topicProvider.getTopics(ALL_BRANDS, callbacks);
verify(callbacks).onTopicsLoadError(any(ErrorResponse.class));
}
示例7: searchCustomersByUpdatedAt
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@GET(CUSTOMERS_URI + "/search")
Call<ApiResponse<Customer>> searchCustomersByUpdatedAt(@Query("since_updated_at") Integer since_updated_at,
@Query("per_page") int perPage, @Query("page") int page, @Query("sort_field") String sortField,
@Query("sort_direction") SortDirection sortDirection, @Query("fields") Fields fields);
示例8: callDesk
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Override
protected DeskBaseResponse<ApiResponse<D>> callDesk(DeskUtil du)
{
// get a service
CaseService service = du.getDeskClient().cases();
Response<ApiResponse<Case>> resp = null;
try
{
if (!delta)
{
resp = service
.searchCasesById(lastRecordId, DESK_PAGE_SIZE_CASE, page, "id", SortDirection.ASC, null, null)
.execute();
}
else
{
resp = service.searchCasesByUpdatedDate(updatedAt, DESK_PAGE_SIZE_CASE, page, "updated_at",
SortDirection.ASC, null, null).execute();
}
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
DeskBaseResponse<ApiResponse<D>> d = new DeskBaseResponse<>();
d.errorCode = resp.code();
d.setIsSuccess(resp.isSuccess());
d.body = (ApiResponse<D>) resp.body();
d.setHeaders(resp.headers());
d.setMessage(resp.message());
return d;
}
示例9: callDesk
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Override
protected DeskBaseResponse<ApiResponse<D>> callDesk(DeskUtil du)
{
// get a service
CustomerService service = du.getDeskClient().customers();
Response<ApiResponse<Customer>> resp = null;
try
{
if (!delta)
{
// false == bigCompanies TODO
resp = service.getCustomers(lastRecordId, DESK_PAGE_SIZE_CUSTOMER, page, "id", SortDirection.ASC,
(false ? Fields.include("id", "_links") : null)).execute();
}
else
{
resp = service.searchCustomersByUpdatedAt(updatedAt, DESK_PAGE_SIZE_CUSTOMER, page, "updated_at",
SortDirection.ASC, (false ? Fields.include("updated_at", "_links") : null)).execute();
}
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
DeskBaseResponse<ApiResponse<D>> d = new DeskBaseResponse<>();
d.errorCode = resp.code();
d.setIsSuccess(resp.isSuccess());
d.body = (ApiResponse<D>) resp.body();
d.setHeaders(resp.headers());
d.setMessage(resp.message());
return d;
}
示例10: callDesk
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Override
protected DeskBaseResponse<ApiResponse<D>> callDesk(DeskUtil du)
{
// get a service
CompanyService service = du.getDeskClient().companies();
Response<ApiResponse<Company>> resp = null;
// set the starting timestamp filter
minTime = (delta ? updatedAt : (lastRecordId == 1 ? 1 : lastRecordId));
// get the current timestamp so we have an upper boundary
now = (int) (Calendar.getInstance().getTime().getTime() / 1000);
try
{
resp = service
.searchCompanies(String.format("(%s:[%d TO %d])", (delta ? "updated_at" : "created_at"), minTime, now),
DESK_PAGE_SIZE_COMPANY, page, "created_at", SortDirection.ASC)
.execute();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
DeskBaseResponse<ApiResponse<D>> d = new DeskBaseResponse<>();
d.errorCode = resp.code();
d.setIsSuccess(resp.isSuccess());
d.body = (ApiResponse<D>) resp.body();
d.setHeaders(resp.headers());
d.setMessage(resp.message());
return d;
}
示例11: setUp
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
articleProvider = new ArticleProvider(mockArticleService);
callback = mock(ArticleCallbacks.class);
when(mockArticleService.searchArticles(
anyString(),
anyInt(),
anyInt(),
any(TopicIds.class), // testing that this is null
any(BrandIds.class),
anyBoolean(),
anyString(),
any(SortDirection.class),
anyString())).thenReturn(mock(Call.class));
when(mockArticleService.getArticles(
anyString(),
anyInt(),
anyInt(),
eq(true), // testing that this is true
any(TopicIds.class),
any(BrandIds.class),
anyString(),
any(SortDirection.class))).thenReturn(mock(Call.class));
}
示例12: getArticlesDoesNotPassTopicIdForAllTopics
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Test
public void getArticlesDoesNotPassTopicIdForAllTopics() throws Exception {
articleProvider.getArticles(ALL_TOPICS, ALL_BRANDS, 1, callback);
verify(mockArticleService).getArticles(
anyString(),
anyInt(),
anyInt(),
anyBoolean(),
isNull(TopicIds.class), // testing that this is null
any(BrandIds.class),
anyString(),
any(SortDirection.class));
}
示例13: getArticlesDoesPassTopicId
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Test
public void getArticlesDoesPassTopicId() throws Exception {
articleProvider.getArticles(1, ALL_BRANDS, 1, callback);
verify(mockArticleService).getArticles(
anyString(),
anyInt(),
anyInt(),
anyBoolean(),
isNotNull(TopicIds.class), // testing that this is not null
any(BrandIds.class),
anyString(),
any(SortDirection.class));
}
示例14: getArticlesDoesNotPassBrandIdForAllBrands
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Test
public void getArticlesDoesNotPassBrandIdForAllBrands() throws Exception {
articleProvider.getArticles(ALL_TOPICS, ALL_BRANDS, 1, callback);
verify(mockArticleService).getArticles(
anyString(),
anyInt(),
anyInt(),
anyBoolean(),
any(TopicIds.class),
isNull(BrandIds.class), // testing that this is null
anyString(),
any(SortDirection.class));
}
示例15: getArticlesDoesPassBrandId
import com.desk.java.apiclient.model.SortDirection; //导入依赖的package包/类
@Test
public void getArticlesDoesPassBrandId() throws Exception {
articleProvider.getArticles(ALL_TOPICS, 1, 1, callback);
verify(mockArticleService).getArticles(
anyString(),
anyInt(),
anyInt(),
anyBoolean(),
any(TopicIds.class),
isNotNull(BrandIds.class), // testing that this is null
anyString(),
any(SortDirection.class));
}