Package net.sf.uadetector.datareader

Examples of net.sf.uadetector.datareader.XmlDataReader


  @Test
  public void call_updateFails_fallbackIsNewer_differentVersion() throws IOException {
    final DataStore fallback = new TestXmlDataStore();

    final DataStoreWhichFallsBack store = new DataStoreWhichFallsBack(new XmlDataReader(),
        NotUpdateableXmlDataStore.DATA_URL_UNREACHABLE, NotUpdateableXmlDataStore.VERSION_URL_UNREACHABLE,
        DataStore.DEFAULT_CHARSET, fallback);

    final UpdateOperationWithCacheFileTask task = new UpdateOperationWithCacheFileTask(store, folder.newFile("cache_file.tmp"));
    assertThat(store.getData()).isSameAs(fallback.getData());
View Full Code Here


  @Test
  public void call_updateFails_fallbackNotNewer_sameVersion() throws IOException {
    final DataStore fallback = new SimpleXmlDataStore(TestXmlDataStore.DATA_URL, TestXmlDataStore.VERSION_URL);

    final DataStoreWhichFallsBack store = new DataStoreWhichFallsBack(new XmlDataReader(),
        NotUpdateableXmlDataStore.DATA_URL_UNREACHABLE, NotUpdateableXmlDataStore.VERSION_URL_UNREACHABLE,
        DataStore.DEFAULT_CHARSET, fallback);

    final UpdateOperationWithCacheFileTask task = new UpdateOperationWithCacheFileTask(store, folder.newFile("cache_file.tmp"));
    assertThat(store.getData()).isSameAs(fallback.getData());
View Full Code Here

    Check.notNull(charset, "charset");
    Check.notNull(dataUrl, "dataUrl");
    Check.notNull(fallback, "fallback");
    Check.notNull(versionUrl, "versionUrl");

    final DataReader reader = new XmlDataReader();
    final DataStore fallbackDataStore = readCacheFileAsFallback(reader, cacheFile, charset, fallback);
    return new CachingXmlDataStore(reader, dataUrl, versionUrl, charset, cacheFile, fallbackDataStore);
  }
View Full Code Here

  };

  @Test(expected = IllegalNullArgumentException.class)
  public void construct_charset_isNull() throws MalformedURLException {
    final URL url = new URL("http://localhost");
    new TestDataStore(new XmlDataReader(), null, url, url, FALLBACK);
  }
View Full Code Here

  }

  @Test(expected = IllegalNullArgumentException.class)
  public void construct_dataUrl_isNull() throws MalformedURLException {
    final URL url = new URL("http://localhost");
    new TestDataStore(new XmlDataReader(), CHARSET, null, url, FALLBACK);
  }
View Full Code Here

  }

  @Test(expected = IllegalNullArgumentException.class)
  public void construct_fallback_isNull() throws MalformedURLException {
    final URL url = new URL("http://localhost");
    new TestDataStore(new XmlDataReader(), CHARSET, url, url, null);
  }
View Full Code Here

    new TestDataStore(new XmlDataReader(), CHARSET, url, url, null);
  }

  @Test
  public void construct_successful() throws Exception {
    final DataReader reader = new XmlDataReader();
    final TestDataStore store = new TestDataStore(reader, CHARSET, DATA_URL, VERSION_URL, FALLBACK);
    assertThat(store.getData().getVersion()).isEqualTo(FALLBACK.getData().getVersion());
    store.getUpdateOperation().call();
    assertThat(store.getData().getVersion()).isEqualTo(UrlUtil.read(VERSION_URL, CHARSET));
    assertThat(store.getDataReader()).isEqualTo(reader);
View Full Code Here

  }

  @Test(expected = IllegalNullArgumentException.class)
  public void construct_versionUrl_isNull() throws MalformedURLException {
    final URL url = new URL("http://localhost");
    new TestDataStore(new XmlDataReader(), CHARSET, url, null, FALLBACK);
  }
View Full Code Here

  private static final URL VERSION_URL = AbstractDataStoreTest2.class.getClassLoader().getResource("uas_older.version");

  @Test(expected = IllegalNullArgumentException.class)
  public void construct_charset_null() throws MalformedURLException {
    final URL url = new URL("http://localhost");
    new TestDataStore(Data.EMPTY, new XmlDataReader(), null, url, url);
  }
View Full Code Here

  }

  @Test(expected = IllegalNullArgumentException.class)
  public void construct_data_null() throws MalformedURLException {
    final URL url = new URL("http://localhost");
    new TestDataStore((Data) null, new XmlDataReader(), CHARSET, url, url);
  }
View Full Code Here

TOP

Related Classes of net.sf.uadetector.datareader.XmlDataReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.