method2testcases
stringlengths
118
6.63k
### Question: FactStoreGrpcService extends RemoteFactStoreImplBase { @Override public void serialOf(MSG_UUID request, StreamObserver<MSG_OptionalSerial> responseObserver) { OptionalLong serialOf = store.serialOf(converter.fromProto(request)); responseObserver.onNext(converter.toProto(serialOf)); responseObserver.onComp...
### Question: FactStoreGrpcService extends RemoteFactStoreImplBase { @Override public void enumerateNamespaces(MSG_Empty request, StreamObserver<MSG_StringSet> responseObserver) { try { responseObserver.onNext(converter.toProto(store.enumerateNamespaces())); responseObserver.onCompleted(); } catch (Throwable e) { respo...
### Question: FactStoreGrpcService extends RemoteFactStoreImplBase { @Override public void enumerateTypes(MSG_String request, StreamObserver<MSG_StringSet> responseObserver) { enableResponseCompression(responseObserver); try { Set<String> types = store.enumerateTypes(converter.fromProto( request)); responseObserver.onN...
### Question: FactStoreGrpcService extends RemoteFactStoreImplBase { @Override public void handshake(MSG_Empty request, StreamObserver<MSG_ServerConfig> responseObserver) { ServerConfig cfg = ServerConfig.of(PROTOCOL_VERSION, collectProperties()); responseObserver.onNext(converter.toProto(cfg)); responseObserver.onComp...
### Question: FactStoreGrpcService extends RemoteFactStoreImplBase { @VisibleForTesting void retrieveImplementationVersion(HashMap<String, String> properties) { String implVersion = "UNKNOWN"; URL propertiesUrl = getProjectProperties(); Properties buildProperties = new Properties(); if (propertiesUrl != null) { try { I...
### Question: FactStoreGrpcService extends RemoteFactStoreImplBase { @Override @Secured(FactCastRole.WRITE) public void invalidate(MSG_UUID request, StreamObserver<MSG_Empty> responseObserver) { try { UUID tokenId = converter.fromProto(request); store.invalidate(new StateToken(tokenId)); responseObserver.onNext(MSG_Emp...
### Question: FactStoreGrpcService extends RemoteFactStoreImplBase { @Override @Secured(FactCastRole.WRITE) public void stateFor(MSG_StateForRequest request, StreamObserver<MSG_UUID> responseObserver) { try { StateForRequest req = converter.fromProto(request); StateToken token = store.stateFor(req.aggIds(), Optional.of...
### Question: FactStoreGrpcService extends RemoteFactStoreImplBase { @Override @Secured(FactCastRole.WRITE) public void publishConditional(MSG_ConditionalPublishRequest request, StreamObserver<MSG_ConditionalPublishResult> responseObserver) { try { ConditionalPublishRequest req = converter.fromProto(request); boolean r...
### Question: PgListener implements InitializingBean, DisposableBean { private void listen() { log.trace("Starting instance Listener"); CountDownLatch l = new CountDownLatch(1); listenerThread = new Thread(() -> { while (running.get()) { postEvent("scheduled-poll"); try (PgConnection pc = pgConnectionSupplier.get()) { ...
### Question: GrpcCompressionInterceptor implements ServerInterceptor { @Override public <ReqT, RespT> Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next) { codecs.selectFrom(headers.get(GRPC_ACCEPT_ENCODING)).ifPresent(c -> { call.setCompression(c); call.se...
### Question: GrpcObserverAdapter implements FactObserver { @Override public void onComplete() { log.info("{} onComplete – sending complete notification", id); observer.onNext(converter.createCompleteNotification()); tryComplete(); } @Override void onComplete(); @Override void onError(Throwable e); @Override void onCa...
### Question: GrpcObserverAdapter implements FactObserver { @Override public void onCatchup() { log.info("{} onCatchup – sending catchup notification", id); observer.onNext(converter.createCatchupNotification()); } @Override void onComplete(); @Override void onError(Throwable e); @Override void onCatchup(); @Override ...
### Question: GrpcObserverAdapter implements FactObserver { @Override public void onError(Throwable e) { log.warn("{} onError – sending Error notification {}", id, e.getMessage()); observer.onError(e); tryComplete(); } @Override void onComplete(); @Override void onError(Throwable e); @Override void onCatchup(); @Overr...
### Question: GrpcObserverAdapter implements FactObserver { @Override public void onNext(Fact element) { observer.onNext(projection.apply(element)); } @Override void onComplete(); @Override void onError(Throwable e); @Override void onCatchup(); @Override void onNext(Fact element); }### Answer: @Test void testOnNext()...
### Question: PgListener implements InitializingBean, DisposableBean { @Override public void destroy() { this.running.set(false); if (listenerThread != null) { listenerThread.interrupt(); } } @Override void afterPropertiesSet(); @Override void destroy(); }### Answer: @Test void testStopWithoutStarting() { PgListener ...
### Question: PgConnectionSupplier { @VisibleForTesting Properties buildPgConnectionProperties(org.apache.tomcat.jdbc.pool.DataSource ds) { Properties dbp = new Properties(); final PoolConfiguration poolProperties = ds.getPoolProperties(); if (poolProperties != null) { setProperty(dbp, "user", poolProperties.getUsernam...
### Question: RdsDataSourceFactoryBeanPostProcessor implements BeanPostProcessor { @Override @NonNull public Object postProcessAfterInitialization(@NonNull Object bean, @NonNull String beanName) throws BeansException { return bean; } @Override @NonNull Object postProcessBeforeInitialization(@NonNull Object bean, @NonN...
### Question: RdsDataSourceFactoryBeanPostProcessor implements BeanPostProcessor { @Override @NonNull public Object postProcessBeforeInitialization(@NonNull Object bean, @NonNull String beanName) throws BeansException { if (bean instanceof AmazonRdsDataSourceFactoryBean) { ((AmazonRdsDataSourceFactoryBean) bean).setDat...
### Question: PgConfigurationProperties implements ApplicationListener<ApplicationReadyEvent> { public int getFetchSizeForIds() { return getQueueSizeForIds() / queueFetchRatio; } int getPageSizeForIds(); int getQueueSizeForIds(); int getFetchSizeForIds(); int getFetchSize(); @Override void onApplicationEvent(Applicati...
### Question: InMemFact extends DefaultFact { @Override public String toString() { return FactCastJson.writeValueAsPrettyString(this); } InMemFact(long ser, Fact toCopyFrom); @Override String toString(); }### Answer: @Test public void testToString() throws Exception { Fact f = Fact.of("{\"ns\":\"someNs\",\"id\":\"" + ...
### Question: FactRenderer { public String render(Fact f) { return "Fact: id=" + f.id() + CR + TAB + "header: " + renderJson(f.jsonHeader()).replaceAll( CR, CR + TAB + TAB) + CR + TAB + "payload: " + renderJson(f.jsonPayload()).replaceAll(CR, CR + TAB + TAB) + CR + CR; } String render(Fact f); }### Answer: @Test void...
### Question: Catchup implements Command { @Override public void runWith(FactCast fc, Options opt) { ConsoleFactObserver obs = new ConsoleFactObserver(opt); SpecBuilder catchup = SubscriptionRequest.catchup(FactSpec.ns(ns)); if (from == null) fc.subscribeEphemeral(catchup.fromScratch(), obs); else fc.subscribeEphemeral...
### Question: ProtoConverter { public MSG_Notification createCatchupNotification() { return MSG_Notification.newBuilder().setType(MSG_Notification.Type.Catchup).build(); } MSG_Notification createCatchupNotification(); MSG_Notification createCompleteNotification(); MSG_Notification createNotificationFor(@NonNull Fact t...
### Question: PgConfigurationProperties implements ApplicationListener<ApplicationReadyEvent> { public int getFetchSize() { return getQueueSize() / queueFetchRatio; } int getPageSizeForIds(); int getQueueSizeForIds(); int getFetchSizeForIds(); int getFetchSize(); @Override void onApplicationEvent(ApplicationReadyEvent...
### Question: ProtoConverter { public MSG_Notification createCompleteNotification() { return MSG_Notification.newBuilder().setType(MSG_Notification.Type.Complete).build(); } MSG_Notification createCatchupNotification(); MSG_Notification createCompleteNotification(); MSG_Notification createNotificationFor(@NonNull Fact...
### Question: ProtoConverter { public MSG_Notification createNotificationFor(@NonNull Fact t) { MSG_Notification.Builder builder = MSG_Notification.newBuilder() .setType(MSG_Notification.Type.Fact); builder.setFact(toProto(t)); return builder.build(); } MSG_Notification createCatchupNotification(); MSG_Notification cr...
### Question: ProtoConverter { public MSG_Empty empty() { return EMPTY; } MSG_Notification createCatchupNotification(); MSG_Notification createCompleteNotification(); MSG_Notification createNotificationFor(@NonNull Fact t); MSG_Notification createNotificationFor(@NonNull UUID id); @NonNull MSG_UUID toProto(@NonNull UU...
### Question: PgQueryBuilder { public PgQueryBuilder(@NonNull SubscriptionRequestTO request) { this.req = request; selectIdOnly = request.idOnly() && !request.hasAnyScriptFilters(); } PgQueryBuilder(@NonNull SubscriptionRequestTO request); PreparedStatementSetter createStatementSetter(@NonNull AtomicLong serial); Strin...
### Question: ProtocolVersion { public boolean isCompatibleTo(ProtocolVersion other) { return (major == other.major) && (minor <= other.minor); } boolean isCompatibleTo(ProtocolVersion other); @Override String toString(); }### Answer: @Test void testIsCompatibleTo() { assertTrue(ProtocolVersion.of(1, 0, 0).isCompatib...
### Question: ProtocolVersion { @Override public String toString() { StringJoiner joiner = new StringJoiner("."); joiner.add(String.valueOf(major)).add(String.valueOf(minor)).add(String.valueOf(patch)); return joiner.toString(); } boolean isCompatibleTo(ProtocolVersion other); @Override String toString(); }### Answer...
### Question: PgSynchronizedQuery { @SuppressWarnings("SameReturnValue") public synchronized void run(boolean useIndex) { long latest = latestFetcher.retrieveLatestSer(); transactionTemplate.execute(status -> { if (!useIndex) jdbcTemplate.execute("SET LOCAL enable_bitmapscan=0;"); jdbcTemplate.query(sql, setter, rowHan...
### Question: SnappyGrpcClientCodec implements Codec { @Override public String getMessageEncoding() { return "snappy"; } @Override String getMessageEncoding(); @Override OutputStream compress(OutputStream os); @Override InputStream decompress(InputStream is); }### Answer: @Test void getMessageEncoding() { assertEqual...
### Question: Lz4GrpcClientCodec 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: ClientStreamObserver implements StreamObserver<FactStoreProto.MSG_Notification> { @Override public void onNext(MSG_Notification f) { log.trace("observer got msg: {}", f); switch (f.getType()) { case Catchup: log.debug("received onCatchup signal"); subscription.notifyCatchup(); break; case Complete: log.de...
### Question: ClientStreamObserver implements StreamObserver<FactStoreProto.MSG_Notification> { @Override public void onCompleted() { subscription.notifyComplete(); } @Override void onNext(MSG_Notification f); @Override void onError(Throwable t); @Override void onCompleted(); }### Answer: @Test void testOnTransportCo...
### Question: ClientStreamObserver implements StreamObserver<FactStoreProto.MSG_Notification> { @Override public void onError(Throwable t) { subscription.notifyError(t); } @Override void onNext(MSG_Notification f); @Override void onError(Throwable t); @Override void onCompleted(); }### Answer: @Test void testOnError(...
### Question: GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public Optional<Fact> fetchById(UUID id) { log.trace("fetching {} from remote store", id); MSG_OptionalFact fetchById; try { fetchById = blockingStub.fetchById(converter.toProto(id)); } catch (StatusRuntimeException e) { throw wrap...
### Question: GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public void publish(@NonNull List<? extends Fact> factsToPublish) { log.trace("publishing {} facts to remote store", factsToPublish.size()); List<MSG_Fact> mf = factsToPublish.stream() .map(converter::toProto) .collect(Collectors ....
### Question: GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting void configureCompression(String codecListFromServer) { codecs.selectFrom(codecListFromServer).ifPresent(c -> { log.info("configuring Codec " + c); this.blockingStub = blockingStub.withCompression(c); this.stub = stub.with...
### Question: GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting void cancel(final ClientCall<MSG_SubscriptionRequest, MSG_Notification> call) { call.cancel("Client is no longer interested", null); } @SuppressWarnings("OptionalUsedAsFieldOrParameterType") @Autowired @Generated GrpcFact...
### Question: PgFactStream { void connect(@NonNull SubscriptionRequestTO request) { this.request = request; log.debug("{} connecting subscription {}", request, request.dump()); postQueryMatcher = new PgPostQueryMatcher(request); PgQueryBuilder q = new PgQueryBuilder(request); initializeSerialToStartAfter(); String sql ...
### Question: GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public OptionalLong serialOf(@NonNull UUID l) { MSG_UUID protoMessage = converter.toProto(l); MSG_OptionalSerial responseMessage; try { responseMessage = blockingStub.serialOf(protoMessage); } catch (StatusRuntimeException e) { thr...
### Question: GrpcFactStore implements FactStore, SmartInitializingSingleton { public synchronized void initialize() { if (!initialized.getAndSet(true)) { log.debug("Invoking handshake"); Map<String, String> serverProperties; ProtocolVersion serverProtocolVersion; try { ServerConfig cfg = converter.fromProto(blockingSt...
### Question: GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public Set<String> enumerateTypes(String ns) { MSG_String ns_message = converter.toProto(ns); MSG_StringSet resp; try { resp = blockingStub.enumerateTypes(ns_message); } catch (StatusRuntimeException e) { throw wrapRetryable(e); } ...
### Question: PgPostQueryMatcher implements Predicate<Fact> { PgPostQueryMatcher(@NonNull SubscriptionRequest req) { canBeSkipped = req.specs().stream().noneMatch(s -> s.jsFilterScript() != null); if (canBeSkipped) { log.trace("{} post query filtering has been disabled", req); } else { this.matchers.addAll(req.specs() ...
### Question: GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting static RuntimeException wrapRetryable(StatusRuntimeException e) { if (e.getStatus().getCode() == Code.UNAVAILABLE) { return new RetryableException(e); } else { return e; } } @SuppressWarnings("OptionalUsedAsFieldOrParamete...
### Question: GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public void invalidate(@NonNull StateToken token) { MSG_UUID msg = converter.toProto(token.uuid()); try { MSG_Empty msgEmpty = blockingStub.invalidate(msg); } catch (StatusRuntimeException e) { throw wrapRetryable(e); } } @Suppress...
### Question: GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public StateToken stateFor(@NonNull Collection<UUID> forAggIds, @NonNull Optional<String> ns) { StateForRequest req = new StateForRequest(Lists.newArrayList(forAggIds), ns.orElse(null)); MSG_StateForRequest msg = converter.toProto(...
### Question: GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public boolean publishIfUnchanged(@NonNull List<? extends Fact> factsToPublish, @NonNull Optional<StateToken> token) { ConditionalPublishRequest req = new ConditionalPublishRequest(factsToPublish, token.map( StateToken::uuid).orEls...
### Question: JadxCLIArgs { public boolean isReplaceConsts() { return replaceConsts; } boolean processArgs(String[] args); boolean overrideProvided(String[] args); JadxArgs toJadxArgs(); List<String> getFiles(); String getOutDir(); String getOutDirSrc(); String getOutDirRes(); boolean isSkipResources(); boolean isSkip...
### Question: CertificateManager { public String generateSignature() { StringBuilder builder = new StringBuilder(); append(builder, NLS.str("certificate.serialSigType"), x509cert.getSigAlgName()); append(builder, NLS.str("certificate.serialSigOID"), x509cert.getSigAlgOID()); return builder.toString(); } CertificateMana...
### Question: CertificateManager { public String generateFingerprint() { StringBuilder builder = new StringBuilder(); try { append(builder, NLS.str("certificate.serialMD5"), getThumbPrint(x509cert, "MD5")); append(builder, NLS.str("certificate.serialSHA1"), getThumbPrint(x509cert, "SHA-1")); append(builder, NLS.str("ce...
### Question: StringRef implements CharSequence { public static StringRef subString(String str, int from, int to) { return new StringRef(str, from, to - from); } private StringRef(String str, int from, int length); static StringRef subString(String str, int from, int to); static StringRef subString(String str, int fro...
### Question: StringRef implements CharSequence { public StringRef trim() { int start = offset; int end = start + length; String str = refStr; while ((start < end) && (str.charAt(start) <= ' ')) { start++; } while ((start < end) && (str.charAt(end - 1) <= ' ')) { end--; } if ((start > offset) || (end < offset + length)...
### Question: StringRef implements CharSequence { public static List<StringRef> split(String str, String splitBy) { int len = str.length(); int targetLen = splitBy.length(); if (len == 0 || targetLen == 0) { return Collections.emptyList(); } int pos = -targetLen; List<StringRef> list = new ArrayList<>(); while (true) {...
### Question: VersionComparator { public static int compare(String str1, String str2) { String[] s1 = str1.split("\\."); int l1 = s1.length; String[] s2 = str2.split("\\."); int l2 = s2.length; int i = 0; while (i < l1 && i < l2) { if (!s1[i].equals(s2[i])) { break; } i++; } if (i < l1 && i < l2) { return Integer.value...
### Question: JadxCLIArgs { public boolean isEscapeUnicode() { return escapeUnicode; } boolean processArgs(String[] args); boolean overrideProvided(String[] args); JadxArgs toJadxArgs(); List<String> getFiles(); String getOutDir(); String getOutDirSrc(); String getOutDirRes(); boolean isSkipResources(); boolean isSkip...
### Question: TypeCompare { public TypeCompareEnum compareTypes(ClassNode first, ClassNode second) { return compareObjects(first.getType(), second.getType()); } TypeCompare(RootNode root); TypeCompareEnum compareTypes(ClassNode first, ClassNode second); TypeCompareEnum compareTypes(ArgType first, ArgType second); Compa...
### Question: TypeUtils { @Nullable public ArgType replaceTypeVariablesUsingMap(ArgType replaceType, Map<ArgType, ArgType> replaceMap) { if (replaceMap.isEmpty()) { return null; } if (replaceType.isGenericType()) { return replaceMap.get(replaceType); } if (replaceType.isArray()) { ArgType replaced = replaceTypeVariable...
### Question: AccessInfo { public AccessInfo changeVisibility(int flag) { int currentVisFlags = accFlags & VISIBILITY_FLAGS; if (currentVisFlags == flag) { return this; } int unsetAllVisFlags = accFlags & ~VISIBILITY_FLAGS; return new AccessInfo(unsetAllVisFlags | flag, type); } AccessInfo(int accessFlags, AFType type)...
### Question: NameMapper { public static boolean isValidIdentifier(String str) { return notEmpty(str) && !isReserved(str) && VALID_JAVA_IDENTIFIER.matcher(str).matches(); } private NameMapper(); static boolean isReserved(String str); static boolean isValidIdentifier(String str); static boolean isValidFullIdentifier(St...
### Question: NameMapper { public static String removeInvalidCharsMiddle(String name) { if (isValidIdentifier(name) && isAllCharsPrintable(name)) { return name; } int len = name.length(); StringBuilder sb = new StringBuilder(len); for (int i = 0; i < len; i++) { int codePoint = name.codePointAt(i); if (isPrintableChar(...
### Question: NameMapper { public static String removeInvalidChars(String name, String prefix) { String result = removeInvalidCharsMiddle(name); if (!result.isEmpty()) { int codePoint = result.codePointAt(0); if (!isValidIdentifierStart(codePoint)) { return prefix + result; } } return result; } private NameMapper(); s...
### Question: JadxCLIArgs { public boolean isSkipSources() { return skipSources; } boolean processArgs(String[] args); boolean overrideProvided(String[] args); JadxArgs toJadxArgs(); List<String> getFiles(); String getOutDir(); String getOutDirSrc(); String getOutDirRes(); boolean isSkipResources(); boolean isSkipSour...
### Question: JSources extends JNode { List<JPackage> getHierarchyPackages(List<JavaPackage> packages) { Map<String, JPackage> pkgMap = new HashMap<>(); for (JavaPackage pkg : packages) { addPackage(pkgMap, new JPackage(pkg, wrapper)); } boolean repeat; do { repeat = false; for (JPackage pkg : pkgMap.values()) { List<J...
### Question: CertificateManager { public static String decode(InputStream in) { StringBuilder strBuild = new StringBuilder(); Collection<? extends Certificate> certificates = readCertificates(in); if (certificates != null) { for (Certificate cert : certificates) { CertificateManager certificateManager = new Certificat...
### Question: CertificateManager { public String generateHeader() { StringBuilder builder = new StringBuilder(); append(builder, NLS.str("certificate.cert_type"), x509cert.getType()); append(builder, NLS.str("certificate.serialSigVer"), ((Integer) x509cert.getVersion()).toString()); append(builder, NLS.str("certificate...
### Question: CatalogService { public CompletableFuture<String> addProductToCatalog(AddProductToCatalogCommand command) { LOG.debug("Processing AddProductToCatalogCommand command: {}", command); return this.commandGateway.send(command); } CatalogService(CommandGateway commandGateway); CompletableFuture<String> addProdu...
### Question: CatalogApiController { @PostMapping("/add") public CompletableFuture<String> addProductToCatalog(@RequestBody Map<String, String> request) { AddProductToCatalogCommand command = new AddProductToCatalogCommand(request.get("id"), request.get("name")); LOG.info("Executing command: {}", command); return catal...
### Question: EventProcessor { @EventHandler public void on(ProductAddedEvent productAddedEvent) { repo.save(new Product(productAddedEvent.getId(), productAddedEvent.getName())); LOG.info("A product was added! Id={} Name={}", productAddedEvent.getId(), productAddedEvent.getName()); } EventProcessor(ProductRepository re...
### Question: DriftMethodInvocation extends AbstractFuture<Object> { static <A extends Address> DriftMethodInvocation<A> createDriftMethodInvocation( MethodInvoker invoker, MethodMetadata metadata, Map<String, String> headers, List<Object> parameters, RetryPolicy retryPolicy, AddressSelector<A> addressSelector, Optiona...
### Question: ReflectionHelper { public static List<String> extractParameterNames(Executable methodOrConstructor) { return PARAMETER_NAMES.getUnchecked(methodOrConstructor); } private ReflectionHelper(); static boolean isArray(Type type); static boolean isOptional(Type type); static Class<?> getArrayOfType(Type compon...
### Question: ThriftUnionMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjection = buildConstructorInject...
### Question: ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInje...
### Question: RetryPolicy { public ExceptionClassification classifyException(Throwable throwable, boolean idempotent) { if (throwable instanceof ConnectionFailedException) { return new ExceptionClassification(Optional.of(TRUE), DOWN); } if (idempotent && throwable instanceof RequestTimeoutException) { return new Except...
### Question: ThriftCatalog { public <T extends Enum<T>> ThriftEnumMetadata<?> getThriftEnumMetadata(Class<?> enumClass) { checkArgument(enumClass.isEnum(), "Class %s is not an enum", enumClass.getName()); ThriftEnumMetadata<?> enumMetadata = enums.get(enumClass); if (enumMetadata == null) { enumMetadata = thriftEnumMe...
### Question: ThriftMethodMetadata { public Method getMethod() { return method; } ThriftMethodMetadata(Method method, ThriftCatalog catalog); String getName(); ThriftType getReturnType(); List<ThriftFieldMetadata> getParameters(); Set<ThriftHeaderParameter> getHeaderParameters(); Map<Short, ExceptionInfo> getExceptions...
### Question: DriftServer { public ServerTransport getServerTransport() { return serverTransport; } @Inject DriftServer( ServerTransportFactory serverTransportFactory, ThriftCodecManager codecManager, MethodInvocationStatsFactory methodInvocationStatsFactory, Set<DriftSe...
### Question: SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } private SimpleAddressSelectorBinder(Optional<List<HostAndPort>> defaultAddresses); static AddressSelectorBinder simpleAd...
### Question: ConnectionPool implements ConnectionManager { @Override public Future<Channel> getConnection(ConnectionParameters connectionParameters, HostAndPort address) { ConnectionKey key = new ConnectionKey(connectionParameters, address); while (true) { synchronized (this) { if (closed) { return group.next().newFai...
### Question: DriftNettyMethodInvoker implements MethodInvoker { @Override public ListenableFuture<Object> invoke(InvokeRequest request) { try { return MoreFutures.addTimeout( InvocationResponseFuture.createInvocationResponseFuture(request, connectionParameters, connectionManager), () -> { String message = "Invocation ...
### Question: DriftServerConfig { @Config("thrift.server.stats.enabled") public DriftServerConfig setStatsEnabled(boolean statsEnabled) { this.statsEnabled = statsEnabled; return this; } boolean isStatsEnabled(); @Config("thrift.server.stats.enabled") DriftServerConfig setStatsEnabled(boolean statsEnabled); }### Answ...
### Question: GenericJDBCConfigurationStore extends AbstractJDBCConfigurationStore implements MessageStoreProvider { @Override public void onDelete(final ConfiguredObject<?> parent) { assertState(CLOSED); ConnectionProvider connectionProvider = JdbcUtils.createConnectionProvider(parent, LOGGER); try { try (Connection c...
### Question: EnvHomeRegistry { public synchronized void registerHome(final File home) throws StoreException { if (home == null) { throw new IllegalArgumentException("home parameter cannot be null"); } String canonicalForm = getCanonicalForm(home); if (_canonicalNames.contains(canonicalForm)) { throw new IllegalArgumen...
### Question: StandardEnvironmentFacade implements EnvironmentFacade { @Override public void close() { try { _committer.stop(); closeSequences(); closeDatabases(); } finally { try { closeEnvironment(); } finally { EnvHomeRegistry.getInstance().deregisterHome(_environmentPath); } } } StandardEnvironmentFacade(StandardEn...
### Question: ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public String getGroupName() { return (String)_configuration.getGroupName(); } ReplicatedEnvironmentFacade(ReplicatedEnvironmentConfiguration configuration); @Override Transaction beginTransaction(TransactionConfig transaction...
### Question: ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public String getNodeName() { return _configuration.getName(); } ReplicatedEnvironmentFacade(ReplicatedEnvironmentConfiguration configuration); @Override Transaction beginTransaction(TransactionConfig transactionConfig); @Over...
### Question: ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public long getLastKnownReplicationTransactionId() { if (_state.get() == State.OPEN) { try { VLSNRange range = RepInternal.getRepImpl(getEnvironment()).getVLSNIndex().getRange(); VLSN lastTxnEnd = range.getLastTxnEnd(); return...
### Question: ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public String getHostPort() { return (String)_configuration.getHostPort(); } ReplicatedEnvironmentFacade(ReplicatedEnvironmentConfiguration configuration); @Override Transaction beginTransaction(TransactionConfig transactionCo...
### Question: ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public String getHelperHostPort() { return (String)_configuration.getHelperHostPort(); } ReplicatedEnvironmentFacade(ReplicatedEnvironmentConfiguration configuration); @Override Transaction beginTransaction(TransactionConfig t...
### Question: CompositeFilter extends Filter<ILoggingEvent> { public void addLogInclusionRule(LogBackLogInclusionRule logInclusionRule) { Filter<ILoggingEvent> f = logInclusionRule.asFilter(); f.setName(logInclusionRule.getName()); _filterList.add(f); } void addLogInclusionRule(LogBackLogInclusionRule logInclusionRule...
### Question: ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { public String getNodeState() { if (_state.get() != State.OPEN) { return ReplicatedEnvironment.State.UNKNOWN.name(); } try { ReplicatedEnvironment.State state = getEnvironment().getState(); return state.toString(); } catch (Run...
### Question: ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener { @Override public Transaction beginTransaction(TransactionConfig transactionConfig) { return getEnvironment().beginTransaction(null, transactionConfig); } ReplicatedEnvironmentFacade(ReplicatedEnvironmentConfiguration configura...
### Question: BDBMessageStore extends AbstractBDBMessageStore { @Override public void onDelete(ConfiguredObject<?> parent) { if (isMessageStoreOpen()) { throw new IllegalStateException("Cannot delete the store as store is still open"); } FileBasedSettings fileBasedSettings = (FileBasedSettings)parent; String storePath ...
### Question: StandardEnvironmentFacadeFactory implements EnvironmentFacadeFactory { @SuppressWarnings("unchecked") @Override public EnvironmentFacade createEnvironmentFacade(final ConfiguredObject<?> parent) { final FileBasedSettings settings = (FileBasedSettings)parent; final String storeLocation = settings.getStoreP...
### Question: MessageConverter_0_8_to_1_0 extends MessageConverter_to_1_0<AMQMessage> { @Override public String getType() { return "v0-8 to v1-0"; } @Override Class<AMQMessage> getInputClass(); @Override String getType(); }### Answer: @Test public void testConvertJmsStreamMessageBody() throws Exception { final List<O...
### Question: AMQShortString implements Comparable<AMQShortString> { @Override public boolean equals(Object o) { if (o == this) { return true; } if(o instanceof AMQShortString) { return equals((AMQShortString) o); } return false; } private AMQShortString(byte[] data); static String readAMQShortStringAsString(QpidByteB...
### Question: AMQShortString implements Comparable<AMQShortString> { public static AMQShortString createAMQShortString(byte[] data) { if (data == null) { throw new NullPointerException("Cannot create AMQShortString with null data[]"); } final AMQShortString cached = getShortStringCache().getIfPresent(ByteBuffer.wrap(da...
### Question: AMQShortString implements Comparable<AMQShortString> { static AMQShortString valueOf(Object obj, boolean truncate, boolean nullAsEmptyString) { if (obj == null) { if (nullAsEmptyString) { return EMPTY_STRING; } return null; } else { String value = String.valueOf(obj); int strLength = Math.min(value.length...
### Question: BasicContentHeaderProperties { public synchronized void dispose() { nullEncodedForm(); if (_headers != null) { _headers.dispose(); } } BasicContentHeaderProperties(BasicContentHeaderProperties other); BasicContentHeaderProperties(); BasicContentHeaderProperties(QpidByteBuffer buffer, int propertyFlags, ...