Java Code Examples for com.danikula.videocache.sourcestorage.SourceInfoStorageFactory#newEmptySourceInfoStorage()

The following examples show how to use com.danikula.videocache.sourcestorage.SourceInfoStorageFactory#newEmptySourceInfoStorage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpUrlSourceTest.java    From AndriodVideoCache with Apache License 2.0 5 votes vote down vote up
@Test(expected = NullPointerException.class)
public void testHeaderInjectorNullNotAcceptable() throws Exception {
    HeaderInjector mockedHeaderInjector = Mockito.mock(HeaderInjector.class);
    when(mockedHeaderInjector.addHeaders(Mockito.anyString())).thenReturn(null);
    SourceInfoStorage emptySourceInfoStorage = SourceInfoStorageFactory.newEmptySourceInfoStorage();
    HttpUrlSource source = new HttpUrlSource(HTTP_DATA_URL_ONE_REDIRECT, emptySourceInfoStorage, mockedHeaderInjector);
    source.open(0);
    fail("source.open should throw NPE!");
}
 
Example 2
Source File: HttpProxyCacheTest.java    From AndriodVideoCache with Apache License 2.0 5 votes vote down vote up
@Test(expected = ProxyCacheException.class)
public void testTouchSourceForAbsentSourceInfoAndCache() throws Exception {
    SourceInfoStorage sourceInfoStorage = SourceInfoStorageFactory.newEmptySourceInfoStorage();
    HttpUrlSource source = ProxyCacheTestUtils.newNotOpenableHttpUrlSource(HTTP_DATA_URL, sourceInfoStorage);
    HttpProxyCache proxyCache = new HttpProxyCache(source, new FileCache(newCacheFile()));
    processRequest(proxyCache, "GET /" + HTTP_DATA_URL + " HTTP/1.1");
    proxyCache.shutdown();
    fail("Angry source should throw error! There is no file and caches source info");
}
 
Example 3
Source File: HttpUrlSourceTest.java    From AndroidVideoCache with Apache License 2.0 5 votes vote down vote up
@Test(expected = NullPointerException.class)
public void testHeaderInjectorNullNotAcceptable() throws Exception {
    HeaderInjector mockedHeaderInjector = Mockito.mock(HeaderInjector.class);
    when(mockedHeaderInjector.addHeaders(Mockito.anyString())).thenReturn(null);
    SourceInfoStorage emptySourceInfoStorage = SourceInfoStorageFactory.newEmptySourceInfoStorage();
    HttpUrlSource source = new HttpUrlSource(HTTP_DATA_URL_ONE_REDIRECT, emptySourceInfoStorage, mockedHeaderInjector);
    source.open(0);
    fail("source.open should throw NPE!");
}
 
Example 4
Source File: HttpProxyCacheTest.java    From AndroidVideoCache with Apache License 2.0 5 votes vote down vote up
@Test(expected = ProxyCacheException.class)
public void testTouchSourceForAbsentSourceInfoAndCache() throws Exception {
    SourceInfoStorage sourceInfoStorage = SourceInfoStorageFactory.newEmptySourceInfoStorage();
    HttpUrlSource source = ProxyCacheTestUtils.newNotOpenableHttpUrlSource(HTTP_DATA_URL, sourceInfoStorage);
    HttpProxyCache proxyCache = new HttpProxyCache(source, new FileCache(newCacheFile()));
    processRequest(proxyCache, "GET /" + HTTP_DATA_URL + " HTTP/1.1");
    proxyCache.shutdown();
    fail("Angry source should throw error! There is no file and caches source info");
}
 
Example 5
Source File: HttpUrlSourceTest.java    From AndriodVideoCache with Apache License 2.0 4 votes vote down vote up
@Test(expected = RuntimeException.class)
public void testNotOpenableHttpUrlSourceOpen() throws Exception {
    SourceInfoStorage sourceInfoStorage = SourceInfoStorageFactory.newEmptySourceInfoStorage();
    ProxyCacheTestUtils.newNotOpenableHttpUrlSource("", sourceInfoStorage).open(Mockito.anyInt());
    fail("source.open() should throw exception");
}
 
Example 6
Source File: HttpUrlSource.java    From AndriodVideoCache with Apache License 2.0 4 votes vote down vote up
public HttpUrlSource(String url) {
    this(url, SourceInfoStorageFactory.newEmptySourceInfoStorage());
}
 
Example 7
Source File: HttpUrlSource.java    From DKVideoPlayer with Apache License 2.0 4 votes vote down vote up
public HttpUrlSource(String url) {
    this(url, SourceInfoStorageFactory.newEmptySourceInfoStorage());
}
 
Example 8
Source File: HttpUrlSource.java    From GSYVideoPlayer with Apache License 2.0 4 votes vote down vote up
public HttpUrlSource(String url) {
    this(url, SourceInfoStorageFactory.newEmptySourceInfoStorage());
}
 
Example 9
Source File: HttpUrlSourceTest.java    From AndroidVideoCache with Apache License 2.0 4 votes vote down vote up
@Test(expected = RuntimeException.class)
public void testNotOpenableHttpUrlSourceOpen() throws Exception {
    SourceInfoStorage sourceInfoStorage = SourceInfoStorageFactory.newEmptySourceInfoStorage();
    ProxyCacheTestUtils.newNotOpenableHttpUrlSource("", sourceInfoStorage).open(Mockito.anyInt());
    fail("source.open() should throw exception");
}
 
Example 10
Source File: HttpUrlSource.java    From AndroidVideoCache with Apache License 2.0 4 votes vote down vote up
public HttpUrlSource(String url) {
    this(url, SourceInfoStorageFactory.newEmptySourceInfoStorage());
}