target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test void testOnNext() { Fact f = Fact.of("{\"ns\":\"ns\",\"id\":\"" + UUID.randomUUID() + "\"}", "{}"); MSG_Notification n = converter.createNotificationFor(f); uut.onNext(n); verify(factObserver).onNext(eq(f)); } | @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.debug("received onComplete signal"); subscription.notifyComplete(); break; case Fact: subscription... | 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.debug("received ... | 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.debug("received ... | 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.debug("received ... | 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.debug("received ... |
@Test void testOnNextFailsOnUnknownMessage() { assertThrows(IllegalArgumentException.class, () -> { MSG_Notification n = MSG_Notification.newBuilder().setType(Type.UNRECOGNIZED).build(); uut.onNext(n); }); } | @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.debug("received onComplete signal"); subscription.notifyComplete(); break; case Fact: subscription... | 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.debug("received ... | 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.debug("received ... | 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.debug("received ... | 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.debug("received ... |
@Test void testOnNextId() { MSG_Notification n = converter.createNotificationFor(UUID.randomUUID()); uut.onNext(n); verify(factObserver).onNext(any(IdOnlyFact.class)); } | @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.debug("received onComplete signal"); subscription.notifyComplete(); break; case Fact: subscription... | 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.debug("received ... | 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.debug("received ... | 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.debug("received ... | 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.debug("received ... |
@Test void testOnCatchup() { uut.onNext(converter.createCatchupNotification()); verify(factObserver).onCatchup(); } | @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.debug("received onComplete signal"); subscription.notifyComplete(); break; case Fact: subscription... | 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.debug("received ... | 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.debug("received ... | 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.debug("received ... | 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.debug("received ... |
@Test void testFailOnUnknownType() { uut.onNext(MSG_Notification.newBuilder().setTypeValue(999).build()); verify(subscription).notifyError(any(RuntimeException.class)); } | @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.debug("received onComplete signal"); subscription.notifyComplete(); break; case Fact: subscription... | 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.debug("received ... | 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.debug("received ... | 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.debug("received ... | 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.debug("received ... |
@Test void testOnComplete() { uut.onNext(converter.createCompleteNotification()); verify(factObserver).onComplete(); } | @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.debug("received onComplete signal"); subscription.notifyComplete(); break; case Fact: subscription... | 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.debug("received ... | 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.debug("received ... | 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.debug("received ... | 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.debug("received ... |
@Test void testOnTransportComplete() { uut.onCompleted(); verify(factObserver).onComplete(); } | @Override public void onCompleted() { subscription.notifyComplete(); } | ClientStreamObserver implements StreamObserver<FactStoreProto.MSG_Notification> { @Override public void onCompleted() { subscription.notifyComplete(); } } | ClientStreamObserver implements StreamObserver<FactStoreProto.MSG_Notification> { @Override public void onCompleted() { subscription.notifyComplete(); } } | 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(); } | 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(); } |
@Test void testOnError() { uut.onError(new IOException()); verify(factObserver).onError(any()); } | @Override public void onError(Throwable t) { subscription.notifyError(t); } | ClientStreamObserver implements StreamObserver<FactStoreProto.MSG_Notification> { @Override public void onError(Throwable t) { subscription.notifyError(t); } } | ClientStreamObserver implements StreamObserver<FactStoreProto.MSG_Notification> { @Override public void onError(Throwable t) { subscription.notifyError(t); } } | 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(); } | 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(); } |
@Test public void testRunWithoutIndex() throws Exception { uut = new PgSynchronizedQuery(jdbcTemplate, sql, setter, rowHandler, serialToContinueFrom, fetcher); uut.run(false); verify(jdbcTemplate).execute(startsWith("SET LOCAL enable_bitmapscan")); } | @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, rowHandler); return null; }); serialToCont... | 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, rowHandler); return ... | 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, rowHandler); return ... | 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, rowHandler); return ... | 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, rowHandler); return ... |
@Test void testFetchByIdNotFound() { UUID id = UUID.randomUUID(); when(blockingStub.fetchById(eq(conv.toProto(id)))).thenReturn(conv.toProto(Optional .empty())); Optional<Fact> fetchById = uut.fetchById(id); assertFalse(fetchById.isPresent()); } | @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 wrapRetryable(e); } if (!fetchById.getPresent()) { return Optional.empty(); } else ... | 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 wrapRetryable(e); ... | 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 wrapRetryable(e); ... | 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 wrapRetryable(e); ... | 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 wrapRetryable(e); ... |
@Test void testFetchByIdFound() { UUID id = UUID.randomUUID(); when(blockingStub.fetchById(eq(conv.toProto(id)))) .thenReturn(conv.toProto(Optional.of(Fact.builder().ns("test").build("{}")))); Optional<Fact> fetchById = uut.fetchById(id); assertTrue(fetchById.isPresent()); } | @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 wrapRetryable(e); } if (!fetchById.getPresent()) { return Optional.empty(); } else ... | 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 wrapRetryable(e); ... | 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 wrapRetryable(e); ... | 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 wrapRetryable(e); ... | 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 wrapRetryable(e); ... |
@Test void testPublish() { when(blockingStub.publish(factsCap.capture())).thenReturn(MSG_Empty.newBuilder().build()); final TestFact fact = new TestFact(); uut.publish(Collections.singletonList(fact)); verify(blockingStub).publish(any()); final MSG_Facts pfacts = factsCap.getValue(); Fact published = conv.fromProto(pfa... | @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 .toList()); MSG_Facts mfs = MSG_Facts.newBuilder().addAllFact(mf).build(); try {... | 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 .toList()); MSG... | 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 .toList()); MSG... | 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 .toList()); MSG... | 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 .toList()); MSG... |
@Test void testPublishNullParameter() { assertThrows(NullPointerException.class, () -> uut.publish(null)); } | @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 .toList()); MSG_Facts mfs = MSG_Facts.newBuilder().addAllFact(mf).build(); try {... | 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 .toList()); MSG... | 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 .toList()); MSG... | 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 .toList()); MSG... | 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 .toList()); MSG... |
@Test void configureCompressionChooseGzipIfAvail() { uut.configureCompression(" gzip,lz3,lz4, lz99"); verify(stub).withCompression("gzip"); } | @VisibleForTesting void configureCompression(String codecListFromServer) { codecs.selectFrom(codecListFromServer).ifPresent(c -> { log.info("configuring Codec " + c); this.blockingStub = blockingStub.withCompression(c); this.stub = stub.withCompression(c); }); } | 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.withCompression(c)... | 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.withCompression(c)... | 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.withCompression(c)... | 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.withCompression(c)... |
@Test void configureCompressionSkipCompression() { uut.configureCompression("zip,lz3,lz4, lz99"); verifyNoMoreInteractions(stub); } | @VisibleForTesting void configureCompression(String codecListFromServer) { codecs.selectFrom(codecListFromServer).ifPresent(c -> { log.info("configuring Codec " + c); this.blockingStub = blockingStub.withCompression(c); this.stub = stub.withCompression(c); }); } | 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.withCompression(c)... | 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.withCompression(c)... | 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.withCompression(c)... | 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.withCompression(c)... |
@Test void testPublishPropagatesException() { when(blockingStub.publish(any())).thenThrow(new SomeException()); assertThrows(SomeException.class, () -> uut.publish(Collections.singletonList(Fact.builder() .build("{}")))); } | @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 .toList()); MSG_Facts mfs = MSG_Facts.newBuilder().addAllFact(mf).build(); try {... | 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 .toList()); MSG... | 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 .toList()); MSG... | 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 .toList()); MSG... | 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 .toList()); MSG... |
@Test void testFetchByIdPropagatesRetryableExceptionOnUnavailableStatus() { when(blockingStub.fetchById(any())).thenThrow(new StatusRuntimeException( Status.UNAVAILABLE)); assertThrows(RetryableException.class, () -> uut.fetchById(UUID.randomUUID())); } | @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 wrapRetryable(e); } if (!fetchById.getPresent()) { return Optional.empty(); } else ... | 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 wrapRetryable(e); ... | 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 wrapRetryable(e); ... | 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 wrapRetryable(e); ... | 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 wrapRetryable(e); ... |
@Test void testPublishPropagatesRetryableExceptionOnUnavailableStatus() { when(blockingStub.publish(any())).thenThrow(new StatusRuntimeException(Status.UNAVAILABLE)); assertThrows(RetryableException.class, () -> uut.publish(Collections.singletonList(Fact .builder() .build("{}")))); } | @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 .toList()); MSG_Facts mfs = MSG_Facts.newBuilder().addAllFact(mf).build(); try {... | 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 .toList()); MSG... | 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 .toList()); MSG... | 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 .toList()); MSG... | 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 .toList()); MSG... |
@SuppressWarnings("unchecked") @Test void testCancelNotRetryableExceptionOnUnavailableStatus() { ClientCall<MSG_SubscriptionRequest, MSG_Notification> call = mock(ClientCall.class); doThrow(new StatusRuntimeException(Status.UNAVAILABLE)).when(call).cancel(any(), any()); assertThrows(StatusRuntimeException.class, () -> ... | @VisibleForTesting void cancel(final ClientCall<MSG_SubscriptionRequest, MSG_Notification> call) { call.cancel("Client is no longer interested", null); } | GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting void cancel(final ClientCall<MSG_SubscriptionRequest, MSG_Notification> call) { call.cancel("Client is no longer interested", null); } } | 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 GrpcFactStore(FactCast... | 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 GrpcFactStore(FactCast... | 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 GrpcFactStore(FactCast... |
@Test public void testConnectNullParameter() throws Exception { assertThrows(NullPointerException.class, () -> { uut.connect(null); }); } | 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 = q.createSQL(); PreparedStat... | 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 = q.createSQL(... | 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 = q.createSQL(... | 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 = q.createSQL(... | 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 = q.createSQL(... |
@Test void testSerialOfPropagatesRetryableExceptionOnUnavailableStatus() { when(blockingStub.serialOf(any())).thenThrow(new StatusRuntimeException( Status.UNAVAILABLE)); assertThrows(RetryableException.class, () -> uut.serialOf(mock(UUID.class))); } | @Override public OptionalLong serialOf(@NonNull UUID l) { MSG_UUID protoMessage = converter.toProto(l); MSG_OptionalSerial responseMessage; try { responseMessage = blockingStub.serialOf(protoMessage); } catch (StatusRuntimeException e) { throw wrapRetryable(e); } return converter.fromProto(responseMessage); } | 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) { throw wrapRetryab... | 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) { throw wrapRetryab... | 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) { throw wrapRetryab... | 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) { throw wrapRetryab... |
@Test void testSerialOf() { OptionalLong seven = OptionalLong.of(7); when(blockingStub.serialOf(any())).thenReturn(conv.toProto(seven)); OptionalLong response = uut.serialOf(mock(UUID.class)); assertEquals(seven, response); assertNotSame(seven, response); } | @Override public OptionalLong serialOf(@NonNull UUID l) { MSG_UUID protoMessage = converter.toProto(l); MSG_OptionalSerial responseMessage; try { responseMessage = blockingStub.serialOf(protoMessage); } catch (StatusRuntimeException e) { throw wrapRetryable(e); } return converter.fromProto(responseMessage); } | 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) { throw wrapRetryab... | 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) { throw wrapRetryab... | 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) { throw wrapRetryab... | 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) { throw wrapRetryab... |
@Test void testInitializePropagatesRetryableExceptionOnUnavailableStatus() { when(blockingStub.handshake(any())).thenThrow(new StatusRuntimeException( Status.UNAVAILABLE)); assertThrows(RetryableException.class, () -> uut.initialize()); } | public synchronized void initialize() { if (!initialized.getAndSet(true)) { log.debug("Invoking handshake"); Map<String, String> serverProperties; ProtocolVersion serverProtocolVersion; try { ServerConfig cfg = converter.fromProto(blockingStub.handshake(converter.empty())); serverProtocolVersion = cfg.version(); server... | 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(blockingStub.handshake(c... | 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(blockingStub.handshake(c... | 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(blockingStub.handshake(c... | 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(blockingStub.handshake(c... |
@Test void testEnumerateNamespacesPropagatesRetryableExceptionOnUnavailableStatus() { when(blockingStub.enumerateNamespaces(any())).thenThrow(new StatusRuntimeException( Status.UNAVAILABLE)); assertThrows(RetryableException.class, () -> uut.enumerateNamespaces()); } | @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 converter.fromProto(resp); } | 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 converter.fromProto(r... | 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 converter.fromProto(r... | 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 converter.fromProto(r... | 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 converter.fromProto(r... |
@Test void testEnumerateNamespaces() { HashSet<String> ns = Sets.newHashSet("foo", "bar"); when(blockingStub.enumerateNamespaces(conv.empty())).thenReturn(conv.toProto(ns)); Set<String> enumerateNamespaces = uut.enumerateNamespaces(); assertEquals(ns, enumerateNamespaces); assertNotSame(ns, enumerateNamespaces); } | @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 converter.fromProto(resp); } | 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 converter.fromProto(r... | 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 converter.fromProto(r... | 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 converter.fromProto(r... | 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 converter.fromProto(r... |
@Test void testEnumerateTypesPropagatesRetryableExceptionOnUnavailableStatus() { when(blockingStub.enumerateTypes(any())).thenThrow(new StatusRuntimeException( Status.UNAVAILABLE)); assertThrows(RetryableException.class, () -> uut.enumerateTypes("ns")); } | @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); } return converter.fromProto(resp); } | 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); } return convert... | 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); } return convert... | 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); } return convert... | 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); } return convert... |
@Test void testEnumerateTypes() { HashSet<String> types = Sets.newHashSet("foo", "bar"); when(blockingStub.enumerateTypes(any())).thenReturn(conv.toProto(types)); Set<String> enumerateTypes = uut.enumerateTypes("ns"); assertEquals(types, enumerateTypes); assertNotSame(types, enumerateTypes); } | @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); } return converter.fromProto(resp); } | 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); } return convert... | 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); } return convert... | 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); } return convert... | 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); } return convert... |
@Test void testSubscribeNull() { expectNPE(() -> uut.subscribe(null, mock(FactObserver.class))); expectNPE(() -> uut.subscribe(null, null)); expectNPE(() -> uut.subscribe(mock(SubscriptionRequestTO.class), null)); } | @Override public Subscription subscribe(@NonNull SubscriptionRequestTO req, @NonNull FactObserver observer) { SubscriptionImpl<Fact> subscription = SubscriptionImpl.on(observer); StreamObserver<FactStoreProto.MSG_Notification> responseObserver = new ClientStreamObserver( subscription); ClientCall<MSG_SubscriptionReques... | GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public Subscription subscribe(@NonNull SubscriptionRequestTO req, @NonNull FactObserver observer) { SubscriptionImpl<Fact> subscription = SubscriptionImpl.on(observer); StreamObserver<FactStoreProto.MSG_Notification> responseObserver = new Clien... | GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public Subscription subscribe(@NonNull SubscriptionRequestTO req, @NonNull FactObserver observer) { SubscriptionImpl<Fact> subscription = SubscriptionImpl.on(observer); StreamObserver<FactStoreProto.MSG_Notification> responseObserver = new Clien... | GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public Subscription subscribe(@NonNull SubscriptionRequestTO req, @NonNull FactObserver observer) { SubscriptionImpl<Fact> subscription = SubscriptionImpl.on(observer); StreamObserver<FactStoreProto.MSG_Notification> responseObserver = new Clien... | GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public Subscription subscribe(@NonNull SubscriptionRequestTO req, @NonNull FactObserver observer) { SubscriptionImpl<Fact> subscription = SubscriptionImpl.on(observer); StreamObserver<FactStoreProto.MSG_Notification> responseObserver = new Clien... |
@Test void testCompatibleProtocolVersion() { when(blockingStub.handshake(any())) .thenReturn(conv.toProto(ServerConfig.of(ProtocolVersion.of(1, 1, 0), new HashMap<>()))); uut.initialize(); } | public synchronized void initialize() { if (!initialized.getAndSet(true)) { log.debug("Invoking handshake"); Map<String, String> serverProperties; ProtocolVersion serverProtocolVersion; try { ServerConfig cfg = converter.fromProto(blockingStub.handshake(converter.empty())); serverProtocolVersion = cfg.version(); server... | 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(blockingStub.handshake(c... | 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(blockingStub.handshake(c... | 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(blockingStub.handshake(c... | 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(blockingStub.handshake(c... |
@Test void testIncompatibleProtocolVersion() { when(blockingStub.handshake(any())) .thenReturn(conv.toProto(ServerConfig.of(ProtocolVersion.of(99, 0, 0), new HashMap<>()))); Assertions.assertThrows(IncompatibleProtocolVersions.class, () -> uut.initialize()); } | public synchronized void initialize() { if (!initialized.getAndSet(true)) { log.debug("Invoking handshake"); Map<String, String> serverProperties; ProtocolVersion serverProtocolVersion; try { ServerConfig cfg = converter.fromProto(blockingStub.handshake(converter.empty())); serverProtocolVersion = cfg.version(); server... | 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(blockingStub.handshake(c... | 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(blockingStub.handshake(c... | 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(blockingStub.handshake(c... | 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(blockingStub.handshake(c... |
@Test public void testPGPostQueryMatcher() throws Exception { assertThrows(NullPointerException.class, () -> { new PgPostQueryMatcher(null); }); } | 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() .stream() .map(FactSpecMatcher::new) .collect(Collectors.toLis... | 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() .stream() .map... | 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() .stream() .map... | 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() .stream() .map... | 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() .stream() .map... |
@Test void testInitializationExecutesOnlyOnce() { when(blockingStub.handshake(any())) .thenReturn(conv.toProto(ServerConfig.of(ProtocolVersion.of(1, 1, 0), new HashMap<>()))); uut.initialize(); uut.initialize(); verify(blockingStub, times(1)).handshake(any()); } | public synchronized void initialize() { if (!initialized.getAndSet(true)) { log.debug("Invoking handshake"); Map<String, String> serverProperties; ProtocolVersion serverProtocolVersion; try { ServerConfig cfg = converter.fromProto(blockingStub.handshake(converter.empty())); serverProtocolVersion = cfg.version(); server... | 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(blockingStub.handshake(c... | 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(blockingStub.handshake(c... | 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(blockingStub.handshake(c... | 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(blockingStub.handshake(c... |
@Test void testWrapRetryable_nonRetryable() throws Exception { StatusRuntimeException cause = new StatusRuntimeException(Status.DEADLINE_EXCEEDED); RuntimeException e = GrpcFactStore.wrapRetryable(cause); assertTrue(e instanceof StatusRuntimeException); assertSame(e, cause); } | @VisibleForTesting static RuntimeException wrapRetryable(StatusRuntimeException e) { if (e.getStatus().getCode() == Code.UNAVAILABLE) { return new RetryableException(e); } else { return e; } } | GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting static RuntimeException wrapRetryable(StatusRuntimeException e) { if (e.getStatus().getCode() == Code.UNAVAILABLE) { return new RetryableException(e); } else { return e; } } } | GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting static RuntimeException wrapRetryable(StatusRuntimeException e) { if (e.getStatus().getCode() == Code.UNAVAILABLE) { return new RetryableException(e); } else { return e; } } @SuppressWarnings("OptionalUsedAsFieldOrParameterType") @Autow... | GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting static RuntimeException wrapRetryable(StatusRuntimeException e) { if (e.getStatus().getCode() == Code.UNAVAILABLE) { return new RetryableException(e); } else { return e; } } @SuppressWarnings("OptionalUsedAsFieldOrParameterType") @Autow... | GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting static RuntimeException wrapRetryable(StatusRuntimeException e) { if (e.getStatus().getCode() == Code.UNAVAILABLE) { return new RetryableException(e); } else { return e; } } @SuppressWarnings("OptionalUsedAsFieldOrParameterType") @Autow... |
@Test void testWrapRetryable() throws Exception { StatusRuntimeException cause = new StatusRuntimeException(Status.UNAVAILABLE); RuntimeException e = GrpcFactStore.wrapRetryable(cause); assertTrue(e instanceof RetryableException); assertSame(e.getCause(), cause); } | @VisibleForTesting static RuntimeException wrapRetryable(StatusRuntimeException e) { if (e.getStatus().getCode() == Code.UNAVAILABLE) { return new RetryableException(e); } else { return e; } } | GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting static RuntimeException wrapRetryable(StatusRuntimeException e) { if (e.getStatus().getCode() == Code.UNAVAILABLE) { return new RetryableException(e); } else { return e; } } } | GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting static RuntimeException wrapRetryable(StatusRuntimeException e) { if (e.getStatus().getCode() == Code.UNAVAILABLE) { return new RetryableException(e); } else { return e; } } @SuppressWarnings("OptionalUsedAsFieldOrParameterType") @Autow... | GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting static RuntimeException wrapRetryable(StatusRuntimeException e) { if (e.getStatus().getCode() == Code.UNAVAILABLE) { return new RetryableException(e); } else { return e; } } @SuppressWarnings("OptionalUsedAsFieldOrParameterType") @Autow... | GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting static RuntimeException wrapRetryable(StatusRuntimeException e) { if (e.getStatus().getCode() == Code.UNAVAILABLE) { return new RetryableException(e); } else { return e; } } @SuppressWarnings("OptionalUsedAsFieldOrParameterType") @Autow... |
@Test void testCancelIsPropagated() throws Exception { ClientCall call = mock(ClientCall.class); uut.cancel(call); verify(call).cancel(any(), any()); } | @VisibleForTesting void cancel(final ClientCall<MSG_SubscriptionRequest, MSG_Notification> call) { call.cancel("Client is no longer interested", null); } | GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting void cancel(final ClientCall<MSG_SubscriptionRequest, MSG_Notification> call) { call.cancel("Client is no longer interested", null); } } | 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 GrpcFactStore(FactCast... | 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 GrpcFactStore(FactCast... | 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 GrpcFactStore(FactCast... |
@Test void testCancelIsNotRetryable() throws Exception { ClientCall call = mock(ClientCall.class); doThrow(StatusRuntimeException.class).when(call).cancel(any(), any()); try { uut.cancel(call); fail(); } catch (Throwable e) { assertTrue(e instanceof StatusRuntimeException); assertFalse(e instanceof RetryableException);... | @VisibleForTesting void cancel(final ClientCall<MSG_SubscriptionRequest, MSG_Notification> call) { call.cancel("Client is no longer interested", null); } | GrpcFactStore implements FactStore, SmartInitializingSingleton { @VisibleForTesting void cancel(final ClientCall<MSG_SubscriptionRequest, MSG_Notification> call) { call.cancel("Client is no longer interested", null); } } | 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 GrpcFactStore(FactCast... | 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 GrpcFactStore(FactCast... | 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 GrpcFactStore(FactCast... |
@Test void testSubscribeNullParameters() throws Exception { expectNPE(() -> uut.subscribe(null, mock(FactObserver.class))); expectNPE(() -> uut.subscribe(mock(SubscriptionRequestTO.class), null)); expectNPE(() -> uut.subscribe(null, null)); } | @Override public Subscription subscribe(@NonNull SubscriptionRequestTO req, @NonNull FactObserver observer) { SubscriptionImpl<Fact> subscription = SubscriptionImpl.on(observer); StreamObserver<FactStoreProto.MSG_Notification> responseObserver = new ClientStreamObserver( subscription); ClientCall<MSG_SubscriptionReques... | GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public Subscription subscribe(@NonNull SubscriptionRequestTO req, @NonNull FactObserver observer) { SubscriptionImpl<Fact> subscription = SubscriptionImpl.on(observer); StreamObserver<FactStoreProto.MSG_Notification> responseObserver = new Clien... | GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public Subscription subscribe(@NonNull SubscriptionRequestTO req, @NonNull FactObserver observer) { SubscriptionImpl<Fact> subscription = SubscriptionImpl.on(observer); StreamObserver<FactStoreProto.MSG_Notification> responseObserver = new Clien... | GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public Subscription subscribe(@NonNull SubscriptionRequestTO req, @NonNull FactObserver observer) { SubscriptionImpl<Fact> subscription = SubscriptionImpl.on(observer); StreamObserver<FactStoreProto.MSG_Notification> responseObserver = new Clien... | GrpcFactStore implements FactStore, SmartInitializingSingleton { @Override public Subscription subscribe(@NonNull SubscriptionRequestTO req, @NonNull FactObserver observer) { SubscriptionImpl<Fact> subscription = SubscriptionImpl.on(observer); StreamObserver<FactStoreProto.MSG_Notification> responseObserver = new Clien... |
@Test void testSerialOfNullParameters() throws Exception { expectNPE(() -> uut.serialOf(null)); } | @Override public OptionalLong serialOf(@NonNull UUID l) { MSG_UUID protoMessage = converter.toProto(l); MSG_OptionalSerial responseMessage; try { responseMessage = blockingStub.serialOf(protoMessage); } catch (StatusRuntimeException e) { throw wrapRetryable(e); } return converter.fromProto(responseMessage); } | 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) { throw wrapRetryab... | 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) { throw wrapRetryab... | 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) { throw wrapRetryab... | 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) { throw wrapRetryab... |
@Test void testInvalidate() throws Exception { assertThrows(NullPointerException.class, () -> uut.invalidate(null)); { UUID id = new UUID(0, 1); StateToken token = new StateToken(id); uut.invalidate(token); verify(blockingStub).invalidate(eq(conv.toProto(id))); } { when(blockingStub.invalidate(any())).thenThrow( new St... | @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); } } | 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); } } } | 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); } } @SuppressWarnings("Opti... | 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); } } @SuppressWarnings("Opti... | 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); } } @SuppressWarnings("Opti... |
@Test void testStateFor() throws Exception { assertThrows(NullPointerException.class, () -> uut.stateFor(Lists.emptyList(), null)); assertThrows(NullPointerException.class, () -> uut.stateFor(null, null)); assertThrows(NullPointerException.class, () -> uut.stateFor(null, Optional.of("foo"))); { UUID id = new UUID(0, 1)... | @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(req); try { MSG_UUID result = blockingStub.stateFor(msg); return new StateToken... | 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(req); try { MS... | 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(req); try { MS... | 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(req); try { MS... | 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(req); try { MS... |
@Test void testPublishIfUnchanged() throws Exception { assertThrows(NullPointerException.class, () -> uut.publishIfUnchanged(Lists.emptyList(), null)); assertThrows(NullPointerException.class, () -> uut.publishIfUnchanged(null, null)); assertThrows(NullPointerException.class, () -> uut.publishIfUnchanged(null, Optional... | @Override public boolean publishIfUnchanged(@NonNull List<? extends Fact> factsToPublish, @NonNull Optional<StateToken> token) { ConditionalPublishRequest req = new ConditionalPublishRequest(factsToPublish, token.map( StateToken::uuid).orElse(null)); MSG_ConditionalPublishRequest msg = converter.toProto(req); try { MSG... | 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).orElse(null)); MSG_... | 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).orElse(null)); MSG_... | 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).orElse(null)); MSG_... | 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).orElse(null)); MSG_... |
@Test void testMapRow() throws Exception { ResultSet rs = mock(ResultSet.class); final UUID id = UUID.randomUUID(); when(rs.getString(PgConstants.ALIAS_ID)).thenReturn(id.toString()); when(rs.getString(PgConstants.ALIAS_NS)).thenReturn("ns"); when(rs.getString(PgConstants.COLUMN_HEADER)).thenReturn("{\"ns\":\"ns\",\"id... | @Override @NonNull public Fact mapRow(@NonNull ResultSet rs, int rowNum) throws SQLException { serial.set(rs.getLong(PgConstants.COLUMN_SER)); return PgFact.from(rs); } | 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); } } | 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); } } | 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); } | 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); } |
@Test public void testInvertedBooleanOption() { assertThat(parse("--no-replace-consts").isReplaceConsts(), is(false)); assertThat(parse("").isReplaceConsts(), is(true)); } | public boolean isReplaceConsts() { return replaceConsts; } | JadxCLIArgs { public boolean isReplaceConsts() { return replaceConsts; } } | JadxCLIArgs { public boolean isReplaceConsts() { return replaceConsts; } } | 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 isSkipSources(); int... | 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 isSkipSources(); int... |
@Test public void decodeRSAKeySignature() { String string = certificateManagerRSA.generateSignature(); assertTrue(string.contains("SHA256withRSA")); assertTrue(string.contains("1.2.840.113549.1.1.11")); } | 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(); } | 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(); } } | 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(); } CertificateManager(Certificat... | 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(); } CertificateManager(Certificat... | 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(); } CertificateManager(Certificat... |
@Test public void decodeDSAKeySignature() { String string = certificateManagerDSA.generateSignature(); assertTrue(string.contains("SHA1withDSA")); assertTrue(string.contains("1.2.840.10040.4.3")); } | 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(); } | 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(); } } | 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(); } CertificateManager(Certificat... | 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(); } CertificateManager(Certificat... | 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(); } CertificateManager(Certificat... |
@Test public void decodeRSAFingerprint() { String string = certificateManagerRSA.generateFingerprint(); assertTrue(string.contains("61 18 0A 71 3F C9 55 16 4E 04 E3 C5 45 08 D9 11")); assertTrue(string.contains("A0 6E A6 06 DB 2C 6F 3A 16 56 7F 75 97 7B AE 85 C2 13 09 37")); assertTrue(string.contains("12 53 E8 BB C8 A... | 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("certificate.serialSHA256"), getThumbP... | 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("certificate.seri... | 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("certificate.seri... | 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("certificate.seri... | 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("certificate.seri... |
@Test public void decodeDSAFingerprint() { String string = certificateManagerDSA.generateFingerprint(); assertTrue(string.contains("D9 06 A6 2D 1F 79 8C 9D A6 EF 40 C7 2E C2 EA 0B")); assertTrue(string.contains("18 E9 9C D4 A1 40 8F 63 FA EC 2E 62 A0 F2 AE B7 3F C3 C2 04")); assertTrue(string.contains("74 F9 48 64 EE A... | 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("certificate.serialSHA256"), getThumbP... | 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("certificate.seri... | 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("certificate.seri... | 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("certificate.seri... | 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("certificate.seri... |
@Test public void decodeRSAPubKey() { String string = certificateManagerRSA.generatePublicKey(); assertTrue(string.contains("RSA")); assertTrue(string.contains("65537")); assertTrue(string.contains("1681953129031804462554643735709908030601939275292568895111488068832920121318010916" + "8890384305768067101521914473763638... | public String generatePublicKey() { PublicKey publicKey = x509cert.getPublicKey(); if (publicKey instanceof RSAPublicKey) { return generateRSAPublicKey(); } if (publicKey instanceof DSAPublicKey) { return generateDSAPublicKey(); } return ""; } | CertificateManager { public String generatePublicKey() { PublicKey publicKey = x509cert.getPublicKey(); if (publicKey instanceof RSAPublicKey) { return generateRSAPublicKey(); } if (publicKey instanceof DSAPublicKey) { return generateDSAPublicKey(); } return ""; } } | CertificateManager { public String generatePublicKey() { PublicKey publicKey = x509cert.getPublicKey(); if (publicKey instanceof RSAPublicKey) { return generateRSAPublicKey(); } if (publicKey instanceof DSAPublicKey) { return generateDSAPublicKey(); } return ""; } CertificateManager(Certificate cert); } | CertificateManager { public String generatePublicKey() { PublicKey publicKey = x509cert.getPublicKey(); if (publicKey instanceof RSAPublicKey) { return generateRSAPublicKey(); } if (publicKey instanceof DSAPublicKey) { return generateDSAPublicKey(); } return ""; } CertificateManager(Certificate cert); static String dec... | CertificateManager { public String generatePublicKey() { PublicKey publicKey = x509cert.getPublicKey(); if (publicKey instanceof RSAPublicKey) { return generateRSAPublicKey(); } if (publicKey instanceof DSAPublicKey) { return generateDSAPublicKey(); } return ""; } CertificateManager(Certificate cert); static String dec... |
@Test public void decodeDSAPubKey() { String string = certificateManagerDSA.generatePublicKey(); assertTrue(string.contains("DSA")); assertTrue(string.contains("193233676050581546825633012823454532222793121048898990016982096262547255815113" + "7546996381246109049596383861577383286736433045701055397423798599190480095839... | public String generatePublicKey() { PublicKey publicKey = x509cert.getPublicKey(); if (publicKey instanceof RSAPublicKey) { return generateRSAPublicKey(); } if (publicKey instanceof DSAPublicKey) { return generateDSAPublicKey(); } return ""; } | CertificateManager { public String generatePublicKey() { PublicKey publicKey = x509cert.getPublicKey(); if (publicKey instanceof RSAPublicKey) { return generateRSAPublicKey(); } if (publicKey instanceof DSAPublicKey) { return generateDSAPublicKey(); } return ""; } } | CertificateManager { public String generatePublicKey() { PublicKey publicKey = x509cert.getPublicKey(); if (publicKey instanceof RSAPublicKey) { return generateRSAPublicKey(); } if (publicKey instanceof DSAPublicKey) { return generateDSAPublicKey(); } return ""; } CertificateManager(Certificate cert); } | CertificateManager { public String generatePublicKey() { PublicKey publicKey = x509cert.getPublicKey(); if (publicKey instanceof RSAPublicKey) { return generateRSAPublicKey(); } if (publicKey instanceof DSAPublicKey) { return generateDSAPublicKey(); } return ""; } CertificateManager(Certificate cert); static String dec... | CertificateManager { public String generatePublicKey() { PublicKey publicKey = x509cert.getPublicKey(); if (publicKey instanceof RSAPublicKey) { return generateRSAPublicKey(); } if (publicKey instanceof DSAPublicKey) { return generateDSAPublicKey(); } return ""; } CertificateManager(Certificate cert); static String dec... |
@Test public void testSubstring() { checkStr(subString("a", 0), "a"); checkStr(subString("a", 1), ""); checkStr(subString("a", 0, 0), ""); checkStr(subString("a", 0, 1), "a"); checkStr(subString("abc", 1, 2), "b"); checkStr(subString("abc", 2), "c"); checkStr(subString("abc", 2, 3), "c"); } | public static StringRef subString(String str, int from, int to) { return new StringRef(str, from, to - from); } | StringRef implements CharSequence { public static StringRef subString(String str, int from, int to) { return new StringRef(str, from, to - from); } } | 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); } | 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 from); static Str... | 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 from); static Str... |
@Test public void testTrim() { checkTrim(fromStr("a"), "a"); checkTrim(fromStr(" a "), "a"); checkTrim(fromStr("\ta"), "a"); checkTrim(subString("a b c", 1), "b c"); checkTrim(subString("a b\tc", 1, 4), "b"); checkTrim(subString("a b\tc", 2, 3), "b"); } | 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)) { return subString(str, start, end); } return th... | 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)) { return sub... | 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)) { return sub... | 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)) { return sub... | 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)) { return sub... |
@Test public void testSplit() { checkSplit("abc", "b", "a", "c"); checkSplit("abc", "a", "", "bc"); checkSplit("abc", "c", "ab"); checkSplit("abc", "d", "abc"); checkSplit("abbbc", "b", "a", "", "", "c"); checkSplit("abbbc", "bb", "a", "bc"); checkSplit("abbbc", "bbb", "a", "c"); checkSplit("abbbc", "bbc", "ab"); check... | 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) { int start = pos + targetLen; pos = indexOf(str, 0... | 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) { int start = p... | 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) { int start = p... | 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) { int start = p... | 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) { int start = p... |
@Test public void testCompare() { checkCompare("", "", 0); checkCompare("1", "1", 0); checkCompare("1", "2", -1); checkCompare("1.1", "1.1", 0); checkCompare("0.5", "0.5", 0); checkCompare("0.5", "0.5.0", 0); checkCompare("0.5", "0.5.00", 0); checkCompare("0.5", "0.5.0.0", 0); checkCompare("0.5", "0.5.0.1", -1); checkC... | 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.valueOf(s1[i]).compareTo(Integer.valueO... | 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.valueOf(s1[i]).comp... | 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.valueOf(s1[i]).comp... | 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.valueOf(s1[i]).comp... | 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.valueOf(s1[i]).comp... |
@Test public void testEscapeUnicodeOption() { assertThat(parse("--escape-unicode").isEscapeUnicode(), is(true)); assertThat(parse("").isEscapeUnicode(), is(false)); } | public boolean isEscapeUnicode() { return escapeUnicode; } | JadxCLIArgs { public boolean isEscapeUnicode() { return escapeUnicode; } } | JadxCLIArgs { public boolean isEscapeUnicode() { return escapeUnicode; } } | 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 isSkipSources(); int... | 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 isSkipSources(); int... |
@Test public void compareTypes() { firstIsNarrow(INT, UNKNOWN); firstIsNarrow(array(UNKNOWN), UNKNOWN); firstIsNarrow(array(UNKNOWN), NARROW); } | public TypeCompareEnum compareTypes(ClassNode first, ClassNode second) { return compareObjects(first.getType(), second.getType()); } | TypeCompare { public TypeCompareEnum compareTypes(ClassNode first, ClassNode second) { return compareObjects(first.getType(), second.getType()); } } | TypeCompare { public TypeCompareEnum compareTypes(ClassNode first, ClassNode second) { return compareObjects(first.getType(), second.getType()); } TypeCompare(RootNode root); } | 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); Comparator<ArgType>... | 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); Comparator<ArgType>... |
@Test void replaceTypeVariablesUsingMap() { ArgType typeVar = genericType("T"); ArgType listCls = object("java.util.List"); Map<ArgType, ArgType> typeMap = Collections.singletonMap(typeVar, STRING); replaceTypeVar(typeVar, typeMap, STRING); replaceTypeVar(generic(listCls, typeVar), typeMap, generic(listCls, STRING)); r... | @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 = replaceTypeVariablesUsingMap(replaceType.getA... | 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 = replaceTypeVariablesUsingMap(repl... | 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 = replaceTypeVariablesUsingMap(repl... | 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 = replaceTypeVariablesUsingMap(repl... | 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 = replaceTypeVariablesUsingMap(repl... |
@Test public void changeVisibility() { AccessInfo accessInfo = new AccessInfo(AccessFlags.PROTECTED | AccessFlags.STATIC, AFType.METHOD); AccessInfo result = accessInfo.changeVisibility(AccessFlags.PUBLIC); assertThat(result.isPublic(), is(true)); assertThat(result.isPrivate(), is(false)); assertThat(result.isProtected... | 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 { 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 { 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); } | 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); boolean cont... | 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); boolean cont... |
@Test public void changeVisibilityNoOp() { AccessInfo accessInfo = new AccessInfo(AccessFlags.PUBLIC, AFType.METHOD); AccessInfo result = accessInfo.changeVisibility(AccessFlags.PUBLIC); assertSame(accessInfo, result); } | 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 { 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 { 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); } | 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); boolean cont... | 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); boolean cont... |
@Test public void validIdentifiers() { assertThat(isValidIdentifier("ACls"), is(true)); } | public static boolean isValidIdentifier(String str) { return notEmpty(str) && !isReserved(str) && VALID_JAVA_IDENTIFIER.matcher(str).matches(); } | NameMapper { public static boolean isValidIdentifier(String str) { return notEmpty(str) && !isReserved(str) && VALID_JAVA_IDENTIFIER.matcher(str).matches(); } } | NameMapper { public static boolean isValidIdentifier(String str) { return notEmpty(str) && !isReserved(str) && VALID_JAVA_IDENTIFIER.matcher(str).matches(); } private NameMapper(); } | 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(String str); sta... | 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(String str); sta... |
@Test public void notValidIdentifiers() { assertThat(isValidIdentifier("1cls"), is(false)); assertThat(isValidIdentifier("-cls"), is(false)); assertThat(isValidIdentifier("A-cls"), is(false)); } | public static boolean isValidIdentifier(String str) { return notEmpty(str) && !isReserved(str) && VALID_JAVA_IDENTIFIER.matcher(str).matches(); } | NameMapper { public static boolean isValidIdentifier(String str) { return notEmpty(str) && !isReserved(str) && VALID_JAVA_IDENTIFIER.matcher(str).matches(); } } | NameMapper { public static boolean isValidIdentifier(String str) { return notEmpty(str) && !isReserved(str) && VALID_JAVA_IDENTIFIER.matcher(str).matches(); } private NameMapper(); } | 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(String str); sta... | 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(String str); sta... |
@Test public void testRemoveInvalidCharsMiddle() { assertThat(removeInvalidCharsMiddle("1cls"), is("1cls")); assertThat(removeInvalidCharsMiddle("-cls"), is("cls")); assertThat(removeInvalidCharsMiddle("A-cls"), is("Acls")); } | 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(codePoint) && isValidIdenti... | 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(codePoint) && ... | 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(codePoint) && ... | 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(codePoint) && ... | 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(codePoint) && ... |
@Test public void testRemoveInvalidChars() { assertThat(removeInvalidChars("1cls", "C"), is("C1cls")); assertThat(removeInvalidChars("-cls", "C"), is("cls")); assertThat(removeInvalidChars("A-cls", "C"), is("Acls")); } | 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; } | 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; } } | 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(); } | 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(); static boolean ... | 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(); static boolean ... |
@Test public void testSrcOption() { assertThat(parse("--no-src").isSkipSources(), is(true)); assertThat(parse("-s").isSkipSources(), is(true)); assertThat(parse("").isSkipSources(), is(false)); } | public boolean isSkipSources() { return skipSources; } | JadxCLIArgs { public boolean isSkipSources() { return skipSources; } } | JadxCLIArgs { public boolean isSkipSources() { return skipSources; } } | 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 isSkipSources(); int get... | 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 isSkipSources(); int get... |
@Test public void testHierarchyPackages() { String pkgName = "a.b.c.d.e"; List<JavaPackage> packages = Collections.singletonList(newPkg(pkgName)); List<JPackage> out = sources.getHierarchyPackages(packages); assertThat(out, hasSize(1)); JPackage jPkg = out.get(0); assertThat(jPkg.getName(), is(pkgName)); assertThat(jPk... | 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<JPackage> innerPackages = pkg.getInnerPa... | 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<JPackage> inner... | 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<JPackage> inner... | 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<JPackage> inner... | 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<JPackage> inner... |
@Test public void testHierarchyPackages2() { List<JavaPackage> packages = asList( newPkg("a.b"), newPkg("a.c"), newPkg("a.d")); List<JPackage> out = sources.getHierarchyPackages(packages); assertThat(out, hasSize(1)); JPackage jPkg = out.get(0); assertThat(jPkg.getName(), is("a")); assertThat(jPkg.getClasses(), hasSize... | 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<JPackage> innerPackages = pkg.getInnerPa... | 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<JPackage> inner... | 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<JPackage> inner... | 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<JPackage> inner... | 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<JPackage> inner... |
@Test public void testHierarchyPackages3() { List<JavaPackage> packages = asList( newPkg("a.b.p1"), newPkg("a.b.p2"), newPkg("a.b.p3")); List<JPackage> out = sources.getHierarchyPackages(packages); assertThat(out, hasSize(1)); JPackage jPkg = out.get(0); assertThat(jPkg.getName(), is("a.b")); assertThat(jPkg.getClasses... | 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<JPackage> innerPackages = pkg.getInnerPa... | 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<JPackage> inner... | 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<JPackage> inner... | 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<JPackage> inner... | 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<JPackage> inner... |
@Test public void testHierarchyPackages4() { List<JavaPackage> packages = asList( newPkg("a.p1"), newPkg("a.b.c.p2"), newPkg("a.b.c.p3"), newPkg("d.e"), newPkg("d.f.a")); List<JPackage> out = sources.getHierarchyPackages(packages); assertThat(out, hasSize(2)); assertThat(out.get(0).getName(), is("a")); assertThat(out.g... | 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<JPackage> innerPackages = pkg.getInnerPa... | 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<JPackage> inner... | 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<JPackage> inner... | 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<JPackage> inner... | 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<JPackage> inner... |
@Test public void decodeNotCertificateFile() throws IOException { try (InputStream in = new FileInputStream(emptyPath)) { String result = CertificateManager.decode(in); assertEquals("", result); } } | 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 CertificateManager(cert); strBuild.append(cer... | 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 CertificateManager(cert)... | 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 CertificateManager(cert)... | 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 CertificateManager(cert)... | 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 CertificateManager(cert)... |
@Test public void decodeRSAKeyHeader() { String string = certificateManagerRSA.generateHeader(); assertTrue(string.contains("X.509")); assertTrue(string.contains("0x4bd68052")); assertTrue(string.contains("CN=test cert, OU=test unit, O=OOO TestOrg, L=St.Peterburg, ST=Russia, C=123456")); } | 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.serialNumber"), "0x" + x509cert.ge... | 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.serialNumber"... | 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.serialNumber"... | 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.serialNumber"... | 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.serialNumber"... |
@Test public void decodeDSAKeyHeader() { String string = certificateManagerDSA.generateHeader(); assertTrue(string.contains("X.509")); assertTrue(string.contains("0x16420ba2")); assertTrue(string.contains("O=\"UJMRFVV CN=EDCVBGT C=TG\"")); } | 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.serialNumber"), "0x" + x509cert.ge... | 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.serialNumber"... | 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.serialNumber"... | 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.serialNumber"... | 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.serialNumber"... |
@Test public void testApi() throws Exception { when(commandGateway.send(any())) .thenAnswer(i -> { AddProductToCatalogCommand command = i.getArgumentAt(0, AddProductToCatalogCommand.class); assertEquals(id, command.getId()); CompletableFuture<String> response = new CompletableFuture<String>(); response.complete(command... | public CompletableFuture<String> addProductToCatalog(AddProductToCatalogCommand command) { LOG.debug("Processing AddProductToCatalogCommand command: {}", command); return this.commandGateway.send(command); } | CatalogService { public CompletableFuture<String> addProductToCatalog(AddProductToCatalogCommand command) { LOG.debug("Processing AddProductToCatalogCommand command: {}", command); return this.commandGateway.send(command); } } | CatalogService { public CompletableFuture<String> addProductToCatalog(AddProductToCatalogCommand command) { LOG.debug("Processing AddProductToCatalogCommand command: {}", command); return this.commandGateway.send(command); } CatalogService(CommandGateway commandGateway); } | CatalogService { public CompletableFuture<String> addProductToCatalog(AddProductToCatalogCommand command) { LOG.debug("Processing AddProductToCatalogCommand command: {}", command); return this.commandGateway.send(command); } CatalogService(CommandGateway commandGateway); CompletableFuture<String> addProductToCatalog(Ad... | CatalogService { public CompletableFuture<String> addProductToCatalog(AddProductToCatalogCommand command) { LOG.debug("Processing AddProductToCatalogCommand command: {}", command); return this.commandGateway.send(command); } CatalogService(CommandGateway commandGateway); CompletableFuture<String> addProductToCatalog(Ad... |
@Test public void checkControllerCallsServiceCorrectly() throws ExecutionException, InterruptedException { assertNotNull(request); assertNotNull(request.containsKey("id")); assertNotNull(request.containsKey("name")); when(commandGateway.addProductToCatalog(any(AddProductToCatalogCommand.class))) .thenAnswer(i -> { AddP... | @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 catalogService.addProductToCatalog(command... | 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 catalogService.addP... | 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 catalogService.addP... | 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 catalogService.addP... | 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 catalogService.addP... |
@Test public void testOn(){ List<Product> products = new ArrayList<>(); when(repo.save(any(Product.class))) .thenAnswer(i -> { Product prod = i.getArgumentAt(0, Product.class); products.add(prod); return prod; }); processor.on(event); verify(repo, times(1)).save(any(Product.class)); verifyNoMoreInteractions(repo); Asse... | @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 { @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 { @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 repository); } | 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 repository); @Ev... | 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 repository); @Ev... |
@Test(timeOut = 60000) public void testFirstTrySuccess() throws Exception { TestingMethodInvocationStat stat = new TestingMethodInvocationStat(); DriftMethodInvocation<?> methodInvocation = createDriftMethodInvocation(RetryPolicy.NO_RETRY_POLICY, stat, () -> immediateFuture(SUCCESS)); assertEquals(methodInvocation.get(... | static <A extends Address> DriftMethodInvocation<A> createDriftMethodInvocation( MethodInvoker invoker, MethodMetadata metadata, Map<String, String> headers, List<Object> parameters, RetryPolicy retryPolicy, AddressSelector<A> addressSelector, Optional<String> addressSelectionContext, MethodInvocationStat stat, Ticker ... | 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, Optional<String> addr... | 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, Optional<String> addr... | 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, Optional<String> addr... | 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, Optional<String> addr... |
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Enum class .*DuplicateValues returned duplicate enum values: 42") public void testDuplicateValues() { thriftEnumMetadata(DuplicateValues.class); } | public ThriftEnumMetadata( String enumName, Class<T> enumClass) throws RuntimeException { this.enumName = requireNonNull(enumName, "enumName must not be null"); this.enumClass = requireNonNull(enumClass, "enumClass must not be null"); Method enumValueMethod = null; for (Method method : enumClass.getMethods()) { if (met... | ThriftEnumMetadata { public ThriftEnumMetadata( String enumName, Class<T> enumClass) throws RuntimeException { this.enumName = requireNonNull(enumName, "enumName must not be null"); this.enumClass = requireNonNull(enumClass, "enumClass must not be null"); Method enumValueMethod = null; for (Method method : enumClass.ge... | ThriftEnumMetadata { public ThriftEnumMetadata( String enumName, Class<T> enumClass) throws RuntimeException { this.enumName = requireNonNull(enumName, "enumName must not be null"); this.enumClass = requireNonNull(enumClass, "enumClass must not be null"); Method enumValueMethod = null; for (Method method : enumClass.ge... | ThriftEnumMetadata { public ThriftEnumMetadata( String enumName, Class<T> enumClass) throws RuntimeException { this.enumName = requireNonNull(enumName, "enumName must not be null"); this.enumClass = requireNonNull(enumClass, "enumClass must not be null"); Method enumValueMethod = null; for (Method method : enumClass.ge... | ThriftEnumMetadata { public ThriftEnumMetadata( String enumName, Class<T> enumClass) throws RuntimeException { this.enumName = requireNonNull(enumName, "enumName must not be null"); this.enumClass = requireNonNull(enumClass, "enumClass must not be null"); Method enumValueMethod = null; for (Method method : enumClass.ge... |
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Enum class .*MultipleUnknownValues has multiple constants annotated with @ThriftEnumUnknownValue") public void testMultipleUnknownValues() { thriftEnumMetadata(MultipleUnknownValues.class); } | public ThriftEnumMetadata( String enumName, Class<T> enumClass) throws RuntimeException { this.enumName = requireNonNull(enumName, "enumName must not be null"); this.enumClass = requireNonNull(enumClass, "enumClass must not be null"); Method enumValueMethod = null; for (Method method : enumClass.getMethods()) { if (met... | ThriftEnumMetadata { public ThriftEnumMetadata( String enumName, Class<T> enumClass) throws RuntimeException { this.enumName = requireNonNull(enumName, "enumName must not be null"); this.enumClass = requireNonNull(enumClass, "enumClass must not be null"); Method enumValueMethod = null; for (Method method : enumClass.ge... | ThriftEnumMetadata { public ThriftEnumMetadata( String enumName, Class<T> enumClass) throws RuntimeException { this.enumName = requireNonNull(enumName, "enumName must not be null"); this.enumClass = requireNonNull(enumClass, "enumClass must not be null"); Method enumValueMethod = null; for (Method method : enumClass.ge... | ThriftEnumMetadata { public ThriftEnumMetadata( String enumName, Class<T> enumClass) throws RuntimeException { this.enumName = requireNonNull(enumName, "enumName must not be null"); this.enumClass = requireNonNull(enumClass, "enumClass must not be null"); Method enumValueMethod = null; for (Method method : enumClass.ge... | ThriftEnumMetadata { public ThriftEnumMetadata( String enumName, Class<T> enumClass) throws RuntimeException { this.enumName = requireNonNull(enumName, "enumName must not be null"); this.enumClass = requireNonNull(enumClass, "enumClass must not be null"); Method enumValueMethod = null; for (Method method : enumClass.ge... |
@Test public void testExtractParameterNamesNoAnnotations() throws Exception { assertEquals( extractParameterNames(getClass().getDeclaredMethod("noAnnotations", String.class, String.class, String.class)), ImmutableList.of("a", "b", "c")); } | public static List<String> extractParameterNames(Executable methodOrConstructor) { return PARAMETER_NAMES.getUnchecked(methodOrConstructor); } | ReflectionHelper { public static List<String> extractParameterNames(Executable methodOrConstructor) { return PARAMETER_NAMES.getUnchecked(methodOrConstructor); } } | ReflectionHelper { public static List<String> extractParameterNames(Executable methodOrConstructor) { return PARAMETER_NAMES.getUnchecked(methodOrConstructor); } private ReflectionHelper(); } | 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 componentType); stat... | 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 componentType); stat... |
@Test public void testExtractParameterNamesThriftFieldAnnotation() throws Exception { assertEquals( extractParameterNames(getClass().getDeclaredMethod("thriftFieldAnnotation", String.class, String.class, String.class)), ImmutableList.of("a", "b", "c")); } | public static List<String> extractParameterNames(Executable methodOrConstructor) { return PARAMETER_NAMES.getUnchecked(methodOrConstructor); } | ReflectionHelper { public static List<String> extractParameterNames(Executable methodOrConstructor) { return PARAMETER_NAMES.getUnchecked(methodOrConstructor); } } | ReflectionHelper { public static List<String> extractParameterNames(Executable methodOrConstructor) { return PARAMETER_NAMES.getUnchecked(methodOrConstructor); } private ReflectionHelper(); } | 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 componentType); stat... | 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 componentType); stat... |
@Test public void testExtractParameterNamesMixedThriftFieldAnnotation() throws Exception { assertEquals( extractParameterNames(getClass().getDeclaredMethod("mixedThriftFieldAnnotation", String.class, String.class, String.class)), ImmutableList.of("a", "b", "c")); } | public static List<String> extractParameterNames(Executable methodOrConstructor) { return PARAMETER_NAMES.getUnchecked(methodOrConstructor); } | ReflectionHelper { public static List<String> extractParameterNames(Executable methodOrConstructor) { return PARAMETER_NAMES.getUnchecked(methodOrConstructor); } } | ReflectionHelper { public static List<String> extractParameterNames(Executable methodOrConstructor) { return PARAMETER_NAMES.getUnchecked(methodOrConstructor); } private ReflectionHelper(); } | 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 componentType); stat... | 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 componentType); stat... |
@Test public void testNonFinalUnionOk() { ThriftUnionMetadataBuilder builder = new ThriftUnionMetadataBuilder(new ThriftCatalog(), NotFinalUnion.class); builder.build(); } | @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjection = buildConstructorInjection(); Iterable<ThriftFieldMetadata> fieldsMetadata = buildFieldInjections(); Lis... | ThriftUnionMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjection = buildConstructorInjection(); Iterabl... | ThriftUnionMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjection = buildConstructorInjection(); Iterabl... | ThriftUnionMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjection = buildConstructorInjection(); Iterabl... | ThriftUnionMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjection = buildConstructorInjection(); Iterabl... |
@Test public void testGenericBuilder() { Type structType = new TypeToken<GenericStruct<String>>() {}.getType(); ThriftStructMetadataBuilder builder = new ThriftStructMetadataBuilder(new ThriftCatalog(), structType); builder.build(); } | @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Iterable<ThriftFieldMetadata> fieldsMetadata = buildFieldInjections(); Li... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... |
@Test(expectedExceptions = MetadataErrorException.class) public void testGenericBuilderForNonGenericStruct() { Type structType = new TypeToken<NonGenericStruct>() {}.getType(); ThriftStructMetadataBuilder builder = new ThriftStructMetadataBuilder(new ThriftCatalog(), structType); builder.build(); } | @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Iterable<ThriftFieldMetadata> fieldsMetadata = buildFieldInjections(); Li... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... |
@Test public void testMergeableRequiredness() { ThriftStructMetadata metadata = new ThriftStructMetadataBuilder(new ThriftCatalog(), MergeableRequiredness.class).build(); assertThat(metadata.getField(1).getRequiredness()) .as("requiredness of field 'foo'") .isEqualTo(Requiredness.OPTIONAL); } | @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Iterable<ThriftFieldMetadata> fieldsMetadata = buildFieldInjections(); Li... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... |
@Test public void testNonFinalStructsOk() { ThriftStructMetadataBuilder builder = new ThriftStructMetadataBuilder(new ThriftCatalog(), NotFinalStruct.class); builder.build(); } | @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Iterable<ThriftFieldMetadata> fieldsMetadata = buildFieldInjections(); Li... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... | ThriftStructMetadataBuilder extends AbstractThriftMetadataBuilder { @Override public ThriftStructMetadata build() { metadataErrors.throwIfHasErrors(); ThriftMethodInjection builderMethodInjection = buildBuilderConstructorInjections(); ThriftConstructorInjection constructorInjections = buildConstructorInjection(); Itera... |
@Test public void testRetryUserException() { ExceptionClassification overloaded = new ExceptionClassification(Optional.of(true), OVERLOADED); RetryPolicy policy = new RetryPolicy(new DriftClientConfig(), classifier -> { if (classifier instanceof TestingUserException) { return overloaded; } return NORMAL_EXCEPTION; }); ... | 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 ExceptionClassification(Optional.o... | 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 ExceptionClassificat... | 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 ExceptionClassificat... | 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 ExceptionClassificat... | 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 ExceptionClassificat... |
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Class .*NotEnum is not an enum") public void testEnumMetadataForNonEnum() { new ThriftCatalog().getThriftEnumMetadata(NotEnum.class); } | 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 = thriftEnumMetadata((Class<T>) enumClass); ... | 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 = thriftEnumMetadata((Class<... | 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 = thriftEnumMetadata((Class<... | 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 = thriftEnumMetadata((Class<... | 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 = thriftEnumMetadata((Class<... |
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "ThriftMethod .* parameter 1 must not be annotated with both @ThriftField and @ThriftHeader") public void invalidHeaderAndFieldParameter() { Method validHeaderWithInferredFieldIds = getMethod("invalidHeaderAndFieldParameter", b... | public Method getMethod() { return method; } | ThriftMethodMetadata { public Method getMethod() { return method; } } | ThriftMethodMetadata { public Method getMethod() { return method; } ThriftMethodMetadata(Method method, ThriftCatalog catalog); } | 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(); Method get... | 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(); Method get... |
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "ThriftMethod .* parameter 1 annotated with @ThriftHeader must be a String") public void invalidHeaderType() { Method validHeaderWithInferredFieldIds = getMethod("invalidHeaderType", boolean.class, int.class); new ThriftMethodM... | public Method getMethod() { return method; } | ThriftMethodMetadata { public Method getMethod() { return method; } } | ThriftMethodMetadata { public Method getMethod() { return method; } ThriftMethodMetadata(Method method, ThriftCatalog catalog); } | 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(); Method get... | 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(); Method get... |
@Test public void testGuiceServer() { ResultsSupplier resultsSupplier = new ResultsSupplier(); TestService testService = new TestService(resultsSupplier); TestingServerTransportFactory serverTransportFactory = new TestingServerTransportFactory(); TestingMethodInvocationStatsFactory statsFactory = new TestingMethodInvoc... | public ServerTransport getServerTransport() { return serverTransport; } | DriftServer { public ServerTransport getServerTransport() { return serverTransport; } } | DriftServer { public ServerTransport getServerTransport() { return serverTransport; } @Inject DriftServer(
ServerTransportFactory serverTransportFactory,
ThriftCodecManager codecManager,
MethodInvocationStatsFactory methodInvocationStatsFactory,
Set<DriftService> service... | DriftServer { public ServerTransport getServerTransport() { return serverTransport; } @Inject DriftServer(
ServerTransportFactory serverTransportFactory,
ThriftCodecManager codecManager,
MethodInvocationStatsFactory methodInvocationStatsFactory,
Set<DriftService> service... | DriftServer { public ServerTransport getServerTransport() { return serverTransport; } @Inject DriftServer(
ServerTransportFactory serverTransportFactory,
ThriftCodecManager codecManager,
MethodInvocationStatsFactory methodInvocationStatsFactory,
Set<DriftService> service... |
@Test public void testGuiceServerFilter() { ResultsSupplier resultsSupplier = new ResultsSupplier(); PassThroughFilter passThroughFilter = new PassThroughFilter(); ShortCircuitFilter shortCircuitFilter = new ShortCircuitFilter(resultsSupplier); TestService testService = new TestService(() -> Futures.immediateFailedFutu... | public ServerTransport getServerTransport() { return serverTransport; } | DriftServer { public ServerTransport getServerTransport() { return serverTransport; } } | DriftServer { public ServerTransport getServerTransport() { return serverTransport; } @Inject DriftServer(
ServerTransportFactory serverTransportFactory,
ThriftCodecManager codecManager,
MethodInvocationStatsFactory methodInvocationStatsFactory,
Set<DriftService> service... | DriftServer { public ServerTransport getServerTransport() { return serverTransport; } @Inject DriftServer(
ServerTransportFactory serverTransportFactory,
ThriftCodecManager codecManager,
MethodInvocationStatsFactory methodInvocationStatsFactory,
Set<DriftService> service... | DriftServer { public ServerTransport getServerTransport() { return serverTransport; } @Inject DriftServer(
ServerTransportFactory serverTransportFactory,
ThriftCodecManager codecManager,
MethodInvocationStatsFactory methodInvocationStatsFactory,
Set<DriftService> service... |
@Test public void testBelowLimit() { byte[] first = new byte[] {1, 2, 3, 4, 5}; byte[] second = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; byte[] third = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; try (TestingPooledByteBufAllocator allocator = new TestingPooledByteBufAllocator()) { Byte... | @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } | ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } } | ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } ThriftFramedDecoder(FrameInfoDecoder frameInfoDecoder, int maxFrameSizeInBytes); } | ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } ThriftFramedDecoder(FrameInfoDecoder frameInfoDecoder, int maxFrameSizeInBytes); } | ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } ThriftFramedDecoder(FrameInfoDecoder frameInfoDecoder, int maxFrameSizeInBytes); } |
@Test public void testChunked() { byte[] first = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; byte[] second = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; byte[] third = new byte[] {5, 4, 3}; try (TestingPooledByteBufAllocator allocator = new TestingPooledByteBufAllocator()) { ByteBuf buffe... | @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } | ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } } | ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } ThriftFramedDecoder(FrameInfoDecoder frameInfoDecoder, int maxFrameSizeInBytes); } | ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } ThriftFramedDecoder(FrameInfoDecoder frameInfoDecoder, int maxFrameSizeInBytes); } | ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } ThriftFramedDecoder(FrameInfoDecoder frameInfoDecoder, int maxFrameSizeInBytes); } |
@Test public void testNoDefaults() throws Exception { List<HostAndPort> addresses = ImmutableList.of(HostAndPort.fromParts("example.com", 1), HostAndPort.fromParts("example.com", 2)); Map<String, String> properties = ImmutableMap.of("testService" + ".thrift.client.addresses", "example.com:1,example.com:2"); testAddress... | public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } | SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } } | SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } private SimpleAddressSelectorBinder(Optional<List<HostAndPort>> defaultAddresses); } | SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } private SimpleAddressSelectorBinder(Optional<List<HostAndPort>> defaultAddresses); static AddressSelectorBinder simpleAddressSelector(... | SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } private SimpleAddressSelectorBinder(Optional<List<HostAndPort>> defaultAddresses); static AddressSelectorBinder simpleAddressSelector(... |
@Test public void testBeyondLimit() throws Exception { try (TestingPooledByteBufAllocator allocator = new TestingPooledByteBufAllocator()) { byte[] small = new byte[] {5, 4, 3}; byte[] firstLargeFrame = createTestFrame(allocator, "first_method", 1, CALL); byte[] secondLargeFrame = createTestFrame(allocator, "second_met... | @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } | ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } } | ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } ThriftFramedDecoder(FrameInfoDecoder frameInfoDecoder, int maxFrameSizeInBytes); } | ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } ThriftFramedDecoder(FrameInfoDecoder frameInfoDecoder, int maxFrameSizeInBytes); } | ThriftFramedDecoder extends ByteToMessageDecoder { @Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> output) { decode(buffer).ifPresent(output::add); } ThriftFramedDecoder(FrameInfoDecoder frameInfoDecoder, int maxFrameSizeInBytes); } |
@Test public void testPooling() { try (ConnectionPool pool = new ConnectionPool(new TestingConnectionManager(), new DefaultEventLoopGroup(), 10, new Duration(1, MINUTES))) { HostAndPort address1 = HostAndPort.fromParts("localhost", 1234); HostAndPort address2 = HostAndPort.fromParts("localhost", 4567); Channel channel1... | @Override public Future<Channel> getConnection(ConnectionParameters connectionParameters, HostAndPort address) { ConnectionKey key = new ConnectionKey(connectionParameters, address); while (true) { synchronized (this) { if (closed) { return group.next().newFailedFuture(new TTransportException("Connection pool is closed... | 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().newFailedFuture(new ... | 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().newFailedFuture(new ... | 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().newFailedFuture(new ... | 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().newFailedFuture(new ... |
@Test public void testTimeout() throws Exception { ScheduledExecutorService executor = newSingleThreadScheduledExecutor(daemonThreadsNamed("test-timeout")); DriftNettyMethodInvoker invoker = new DriftNettyMethodInvoker( new ConnectionParameters( FRAMED, BINARY, new DataSize(16, Unit.MEGABYTE), new Duration(11, MILLISEC... | @Override public ListenableFuture<Object> invoke(InvokeRequest request) { try { return MoreFutures.addTimeout( InvocationResponseFuture.createInvocationResponseFuture(request, connectionParameters, connectionManager), () -> { String message = "Invocation response future did not complete after " + invokeTimeout; log.err... | DriftNettyMethodInvoker implements MethodInvoker { @Override public ListenableFuture<Object> invoke(InvokeRequest request) { try { return MoreFutures.addTimeout( InvocationResponseFuture.createInvocationResponseFuture(request, connectionParameters, connectionManager), () -> { String message = "Invocation response futur... | DriftNettyMethodInvoker implements MethodInvoker { @Override public ListenableFuture<Object> invoke(InvokeRequest request) { try { return MoreFutures.addTimeout( InvocationResponseFuture.createInvocationResponseFuture(request, connectionParameters, connectionManager), () -> { String message = "Invocation response futur... | DriftNettyMethodInvoker implements MethodInvoker { @Override public ListenableFuture<Object> invoke(InvokeRequest request) { try { return MoreFutures.addTimeout( InvocationResponseFuture.createInvocationResponseFuture(request, connectionParameters, connectionManager), () -> { String message = "Invocation response futur... | DriftNettyMethodInvoker implements MethodInvoker { @Override public ListenableFuture<Object> invoke(InvokeRequest request) { try { return MoreFutures.addTimeout( InvocationResponseFuture.createInvocationResponseFuture(request, connectionParameters, connectionManager), () -> { String message = "Invocation response futur... |
@Test public void testSingleDefault() throws Exception { HostAndPort address = HostAndPort.fromParts("example.com", 1); testAddressSelector(simpleAddressSelector(address), ImmutableMap.of(), ImmutableList.of(address)); testAddressSelector( simpleAddressSelector(address), ImmutableMap.of("testService" + ".thrift.client.... | public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } | SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } } | SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } private SimpleAddressSelectorBinder(Optional<List<HostAndPort>> defaultAddresses); } | SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } private SimpleAddressSelectorBinder(Optional<List<HostAndPort>> defaultAddresses); static AddressSelectorBinder simpleAddressSelector(... | SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } private SimpleAddressSelectorBinder(Optional<List<HostAndPort>> defaultAddresses); static AddressSelectorBinder simpleAddressSelector(... |
@Test public void testMultipleDefaults() throws Exception { List<HostAndPort> addresses = ImmutableList.of(HostAndPort.fromParts("example.com", 1), HostAndPort.fromParts("example.com", 2)); testAddressSelector(simpleAddressSelector(addresses), ImmutableMap.of(), addresses); testAddressSelector( simpleAddressSelector(ad... | public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } | SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } } | SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } private SimpleAddressSelectorBinder(Optional<List<HostAndPort>> defaultAddresses); } | SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } private SimpleAddressSelectorBinder(Optional<List<HostAndPort>> defaultAddresses); static AddressSelectorBinder simpleAddressSelector(... | SimpleAddressSelectorBinder implements AddressSelectorBinder { public static AddressSelectorBinder simpleAddressSelector() { return new SimpleAddressSelectorBinder(Optional.empty()); } private SimpleAddressSelectorBinder(Optional<List<HostAndPort>> defaultAddresses); static AddressSelectorBinder simpleAddressSelector(... |
@Test public void testDefaults() { assertRecordedDefaults(recordDefaults(DriftServerConfig.class) .setStatsEnabled(true)); } | @Config("thrift.server.stats.enabled") public DriftServerConfig setStatsEnabled(boolean statsEnabled) { this.statsEnabled = statsEnabled; return this; } | DriftServerConfig { @Config("thrift.server.stats.enabled") public DriftServerConfig setStatsEnabled(boolean statsEnabled) { this.statsEnabled = statsEnabled; return this; } } | DriftServerConfig { @Config("thrift.server.stats.enabled") public DriftServerConfig setStatsEnabled(boolean statsEnabled) { this.statsEnabled = statsEnabled; return this; } } | 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); } | 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); } |
@Test public void testExplicitPropertyMappings() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("thrift.server.stats.enabled", "false") .build(); DriftServerConfig expected = new DriftServerConfig() .setStatsEnabled(false); assertFullMapping(properties, expected); } | @Config("thrift.server.stats.enabled") public DriftServerConfig setStatsEnabled(boolean statsEnabled) { this.statsEnabled = statsEnabled; return this; } | DriftServerConfig { @Config("thrift.server.stats.enabled") public DriftServerConfig setStatsEnabled(boolean statsEnabled) { this.statsEnabled = statsEnabled; return this; } } | DriftServerConfig { @Config("thrift.server.stats.enabled") public DriftServerConfig setStatsEnabled(boolean statsEnabled) { this.statsEnabled = statsEnabled; return this; } } | 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); } | 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); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.