Package net.sf.uadetector.datastore

Examples of net.sf.uadetector.datastore.TestXmlDataStore


  public void test() throws Exception {
    final URL resource = getClass().getClassLoader().getResource("uas_older.xml");
    final String expected = formatSimilar(UrlUtil.read(resource, Charsets.UTF_8)).replaceAll("/si </regstring>", "/si</regstring>");

    final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    XmlDataWriter.write(new TestXmlDataStore().getData(), outputStream);
    final String actual = new String(outputStream.toByteArray(), "UTF-8");

    assertThat(formatSimilar(actual)).isEqualTo(expected);
  }
View Full Code Here


  }

  @Test
  public void shutdown() {
    // shutdown must not interrupt the caller
    new UserAgentStringParserImpl<DataStore>(new TestXmlDataStore()).shutdown();
  }
View Full Code Here

    }
    return INSTANCE;
  }

  private static RefreshableDataStore setUpDataStore() {
    return new TestXmlDataStore();
  }
View Full Code Here

    assertThat(agent.getDeviceCategory()).isEqualTo(DeviceCategory.EMPTY);
  }

  @Test
  public void refresh() throws Exception {
    final UpdatingUserAgentStringParserImpl parser = new UpdatingUserAgentStringParserImpl(new TestXmlDataStore());
    parser.getDataStore().refresh();
  }
View Full Code Here

    parser.getDataStore().refresh();
  }

  @Test(expected = IllegalNegativeArgumentException.class)
  public void setUpdateInterval_toSmall() throws MalformedURLException {
    final UpdatingUserAgentStringParserImpl parser = new UpdatingUserAgentStringParserImpl(new TestXmlDataStore());
    parser.setUpdateInterval(-1l);
  }
View Full Code Here

  }

  @Test
  public void shutdown() {
    // shutdown must not interrupt the caller
    new UpdatingUserAgentStringParserImpl(new TestXmlDataStore()).shutdown();
  }
View Full Code Here

    new UpdatingUserAgentStringParserImpl(new TestXmlDataStore()).shutdown();
  }

  @Test
  public void testUpdateMechanismWhileParsing() throws InterruptedException {
    final UpdatingUserAgentStringParserImpl parser = new UpdatingUserAgentStringParserImpl(new TestXmlDataStore());
    final long firstLastUpdateCheck = parser.getDataStore().getUpdateOperation().getLastUpdateCheck();
    LOG.debug("LastUpdateCheck at: " + firstLastUpdateCheck);
    final long originalInterval = parser.getUpdateInterval();

    // reduce the interval since testing
View Full Code Here

TOP

Related Classes of net.sf.uadetector.datastore.TestXmlDataStore

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.