@Test public void testMemoryAndStreamSame () throws IOException { IndirectDataset cachedDataset = DatasetBuilder.file() .configureDefaultCaches() .build(Filename.LITE_PATTERN_V32); Provider cachedProvider = new Provider(cachedDataset, new LruCache(5000)); IndirectDataset unCachedDataset = DatasetBuilder.file() .build(Filename.LITE_PATTERN_V32); Provider unCachedProvider = new Provider(unCachedDataset); Dataset memoryDataset = MemoryFactory.create(Filename.LITE_PATTERN_V32); Provider memoryProvider = new Provider(memoryDataset); FileInputStream is = new FileInputStream(Filename.GOOD_USERAGENTS_FILE); BufferedReader source = new BufferedReader(new InputStreamReader(is)); String line; int count = 0; while ((line = source.readLine()) != null) { Match cachedMatch = cachedProvider.match(line); Match unCachedMatch = unCachedProvider.match(line); Match memoryMatch = memoryProvider.match(line); matchEquals(memoryMatch,cachedMatch); matchEquals(memoryMatch,unCachedMatch); count++; } logger.info("{} tests done", count); source.close(); cachedDataset.close(); unCachedDataset.close(); memoryDataset.close(); }
public Match match(final Map<String, String> headers) throws IOException { return match(headers, createMatch()); }
Provider { public Match match(final Map<String, String> headers) throws IOException { return match(headers, createMatch()); } }
Provider { public Match match(final Map<String, String> headers) throws IOException { return match(headers, createMatch()); } Provider(Dataset dataSet);  Provider(Dataset dataSet, int cacheSize);  Provider(Dataset dataSet, ILoadingCache cache);   Provider(Dataset dataSet, boolean recordDetectionTime, ILoadingCache cache); }
Provider { public Match match(final Map<String, String> headers) throws IOException { return match(headers, createMatch()); } Provider(Dataset dataSet);  Provider(Dataset dataSet, int cacheSize);  Provider(Dataset dataSet, ILoadingCache cache);   Provider(Dataset dataSet, boolean recordDetectionTime, ILoadingCache cache); long getDetectionCount(); long[] getMethodCounts(); double getPercentageCacheMisses(); @Deprecated long getCacheSwitches(); double getCacheRequests(); long getCacheMisses(); Match createMatch(); Match match(final Map<String, String> headers); Match match(final Map<String, String> headers, Match match); Match match(String targetUserAgent); Match match(String targetUserAgent, Match match); Match matchForDeviceId(byte[] deviceIdArray); Match matchForDeviceId(String deviceId); Match matchForDeviceId(ArrayList<Integer> profileIds); Match matchForDeviceId(byte[] deviceIdArray, Match match); Match matchForDeviceId(String deviceId, Match match); Match matchForDeviceId(ArrayList<Integer> profileIds, Match match); }
Provider { public Match match(final Map<String, String> headers) throws IOException { return match(headers, createMatch()); } Provider(Dataset dataSet);  Provider(Dataset dataSet, int cacheSize);  Provider(Dataset dataSet, ILoadingCache cache);   Provider(Dataset dataSet, boolean recordDetectionTime, ILoadingCache cache); long getDetectionCount(); long[] getMethodCounts(); double getPercentageCacheMisses(); @Deprecated long getCacheSwitches(); double getCacheRequests(); long getCacheMisses(); Match createMatch(); Match match(final Map<String, String> headers); Match match(final Map<String, String> headers, Match match); Match match(String targetUserAgent); Match match(String targetUserAgent, Match match); Match matchForDeviceId(byte[] deviceIdArray); Match matchForDeviceId(String deviceId); Match matchForDeviceId(ArrayList<Integer> profileIds); Match matchForDeviceId(byte[] deviceIdArray, Match match); Match matchForDeviceId(String deviceId, Match match); Match matchForDeviceId(ArrayList<Integer> profileIds, Match match); final Dataset dataSet; }