Package net.sf.uadetector.datareader

Examples of net.sf.uadetector.datareader.DataReader


    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


    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
  public void construct_successful() {
    final Data data = new DataBlueprint().version("test-version").build();
    final DataReader reader = new XmlDataReader();
    final TestDataStore store = new TestDataStore(data, reader, CHARSET, DATA_URL, VERSION_URL);

    assertThat(store.getData().getVersion()).isEqualTo("test-version");
    assertThat(store.getData()).isSameAs(data);
    assertThat(store.getDataReader()).isEqualTo(reader);
View Full Code Here

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

  @Test
  public void construct_successful() {
    final DataReader reader = new XmlDataReader();
    final DataStore store = new TestDataStore(reader, DATA_URL, VERSION_URL, CHARSET);

    assertThat(!store.getData().getVersion().isEmpty()).isTrue();
    assertThat(store.getDataReader()).isEqualTo(reader);
    assertThat(store.getDataUrl().toExternalForm()).isEqualTo(DATA_URL);
View Full Code Here

    assertThat(store.getVersionUrl().toExternalForm()).isEqualTo(VERSION_URL);
  }

  @Test(expected = IllegalStateException.class)
  public void construct_unreachable_url() {
    final DataReader reader = new XmlDataReader();
    final String unreachable = "http://unreachable.local";
    new TestDataStore(reader, unreachable, unreachable, CHARSET);
  }
View Full Code Here

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

  @Test
  public void construct_successful() {
    final DataReader reader = new XmlDataReader();
    final DataStore store = new TestDataStore(reader, DATA_URL, VERSION_URL, CHARSET);

    assertThat(store.getData().getVersion()).isEqualTo(TestXmlDataStore.VERSION_NEWER);
    assertThat(store.getDataReader()).isEqualTo(reader);
    assertThat(store.getDataUrl()).isEqualTo(DATA_URL);
View Full Code Here

TOP

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

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.