focal_method
stringlengths
13
60.9k
test_case
stringlengths
25
109k
@Override public ColumnStatisticsObj aggregate(List<ColStatsObjWithSourceInfo> colStatsWithSourceInfo, List<String> partNames, boolean areAllPartsFound) throws MetaException { checkStatisticsList(colStatsWithSourceInfo); ColumnStatisticsObj statsObj = null; String colType; String colName = null...
@Test public void testAggregateMultipleStatsWhenSomeNullValues() throws MetaException { List<String> partitions = Arrays.asList("part1", "part2"); ColumnStatisticsData data1 = new ColStatsBuilder<>(Decimal.class).numNulls(1).numDVs(2) .low(ONE).high(TWO).hll(1, 2).kll(1, 2).build(); ColumnStatist...
@Override public Integer getInteger(final int columnIndex) { return values.getInteger(columnIndex - 1); }
@Test public void shouldGetInt() { assertThat(row.getInteger("f_int"), is(2)); }
@Override public String toString() { StringBuilder b = new StringBuilder(); if (StringUtils.isNotBlank(protocol)) { b.append(protocol); b.append("://"); } if (StringUtils.isNotBlank(host)) { b.append(host); } if (!isPortDefault() &&...
@Test public void testNonHttpProtocolWithPort() { s = "ftp://ftp.example.com:20/dir"; t = "ftp://ftp.example.com:20/dir"; assertEquals(t, new HttpURL(s).toString()); }
public static <T> T copyProperties(Object source, Class<T> tClass, String... ignoreProperties) { if (null == source) { return null; } T target = ReflectUtil.newInstanceIfPossible(tClass); copyProperties(source, target, CopyOptions.create().setIgnoreProperties(ignoreProperties)); return target; }
@Test public void copyBeanPropertiesFunctionFilterTest() { //https://gitee.com/dromara/hutool/pulls/590 final Person o = new Person(); o.setName("asd"); o.setAge(123); o.setOpenid("asd"); @SuppressWarnings("unchecked") final CopyOptions copyOptions = CopyOptions.create().setIgnoreProperties(Person::getAge...
public TypeSerializer<T> getElementSerializer() { // call getSerializer() here to get the initialization check and proper error message final TypeSerializer<List<T>> rawSerializer = getSerializer(); if (!(rawSerializer instanceof ListSerializer)) { throw new IllegalStateException(); ...
@Test void testSerializerDuplication() { // we need a serializer that actually duplicates for testing (a stateful one) // we use Kryo here, because it meets these conditions TypeSerializer<String> statefulSerializer = new KryoSerializer<>(String.class, new SerializerConfigImp...
public static <T> Iterator<T> skipFirst(Iterator<T> iterator, @Nonnull Predicate<? super T> predicate) { checkNotNull(iterator, "iterator cannot be null."); while (iterator.hasNext()) { T object = iterator.next(); if (!predicate.test(object)) { continue; ...
@Test public void skipFirstAll() { var list = List.of(1, 2, 3, 4, 5, 6); var actual = IterableUtil.skipFirst(list.iterator(), v -> v > 0); assertIteratorsEquals(list, actual); }
void concatBlocks(INodeFile[] inodes, BlockManager bm) { int size = this.blocks.length; int totalAddedBlocks = 0; for(INodeFile f : inodes) { Preconditions.checkState(f.isStriped() == this.isStriped()); totalAddedBlocks += f.blocks.length; } BlockInfo[] newlist = new BlockIn...
@Test public void testConcatBlocks() { INodeFile origFile = createINodeFiles(1, "origfile")[0]; assertEquals("Number of blocks didn't match", origFile.numBlocks(), 1L); INodeFile[] appendFiles = createINodeFiles(4, "appendfile"); BlockManager bm = Mockito.mock(BlockManager.class); origFile.concat...
@Override public void check(Thread currentThread) throws CeTaskInterruptedException { super.check(currentThread); computeTimeOutOf(taskOf(currentThread)) .ifPresent(timeout -> { throw new CeTaskTimeoutException(format("Execution of task timed out after %s ms", timeout)); }); }
@Test public void check_fails_with_ISE_if_thread_is_not_running_a_CeWorker_with_no_current_CeTask() { Thread t = newThreadWithRandomName(); mockWorkerOnThread(t, ceWorker); assertThatThrownBy(() -> underTest.check(t)) .isInstanceOf(IllegalStateException.class) .hasMessage("Could not find the ...
@VisibleForTesting static void instantiateHeapMemoryMetrics(final MetricGroup metricGroup) { instantiateMemoryUsageMetrics( metricGroup, () -> ManagementFactory.getMemoryMXBean().getHeapMemoryUsage()); }
@Test void testHeapMetricsCompleteness() { final InterceptingOperatorMetricGroup heapMetrics = new InterceptingOperatorMetricGroup(); MetricUtils.instantiateHeapMemoryMetrics(heapMetrics); assertThat(heapMetrics.get(MetricNames.MEMORY_USED)).isNotNull(); assertThat(heapMetrics.get(...
public static SchemaAndValue parseString(String value) { if (value == null) { return NULL_SCHEMA_AND_VALUE; } if (value.isEmpty()) { return new SchemaAndValue(Schema.STRING_SCHEMA, value); } ValueParser parser = new ValueParser(new Parser(value)); ...
@Test public void shouldParseTimeStringAsDate() throws Exception { String str = "14:34:54.346Z"; SchemaAndValue result = Values.parseString(str); assertEquals(Type.INT32, result.schema().type()); assertEquals(Time.LOGICAL_NAME, result.schema().name()); java.util.Date expected...
@Override public Object getObject(final int columnIndex) throws SQLException { return mergeResultSet.getValue(columnIndex, Object.class); }
@Test void assertGetObjectWithByteArray() throws SQLException { byte[] result = new byte[0]; when(mergeResultSet.getValue(1, byte[].class)).thenReturn(result); assertThat(shardingSphereResultSet.getObject(1, byte[].class), is(result)); }
static Builder builder() { return new AutoValue_CsvIOParseError.Builder(); }
@Test public void usableInMultiOutput() { List<CsvIOParseError> want = Arrays.asList( CsvIOParseError.builder() .setMessage("error message") .setObservedTimestamp(Instant.now()) .setStackTrace("stack trace") .build(), ...
@Override public <T extends Recorder> RetryContext<T> context() { return new RetryContextImpl<>(); }
@Test public void contextResultTest() { final Retry retry = Retry.create(build("context", true)); final RetryContext<Recorder> context = retry.context(); final Recorder recorder = Mockito.mock(Recorder.class); final boolean result = context.onResult(recorder, new Object(), 100L); ...
public Map<String, TableMeta> loadTableMeta(List<String> tables) throws DataXException { Map<String, TableMeta> tableMetas = new HashMap(); try (Statement stmt = conn.createStatement()) { ResultSet rs = stmt.executeQuery("show stables"); while (rs.next()) { Table...
@Test public void loadTableMeta() throws SQLException { // given SchemaManager schemaManager = new SchemaManager(conn); List<String> tables = Arrays.asList("stb1", "stb2", "tb1", "tb3", "weather"); // when Map<String, TableMeta> tableMetaMap = schemaManager.loadTableMeta(tab...
public DdlCommandResult execute( final String sql, final DdlCommand ddlCommand, final boolean withQuery, final Set<SourceName> withQuerySources ) { return execute(sql, ddlCommand, withQuery, withQuerySources, false); }
@Test public void shouldAddNormalTableWhenNoTypeIsSpecified() { // Given: final CreateTableCommand cmd = buildCreateTable( SourceName.of("t1"), false, null ); // When: cmdExec.execute(SQL_TEXT, cmd, true, NO_QUERY_SOURCES); // Then: final KsqlTable ksqlTable = (Ks...
public static IndicesBlockStatus parseBlockSettings(final GetSettingsResponse settingsResponse) { IndicesBlockStatus result = new IndicesBlockStatus(); final var indexToSettingsMap = settingsResponse.getIndexToSettings(); final String[] indicesInResponse = indexToSettingsMap.keySet().toArray(new...
@Test public void noBlockedIndicesIdentifiedIfEmptySettingsPresent() { var settingsBuilder = Map.of("index_0", Settings.builder().build()); GetSettingsResponse emptySettingsResponse = new GetSettingsResponse(settingsBuilder, Map.of()); final IndicesBlockStatus indicesBlockStatus = BlockSetti...
public static SQLParser newInstance(final String sql, final Class<? extends SQLLexer> lexerClass, final Class<? extends SQLParser> parserClass) { return createSQLParser(createTokenStream(sql, lexerClass), parserClass); }
@Test void assertNewInstance() { assertThat(SQLParserFactory.newInstance(SQL, mock(LexerFixture.class).getClass(), mock(ParserFixture.class).getClass()), instanceOf(ParserFixture.class)); }
static CastExpr getCategoricalPredictorExpression(final String categoricalPredictorMapName) { final String lambdaExpressionMethodName = "evaluateCategoricalPredictor"; final String parameterName = "input"; final MethodCallExpr lambdaMethodCallExpr = new MethodCallExpr(); lambdaMethodCall...
@Test void getCategoricalPredictorExpression() throws IOException { final String categoricalPredictorMapName = "categoricalPredictorMapName"; CastExpr retrieved = KiePMMLRegressionTableFactory.getCategoricalPredictorExpression(categoricalPredictorMapName); String text = getFi...
public String getLegacyColumnName( DatabaseMetaData dbMetaData, ResultSetMetaData rsMetaData, int index ) throws KettleDatabaseException { if ( dbMetaData == null ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, "MySQLDatabaseMeta.Exception.LegacyColumnNameNoDBMetaDataException" ) ); } ...
@Test( expected = KettleDatabaseException.class ) public void testGetLegacyColumnNameDriverGreaterThanThreeException() throws Exception { DatabaseMetaData databaseMetaData = mock( DatabaseMetaData.class ); doReturn( 5 ).when( databaseMetaData ).getDriverMajorVersion(); new MySQLDatabaseMeta().getLegacyCo...
public final StringSubject hasMessageThat() { StandardSubjectBuilder check = check("getMessage()"); if (actual instanceof ErrorWithFacts && ((ErrorWithFacts) actual).facts().size() > 1) { check = check.withMessage( "(Note from Truth: When possible, instead of asserting on the full ...
@Test public void hasMessageThat_failure() { NullPointerException actual = new NullPointerException("message"); expectFailureWhenTestingThat(actual).hasMessageThat().isEqualTo("foobar"); assertFailureValue("value of", "throwable.getMessage()"); assertErrorHasActualAsCause(actual, expectFailure.getFail...
public static String get(@NonNull SymbolRequest request) { String name = request.getName(); String title = request.getTitle(); String tooltip = request.getTooltip(); String htmlTooltip = request.getHtmlTooltip(); String classes = request.getClasses(); String pluginName = ...
@Test @DisplayName("HTML tooltip overrides tooltip") void htmlTooltipOverridesTooltip() { String symbol = Symbol.get(new SymbolRequest.Builder() .withName("science") .withTooltip("Tooltip") .withHtmlTooltip("<p>Some HTML Tooltip</p>") .buil...
public static String getTypeName(final int type) { switch (type) { case START_EVENT_V3: return "Start_v3"; case STOP_EVENT: return "Stop"; case QUERY_EVENT: return "Query"; case ROTATE_EVENT: return "...
@Test public void getTypeNameInputPositiveOutputNotNull34() { // Arrange final int type = 9; // Act final String actual = LogEvent.getTypeName(type); // Assert result Assert.assertEquals("Append_block", actual); }
@CanIgnoreReturnValue public final Ordered containsAtLeast( @Nullable Object firstExpected, @Nullable Object secondExpected, @Nullable Object @Nullable ... restOfExpected) { return containsAtLeastElementsIn(accumulate(firstExpected, secondExpected, restOfExpected)); }
@Test public void iterableContainsAtLeastFailsWithSameToStringAndHomogeneousListWithNull() { expectFailureWhenTestingThat(asList("null", "abc")).containsAtLeast("abc", null); assertFailureValue("missing (1)", "null (null type)"); assertFailureValue("though it did contain (1)", "null (java.lang.String)"); ...
public static <T> T parseObject(String text, Class<T> clazz) { if (StringUtil.isBlank(text)) { return null; } return JSON_FACADE.parseObject(text, clazz); }
@Test public void assertParseObjectTypeReference() { Assert.assertNull(JSONUtil.parseObject(null, new TypeReference<List<Foo>>() { })); Assert.assertNull(JSONUtil.parseObject(" ", new TypeReference<List<Foo>>() { })); Assert.assertEquals( EXPECTED_FOO_ARRAY, ...
@Override @MethodNotAvailable public LocalMapStats getLocalMapStats() { throw new MethodNotAvailableException(); }
@Test(expected = MethodNotAvailableException.class) public void testGetLocalMapStats() { adapter.getLocalMapStats(); }
public static int nextPowerOfTwo(final int value) { return 1 << (32 - Integer.numberOfLeadingZeros(value - 1)); }
@Test public void testNextLongPowerOfTwo() { assertEquals(1L, QuickMath.nextPowerOfTwo(-9999999L)); assertEquals(1L, QuickMath.nextPowerOfTwo(-1L)); assertEquals(1L, QuickMath.nextPowerOfTwo(0L)); assertEquals(1L, QuickMath.nextPowerOfTwo(1L)); assertEquals(2L, QuickMath.next...
@VisibleForTesting public static JobGraph createJobGraph(StreamGraph streamGraph) { return new StreamingJobGraphGenerator( Thread.currentThread().getContextClassLoader(), streamGraph, null, Runnable::run) ...
@Test void testDefaultJobType() { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); StreamGraph streamGraph = new StreamGraphGenerator( Collections.emptyList(), env.getConfig(), env.getCheckpointConfig()) ...
@Override public MergedResult decorate(final QueryResult queryResult, final SQLStatementContext sqlStatementContext, final EncryptRule rule) { SQLStatement sqlStatement = sqlStatementContext.getSqlStatement(); if (sqlStatement instanceof MySQLExplainStatement || sqlStatement instanceof MySQLShowColu...
@Test void assertMergedResultWithShowCreateTableStatement() { sqlStatementContext = getShowCreateTableStatementContext(); RuleMetaData ruleMetaData = mock(RuleMetaData.class); when(ruleMetaData.getSingleRule(SQLParserRule.class)).thenReturn(mock(SQLParserRule.class)); EncryptDALResul...
@Override public DdlCommand create( final String sqlExpression, final DdlStatement ddlStatement, final SessionConfig config ) { return FACTORIES .getOrDefault(ddlStatement.getClass(), (statement, cf, ci) -> { throw new KsqlException( "Unable to find ddl command ...
@Test public void shouldCreateCommandForAlterSource() { // Given: final AlterSource ddlStatement = new AlterSource(SOME_NAME, DataSourceType.KSTREAM, new ArrayList<>()); // When: final DdlCommand result = commandFactories .create(sqlExpression, ddlStatement, SessionConfig.of(ksqlConfig, empt...
@Override public boolean test(Pickle pickle) { URI picklePath = pickle.getUri(); if (!lineFilters.containsKey(picklePath)) { return true; } for (Integer line : lineFilters.get(picklePath)) { if (Objects.equals(line, pickle.getLocation().getLine()) ...
@Test void matches_pickles_from_files_not_in_the_predicate_map() { // the argument "path/file.feature another_path/file.feature:8" // results in only line predicates only for another_path/file.feature, // but all pickles from path/file.feature shall also be executed. LinePredicate pr...
public static <T extends TypedSPI> T getService(final Class<T> serviceInterface, final Object type) { return getService(serviceInterface, type, new Properties()); }
@Test void assertGetServiceWhenTypeIsNotExist() { assertThrows(ServiceProviderNotFoundException.class, () -> TypedSPILoader.getService(TypedSPIFixture.class, "NOT_EXISTED")); }
private HikariDataSource createHikariDataSource() { HikariConfig config = new HikariConfig(); config.setJdbcUrl(getJdbcUrl()); config.setUsername(properties.get(JDBCResource.USER)); config.setPassword(properties.get(JDBCResource.PASSWORD)); config.setDriverClassName(getDriverName...
@Test public void testCreateHikariDataSource() { properties = new HashMap<>(); properties.put(DRIVER_CLASS, "org.mariadb.jdbc.Driver"); properties.put(JDBCResource.URI, "jdbc:mariadb://127.0.0.1:3306"); properties.put(JDBCResource.USER, "root"); properties.put(JDBCResource.PA...
public static byte[] inputStream2Bytes(InputStream is) { if (is == null) { return null; } try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int i; while ((i = is.read()) != -1) { baos.write(i); } ...
@Test void inputStream2Bytes() { assertNull(StringUtils.inputStream2Bytes(null)); String data = "abc\n" + ":\"klsdf\n" + "2ks,x:\".,-3sd˚ø≤ø¬≥"; byte[] bs = data.getBytes(Constants.DEFAULT_CHARSET); ByteArrayInputStream inputStream = new ByteArrayInput...
public Node parse() throws ScanException { if (tokenList == null || tokenList.isEmpty()) return null; return E(); }
@Test public void literalVariableLiteral() throws ScanException { Tokenizer tokenizer = new Tokenizer("a${b}c"); Parser parser = new Parser(tokenizer.tokenize()); Node node = parser.parse(); Node witness = new Node(Node.Type.LITERAL, "a"); witness.next = new Node(Node.Type.VA...
@Override public Num calculate(BarSeries series, Position position) { if (position == null || position.getEntry() == null || position.getExit() == null) { return series.zero(); } CashFlow cashFlow = new CashFlow(series, position); return calculateMaximumDrawdown(series, n...
@Test public void calculateWithGainsAndLosses() { MockBarSeries series = new MockBarSeries(numFunction, 1, 2, 3, 6, 5, 20, 3); AnalysisCriterion mdd = getCriterion(); TradingRecord tradingRecord = new BaseTradingRecord(Trade.buyAt(0, series), Trade.sellAt(1, series), Trade.bu...
public MetricsBuilder enableRegistry(Boolean enableRegistry) { this.enableRegistry = enableRegistry; return getThis(); }
@Test void enableRegistry() { MetricsBuilder builder = MetricsBuilder.newBuilder(); builder.enableRegistry(true); Assertions.assertTrue(builder.build().getEnableRegistry()); }
public static Table resolveCalciteTable(SchemaPlus schemaPlus, List<String> tablePath) { Schema subSchema = schemaPlus; // subSchema.getSubschema() for all except last for (int i = 0; i < tablePath.size() - 1; i++) { subSchema = subSchema.getSubSchema(tablePath.get(i)); if (subSchema == null) {...
@Test public void testMissingFlat() { String tableName = "fake_table"; when(mockSchemaPlus.getTable(tableName)).thenReturn(null); Table table = TableResolution.resolveCalciteTable(mockSchemaPlus, ImmutableList.of(tableName)); assertThat(table, Matchers.nullValue()); }
private Mono<ServerResponse> fetchThemeSetting(ServerRequest request) { return themeNameInPathVariableOrActivated(request) .flatMap(name -> client.fetch(Theme.class, name)) .mapNotNull(theme -> theme.getSpec().getSettingName()) .flatMap(settingName -> client.fetch(Setting.cla...
@Test void fetchThemeSetting() { Theme theme = new Theme(); theme.setMetadata(new Metadata()); theme.getMetadata().setName("fake"); theme.setSpec(new Theme.ThemeSpec()); theme.getSpec().setSettingName("fake-setting"); when(client.fetch(eq(Setting.class), eq("fake-set...
public synchronized void synchronizeClusterSchemas( ClusterSchema clusterSchema ) { synchronizeClusterSchemas( clusterSchema, clusterSchema.getName() ); }
@Test public void synchronizeClusterSchemas_use_case_sensitive_name() throws Exception { TransMeta transformarion1 = createTransMeta(); ClusterSchema clusterSchema1 = createClusterSchema( "ClusterSchema", true ); transformarion1.setClusterSchemas( Collections.singletonList( clusterSchema1 ) ); spoonDe...
@JsonCreator public Range( @JsonProperty("low") Marker low, @JsonProperty("high") Marker high) { this(low, high, () -> { if (low.compareTo(high) > 0) { throw new IllegalArgumentException("low must be less than or equal to high"); } ...
@Test public void testRange() { Range range = Range.range(BIGINT, 0L, false, 2L, true); assertEquals(range.getLow(), Marker.above(BIGINT, 0L)); assertEquals(range.getHigh(), Marker.exactly(BIGINT, 2L)); assertFalse(range.isSingleValue()); assertFalse(range.isAll()); ...
public static void sortMessages(Message[] messages, final SortTerm[] sortTerm) { final List<SortTermWithDescending> sortTermsWithDescending = getSortTermsWithDescending(sortTerm); sortMessages(messages, sortTermsWithDescending); }
@Test public void testSortMessages() throws Exception { Message[] expected = new Message[] { MESSAGES[0], MESSAGES[1], MESSAGES[2] }; // Sort using all the terms. Message order should be the same no matter what term is used for (SortTerm term : POSSIBLE_TERMS) { Message[] actual...
public Protocol forName(final String identifier) { return this.forName(identifier, null); }
@Test public void testFindProtocolProviderMismatch() { final TestProtocol dav_provider1 = new TestProtocol(Scheme.dav) { @Override public String getIdentifier() { return "dav"; } @Override public String getProvider() { ...
@Override public void addMeasure(String metricKey, int value) { Metric metric = metricRepository.getByKey(metricKey); validateAddMeasure(metric); measureRepository.add(internalComponent, metric, newMeasureBuilder().create(value)); }
@Test public void add_double_measure_create_measure_of_type_double_with_right_value() { MeasureComputerContextImpl underTest = newContext(PROJECT_REF, NCLOC_KEY, DOUBLE_METRIC_KEY); underTest.addMeasure(DOUBLE_METRIC_KEY, 10d); Optional<Measure> measure = measureRepository.getAddedRawMeasure(PROJECT_REF,...
static int toInteger(final JsonNode object) { if (object instanceof NumericNode) { return object.intValue(); } if (object instanceof TextNode) { try { return Integer.parseInt(object.textValue()); } catch (final NumberFormatException e) { throw failedStringCoercionException(...
@Test(expected = IllegalArgumentException.class) public void shouldNotConvertIncorrectStringToInt() { JsonSerdeUtils.toInteger(JsonNodeFactory.instance.textNode("1!")); }
Map<String, Object> getOriginals() { return originalsWithPrefix(""); }
@Test public void shouldReturnDifferentMapOnEachCallToOriginals() { // Given: final KsqlRestConfig config = new KsqlRestConfig(ImmutableMap.<String, Object>builder() .putAll(MIN_VALID_CONFIGS) .put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, "10") .build() ); final Map<String, Ob...
@Override public void reset() { this.size = 0; this.val0 = 0; finishCopy().reset(); }
@Test public void testReset() { final IntHashCounter intCounter = new AtomicIntHashCounter(); Assert.assertEquals(intCounter.size(), 0); final int testTimes = 10240; for (int i = 0; i < testTimes; i++) { Assert.assertEquals(1, intCounter.addAndGet(i, 1)); } ...
@Override public RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException { switch (request.getCode()) { case RequestCode.UPDATE_AND_CREATE_TOPIC: return this.updateAndCreateTopic(ctx, request); case Re...
@Test public void testProcessRequest_success() throws RemotingCommandException, UnknownHostException { RemotingCommand request = createUpdateBrokerConfigCommand(); RemotingCommand response = adminBrokerProcessor.processRequest(handlerContext, request); assertThat(response.getCode()).isEqualT...
@VisibleForTesting static void instantiateGarbageCollectorMetrics( MetricGroup metrics, List<GarbageCollectorMXBean> garbageCollectors) { for (final GarbageCollectorMXBean garbageCollector : garbageCollectors) { MetricGroup gcGroup = metrics.addGroup(garbageCollector.getName()); ...
@Test public void testGcMetricCompleteness() { Map<String, InterceptingOperatorMetricGroup> addedGroups = new HashMap<>(); InterceptingOperatorMetricGroup gcGroup = new InterceptingOperatorMetricGroup() { @Override public MetricGroup addGroup(S...
public String toJsonString() { ObjectMapper objectMapper = new ObjectMapper(); try { return objectMapper.writeValueAsString(this); } catch (JsonProcessingException e) { throw new RuntimeException(e); } }
@Test void toJsonString() throws JsonProcessingException { ObjectMapper objectMapper = new ObjectMapper(); Instance instance = Instance.getInstance(); Map<String,Object> map = new HashMap<>(); Map<String,Object> mmap = new HashMap<>(); mmap.put("k","v"); map.put("k",m...
public RejectState getRejectState() { return rejectState; }
@Test public void testConstructor() { RpcDeniedReply reply = new RpcDeniedReply(0, ReplyState.MSG_ACCEPTED, RejectState.AUTH_ERROR, new VerifierNone()); Assert.assertEquals(0, reply.getXid()); Assert.assertEquals(RpcMessage.Type.RPC_REPLY, reply.getMessageType()); Assert.assertEquals(ReplyStat...
@Override public MapperResult getGroupIdList(MapperContext context) { String sql = "SELECT group_id FROM config_info WHERE tenant_id ='" + NamespaceUtil.getNamespaceDefaultId() + "' GROUP BY group_id LIMIT " + context.getStartRow() + "," + context.getPageSize(); return new MapperResu...
@Test void testGetGroupIdList() { MapperResult mapperResult = configInfoMapperByMySql.getGroupIdList(context); assertEquals(mapperResult.getSql(), "SELECT group_id FROM config_info WHERE tenant_id ='' GROUP BY group_id LIMIT " + startRow + "," + pageSize); assertArrayEquals(m...
@Override public void process(Exchange exchange) throws Exception { Object payload = exchange.getMessage().getBody(); if (payload == null) { return; } ProtobufSchema answer = computeIfAbsent(exchange); if (answer != null) { exchange.setProperty(Schem...
@Test void shouldReadSchemaFromClasspathResource() throws Exception { Exchange exchange = new DefaultExchange(camelContext); exchange.setProperty(SchemaHelper.CONTENT_CLASS, Person.class.getName()); exchange.getMessage().setBody(person); ProtobufSchemaResolver schemaResolver = new ...
@Override public String toString() { return toString(true); }
@Test public void testToStringHumanNoShowQuota() { long length = Long.MAX_VALUE; long fileCount = 222222222; long directoryCount = 33333; long quota = 222256578; long spaceConsumed = 55555; long spaceQuota = Long.MAX_VALUE; ContentSummary contentSummary = new ContentSummary.Builder().leng...
@Override public String getAuthenticationScheme() { switch (event.getRequestSource()) { case API_GATEWAY: if (event.getRequestContext().getAuthorizer() != null && event.getRequestContext().getAuthorizer().getClaims() != null && event.getRequestContext().getAuthorizer().ge...
@Test void authScheme_getAuthenticationScheme_userPool() { AwsProxySecurityContext context = new AwsProxySecurityContext(null, REQUEST_COGNITO_USER_POOL); assertNotNull(context.getAuthenticationScheme()); assertEquals(AUTH_SCHEME_COGNITO_POOL, context.getAuthenticationScheme()); }
public static LinkKey canonicalLinkKey(Link link) { String sn = link.src().elementId().toString(); String dn = link.dst().elementId().toString(); return sn.compareTo(dn) < 0 ? linkKey(link.src(), link.dst()) : linkKey(link.dst(), link.src()); }
@Test public void canonLinkKey() { LinkKey fb = TopoUtils.canonicalLinkKey(LINK_FU_BAH); LinkKey bf = TopoUtils.canonicalLinkKey(LINK_BAH_FU); assertEquals("not canonical", fb, bf); }
@Deprecated @Restricted(DoNotUse.class) public static String resolve(ConfigurationContext context, String toInterpolate) { return context.getSecretSourceResolver().resolve(toInterpolate); }
@Test public void resolve_nothing() { assertThat(resolve("FOO"), equalTo("FOO")); }
public static HostInfo buildFromEndpoint(final String endPoint) { if (Utils.isBlank(endPoint)) { return null; } final String host = getHost(endPoint); final Integer port = getPort(endPoint); if (host == null || port == null) { throw new ConfigException( ...
@Test public void shouldReturnNullHostInfoForNullEndPoint() { assertNull(HostInfo.buildFromEndpoint(null)); }
public String getTopicName() { return topicName == null ? INVALID_TOPIC_NAME : topicName; }
@Test public void shouldUseNameIfNoWIthClause() { // When: final TopicProperties properties = new TopicProperties.Builder() .withName("name") .withWithClause(Optional.empty(), Optional.of(1), Optional.empty(), Optional.of((long) 100)) .build(); // Then: assertThat(properties.g...
@Override public <VAgg> KTable<K, VAgg> aggregate(final Initializer<VAgg> initializer, final Aggregator<? super K, ? super V, VAgg> adder, final Aggregator<? super K, ? super V, VAgg> subtractor, ...
@Test public void shouldNotAllowNullSubtractorOnAggregate() { assertThrows(NullPointerException.class, () -> groupedTable.aggregate( MockInitializer.STRING_INIT, MockAggregator.TOSTRING_ADDER, null, Materialized.as("store"))); }
public int getErrCode() { return errCode; }
@Test void testConstructorWithErrorCodeAndCause() { NacosRuntimeException exception = new NacosRuntimeException(NacosException.INVALID_PARAM, new RuntimeException("test")); assertEquals(NacosException.INVALID_PARAM, exception.getErrCode()); assertEquals("java.lang.RuntimeExce...
Map<String, File> scanExistingUsers() throws IOException { Map<String, File> users = new HashMap<>(); File[] userDirectories = listUserDirectories(); if (userDirectories != null) { for (File directory : userDirectories) { String userId = idStrategy.idFromFilename(dire...
@Test public void scanExistingUsersCaseSensitive() throws IOException { File usersDirectory = createTestDirectory(getClass(), name); UserIdMigrator migrator = new UserIdMigrator(usersDirectory, new IdStrategy.CaseSensitive()); Map<String, File> userMappings = migrator.scanExistingUsers(); ...
@Override public Map<String, Set<String>> getAllIndexAliases() { final Map<String, Set<String>> indexNamesAndAliases = indices.getIndexNamesAndAliases(getIndexWildcard()); // filter out the restored archives from the result set return indexNamesAndAliases.entrySet().stream() ...
@Test public void nullIndexerDoesNotThrow() { final Map<String, Set<String>> deflectorIndices = mongoIndexSet.getAllIndexAliases(); assertThat(deflectorIndices).isEmpty(); }
public static Read read() { return new Read(null, "", new Scan()); }
@Test public void testReadingSDF() throws Exception { final String table = tmpTable.getName(); final int numRows = 1001; createAndWriteData(table, numRows); runReadTestLength(HBaseIO.read().withConfiguration(conf).withTableId(table), true, numRows); }
@Nullable public Float getFloatValue(@FloatFormat final int formatType, @IntRange(from = 0) final int offset) { if ((offset + getTypeLen(formatType)) > size()) return null; switch (formatType) { case FORMAT_SFLOAT -> { if (mValue[offset + 1] == 0x07 && mValue[offset] == (byte) 0xFE) return F...
@Test public void setValue_FLOAT_positiveInfinity() { final MutableData data = new MutableData(new byte[4]); data.setValue(Float.POSITIVE_INFINITY, Data.FORMAT_FLOAT, 0); final float value = data.getFloatValue(Data.FORMAT_FLOAT, 0); assertEquals(Float.POSITIVE_INFINITY, value, 0.00); }
@Override public KTable<Windowed<K>, V> aggregate(final Initializer<V> initializer) { return aggregate(initializer, Materialized.with(null, null)); }
@Test public void slidingWindowAggregateStreamsTest() { final KTable<Windowed<String>, String> customers = windowedCogroupedStream.aggregate( MockInitializer.STRING_INIT, Materialized.with(Serdes.String(), Serdes.String())); customers.toStream().to(OUTPUT); try (final Topolo...
@Override public void handleTenantMenu(TenantMenuHandler handler) { // 如果禁用,则不执行逻辑 if (isTenantDisable()) { return; } // 获得租户,然后获得菜单 TenantDO tenant = getTenant(TenantContextHolder.getRequiredTenantId()); Set<Long> menuIds; if (isSystemTenant(tenan...
@Test public void testHandleTenantMenu_disable() { // 准备参数 TenantMenuHandler handler = mock(TenantMenuHandler.class); // mock 禁用 when(tenantProperties.getEnable()).thenReturn(false); // 调用 tenantService.handleTenantMenu(handler); // 断言 verify(handler,...
@Override public HttpResponseOutputStream<FileEntity> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final String uploadUri; FileUploadPartEntity uploadPartEntity = null; if(StringUtils.isBlank(status.getUrl())) { ...
@Test public void testWriteSinglePart() throws Exception { final BrickWriteFeature feature = new BrickWriteFeature(session); final Path container = new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)); final long containerTimestamp = new BrickAttributesFinderFeature(session).find...
@Override public List<String> getConfig(RedisClusterNode node, String pattern) { RedisClient entry = getEntry(node); RFuture<List<String>> f = executorService.writeAsync(entry, StringCodec.INSTANCE, RedisCommands.CONFIG_GET, pattern); return syncFuture(f); }
@Test public void testGetConfig() { RedisClusterNode master = getFirstMaster(); List<String> config = connection.getConfig(master, "*"); assertThat(config.size()).isGreaterThan(20); }
@Override public Object getParameter(String key) { return param.get(key); }
@Test void getParameter() { ConfigResponse configResponse = new ConfigResponse(); String dataId = "id"; String group = "group"; String tenant = "n"; String content = "abc"; String custom = "custom"; configResponse.setContent(content); configRe...
@InvokeOnHeader(Web3jConstants.SHH_HAS_IDENTITY) void shhHasIdentity(Message message) throws IOException { String identityAddress = message.getHeader(Web3jConstants.ADDRESS, configuration::getAddress, String.class); Request<?, ShhHasIdentity> request = web3j.shhHasIdentity(identityAddress); ...
@Test public void shhHasIdentityTest() throws Exception { ShhHasIdentity response = Mockito.mock(ShhHasIdentity.class); Mockito.when(mockWeb3j.shhHasIdentity(any())).thenReturn(request); Mockito.when(request.send()).thenReturn(response); Mockito.when(response.hasPrivateKeyForIdentity...
public Bson parseSingleExpression(final String filterExpression, final List<EntityAttribute> attributes) { final Filter filter = singleFilterParser.parseSingleExpression(filterExpression, attributes); return filter.toBson(); }
@Test void parsesFilterExpressionCorrectlyForStringType() { assertEquals(Filters.eq("owner", "baldwin"), toTest.parseSingleExpression("owner:baldwin", List.of(EntityAttribute.builder() .id("owner") .titl...
public static void analyze(CreateTableStmt statement, ConnectContext context) { final TableName tableNameObject = statement.getDbTbl(); MetaUtils.normalizationTableName(context, tableNameObject); final String catalogName = tableNameObject.getCatalog(); MetaUtils.checkCatalogExistAndRepo...
@Test public void testMaxColumn() throws Exception { Config.max_column_number_per_table = 1; String sql = "CREATE TABLE test_create_table_db.starrocks_test_table\n" + "(\n" + " `tag_id` bigint not null,\n" + " `tag_name` string\n" + ...
@Override public void encode(final ChannelHandlerContext context, final DatabasePacket message, final ByteBuf out) { boolean isIdentifierPacket = message instanceof PostgreSQLIdentifierPacket; if (isIdentifierPacket) { prepareMessageHeader(out, ((PostgreSQLIdentifierPacket) message).getI...
@Test void assertEncodePostgreSQLPacket() { PostgreSQLPacket packet = mock(PostgreSQLPacket.class); new OpenGaussPacketCodecEngine().encode(context, packet, byteBuf); verify(packet).write(any(PostgreSQLPacketPayload.class)); }
@Override public boolean isTypeOf(Class<?> type) { checkNotNull(type); return id.isTypeOf(type); }
@Test public void testTypeOf() { ContinuousResource continuous = Resources.continuous(D1, P1, Bandwidth.class) .resource(BW1.bps()); assertThat(continuous.isTypeOf(DeviceId.class), is(false)); assertThat(continuous.isTypeOf(PortNumber.class), is(false)); assertThat(c...
@Override public int compare(InetSocketAddress addr1, InetSocketAddress addr2) { if (addr1.equals(addr2)) { return 0; } if (!addr1.isUnresolved() && !addr2.isUnresolved()) { if (addr1.getAddress().getClass() == addr2.getAddress().getClass()) { return 0...
@Test public void testCompareUnresolvedSimple() { NameServerComparator comparator = new NameServerComparator(Inet4Address.class); int x = comparator.compare(IPV4ADDRESS1, UNRESOLVED1); int y = comparator.compare(UNRESOLVED1, IPV4ADDRESS1); assertEquals(-1, x); assertEquals(x...
protected String getNodeId(final Path file, final int chunksize) throws BackgroundException { if(file.isRoot()) { return ROOT_NODE_ID; } try { final String type; if(file.isDirectory()) { type = "room:folder"; } else { ...
@Test public void getFileIdFile() throws Exception { final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session); final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new Tran...
private void stop(int numOfServicesStarted, boolean stopOnlyStartedServices) { // stop in reverse order of start Exception firstException = null; List<Service> services = getServices(); for (int i = numOfServicesStarted - 1; i >= 0; i--) { Service service = services.get(i); if (LOG.isDebugEn...
@Test(timeout = 10000) public void testAddUninitedChildInStop() throws Throwable { CompositeService parent = new CompositeService("parent"); BreakableService child = new BreakableService(); parent.init(new Configuration()); parent.start(); parent.stop(); AddSiblingService.addChildToService(par...
@Override public LoadBalancer newLoadBalancer(final LoadBalancer.Helper helper) { return new AbstractLoadBalancer(helper) { @Override protected AbstractReadyPicker newPicker(final List<LoadBalancer.Subchannel> list) { return new RandomPicker(list); } ...
@Test public void testNewLoadBalancer() { LoadBalancer.Helper helper = new UnitTestReadHelper(); final LoadBalancer loadBalancer = randomLoadBalancerProvider.newLoadBalancer(helper); assertNotNull(loadBalancer); }
@Override public ClientDetailsEntity saveNewClient(ClientDetailsEntity client) { if (client.getId() != null) { // if it's not null, it's already been saved, this is an error throw new IllegalArgumentException("Tried to save a new client with an existing ID: " + client.getId()); } if (client.getRegisteredRedi...
@Test(expected = IllegalArgumentException.class) public void heartMode_authcode_invalidGrants() { Mockito.when(config.isHeartMode()).thenReturn(true); ClientDetailsEntity client = new ClientDetailsEntity(); Set<String> grantTypes = new LinkedHashSet<>(); grantTypes.add("authorization_code"); grantTypes.add(...
public void incTopicPutSize(final String topic, final int size) { this.statsTable.get(Stats.TOPIC_PUT_SIZE).addValue(topic, size, 1); }
@Test public void testIncTopicPutSize() { brokerStatsManager.incTopicPutSize(TOPIC, 2); assertThat(brokerStatsManager.getStatsItem(TOPIC_PUT_SIZE, TOPIC).getValue().doubleValue()).isEqualTo(2L); }
@Bean public TimerRegistry timerRegistry( TimerConfigurationProperties timerConfigurationProperties, EventConsumerRegistry<TimerEvent> timerEventConsumerRegistry, RegistryEventConsumer<Timer> timerRegistryEventConsumer, @Qualifier("compositeTimerCustomizer") Composite...
@Test public void shouldConfigureInstancesUsingDedicatedConfigs() { InstanceProperties instanceProperties1 = new InstanceProperties() .setMetricNames("resilience4j.timer.operations1") .setOnFailureTagResolver(QualifiedClassNameOnFailureTagResolver.class) .setE...
@Override public void rotate(IndexSet indexSet) { indexRotator.rotate(indexSet, this::shouldRotate); }
@Test public void testRotate() { when(indices.numberOfMessages("name")).thenReturn(10L); when(indexSet.getNewestIndex()).thenReturn("name"); when(indexSet.getConfig()).thenReturn(indexSetConfig); when(indexSetConfig.rotationStrategyConfig()).thenReturn(MessageCountRotationStrategyCon...
protected static byte rho(long x, int k) { return (byte) (Long.numberOfLeadingZeros((x << k) | (1 << (k - 1))) + 1); }
@Test public void testRhoL() { assertEquals(49, AdaptiveCounting.rho(0L, 16)); assertEquals(48, AdaptiveCounting.rho(1L, 16)); assertEquals(47, AdaptiveCounting.rho(2L, 16)); assertEquals(1, AdaptiveCounting.rho(0x80008000L, 32)); assertEquals(55, AdaptiveCounting.rho(0L, 10...
@Override public InternalCompletableFuture<ClientMessage> exceptionally(@Nonnull Function<Throwable, ? extends ClientMessage> fn) { return super.exceptionally(new CallIdTrackingFunction(fn)); }
@Test public void test_exceptionally() throws Exception { CompletableFuture nextStage = invocationFuture.exceptionally((t) -> response); invocationFuture.completeExceptionally(new IllegalStateException()); assertEquals(response, nextStage.get(ASSERT_TRUE_EVENTUALLY_TIMEOUT, TimeUnit.SECONDS...
@Override public synchronized void reconnect() throws RemotingException { client.reconnect(); }
@Test void testReconnect() { HeaderExchangeClient headerExchangeClient = new HeaderExchangeClient(Mockito.mock(Client.class), false); Assertions.assertTrue(headerExchangeClient.shouldReconnect(URL.valueOf("localhost"))); Assertions.assertTrue(headerExchangeClient.shouldReconnect(URL.valueOf...
@Override public SortedSet<IndexRange> find(DateTime begin, DateTime end) { final DBQuery.Query query = DBQuery.or( DBQuery.and( DBQuery.notExists("start"), // "start" has been used by the old index ranges in MongoDB DBQuery.lessThanEquals(Ind...
@Test @MongoDBFixtures("MongoIndexRangeServiceTest-LegacyIndexRanges.json") public void findIgnoresLegacyIndexRanges() throws Exception { when(indices.waitForRecovery("graylog_1")).thenReturn(HealthStatus.Green); final DateTime begin = new DateTime(2015, 1, 1, 0, 0, DateTimeZone.UTC); f...
public final void doesNotContainEntry(@Nullable Object key, @Nullable Object value) { checkNoNeedToDisplayBothValues("entrySet()") .that(checkNotNull(actual).entrySet()) .doesNotContain(immutableEntry(key, value)); }
@Test public void doesNotContainEntry() { ImmutableMap<String, String> actual = ImmutableMap.of("kurt", "kluever"); assertThat(actual).doesNotContainEntry("greg", "kick"); assertThat(actual).doesNotContainEntry(null, null); assertThat(actual).doesNotContainEntry("kurt", null); assertThat(actual).d...
@Override public String render(String text) { if (StringUtils.isBlank(text)) { return ""; } if (regex.isEmpty() || link.isEmpty()) { Comment comment = new Comment(); comment.escapeAndAdd(text); return comment.render(); } try { ...
@Test public void shouldReturnMatchedStringFromFirstGroupIfMultipleGroupsAreDefined() throws Exception { String link = "http://mingle05/projects/cce/cards/${ID}"; String regex = "(\\d+)-(evo\\d+)"; trackingTool = new DefaultCommentRenderer(link, regex); String result = trackingTool....
@Override public List<Runnable> shutdownNow() { return delegate.shutdownNow(); }
@Test public void shutdownNow_delegates_to_executorService() { underTest.shutdownNow(); inOrder.verify(executorService).shutdownNow(); inOrder.verifyNoMoreInteractions(); }
public JmxCollector register() { return register(PrometheusRegistry.defaultRegistry); }
@Test public void testSnakeCaseAttrName() throws Exception { new JmxCollector( "\n---\nrules:\n- pattern: `^hadoop<service=DataNode, name=DataNodeActivity-ams-hdd001-50010><>replace_block_op_min_time:`\n name: foo\n attrNameSnakeCase: true" .replace(...
@Override public void writeBytes(Slice source) { writeBytes(source, 0, source.length()); }
@Test public void testWriteBytesEmptyBytes() { OrcOutputBuffer orcOutputBuffer = createOrcOutputBuffer(new DataSize(256, KILOBYTE)); orcOutputBuffer.writeBytes(new byte[0]); // EMPTY_SLICE has null byte buffer assertCompressedContent(orcOutputBuffer, new byte[0], ImmutableList.of()); ...
@Override public void apply(final Record<KOut, Change<ValueAndTimestamp<VOut>>> record) { @SuppressWarnings("rawtypes") final ProcessorNode prev = context.currentNode(); context.setCurrentNode(myNode); try { context.forward( record .withValue( ...
@Test public void shouldForwardParameterTimestampIfNewValueIsNull() { @SuppressWarnings("unchecked") final InternalProcessorContext<String, Change<String>> context = mock(InternalProcessorContext.class); doNothing().when(context).forward( new Record<>( "key", ...
public void removePipelineMetrics(String pipelineId) { registry.removeMatching(MetricFilter.startsWith(name( pipelinesPrefix, requireNonBlank(pipelineId, "pipelineId is blank") ))); }
@Test void removePipelineMetrics() { final var metricRegistry = new MetricRegistry(); final var registry = PipelineMetricRegistry.create(metricRegistry, "PIPELINE", "RULE"); registry.registerPipelineMeter("pipeline-1", "executed"); registry.registerStageMeter("pipeline-1", 5, "execu...
static String[] toConfigModelsPluginDir(String configModelsPluginDirString) { return multiValueParameterStream(configModelsPluginDirString).toArray(String[]::new); }
@Test public void string_arrays_are_split_on_spaces() { String[] parsed = toConfigModelsPluginDir("/home/vespa/foo /home/vespa/bar "); assertEquals(2, parsed.length); }
public static String sha3(String hexInput) { byte[] bytes = Numeric.hexStringToByteArray(hexInput); byte[] result = sha3(bytes); return Numeric.toHexString(result); }
@Test public void testSha3HashHex() { assertEquals( Hash.sha3(""), ("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")); assertEquals( Hash.sha3("68656c6c6f20776f726c64"), ("0x47173285a8d7341e5e972fc677286384f802f8ef...
@Override protected void decode(final ChannelHandlerContext ctx, final ByteBuf in, final List<Object> out) { MySQLPacketPayload payload = new MySQLPacketPayload(in, ctx.channel().attr(CommonConstants.CHARSET_ATTRIBUTE_KEY).get()); if (handshakeReceived) { MySQLPacket responsePacket = dec...
@Test void assertDecodeAuthMoreDataPacket() throws ReflectiveOperationException { MySQLNegotiatePackageDecoder negotiatePackageDecoder = new MySQLNegotiatePackageDecoder(); Plugins.getMemberAccessor().set(MySQLNegotiatePackageDecoder.class.getDeclaredField("handshakeReceived"), negotiatePackageDecod...
@Override @CacheEvict(value = RedisKeyConstants.ROLE, key = "#updateReqVO.id") @LogRecord(type = SYSTEM_ROLE_TYPE, subType = SYSTEM_ROLE_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", success = SYSTEM_ROLE_UPDATE_SUCCESS) public void updateRole(RoleSaveReqVO updateReqVO) { // 1.1 校验是否可以...
@Test public void testUpdateRole() { // mock 数据 RoleDO roleDO = randomPojo(RoleDO.class, o -> o.setType(RoleTypeEnum.CUSTOM.getType())); roleMapper.insert(roleDO); // 准备参数 Long id = roleDO.getId(); RoleSaveReqVO reqVO = randomPojo(RoleSaveReqVO.class, o -> o.setId(id)...
public static URI generateSegmentMetadataURI(String segmentTarPath, String segmentName) throws URISyntaxException { URI segmentTarURI = URI.create(segmentTarPath); URI metadataTarGzFilePath = new URI( segmentTarURI.getScheme(), segmentTarURI.getUserInfo(), segmentTarURI.getHost(), ...
@Test public void testGenerateSegmentMetadataURI() throws URISyntaxException { assertEquals( SegmentPushUtils.generateSegmentMetadataURI("/a/b/c/my-segment.tar.gz", "my-segment"), URI.create("/a/b/c/my-segment.metadata.tar.gz")); assertEquals( SegmentPushUtils.generateSegmentMet...
public static boolean matchesInternalTopicFormat(final String topicName) { return topicName.endsWith("-changelog") || topicName.endsWith("-repartition") || topicName.endsWith("-subscription-registration-topic") || topicName.endsWith("-subscription-response-topic") ||...
@Test public void shouldDetermineInternalTopicBasedOnTopicName1() { assertTrue(StreamsResetter.matchesInternalTopicFormat("appId-named-subscription-response-topic")); assertTrue(StreamsResetter.matchesInternalTopicFormat("appId-named-subscription-registration-topic")); assertTrue(StreamsRese...
@Override public void lock() { try { lockInterruptibly(-1, null); } catch (InterruptedException e) { throw new IllegalStateException(); } }
@Test public void testIsLocked() { RLock lock = redisson.getSpinLock("lock"); Assertions.assertFalse(lock.isLocked()); lock.lock(); Assertions.assertTrue(lock.isLocked()); lock.unlock(); Assertions.assertFalse(lock.isLocked()); }