method2testcases stringlengths 118 6.63k |
|---|
### Question:
PixabayImage { public String getPreviewURL() { return previewURL; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageURL, St... |
### Question:
PixabayImage { public String getWebformatURL() { return webformatURL; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageURL... |
### Question:
PixabayImage { public int getImageWidth() { return imageWidth; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageURL, Strin... |
### Question:
PixabayImage { public long getUserId() { return userId; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageURL, String previ... |
### Question:
PixabayImage { public String getUser() { return "By: " + user; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageURL, Strin... |
### Question:
PixabayImage { public PixabayImageType getType() { return type; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageURL, Stri... |
### Question:
PixabayImage { public long getId() { return id; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageURL, String previewURL,
... |
### Question:
PixabayImage { public String getUserImageURL() { return userImageURL; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageURL... |
### Question:
PixabayImage { public int getImageHeight() { return imageHeight; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageURL, Str... |
### Question:
PixabayImage { public String getLikes() { return String.valueOf(likes); } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageU... |
### Question:
PixabayImage { public String getFavorites() { return String.valueOf(favorites); } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, Stri... |
### Question:
PixabayImage { public String getTags() { if (tags == null) return ""; if (tags.contains(", ")) { String[] splitTags = tags.toUpperCase().split(", "); return TextUtils.join(" - ", splitTags); } else return tags; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
... |
### Question:
PixabayImage { public int getWebformatHeight() { return webformatHeight; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String page... |
### Question:
PixabayImage { public long getViews() { return views; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageURL, String preview... |
### Question:
PixabayImage { public int getWebformatWidth() { return webformatWidth; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageUR... |
### Question:
PixabayImage { public int getPreviewWidth() { return previewWidth; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageURL, S... |
### Question:
PixabayImage { public String getComments() { return String.valueOf(comments); } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String... |
### Question:
PixabayImage { public long getDownloads() { return downloads; } PixabayImage(int previewHeight, int likes, int favorites, String tags,
int webformatHeight, long views, int webformatWidth, int previewWidth,
int comments, long downloads, String pageURL, String... |
### Question:
ClientSpanNameProvider { public static Function<HttpRequest, String> PREFIXED_REQUEST_METHOD_NAME(final String prefix) { return (request) -> replaceIfNull(prefix, "") + replaceIfNull(request.getRequestLine().getMethod(), "unknown"); } static Function<HttpRequest, String> PREFIXED_REQUEST_METHOD_NAME(fina... |
### Question:
ClientSpanNameProvider { public static Function<HttpRequest, String> PREFIXED_REQUEST_TARGET_NAME(final String prefix) { return (request) -> replaceIfNull(prefix, "") + replaceIfNull(standardizeUri(request.getRequestLine().getUri()), "unknown"); } static Function<HttpRequest, String> PREFIXED_REQUEST_MET... |
### Question:
ClientSpanNameProvider { public static Function<HttpRequest, String> PREFIXED_REQUEST_METHOD_TARGET_NAME( final String prefix) { return (request) -> replaceIfNull(prefix, "") + replaceIfNull(request.getRequestLine().getMethod(), "unknown") + " " + replaceIfNull(standardizeUri(request.getRequestLine().getU... |
### Question:
RxReceiver { @NonNull public static Observable<Intent> receives(@NonNull final Context context, @NonNull final IntentFilter intentFilter) { return Observable.create(new ObservableOnSubscribe<Intent>() { @Override public void subscribe(final ObservableEmitter<Intent> emitter) { final BroadcastReceiver rece... |
### Question:
RxReceiver { @NonNull @CheckResult public static Observable<Intent> receives(@NonNull final Context context, @NonNull final IntentFilter intentFilter) { return Observable.create(new Action1<Emitter<Intent>>() { @Override public void call(final Emitter<Intent> emitter) { final BroadcastReceiver receiver = ... |
### Question:
RxReceiverLocal { @NonNull public static Observable<Intent> receives(@NonNull final Context context, @NonNull final IntentFilter intentFilter) { return Observable.create(new ObservableOnSubscribe<Intent>() { @Override public void subscribe(final ObservableEmitter<Intent> emitter) { final BroadcastReceiver... |
### Question:
RxReceiverLocal { @NonNull @CheckResult public static Observable<Intent> receives(@NonNull final Context context, @NonNull final IntentFilter intentFilter) { return Observable.create(new Action1<Emitter<Intent>>() { @Override public void call(final Emitter<Intent> emitter) { final BroadcastReceiver receiv... |
### Question:
FlaxModel { protected void notifyModelChanged() { modelSubject.onNext((M)this); } FlaxModel(); }### Answer:
@Test public void testNotifyModelChanged() throws Exception { TestObserver testSubscriber = flaxModel.getObservable().test(); flaxModel.notifyModelChanged(); flaxModel.notifyModelChanged(); testSu... |
### Question:
FlaxStore { static<M extends FlaxModel> M getModel(Class modelClass) { return getModel(modelClass, 0); } private FlaxStore(); }### Answer:
@Test public void testStoreReturnsSameValueForSameKeys() throws Exception { Foo fooOne = FlaxStore.getModel(Foo.class, 0); Foo fooTwo = FlaxStore.getModel(Foo.class... |
### Question:
GrizzlyExecutorService extends AbstractExecutorService implements ExtendedThreadPool { public static GrizzlyExecutorService createInstance() { return createInstance(ThreadPoolConfig.DEFAULT); } protected GrizzlyExecutorService(ThreadPoolConfig config); protected GrizzlyExecutorService(ThreadPoolConfig c... |
### Question:
PCA9685 implements Closeable { public void setPwmFreq(int freqHz) throws IOException { try { double prescaleval = 25000000.0; prescaleval /= 4096.0; prescaleval /= freqHz; prescaleval -= 1.0; Log.d(TAG, String.format("Setting PWM frequency to %d Hz", freqHz)); Log.d(TAG, String.format("Estimated pre-scale... |
### Question:
PCA9685 implements Closeable { public void setAllPwm(int on, int off) throws IOException { if (i2cDevice != null) { try { i2cDevice.writeRegByte(ALL_LED_ON_L, (byte) (on & 0xFF)); i2cDevice.writeRegByte(ALL_LED_ON_H, (byte) (on >> 8)); i2cDevice.writeRegByte(ALL_LED_OFF_L, (byte) (off & 0xFF)); i2cDevice.... |
### Question:
PCA9685Servo extends PCA9685 { public void setServoAngle(int channel, int angle) throws IOException { setPwm(channel, 0, map(angle, minAngle, maxAngle, minPwm, maxPwm)); } PCA9685Servo(byte address, @NonNull PeripheralManager manager); void setServoMinMaxPwm(int minAngle, int maxAngle, int minPwm, int max... |
### Question:
PCA9685Servo extends PCA9685 { public int map(int x, int inMin, int inMax, int outMin, int outMax) { return (x - inMin) * (outMax - outMin) / (inMax - inMin) + outMin; } PCA9685Servo(byte address, @NonNull PeripheralManager manager); void setServoMinMaxPwm(int minAngle, int maxAngle, int minPwm, int maxPw... |
### Question:
Order { public double getTotal() { double total = 0; for (Product product : products) { total += product.getPrice(); } return total; } Order(Product ... products); double getTotal(); }### Answer:
@Test public void should_sum_all_prices() { Order order = new Order(new Product(30), new Product(40.0)); asse... |
### Question:
PgConfigurationProperties implements ApplicationListener<ApplicationReadyEvent> { public int getPageSizeForIds() { return pageSize * idOnlyFactor; } int getPageSizeForIds(); int getQueueSizeForIds(); int getFetchSizeForIds(); int getFetchSize(); @Override void onApplicationEvent(ApplicationReadyEvent eve... |
### Question:
GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public Subscription subscribe(@NonNull SubscriptionRequestTO req, @NonNull FactObserver observer) { SubscriptionImpl<Fact> subscription = SubscriptionImpl.on(observer); StreamObserver<FactStoreProto.MSG_Notification> responseObserv... |
### Question:
GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public long currentTime() { MSG_Empty empty = converter.empty(); MSG_CurrentDatabaseTime resp; try { resp = blockingStub.currentTime(empty); } catch (StatusRuntimeException e) { throw wrapRetryable(e); } return converter.fromProto(... |
### Question:
GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public Set<String> enumerateNamespaces() { MSG_Empty empty = converter.empty(); MSG_StringSet resp; try { resp = blockingStub.enumerateNamespaces(empty); } catch (StatusRuntimeException e) { throw wrapRetryable(e); } return convert... |
### Question:
FactCastJson { @SneakyThrows public static <T> T copy(@NonNull T toCopy) { Class<?> c = toCopy.getClass(); return reader.forType(c).readValue(writer.forType(c).writeValueAsString(toCopy)); } @SneakyThrows static T copy(@NonNull T toCopy); @SneakyThrows static String writeValueAsString(@NonNull T value); ... |
### Question:
FactCastJson { @SneakyThrows public static <T> T readValue(@NonNull Class<T> class1, String json) { return reader.forType(class1).readValue(json); } @SneakyThrows static T copy(@NonNull T toCopy); @SneakyThrows static String writeValueAsString(@NonNull T value); @SneakyThrows static T readValue(@NonNull ... |
### Question:
FactCastJson { @SneakyThrows public static <T> String writeValueAsString(@NonNull T value) { return writer.writeValueAsString(value); } @SneakyThrows static T copy(@NonNull T toCopy); @SneakyThrows static String writeValueAsString(@NonNull T value); @SneakyThrows static T readValue(@NonNull Class<T> clas... |
### Question:
FactCastJson { public static ObjectNode newObjectNode() { return objectMapper.getNodeFactory().objectNode(); } @SneakyThrows static T copy(@NonNull T toCopy); @SneakyThrows static String writeValueAsString(@NonNull T value); @SneakyThrows static T readValue(@NonNull Class<T> class1, String json); @Sneaky... |
### Question:
FactCastJson { public static ObjectNode toObjectNode(String json) { try { return (ObjectNode) objectMapper.readTree(json); } catch (IOException e) { throw new RuntimeException(e); } } @SneakyThrows static T copy(@NonNull T toCopy); @SneakyThrows static String writeValueAsString(@NonNull T value); @Sneaky... |
### Question:
PgFactExtractor implements RowMapper<Fact> { @Override @NonNull public Fact mapRow(@NonNull ResultSet rs, int rowNum) throws SQLException { serial.set(rs.getLong(PgConstants.COLUMN_SER)); return PgFact.from(rs); } @Override @NonNull Fact mapRow(@NonNull ResultSet rs, int rowNum); }### Answer:
@Test void... |
### Question:
FactCastJson { @SneakyThrows @Generated public static String writeValueAsPrettyString(Object o) { return objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(o); } @SneakyThrows static T copy(@NonNull T toCopy); @SneakyThrows static String writeValueAsString(@NonNull T value); @SneakyThrows s... |
### Question:
JavaScriptEngineSupplier implements Supplier<ScriptEngine> { @Override public ScriptEngine get() { ScriptEngine engine = getEngineByName("nashorn", "javascript", "js"); if (engine == null) throw new IllegalStateException("Cannot find any engine to run javascript code."); return engine; } JavaScriptEngineS... |
### Question:
FactSpec { public static FactSpec ns(String ns) { return new FactSpec(ns); } FactSpec(@NonNull @JsonProperty("ns") String ns); FactSpec meta(@NonNull String k, @NonNull String v); static FactSpec ns(String ns); FilterScript filterScript(); FactSpec filterScript(FilterScript script); @Deprecated FactSpec j... |
### Question:
FactSpec { public FilterScript filterScript() { if (filterScript != null) return filterScript; else if (jsFilterScript != null) return new FilterScript("js", jsFilterScript); else return null; } FactSpec(@NonNull @JsonProperty("ns") String ns); FactSpec meta(@NonNull String k, @NonNull String v); static F... |
### Question:
FactSpecMatcher implements Predicate<Fact> { protected boolean metaMatch(Fact t) { if ((meta.isEmpty())) { return true; } return meta.entrySet().stream().allMatch(e -> e.getValue().equals(t.meta(e.getKey()))); } FactSpecMatcher(@NonNull FactSpec spec); @Override boolean test(Fact t); static Predicate<Fact... |
### Question:
PgIdFactExtractor implements RowMapper<Fact> { @Override @NonNull public Fact mapRow(@NonNull ResultSet rs, int rowNum) throws SQLException { serial.set(rs.getLong(PgConstants.COLUMN_SER)); return new IdOnlyFact(UUID.fromString(rs.getString(PgConstants.ALIAS_ID))); } @Override @NonNull Fact mapRow(@NonNu... |
### Question:
FactSpecMatcher implements Predicate<Fact> { protected boolean nsMatch(Fact t) { return ns.equals(t.ns()); } FactSpecMatcher(@NonNull FactSpec spec); @Override boolean test(Fact t); static Predicate<Fact> matchesAnyOf(@NonNull List<FactSpec> spec); static Predicate<Fact> matches(@NonNull FactSpec spec); ... |
### Question:
FactSpecMatcher implements Predicate<Fact> { protected boolean typeMatch(Fact t) { if (type == null) { return true; } String otherType = t.type(); return type.equals(otherType); } FactSpecMatcher(@NonNull FactSpec spec); @Override boolean test(Fact t); static Predicate<Fact> matchesAnyOf(@NonNull List<Fac... |
### Question:
FactSpecMatcher implements Predicate<Fact> { protected boolean aggIdMatch(Fact t) { if (aggId == null) { return true; } return t.aggIds().contains(aggId); } FactSpecMatcher(@NonNull FactSpec spec); @Override boolean test(Fact t); static Predicate<Fact> matchesAnyOf(@NonNull List<FactSpec> spec); static Pr... |
### Question:
FactSpecMatcher implements Predicate<Fact> { @SneakyThrows @Generated protected boolean scriptMatch(Fact t) { if (script == null) { return true; } return (Boolean) scriptEngine.eval("test(" + t.jsonHeader() + "," + t.jsonPayload() + ")"); } FactSpecMatcher(@NonNull FactSpec spec); @Override boolean test(F... |
### Question:
FactSpecMatcher implements Predicate<Fact> { public static Predicate<Fact> matchesAnyOf(@NonNull List<FactSpec> spec) { List<FactSpecMatcher> matchers = spec.stream() .map(FactSpecMatcher::new) .collect(Collectors.toList()); return f -> matchers.stream().anyMatch(p -> p.test(f)); } FactSpecMatcher(@NonNul... |
### Question:
FactSpecMatcher implements Predicate<Fact> { public static Predicate<Fact> matches(@NonNull FactSpec spec) { return new FactSpecMatcher(spec); } FactSpecMatcher(@NonNull FactSpec spec); @Override boolean test(Fact t); static Predicate<Fact> matchesAnyOf(@NonNull List<FactSpec> spec); static Predicate<Fact... |
### Question:
IdOnlyFact implements Fact { @Override public String ns() { throw new UnsupportedOperationException(); } @Override String ns(); @Override String type(); @Override Set<UUID> aggIds(); @Override String jsonHeader(); @Override String jsonPayload(); @Override String meta(String key); }### Answer:
@Test void... |
### Question:
IdOnlyFact implements Fact { @Override public String type() { throw new UnsupportedOperationException(); } @Override String ns(); @Override String type(); @Override Set<UUID> aggIds(); @Override String jsonHeader(); @Override String jsonPayload(); @Override String meta(String key); }### Answer:
@Test vo... |
### Question:
IdOnlyFact implements Fact { @Override public Set<UUID> aggIds() { throw new UnsupportedOperationException(); } @Override String ns(); @Override String type(); @Override Set<UUID> aggIds(); @Override String jsonHeader(); @Override String jsonPayload(); @Override String meta(String key); }### Answer:
@Te... |
### Question:
IdOnlyFact implements Fact { @Override public String jsonHeader() { throw new UnsupportedOperationException(); } @Override String ns(); @Override String type(); @Override Set<UUID> aggIds(); @Override String jsonHeader(); @Override String jsonPayload(); @Override String meta(String key); }### Answer:
@T... |
### Question:
IdOnlyFact implements Fact { @Override public String jsonPayload() { throw new UnsupportedOperationException(); } @Override String ns(); @Override String type(); @Override Set<UUID> aggIds(); @Override String jsonHeader(); @Override String jsonPayload(); @Override String meta(String key); }### Answer:
@... |
### Question:
IdOnlyFact implements Fact { @Override public String meta(String key) { throw new UnsupportedOperationException(); } @Override String ns(); @Override String type(); @Override Set<UUID> aggIds(); @Override String jsonHeader(); @Override String jsonPayload(); @Override String meta(String key); }### Answer... |
### Question:
PgFact implements Fact { @SneakyThrows @Generated public static Fact from(ResultSet resultSet) { String id = resultSet.getString(PgConstants.ALIAS_ID); String aggId = resultSet.getString(PgConstants.ALIAS_AGGID); String type = resultSet.getString(PgConstants.ALIAS_TYPE); String ns = resultSet.getString(Pg... |
### Question:
DefaultFactCast implements FactCast { @Override @NonNull public Subscription subscribeEphemeral(@NonNull SubscriptionRequest req, @NonNull FactObserver observer) { return store.subscribe(SubscriptionRequestTO.forFacts(req), observer); } @Override @NonNull Subscription subscribeEphemeral(@NonNull Subscrip... |
### Question:
DefaultFactCast implements FactCast { @Override public void publish(@NonNull List<? extends Fact> factsToPublish) { FactValidation.validate(factsToPublish); store.publish(factsToPublish); } @Override @NonNull Subscription subscribeEphemeral(@NonNull SubscriptionRequest req,
@NonNull FactObser... |
### Question:
PgFact implements Fact { @VisibleForTesting static Set<UUID> toUUIDArray(String aggIdArrayAsString) { Set<UUID> set = new LinkedHashSet<>(); if (aggIdArrayAsString != null && aggIdArrayAsString.trim().length() > 2) { UUID[] readValue = FactCastJson.readValue(UUID[].class, aggIdArrayAsString); if (readValu... |
### Question:
DefaultFactCast implements FactCast { @Override @NonNull public OptionalLong serialOf(@NonNull UUID id) { return store.serialOf(id); } @Override @NonNull Subscription subscribeEphemeral(@NonNull SubscriptionRequest req,
@NonNull FactObserver observer); @Override void publish(@NonNull List<? e... |
### Question:
DefaultFactCast implements FactCast { @Override public Set<String> enumerateNamespaces() { return store.enumerateNamespaces(); } @Override @NonNull Subscription subscribeEphemeral(@NonNull SubscriptionRequest req,
@NonNull FactObserver observer); @Override void publish(@NonNull List<? extends... |
### Question:
DefaultFactCast implements FactCast { @Override public Set<String> enumerateTypes(@NonNull String ns) { return store.enumerateTypes(ns); } @Override @NonNull Subscription subscribeEphemeral(@NonNull SubscriptionRequest req,
@NonNull FactObserver observer); @Override void publish(@NonNull List... |
### Question:
DefaultFactCast implements FactCast { @Override public LockedOperationBuilder lock(@NonNull String ns) { if (ns.trim().isEmpty()) throw new IllegalArgumentException("Namespace must not be empty"); return new LockedOperationBuilder(this.store, ns); } @Override @NonNull Subscription subscribeEphemeral(@Non... |
### Question:
DefaultFactCast implements FactCast { @Override public Subscription subscribe(@NonNull SubscriptionRequest request, @NonNull FactObserver observer) { return new ReconnectingFactSubscriptionWrapper(store, SubscriptionRequestTO.forFacts( request), observer); } @Override @NonNull Subscription subscribeEphem... |
### Question:
StateToken { public StateToken() { this(UUID.randomUUID()); } StateToken(); }### Answer:
@Test public void testStateToken() throws Exception { assertThat(new StateToken().uuid()).isNotNull(); } |
### Question:
IntermediatePublishResult { public Optional<Runnable> andThen() { return Optional.ofNullable(andThen); } Optional<Runnable> andThen(); }### Answer:
@Test public void testNullContracts() throws Exception { assertThrows(NullPointerException.class, () -> { new IntermediatePublishResult(null); }); assertThr... |
### Question:
LockedOperationBuilder { public OnBuilderStep on(@NonNull UUID aggId, UUID... otherAggIds) { LinkedList<UUID> ids = new LinkedList<>(); ids.add(aggId); ids.addAll(Arrays.asList(otherAggIds)); return new OnBuilderStep(ids); } OnBuilderStep on(@NonNull UUID aggId, UUID... otherAggIds); }### Answer:
@Test ... |
### Question:
ExceptionAfterPublish extends IllegalStateException { public ExceptionAfterPublish(@NonNull List<Fact> publishedFacts, @NonNull Throwable e) { super("An exception has happened in the 'andThen' part of your publishing attempt. " + "This is a programming error, as the runnable in andThen is not supposed to ... |
### Question:
WithOptimisticLock { @NonNull public PublishingResult attempt(@NonNull Attempt operation) throws AttemptAbortedException, OptimisticRetriesExceededException, ExceptionAfterPublish { while (++count <= retry) { StateToken token = store.stateFor(ids, Optional.ofNullable(ns)); try { IntermediatePublishResult ... |
### Question:
SubscriptionImpl implements Subscription { @Override public void close() { if (!closed.getAndSet(true)) { SubscriptionCancelledException closedException = new SubscriptionCancelledException( "Client closed the subscription"); catchup.completeExceptionally(closedException); complete.completeExceptionally(c... |
### Question:
SubscriptionImpl implements Subscription { @Override public Subscription awaitCatchup() throws SubscriptionCancelledException { try { catchup.get(); } catch (InterruptedException | ExecutionException e) { throw new SubscriptionCancelledException(e); } return this; } @Override void close(); @Override Subs... |
### Question:
SubscriptionImpl implements Subscription { @Override public Subscription awaitComplete() throws SubscriptionCancelledException { try { complete.get(); } catch (InterruptedException | ExecutionException e) { throw new SubscriptionCancelledException(e); } return this; } @Override void close(); @Override Su... |
### Question:
SubscriptionImpl implements Subscription { public void notifyElement(@NonNull T e) { if (!closed.get()) { observer.onNext(e); } } @Override void close(); @Override Subscription awaitCatchup(); Subscription awaitCatchup(long waitTimeInMillis); @Override Subscription awaitComplete(); Subscription awaitComp... |
### Question:
SubscriptionImpl implements Subscription { public void notifyError(Throwable e) { if (!closed.get()) { observer.onError(e); if (!catchup.isDone()) { catchup.completeExceptionally(e); } if (!complete.isDone()) { complete.completeExceptionally(e); } tryClose(); } } @Override void close(); @Override Subscri... |
### Question:
SubscriptionImpl implements Subscription { public SubscriptionImpl<T> onClose(Runnable e) { onClose = e; return this; } @Override void close(); @Override Subscription awaitCatchup(); Subscription awaitCatchup(long waitTimeInMillis); @Override Subscription awaitComplete(); Subscription awaitComplete(long ... |
### Question:
SubscriptionImpl implements Subscription { public static <T> SubscriptionImpl<T> on(@NonNull GenericObserver<T> o) { return new SubscriptionImpl<>(o); } @Override void close(); @Override Subscription awaitCatchup(); Subscription awaitCatchup(long waitTimeInMillis); @Override Subscription awaitComplete();... |
### Question:
ReconnectingFactSubscriptionWrapper implements Subscription { @Override public Subscription awaitComplete() throws SubscriptionCancelledException { for (;;) { assertSubscriptionStateNotClosed(); Subscription cur = currentSubscription.get(); if (cur != null) { try { cur.awaitComplete(); return this; } catc... |
### Question:
ReconnectingFactSubscriptionWrapper implements Subscription { @Override public Subscription awaitCatchup() throws SubscriptionCancelledException { for (;;) { assertSubscriptionStateNotClosed(); Subscription cur = currentSubscription.get(); if (cur != null) { try { cur.awaitCatchup(); return this; } catch ... |
### Question:
ReconnectingFactSubscriptionWrapper implements Subscription { private void assertSubscriptionStateNotClosed() { if (closed.get()) { throw new SubscriptionCancelledException("Subscription already cancelled"); } } ReconnectingFactSubscriptionWrapper(@NonNull FactStore store,
@NonNull Subscriptio... |
### Question:
CondensedQueryExecutor { public void trigger() { if (connectionStateSupplier.get()) { if (maxDelayInMillis < 1) { runTarget(); } else if (!currentlyScheduled.getAndSet(true)) { timer.schedule(new TimerTask() { @Override public void run() { currentlyScheduled.set(false); try { CondensedQueryExecutor.this.r... |
### Question:
FluentSubscriptionRequest implements SubscriptionRequest { @Override public String toString() { return debugInfo; } FluentSubscriptionRequest(); @Override java.util.Optional<UUID> startingAfter(); @Override String toString(); }### Answer:
@Test void testToString() { SubscriptionRequest r = SubscriptionRe... |
### Question:
SubscriptionRequestTO implements SubscriptionRequest { public static SubscriptionRequestTO forFacts(SubscriptionRequest request) { SubscriptionRequestTO t = new SubscriptionRequestTO(request); t.idOnly(false); return t; } SubscriptionRequestTO(SubscriptionRequest request); boolean hasAnyScriptFilters(); @... |
### Question:
SubscriptionRequestTO implements SubscriptionRequest { @Override public String toString() { return debugInfo; } SubscriptionRequestTO(SubscriptionRequest request); boolean hasAnyScriptFilters(); @Override java.util.Optional<UUID> startingAfter(); static SubscriptionRequestTO forFacts(SubscriptionRequest r... |
### Question:
SubscriptionRequestTO implements SubscriptionRequest { public boolean hasAnyScriptFilters() { return specs.stream().anyMatch(s -> s.jsFilterScript() != null); } SubscriptionRequestTO(SubscriptionRequest request); boolean hasAnyScriptFilters(); @Override java.util.Optional<UUID> startingAfter(); static Sub... |
### Question:
SubscriptionRequestTO implements SubscriptionRequest { public void addSpecs(@NonNull List<FactSpec> factSpecs) { checkArgument(!factSpecs.isEmpty()); specs.addAll(factSpecs); } SubscriptionRequestTO(SubscriptionRequest request); boolean hasAnyScriptFilters(); @Override java.util.Optional<UUID> startingAft... |
### Question:
Lz4GrpcServerCodec implements Codec { @Override public String getMessageEncoding() { return "lz4"; } @Override String getMessageEncoding(); @Override InputStream decompress(InputStream inputStream); @Override OutputStream compress(OutputStream outputStream); }### Answer:
@Test void getMessageEncoding() ... |
### Question:
SnappyGrpcServerCodec implements Codec { @Override public String getMessageEncoding() { return "snappy"; } @Override String getMessageEncoding(); @Override InputStream decompress(InputStream inputStream); @Override OutputStream compress(OutputStream outputStream); }### Answer:
@Test void getMessageEncod... |
### Question:
BlockingStreamObserver implements StreamObserver<T> { @Override public void onCompleted() { delegate.onCompleted(); } BlockingStreamObserver(@NonNull String id, @NonNull ServerCallStreamObserver<T> delegate); @Override void onNext(T value); @Override void onError(Throwable t); @Override void onCompleted()... |
### Question:
BlockingStreamObserver implements StreamObserver<T> { @Override public void onError(Throwable t) { delegate.onError(t); } BlockingStreamObserver(@NonNull String id, @NonNull ServerCallStreamObserver<T> delegate); @Override void onNext(T value); @Override void onError(Throwable t); @Override void onComplet... |
### Question:
PgConfigurationProperties implements ApplicationListener<ApplicationReadyEvent> { public int getQueueSizeForIds() { return queueSize * idOnlyFactor; } int getPageSizeForIds(); int getQueueSizeForIds(); int getFetchSizeForIds(); int getFetchSize(); @Override void onApplicationEvent(ApplicationReadyEvent e... |
### Question:
BlockingStreamObserver implements StreamObserver<T> { @Override public void onNext(T value) { if (!delegate.isCancelled()) { synchronized (lock) { if (!delegate.isReady()) { for (int i = 1; i <= RETRY_COUNT; i++) { log.debug("{} channel not ready. Slow client? Attempt: {}/{}", id, i, RETRY_COUNT); try { l... |
### Question:
FactStoreGrpcService extends RemoteFactStoreImplBase { @Override @Secured(FactCastRole.WRITE) public void publish(@NonNull MSG_Facts request, StreamObserver<MSG_Empty> responseObserver) { List<Fact> facts = request.getFactList() .stream() .map(converter::fromProto) .collect( Collectors.toList()); final in... |
### Question:
FactStoreGrpcService extends RemoteFactStoreImplBase { @Override public void fetchById(MSG_UUID request, StreamObserver<MSG_OptionalFact> responseObserver) { try { enableResponseCompression(responseObserver); UUID fromProto = converter.fromProto(request); log.trace("fetchById {}", fromProto); Optional<Fac... |
### Question:
FactStoreGrpcService extends RemoteFactStoreImplBase { @Override public void subscribe(MSG_SubscriptionRequest request, StreamObserver<MSG_Notification> responseObserver) { enableResponseCompression(responseObserver); SubscriptionRequestTO req = converter.fromProto(request); resetDebugInfo(req); BlockingS... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.