当前位置: 首页>>代码示例>>Java>>正文


Java ReadFilter.setLinkUri方法代码示例

本文整理汇总了Java中org.jboss.aerogear.android.core.ReadFilter.setLinkUri方法的典型用法代码示例。如果您正苦于以下问题:Java ReadFilter.setLinkUri方法的具体用法?Java ReadFilter.setLinkUri怎么用?Java ReadFilter.setLinkUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.aerogear.android.core.ReadFilter的用法示例。


在下文中一共展示了ReadFilter.setLinkUri方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testNext

import org.jboss.aerogear.android.core.ReadFilter; //导入方法依赖的package包/类
@SuppressWarnings({"rawtypes", "unchecked"})
@Test
public void testNext() {
    Pipe pipe = mock(Pipe.class);
    ReadFilter next = new ReadFilter();
    List delegate = new ArrayList();
    ReadFilter previous = new ReadFilter();

    next.setLinkUri(URI.create("./next"));
    previous.setLinkUri(URI.create("./previous"));

    WrappingPagedList list = new WrappingPagedList(pipe, delegate, next, previous);
    list.next(mock(Callback.class));
    list.previous(mock(Callback.class));

    verify(pipe).read(eq(next), any(Callback.class));
    verify(pipe).read(eq(previous), any(Callback.class));

}
 
开发者ID:aerogear,项目名称:aerogear-android-pipe,代码行数:20,代码来源:PagedListTest.java

示例2: read

import org.jboss.aerogear.android.core.ReadFilter; //导入方法依赖的package包/类
@Override
public void read(String idx, Callback<T> callback) {
    ReadFilter filter = new ReadFilter();
    filter.setLinkUri(URI.create(idx));

    int id = Arrays.hashCode(new Object[] { name, filter, callback });
    Bundle bundle = new Bundle();
    bundle.putSerializable(CALLBACK, callback);
    bundle.putSerializable(FILTER, filter);
    bundle.putSerializable(METHOD, Methods.READ_ID);
    manager.initLoader(id, bundle, this);
}
 
开发者ID:aerogear,项目名称:aerogear-android-pipe,代码行数:13,代码来源:LoaderAdapter.java

示例3: getNextFilter

import org.jboss.aerogear.android.core.ReadFilter; //导入方法依赖的package包/类
@Override
public ReadFilter getNextFilter(HeaderAndBody result, PageConfig config) {
    ReadFilter filter = new ReadFilter();
    URI nextUri = URI.create(result.getHeader(config.getNextIdentifier()).toString());
    filter.setLinkUri(baseUri.resolve(nextUri));
    return filter;
}
 
开发者ID:aerogear,项目名称:aerogear-android-pipe,代码行数:8,代码来源:URIPageHeaderParser.java

示例4: getPreviousFilter

import org.jboss.aerogear.android.core.ReadFilter; //导入方法依赖的package包/类
@Override
public ReadFilter getPreviousFilter(HeaderAndBody result, PageConfig config) {
    ReadFilter filter = new ReadFilter();
    URI nextUri = URI.create(result.getHeader(config.getPreviousIdentifier()).toString());
    filter.setLinkUri(baseUri.resolve(nextUri));
    return filter;
}
 
开发者ID:aerogear,项目名称:aerogear-android-pipe,代码行数:8,代码来源:URIPageHeaderParser.java

示例5: getNextFilter

import org.jboss.aerogear.android.core.ReadFilter; //导入方法依赖的package包/类
@Override
public ReadFilter getNextFilter(HeaderAndBody result, PageConfig config) {
    ReadFilter filter = new ReadFilter();
    JsonParser parser = new JsonParser();
    JsonElement element = parser.parse(new String(result.getBody()));
    URI nextUri = URI.create(getFromJSON(element, config.getNextIdentifier()));
    filter.setLinkUri(baseUri.resolve(nextUri));
    return filter;
}
 
开发者ID:aerogear,项目名称:aerogear-android-pipe,代码行数:10,代码来源:URIBodyPageParser.java

示例6: getPreviousFilter

import org.jboss.aerogear.android.core.ReadFilter; //导入方法依赖的package包/类
@Override
public ReadFilter getPreviousFilter(HeaderAndBody result, PageConfig config) {
    ReadFilter filter = new ReadFilter();
    JsonParser parser = new JsonParser();
    JsonElement element = parser.parse(new String(result.getBody()));
    URI nextUri = URI.create(getFromJSON(element, config.getPreviousIdentifier()));
    filter.setLinkUri(baseUri.resolve(nextUri));
    return filter;
}
 
开发者ID:aerogear,项目名称:aerogear-android-pipe,代码行数:10,代码来源:URIBodyPageParser.java

示例7: runReadWithFilterUsingUri

import org.jboss.aerogear.android.core.ReadFilter; //导入方法依赖的package包/类
@Test
public void runReadWithFilterUsingUri() throws Exception {

    final CountDownLatch latch = new CountDownLatch(1);

    HttpProviderFactory factory = mock(HttpProviderFactory.class);
    when(factory.get(anyObject())).thenReturn(mock(HttpProvider.class));

    RestAdapter<Data> adapter = new RestAdapter<Data>(Data.class, url);
    Object restRunner = UnitTestUtils.getPrivateField(adapter, "restRunner");
    UnitTestUtils.setPrivateField(restRunner, "httpProviderFactory", factory);

    ReadFilter filter = new ReadFilter();
    filter.setLinkUri(URI.create("rail%2Ftrails?limit=10&where=%7B%22model%22:%22BMW%22%7D"));

    adapter.read(filter, new Callback<List<Data>>() {
        @Override
        public void onSuccess(List<Data> data) {
            latch.countDown();
        }

        @Override
        public void onFailure(Exception e) {
            latch.countDown();
        }
    });
    latch.await(500, TimeUnit.MILLISECONDS);

    verify(factory).get(Mockito.argThat(new ObjectVarArgsMatcher(new URL(url.toString() + "rail%2Ftrails?limit=10&where=%7B%22model%22:%22BMW%22%7D"), 60000)));
}
 
开发者ID:aerogear,项目名称:aerogear-android-pipe,代码行数:31,代码来源:RestAdapterTest.java

示例8: testEscapeComplexUri

import org.jboss.aerogear.android.core.ReadFilter; //导入方法依赖的package包/类
@Test
public void testEscapeComplexUri() throws Exception {

    final CountDownLatch latch = new CountDownLatch(1);

    HttpProviderFactory factory = mock(HttpProviderFactory.class);
    when(factory.get(anyObject())).thenReturn(mock(HttpProvider.class));

    RestAdapter<Data> adapter = new RestAdapter<Data>(Data.class, url);
    Object restRunner = UnitTestUtils.getPrivateField(adapter, "restRunner");
    UnitTestUtils.setPrivateField(restRunner, "httpProviderFactory", factory);

    ReadFilter filter = new ReadFilter();
    filter.setLinkUri(URI.create("metrics/gauges/MI~R~%5Bacbfe3d2-fd73-43b0-94ad-c38f32abba1f"
            + "%2FHolu~~%5D~MT~WildFly%20Memory%20Metrics~Heap%20Max/data?start=1463907826698&end=1466586226698"));

    adapter.read(filter, new Callback<List<Data>>() {
        @Override
        public void onSuccess(List<Data> data) {
            latch.countDown();
        }

        @Override
        public void onFailure(Exception e) {
            latch.countDown();
        }
    });
    latch.await(500, TimeUnit.MILLISECONDS);

    verify(factory).get(Mockito.argThat(new ObjectVarArgsMatcher(new URL(url.toString() + "metrics/gauges/MI~R~%5Bacbfe3d2-fd73-43b0-"
            + "94ad-c38f32abba1f%2FHolu~~%5D~MT~WildFly%20Memory%20Metrics~Heap%20Max/data?start=1463907826698&end=1466586226698"), 60000)));
}
 
开发者ID:aerogear,项目名称:aerogear-android-pipe,代码行数:33,代码来源:RestAdapterTest.java

示例9: onRawRead

import org.jboss.aerogear.android.core.ReadFilter; //导入方法依赖的package包/类
@Override
public HeaderAndBody onRawRead(Pipe<T> requestingPipe, String id) {
    ReadFilter filter = new ReadFilter();
    filter.setLinkUri(URI.create(id));
    return onRawReadWithFilter(filter, requestingPipe);
}
 
开发者ID:aerogear,项目名称:aerogear-android-pipe,代码行数:7,代码来源:RestRunner.java


注:本文中的org.jboss.aerogear.android.core.ReadFilter.setLinkUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。