@Test public void scanExecutorAttributes() { Scheduler fixedThreadPool = Schedulers.fromExecutorService(Executors.newFixedThreadPool(3)); Long test = Integer.MAX_VALUE + 1L; System.out.println(test.intValue() == Integer.MAX_VALUE); assertThat(Scannable.from(fixedThreadPool).scan(Scannable.Attr.CAPACITY)).isEqualTo(3); assertThat(Scannable.from(fixedThreadPool).scan(Scannable.Attr.BUFFERED)).isZero(); assertThat(Scannable.from(fixedThreadPool).scan(Scannable.Attr.LARGE_BUFFERED)).isZero(); fixedThreadPool.schedule(() -> { assertThat(Scannable.from(fixedThreadPool).scan(Scannable.Attr.BUFFERED)).isNotZero(); assertThat(Scannable.from(fixedThreadPool).scan(Scannable.Attr.LARGE_BUFFERED)).isNotZero(); }); } }
@Test public void fetchProgress_setMinInterval() { final DownloadTask task = spy(new DownloadTask .Builder("https://jacksgong.com", "parentPath", "filename") .setMinIntervalMillisCallbackProcess(1) .build()); final DownloadListener listener = mock(DownloadListener.class); when(task.getListener()).thenReturn(listener); dispatcher.dispatch().fetchProgress(task, 1, 2); assertThat(DownloadTask.TaskHideWrapper.getLastCallbackProcessTs(task)).isNotZero(); } }
@Test public void log_requests_when_TRACE_level_is_enabled() { logTester.setLevel(LoggerLevel.TRACE); BulkIndexer indexer = new BulkIndexer(es.client(), INDEX_TYPE_FAKE, Size.REGULAR, new FakeListener()); indexer.start(); indexer.add(newIndexRequestWithDocId("foo")); indexer.addDeletion(INDEX_TYPE_FAKE, "foo"); indexer.add(newIndexRequestWithDocId("bar")); indexer.stop(); assertThat(logTester.logs(LoggerLevel.TRACE) .stream() .filter(log -> log.contains("Bulk[2 index requests on fakes/fake, 1 delete requests on fakes/fake]")) .count()).isNotZero(); }
assertThat(clientStartTime).isNotZero(); assertThat(clientWireSendTime).isGreaterThanOrEqualTo(clientStartTime); assertThat(clientWireReceiveTime).isGreaterThanOrEqualTo(clientWireSendTime);
@Test public void getBalanceTest() { try { assertThat(ACCOUNT_API.getBalance("c91e9d46dd4b7584f0b6348ee18277c10fd7cb94", "latest")).isNotZero(); assertThat(ACCOUNT_API.getBalance("c91e9d46dd4b7584f0b6348ee18277c10fd7cb94", "1023")).isNotZero(); } catch (Exception e) { log.debug("getBalanceTest :: exception : " + e); } } }
@Test public void backwardCompatibility() throws Exception { final RemoveProjectCommand c = (RemoveProjectCommand) Jackson.readValue( '{' + " \"type\": \"REMOVE_PROJECT\"," + " \"projectName\": \"foo\"" + '}', Command.class); assertThat(c.author()).isEqualTo(Author.SYSTEM); assertThat(c.timestamp()).isNotZero(); assertThat(c.projectName()).isEqualTo("foo"); } }
@Test public void backwardCompatibility() throws Exception { final CreateProjectCommand c = (CreateProjectCommand) Jackson.readValue( '{' + " \"type\": \"CREATE_PROJECT\"," + " \"projectName\": \"foo\"" + '}', Command.class); assertThat(c.author()).isEqualTo(Author.SYSTEM); assertThat(c.timestamp()).isNotZero(); assertThat(c.projectName()).isEqualTo("foo"); } }
@Test public void backwardCompatibility() throws Exception { final UnremoveProjectCommand c = (UnremoveProjectCommand) Jackson.readValue( '{' + " \"type\": \"UNREMOVE_PROJECT\"," + " \"projectName\": \"foo\"" + '}', Command.class); assertThat(c.author()).isEqualTo(Author.SYSTEM); assertThat(c.timestamp()).isNotZero(); assertThat(c.projectName()).isEqualTo("foo"); } }
@Test public void backwardCompatibility() throws Exception { final RemoveNamedQueryCommand c = (RemoveNamedQueryCommand) Jackson.readValue( '{' + " \"type\": \"REMOVE_NAMED_QUERY\"," + " \"projectName\": \"foo\"," + " \"queryName\": \"bar\"" + '}', Command.class); assertThat(c.author()).isEqualTo(Author.SYSTEM); assertThat(c.timestamp()).isNotZero(); assertThat(c.projectName()).isEqualTo("foo"); assertThat(c.queryName()).isEqualTo("bar"); } }
@Test public void backwardCompatibility() throws Exception { final RemoveRepositoryCommand c = (RemoveRepositoryCommand) Jackson.readValue( '{' + " \"type\": \"REMOVE_REPOSITORY\"," + " \"projectName\": \"foo\"," + " \"repositoryName\": \"bar\"" + '}', Command.class); assertThat(c.author()).isEqualTo(Author.SYSTEM); assertThat(c.timestamp()).isNotZero(); assertThat(c.projectName()).isEqualTo("foo"); assertThat(c.repositoryName()).isEqualTo("bar"); } }
@Test public void backwardCompatibility() throws Exception { final UnremoveRepositoryCommand c = (UnremoveRepositoryCommand) Jackson.readValue( '{' + " \"type\": \"UNREMOVE_REPOSITORY\"," + " \"projectName\": \"foo\"," + " \"repositoryName\": \"bar\"" + '}', Command.class); assertThat(c.author()).isEqualTo(Author.SYSTEM); assertThat(c.timestamp()).isNotZero(); assertThat(c.projectName()).isEqualTo("foo"); assertThat(c.repositoryName()).isEqualTo("bar"); } }
@Test public void createEmptySnapshot() throws IOException { StatsSnapshot snapshot = stats.createSnapshot(); assertThat(snapshot.timestamp).isNotZero(); assertThat(snapshot.flushCount).isZero(); assertThat(snapshot.flushEventCount).isZero(); assertThat(snapshot.integrationOperationCount).isZero(); assertThat(snapshot.integrationOperationDuration).isZero(); assertThat(snapshot.integrationOperationAverageDuration).isZero(); assertThat(snapshot.integrationOperationDurationByIntegration).isEmpty(); } }
@Test public void backwardCompatibility() throws Exception { final CreateRepositoryCommand c = (CreateRepositoryCommand) Jackson.readValue( '{' + " \"type\": \"CREATE_REPOSITORY\"," + " \"projectName\": \"foo\"," + " \"repositoryName\": \"bar\"" + '}', Command.class); assertThat(c.author()).isEqualTo(Author.SYSTEM); assertThat(c.timestamp()).isNotZero(); assertThat(c.projectName()).isEqualTo("foo"); assertThat(c.repositoryName()).isEqualTo("bar"); } }
@Test public void backwardCompatibility() throws Exception { final RemovePluginCommand c = (RemovePluginCommand) Jackson.readValue( '{' + " \"type\": \"REMOVE_PLUGIN\"," + " \"projectName\": \"foo\"," + " \"pluginName\": \"my_plugin\"" + '}', Command.class); assertThat(c.author()).isEqualTo(Author.SYSTEM); assertThat(c.timestamp()).isNotZero(); assertThat(c.projectName()).isEqualTo("foo"); assertThat(c.pluginName()).isEqualTo("my_plugin"); } }
@Test public void backwardCompatibility() throws Exception { final SavePluginCommand c = (SavePluginCommand) Jackson.readValue( '{' + " \"type\": \"SAVE_PLUGIN\"," + " \"projectName\": \"foo\"," + " \"pluginName\": \"my_plugin\"," + " \"path\": \"/plugin.json\"" + '}', Command.class); assertThat(c.author()).isEqualTo(Author.SYSTEM); assertThat(c.timestamp()).isNotZero(); assertThat(c.projectName()).isEqualTo("foo"); assertThat(c.pluginName()).isEqualTo("my_plugin"); assertThat(c.path()).isEqualTo("/plugin.json"); } }
@Test void shouldGetAsyncSystemCurrentTime() throws Exception { Long time = new RedisTimeSupplier(connect).getAsync().toCompletableFuture().get(); assertThat(time).isNotNull().isNotNegative().isNotZero(); }
@Test void shouldGetReactiveSystemCurrentTime() { Long time = new RedisTimeSupplier(connect).getReactive().block(); assertThat(time).isNotNull().isNotNegative().isNotZero(); } }
@Test void shouldGetSystemCurrentTime() { Long time = new RedisTimeSupplier(connect).get(); assertThat(time).isNotNull().isNotNegative().isNotZero(); }
@Test public void backwardCompatibility() throws Exception { final SaveNamedQueryCommand c = (SaveNamedQueryCommand) Jackson.readValue( '{' + " \"type\": \"SAVE_NAMED_QUERY\"," + " \"projectName\": \"foo\"," + " \"queryName\": \"bar\"," + " \"enabled\": true," + " \"repositoryName\": \"qux\"," + " \"query\": {" + " \"type\": \"IDENTITY\"," + " \"path\": \"/first.txt\"" + " }," + " \"comment\": \"plaintext comment\"," + " \"markup\": \"PLAINTEXT\"" + '}', Command.class); assertThat(c.author()).isEqualTo(Author.SYSTEM); assertThat(c.timestamp()).isNotZero(); assertThat(c.projectName()).isEqualTo("foo"); assertThat(c.queryName()).isEqualTo("bar"); assertThat(c.isEnabled()).isTrue(); assertThat(c.repositoryName()).isEqualTo("qux"); assertThat(c.query()).isEqualTo(Query.ofText("/first.txt")); assertThat(c.comment()).isEqualTo("plaintext comment"); assertThat(c.markup()).isSameAs(Markup.PLAINTEXT); } }
private void checkGetItemDetailsCallback(ItemDetails itemDetails, Item item, PurchaseType type) { assertThat(itemDetails.hasItemId(item.getSku())).isTrue(); assertThat(itemDetails.getByItemId(item.getSku())).isNotNull(); if (type == PurchaseType.IN_APP) { assertThat(itemDetails.getByItemId(item.getSku()).getSubscriptionPeriod()).isEmpty(); assertThat(itemDetails.getByItemId(item.getSku()).getFreeTrialPeriod()).isEmpty(); assertThat(itemDetails.getByItemId(item.getSku()).getIntroductoryPrice()).isEmpty(); assertThat(itemDetails.getByItemId(item.getSku()).getIntroductoryPriceAmountMicros()).isZero(); assertThat(itemDetails.getByItemId(item.getSku()).getIntroductoryPricePeriod()).isEmpty(); assertThat(itemDetails.getByItemId(item.getSku()).getIntroductoryPriceCycles()).isZero(); } else { assertThat(itemDetails.getByItemId(item.getSku()).getSubscriptionPeriod()).isNotEmpty(); assertThat(itemDetails.getByItemId(item.getSku()).getFreeTrialPeriod()).isNotEmpty(); assertThat(itemDetails.getByItemId(item.getSku()).getIntroductoryPrice()).isNotEmpty(); assertThat(itemDetails.getByItemId(item.getSku()).getIntroductoryPriceAmountMicros()).isNotZero(); assertThat(itemDetails.getByItemId(item.getSku()).getIntroductoryPricePeriod()).isNotEmpty(); assertThat(itemDetails.getByItemId(item.getSku()).getIntroductoryPriceCycles()).isNotZero(); } } }