method2testcases stringlengths 118 6.63k |
|---|
### Question:
DefaultSimplePushServer implements SimplePushServer { @Override public HelloResponse handleHandshake(final HelloMessage handshake) { final Set<String> oldChannels = store.getChannelIds(handshake.getUAID()); for (String channelId : handshake.getChannelIds()) { if (!oldChannels.contains(channelId)) { store.... |
### Question:
DefaultSimplePushServer implements SimplePushServer { @Override public RegisterResponse handleRegister(final RegisterMessage register, final String uaid) { final String channelId = register.getChannelId(); final String endpointToken = generateEndpointToken(uaid, channelId); final boolean saved = store.sav... |
### Question:
DefaultSimplePushServer implements SimplePushServer { public boolean removeChannel(final String channnelId, final String uaid) { try { final Channel channel = store.getChannel(channnelId); if (channel.getUAID().equals(uaid)) { store.removeChannels(new HashSet<String>(Arrays.asList(channnelId))); return tr... |
### Question:
DefaultSimplePushServer implements SimplePushServer { public String getUAID(final String channelId) throws ChannelNotFoundException { return getChannel(channelId).getUAID(); } DefaultSimplePushServer(final DataStore store, final SimplePushServerConfig config, final byte[] privateKey); @Override HelloRespo... |
### Question:
DefaultSimplePushServer implements SimplePushServer { @Override public Notification handleNotification(final String endpointToken, final String body) throws ChannelNotFoundException { final Long version = Long.valueOf(VersionExtractor.extractVersion(body)); final String channelId = store.updateVersion(end... |
### Question:
WebSocketSslServerSslContext { public SSLContext sslContext() { try { final SSLContext serverContext = SSLContext.getInstance(PROTOCOL); serverContext.init(keyManagerFactory(loadKeyStore()).getKeyManagers(), null, null); return serverContext; } catch (final Exception e) { throw new RuntimeException("Faile... |
### Question:
UserAgent { public long timestamp() { return timestamp.get(); } UserAgent(final String uaid, final T transport, final long timestamp); String uaid(); T context(); long timestamp(); void timestamp(final long timestamp); @Override String toString(); }### Answer:
@Test public void timestamp() { final UserAg... |
### Question:
MessageFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[messages=" + messages + ']'; } MessageFrame(final String message); MessageFrame(final String... messages); MessageFrame(final List<String> messages); List<String>... |
### Question:
ConfigReader { public static StandaloneConfig parse(final String fileName) throws Exception { final File configFile = new File(fileName); InputStream in = null; try { in = configFile.exists() ? new FileInputStream(configFile) : ConfigReader.class.getResourceAsStream(fileName); return parse(in); } finally ... |
### Question:
SimplePushSockJSService implements SockJsService { @Override public SockJsConfig config() { return sockjsConfig; } SimplePushSockJSService(final SockJsConfig sockjsConfig, final SimplePushServer simplePushServer); @Override SockJsConfig config(); @Override void onOpen(final SockJsSessionContext session); ... |
### Question:
DefaultChannel implements Channel { @Override public int hashCode() { int result = 1; result = 31 * result + ((channelId == null) ? 0 : channelId.hashCode()); result = 31 * result + ((endpointToken == null) ? 0 : endpointToken.hashCode()); result = 31 * result + (int) (version ^ (version >>> 32)); return ... |
### Question:
DefaultChannel implements Channel { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Channel)) { return false; } final DefaultChannel o = (DefaultChannel) obj; return (uaid == null ? o.uaid == null : uaid.equals(o.uaid)... |
### Question:
XhrSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } XhrSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override String... |
### Question:
JsonpSendTransport extends AbstractSendTransport { @Override public String toString() { return StringUtil.simpleClassName(this) + "[config=" + config + ']'; } JsonpSendTransport(final SockJsConfig config); @Override void respond(final ChannelHandlerContext ctx, final FullHttpRequest request); @Override St... |
### Question:
AckMessageImpl implements AckMessage { @Override public Set<Ack> getAcks() { return Collections.unmodifiableSet(acks); } AckMessageImpl(final Set<Ack> acks); @Override Type getMessageType(); @Override Set<Ack> getAcks(); @Override String toString(); }### Answer:
@Test public void constructWithUpdates() {... |
### Question:
HtmlFileTransport extends ChannelHandlerAdapter { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { if (msg instanceof Frame) { final Frame frame = (Frame) msg; if (headerSent.compareAndSet(false, true)) { final HttpResponse res... |
### Question:
WebSocketHAProxyHandshaker extends WebSocketServerHandshaker00 { public static boolean isHAProxyReqeust(final FullHttpRequest request) { final String version = request.headers().get(Names.SEC_WEBSOCKET_VERSION); return version == null && request.content().readableBytes() == 0; } WebSocketHAProxyHandshaker... |
### Question:
EventSourceTransport extends ChannelHandlerAdapter { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { if (msg instanceof Frame) { final Frame frame = (Frame) msg; if (headerSent.compareAndSet(false, true)) { ctx.write(createRes... |
### Question:
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content... |
### Question:
AckImpl implements Ack { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((channelId == null) ? 0 : channelId.hashCode()); return result; } AckImpl(final String channelId, final long version); @Override String getChannelId(); @Override long getVersion(); @... |
### Question:
SockJsHandler extends SimpleChannelInboundHandler<FullHttpRequest> { static PathParams matches(final String path) { final Matcher matcher = SERVER_SESSION_PATTERN.matcher(path); if (matcher.find()) { final String serverId = matcher.group(1); final String sessionId = matcher.group(2); final String transpor... |
### Question:
Greeting { private Greeting() { } private Greeting(); static boolean matches(final String path); static FullHttpResponse response(final HttpRequest request); }### Answer:
@Test public void greeting() throws Exception { final FullHttpResponse response = sendGreetingRequest(); assertWelcomeMessage(respons... |
### Question:
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8... |
### Question:
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.ch... |
### Question:
SockJsSession { public void setState(State newState) { while (true) { final State oldState = state.get(); if (state.compareAndSet(oldState, newState)) { return; } } } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(fi... |
### Question:
SockJsSession { public void onOpen(final SockJsSessionContext session) { setState(State.OPEN); service.onOpen(session); updateTimestamp(); } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ... |
### Question:
SockJsSession { public void onMessage(final String message) throws Exception { service.onMessage(message); updateTimestamp(); } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); Channel... |
### Question:
SockJsSession { public void onClose() { setState(State.CLOSED); service.onClose(); } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); ChannelHandlerContext openContext(); void setOpenC... |
### Question:
SockJsSession { public void addMessage(final String message) { messageQueue.add(message); updateTimestamp(); } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); ChannelHandlerContext op... |
### Question:
SockJsSession { @SuppressWarnings("ManualArrayToCollectionCopy") public void addMessages(final String[] messages) { for (String msg: messages) { messageQueue.add(msg); } } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionConte... |
### Question:
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeExcep... |
### Question:
CryptoUtil { public static String encrypt(final byte[] key, final String content) throws Exception { final byte[] iv = BlockCipher.getIV(); final byte[] encrypted = new CryptoBox(key).encrypt(iv, content.getBytes(ASCII)); final String base64 = new UrlBase64().encode(prependIV(encrypted, iv)); return URLEn... |
### Question:
CryptoUtil { public static String decrypt(final byte[] key, final String content) throws Exception { final byte[] decodedContent = new UrlBase64().decode(URLDecoder.decode(content, ASCII.displayName())); final byte[] iv = extractIV(decodedContent); final byte[] decrypted = new CryptoBox(key).decrypt(iv, e... |
### Question:
RedisDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final Jedis jedis = jedisPool.getResource(); try { final String uaid = channel.getUAID(); final String chid = channel.getChannelId(); if (jedis.sismember(uaidLookupKey(uaid), chid)) { return false; } final ... |
### Question:
RedisDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { final List<String> endpointTokenAndUaid = jedis.hmget(chidLookupKey(channelId), TOKEN_KEY, UAID_KEY); if (!endpointTokenAnd... |
### Question:
RedisDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final Jedis jedis = jedisPool.getResource(); try { return jedis.smembers(uaidLookupKey(uaid)); } finally { jedisPool.returnResource(jedis); } } RedisDataStore(final String host, final int port); @Override... |
### Question:
RedisDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { for (String channelId : channelIds) { removeChannel(channelId); } } RedisDataStore(final String host, final int port); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivat... |
### Question:
RedisDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long newVersion) throws VersionException, ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { jedis.watch(endpointToken); final String versionString = jedis.get(endpointT... |
### Question:
RedisDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) { final Jedis jedis = jedisPool.getResource(); try { jedis.set(ackLookupKey(channelId), Long.toString(version)); final List<String> hashValues = jedis.hmget(chidLookupKey(channelId)... |
### Question:
RedisDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acks) { final Jedis jedis = jedisPool.getResource(); try { for (Ack ack : acks) { jedis.del(ackLookupKey(ack.getChannelId())); jedis.srem(acksLookupKey(uaid), ack.getChannelId()); } return ... |
### Question:
InMemoryDataStore implements DataStore { @Override public boolean saveChannel(final Channel ch) { checkNotNull(ch, "ch"); final MutableChannel mutableChannel = new MutableChannel(ch); final Channel previous = channels.putIfAbsent(ch.getChannelId(), mutableChannel); endpoints.put(ch.getEndpointToken(), mut... |
### Question:
HelloMessageImpl implements HelloMessage { @Override public Set<String> getChannelIds() { return Collections.unmodifiableSet(channelIds); } HelloMessageImpl(); HelloMessageImpl(final String uaid); HelloMessageImpl(final String uaid, final Set<String> channelIds); @Override String getUAID(); @Override Se... |
### Question:
InMemoryDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { checkNotNull(channelId, "channelId"); final Channel channel = channels.get(channelId); if (channel == null) { throw new ChannelNotFoundException("No Channel for [" + chann... |
### Question:
InMemoryDataStore implements DataStore { private boolean removeChannel(final String channelId) { checkNotNull(channelId, "channelId"); final Channel channel = channels.remove(channelId); if (channel != null) { endpoints.remove(endpoints.get(channel.getEndpointToken())); } return channel != null; } @Overr... |
### Question:
InMemoryDataStore implements DataStore { @Override public void removeChannels(final String uaid) { checkNotNull(uaid, "uaid"); for (Channel channel : channels.values()) { if (channel.getUAID().equals(uaid)) { removeChannel(channel.getChannelId()); logger.info("Removing [" + channel.getChannelId() + "] for... |
### Question:
InMemoryDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) throws ChannelNotFoundException { checkNotNull(channelId, "channelId"); checkNotNull(version, "version"); final Channel channel = channels.get(channelId); if (channel == null) { ... |
### Question:
CouchDBDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length == 0) { final Map<String, String> map = new HashMap<String, String>(2); map.put(TYPE_FIELD, Views.SERVER.viewName()); map.put("... |
### Question:
CouchDBDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { db.create(channelAsMap(channel)); return true; } CouchDBDataStore(final String url, final String dbName); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @Overr... |
### Question:
CouchDBDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { return channelFromJson(getChannelJson(channelId)); } CouchDBDataStore(final String url, final String dbName); @Override void savePrivateKeySalt(final byte[] salt); @Overrid... |
### Question:
CouchDBDataStore implements DataStore { @Override public void removeChannels(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UAID.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); final Set<String> channelIds = new HashSet<String>(rows.size()); for (Row row : row... |
### Question:
OpenFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[o]"; } OpenFrame(); @Override String toString(); @Override OpenFrame copy(); @Override OpenFrame duplicate(); @Override OpenFrame retain(); @Override OpenFrame retain(... |
### Question:
CouchDBDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UAID.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); if (rows.isEmpty()) { return Collections.emptySet(); } final Set<String> chan... |
### Question:
CouchDBDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final ViewResult viewResult = db.queryView(query(Views.TOKEN.viewName(), endpointToken)); final List<Row> rows = viewResult.getR... |
### Question:
CouchDBDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) throws ChannelNotFoundException { final JsonNode json = getChannelJson(channelId); final Map<String, String> unack = docToAckMap((ObjectNode) json.get(DOC_FIELD), version); db.cre... |
### Question:
CouchDBDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UNACKS.viewName(), uaid)); return rowsToAcks(viewResult.getRows()); } CouchDBDataStore(final String url, final String dbName); @Override void save... |
### Question:
CouchDBDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked) { final ViewResult viewResult = db.queryView(query(Views.UNACKS.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); final Collection<BulkDeleteDocument> removals = new... |
### Question:
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channe... |
### Question:
CloseFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[statusCode=" + statusCode + ", statusMsg='" + statusMsg + "']"; } CloseFrame(final int statusCode, final String statusMsg); int statusCode(); String statusMsg(); @Ove... |
### Question:
JpaDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length != 0) { return; } final JpaOperation<Void> saveSalt = new JpaOperation<Void>() { @Override public Void perform(final EntityManager ... |
### Question:
JpaDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final JpaOperation<Boolean> saveChannel = new JpaOperation<Boolean>() { @Override public Boolean perform(final EntityManager em) { UserAgentDTO userAgent = em.find(UserAgentDTO.class, channel.getUAID()); if (... |
### Question:
JpaDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final JpaOperation<ChannelDTO> findChannel = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(EntityManager em) { return em.find(ChannelDTO.class, channelId... |
### Question:
JpaDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final JpaOperation<Set<String>> getChannelIds = new JpaOperation<Set<String>>() { @Override public Set<String> perform(final EntityManager em) { final Set<String> channels = new HashSet<String>(); final Use... |
### Question:
JpaDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { if (channelIds == null || channelIds.isEmpty()) { return; } final JpaOperation<Integer> removeChannel = new JpaOperation<Integer>() { @Override public Integer perform(EntityManager em) { final Query de... |
### Question:
JpaDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final JpaOperation<ChannelDTO> updateVersion = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(final EntityMana... |
### Question:
MessageFrame extends DefaultByteBufHolder implements Frame { public List<String> messages() { return Collections.unmodifiableList(messages); } MessageFrame(final String message); MessageFrame(final String... messages); MessageFrame(final List<String> messages); List<String> messages(); @Override Message... |
### Question:
LocationEngineProxy implements LocationEngine { @VisibleForTesting T removeListener(@NonNull LocationEngineCallback<LocationEngineResult> callback) { return listeners != null ? listeners.remove(callback) : null; } LocationEngineProxy(LocationEngineImpl<T> locationEngineImpl); @Override void getLastLocatio... |
### Question:
MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean isCnRegion() { if (checkRequiredParameters(sAccessToken.get(), userAgent)) { return telemetryClient.isCnRegion(); } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(C... |
### Question:
MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @VisibleForTesting TelemetryClientFactory getTelemetryClientFactory(String accessToken, String userAgent) { String fullUserAgent = TelemetryUtils.createFullUserAgent(userAgent, applicationContext); return new TelemetryClientFactory(access... |
### Question:
AbstractCompositeMetrics { @Nullable public Metrics getMetrics(@NonNull String name) { Deque<Metrics> metrics = metricsMap.get(name.trim()); synchronized (this) { return metrics != null && !metrics.isEmpty() ? metrics.pop() : null; } } AbstractCompositeMetrics(long maxLength); void add(String name, long d... |
### Question:
MetricsImpl implements Metrics { @Override public void add(long delta) { value.addAndGet(delta); } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); @Override void add(long delta); @Override long getValue(); @Override long getStart(); @Override long getEnd(); }### ... |
### Question:
MetricsImpl implements Metrics { @Override public long getValue() { return value.get(); } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); @Override void add(long delta); @Override long getValue(); @Override long getStart(); @Override long getEnd(); }### Answer:
@... |
### Question:
MetricsImpl implements Metrics { @Override public long getStart() { return start; } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); @Override void add(long delta); @Override long getValue(); @Override long getStart(); @Override long getEnd(); }### Answer:
@Test p... |
### Question:
MetricsImpl implements Metrics { @Override public long getEnd() { return end; } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); @Override void add(long delta); @Override long getValue(); @Override long getStart(); @Override long getEnd(); }### Answer:
@Test publi... |
### Question:
MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(thr... |
### Question:
AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onS... |
### Question:
MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (!MAPBOX_PREF_ENABLE_CRASH_REPORTER.equals(key)) { return; } try { isEnabl... |
### Question:
AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new AndroidLocationEngineCallbackTransport(callback); } AndroidLocationEngineImpl(@NonNull Context context);... |
### Question:
AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void removeLocationUpdates(@NonNull LocationListener listener) { if (listener != null) { locationManager.removeUpdates(listener); } } AndroidLocationEngineImpl(@NonNull Context c... |
### Question:
AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { currentProvider = getB... |
### Question:
LocationEngineResult { @Nullable public static LocationEngineResult extractResult(Intent intent) { LocationEngineResult result = null; if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) { result = extractGooglePlayResult(intent); } return result == null ? extractAndroidResult(intent) : result; } private Loc... |
### Question:
LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @... |
### Question:
MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location bestLastLocation = getBestLastLocation(); if (bestLastLocation != null) { callback.onSuccess(LocationE... |
### Question:
GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @Override public void removeLocationUpdates(@NonNull LocationCallback listener) { if (listener != null) { fusedLocationProviderClient.removeLocationUpdates(listener); } } @VisibleForTesting GoogleLocationEngineImpl(FusedLocationPr... |
### Question:
GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @SuppressLint("MissingPermission") @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { GoogleLastLocationEngineCallbackTransport transport = new GoogleLas... |
### Question:
GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationCallback listener, @Nullable Looper looper) throws SecurityException { fusedLocationProviderCl... |
### Question:
ConfigurationClient implements Callback { boolean shouldUpdate() { SharedPreferences sharedPreferences = TelemetryUtils.obtainSharedPreferences(context); long lastUpdateTime = sharedPreferences.getLong(MAPBOX_CONFIG_SYNC_KEY_TIMESTAMP, 0); long millisecondDiff = System.currentTimeMillis() - lastUpdateTime... |
### Question:
AppUserTurnstile extends Event implements Parcelable { @Override Type obtainType() { return Type.TURNSTILE; } AppUserTurnstile(String sdkIdentifier, String sdkVersion); AppUserTurnstile(String sdkIdentifier, String sdkVersion, boolean isFromPreferences); private AppUserTurnstile(Parcel in); @Nullable S... |
### Question:
MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new MapboxLocationEngineCallbackTransport(callback); } MapboxFusedLocationEngineImpl(@NonNull Context context); @NonNu... |
### Question:
AppUserTurnstile extends Event implements Parcelable { @Nullable public String getSkuId() { return skuId; } AppUserTurnstile(String sdkIdentifier, String sdkVersion); AppUserTurnstile(String sdkIdentifier, String sdkVersion, boolean isFromPreferences); private AppUserTurnstile(Parcel in); @Nullable Str... |
### Question:
NetworkUsageMetricsCollector { void addRxBytes(long bytes) { metrics.addRxBytesForType(getActiveNetworkType(), bytes); } NetworkUsageMetricsCollector(Context context, TelemetryMetrics metrics); }### Answer:
@Test public void addRxBytes() { networkUsageMetricsCollector.addRxBytes(30); verify(metrics).add... |
### Question:
NetworkUsageMetricsCollector { void addTxBytes(long bytes) { metrics.addTxBytesForType(getActiveNetworkType(), bytes); } NetworkUsageMetricsCollector(Context context, TelemetryMetrics metrics); }### Answer:
@Test public void addTxBytes() { networkUsageMetricsCollector.addTxBytes(30); verify(metrics).add... |
### Question:
TelemetryMetrics extends AbstractCompositeMetrics { public void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_RX : MOBILE_BYTES_RX, bytes); } } TelemetryMetrics(long maxLength);... |
### Question:
TelemetryMetrics extends AbstractCompositeMetrics { public void addTxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_TX : MOBILE_BYTES_TX, bytes); } } TelemetryMetrics(long maxLength);... |
### Question:
MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(req... |
### Question:
AlarmSchedulerFlusher implements SchedulerFlusher { @Override public void register() { Intent alarmIntent = receiver.supplyIntent(); pendingIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT); IntentFilter filter = new IntentFilter(SCHEDULER_FLUSHER_INTENT); con... |
### Question:
LocationEngineControllerImpl implements LocationEngineController { @Override public void onResume() { registerReceiver(); requestLocationUpdates(); } LocationEngineControllerImpl(@NonNull Context context,
@NonNull LocationEngine locationEngine,
... |
### Question:
LocationEngineControllerImpl implements LocationEngineController { @Override public void onDestroy() { removeLocationUpdates(); unregisterReceiver(); } LocationEngineControllerImpl(@NonNull Context context,
@NonNull LocationEngine locationEngine,
... |
### Question:
LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { boolean isEnabled() { return isEnabled.get(); } @VisibleForTesting LocationCollectionClient(@NonNull LocationEngineController collectionController,
@NonNull HandlerThread handlerThread,
... |
### Question:
LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { long getSessionRotationInterval() { return sessionIdentifier.get().getInterval(); } @VisibleForTesting LocationCollectionClient(@NonNull LocationEngineController collectionController,
@NonN... |
### Question:
LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { try { if (LOCATION_COLLECTOR_ENABLED.equals(key)) { setEnabled(sharedPreferences.getBoolean(LOCATION_COLLECTOR_ENABLED... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.