focal_method
stringlengths
13
60.9k
test_case
stringlengths
25
109k
@Override public boolean isEmpty() { return size() == 0; }
@Test public void shouldReturnTrueWhenAllPartsEmpty() { PipelineConfigs group = new MergePipelineConfigs( new BasicPipelineConfigs(), new BasicPipelineConfigs()); assertThat(group.isEmpty(), is(true)); }
public static long getLong(String envName, long defaultValue) { long value = defaultValue; String envValue = System.getenv(envName); if (envValue != null) { try { value = Long.parseLong(envValue); } catch (NumberFormatException e) { } ...
@Test public void getLong() { assertEquals(12345678901234567L, EnvUtil.getLong("myLong", 123L)); assertEquals(987654321987654321L, EnvUtil.getLong("wrongLong", 987654321987654321L)); }
@Override public ObjectNode encode(Load load, CodecContext context) { checkNotNull(load, "Load cannot be null"); return context.mapper().createObjectNode() .put(RATE, load.rate()) .put(LATEST, load.latest()) .put(VALID, load.isValid()) ...
@Test public void testLoadEncode() { final long startTime = System.currentTimeMillis(); final Load load = new DefaultLoad(20, 10, 1); final JsonNode node = new LoadCodec() .encode(load, new MockCodecContext()); assertThat(node.get("valid").asBoolean(), is(true)); ...
@Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest)req; HttpServletResponse response = (HttpServletResponse)res; // Do not allow framing; OF-997 ...
@Test public void willRedirectARequestIfTheServletRequestAuthenticatorReturnsNoUser() throws Exception { AuthCheckFilter.SERVLET_REQUEST_AUTHENTICATOR.setValue(NoUserServletAuthenticatorClass.class); final AuthCheckFilter filter = new AuthCheckFilter(adminManager, loginLimitManager); filte...
static public void copyFile(String source, String target) throws IOException { File sf = new File(source); if (!sf.exists()) { throw new IllegalArgumentException("source file does not exist."); } File tf = new File(target); tf.getParentFile().mkdirs(); if (!tf...
@Test public void testCopyFile() throws Exception { File source = new File(testRootDir, "source"); String target = testRootDir + File.separator + "dest"; IOTinyUtils.writeStringToFile(source, "testCopyFile", StandardCharsets.UTF_8.name()); IOTinyUtils.copyFile(source.getCanonicalPa...
@Operation( summary = "Search for the given search keys in the key transparency log", description = """ Enforced unauthenticated endpoint. Returns a response if all search keys exist in the key transparency log. """ ) @ApiResponse(responseCode = "200", description = "All search key l...
@Test void searchRatelimited() { MockUtils.updateRateLimiterResponseToFail( rateLimiters, RateLimiters.For.KEY_TRANSPARENCY_SEARCH_PER_IP, "127.0.0.1", Duration.ofMinutes(10), true); final Invocation.Builder request = resources.getJerseyTest() .target("/v1/key-transparency/search") .re...
public static int getDefaultReplyTimeout() { // The timeout value must be greater than 0 otherwise we will answer the default value if (defaultPacketReplyTimeout <= 0) { defaultPacketReplyTimeout = 5000; } return defaultPacketReplyTimeout; }
@Test public void testSmackConfiguration() { SmackConfiguration.getDefaultReplyTimeout(); }
void rewrapConnection(Connection connection) throws IllegalAccessException { assert connection != null; if (jboss && connection.getClass().getSimpleName().startsWith("WrappedConnection")) { // pour jboss, // result instance de WrappedConnectionJDK6 ou WrappedConnectionJDK5 // (attribut "mc" sur classe pare...
@Test public void testRewrapConnection() throws SQLException, IllegalAccessException { DriverManager.registerDriver(driver); // nécessite la dépendance vers la base de données H2 final Connection connection = DriverManager.getConnection(H2_DATABASE_URL); jdbcWrapper.rewrapConnection(connection); connection.c...
public static DatabaseType getStorageType(final DataSource dataSource) { try (Connection connection = dataSource.getConnection()) { return DatabaseTypeFactory.get(connection.getMetaData().getURL()); } catch (final SQLFeatureNotSupportedException sqlFeatureNotSupportedException) { ...
@Test void assertGetStorageTypeWhenGetConnectionError() throws SQLException { DataSource dataSource = mock(DataSource.class); when(dataSource.getConnection()).thenThrow(SQLException.class); assertThrows(SQLWrapperException.class, () -> DatabaseTypeEngine.getStorageType(dataSource)); }
@Override public boolean equals(Object object) { if (object instanceof DefaultDeviceDescription) { if (!super.equals(object)) { return false; } DefaultDeviceDescription that = (DefaultDeviceDescription) object; return Objects.equal(this.uri, th...
@Test public void testEquals() { DeviceDescription device1 = new DefaultDeviceDescription(DURI, SWITCH, MFR, HW, SW, SN, CID, DA); DeviceDescription sameAsDevice1 = new DefaultDeviceDescription(DURI, SWITCH, MFR, HW, SW, SN, CID, DA); DeviceDescription device2...
@Override protected InputStream readInputStreamParam(String key) { Part part = readPart(key); return (part == null) ? null : part.getInputStream(); }
@Test public void return_no_input_stream_when_content_type_is_null() { when(source.getContentType()).thenReturn(null); assertThat(underTest.readInputStreamParam("param1")).isNull(); }
@Override public void discoverSchemaTransform( ExpansionApi.DiscoverSchemaTransformRequest request, StreamObserver<ExpansionApi.DiscoverSchemaTransformResponse> responseObserver) { if (!checkedAllServices) { try { waitForAllServicesToBeReady(); } catch (TimeoutException e) { ...
@Test public void testObserverOneEndpointReturns() { ExpansionServiceClient expansionServiceClient = Mockito.mock(ExpansionServiceClient.class); Mockito.when(clientFactory.getExpansionServiceClient(Mockito.any())) .thenReturn(expansionServiceClient); Mockito.when(expansionServiceClient.discover(Mo...
public static List<StreamedRow> toRows( final Buffer buff, final Function<StreamedRow, StreamedRow> addHostInfo ) { final List<StreamedRow> rows = new ArrayList<>(); int begin = 0; for (int i = 0; i <= buff.length(); i++) { if ((i == buff.length() && (i - begin > 1)) || (i < ...
@Test public void toRows_errorParsingNotAtEnd() { // When: final Exception e = assertThrows( KsqlRestClientException.class, () -> KsqlTargetUtil.toRows(Buffer.buffer( "[{\"header\":{\"queryId\":\"query_id_10\",\"schema\":\"`col1` STRING\"}},\n" + "{\"row\":{\"column...
@Override public PubsubMessage apply(Row row) { return new PubsubMessage(payloadExtractor.apply(row), attributesExtractor.apply(row)); }
@Test public void rowPayloadTransformFailure() { Schema payloadSchema = Schema.builder().addStringField("fieldName").build(); Row payload = Row.withSchema(payloadSchema).attachValues("abc"); Schema schema = Schema.builder() .addRowField(PAYLOAD_FIELD, payloadSchema) .addFie...
static int loadRequiredIntProp( Properties props, String keyName ) { String value = props.getProperty(keyName); if (value == null) { throw new RuntimeException("Failed to find " + keyName); } try { return Integer.parseInt(value); } catc...
@Test public void loadMissingRequiredIntProp() { Properties props = new Properties(); assertEquals("Failed to find foo.bar", assertThrows(RuntimeException.class, () -> PropertiesUtils.loadRequiredIntProp(props, "foo.bar")). getMessage()); }
@Override public String toString(final RouteUnit routeUnit) { String quotedIndexName = identifier.getQuoteCharacter().wrap(getIndexValue(routeUnit)); return isGeneratedIndex() ? " " + quotedIndexName + " " : quotedIndexName; }
@Test void assertToString() { IndexToken indexToken = new IndexToken(0, 0, new IdentifierValue("t_order_index"), mock(SQLStatementContext.class, withSettings().extraInterfaces(TableAvailable.class).defaultAnswer(RETURNS_DEEP_STUBS)), mock(ShardingRule.class), mock(ShardingSphereSchema.class)...
static SortKey[] rangeBounds( int numPartitions, Comparator<StructLike> comparator, SortKey[] samples) { // sort the keys first Arrays.sort(samples, comparator); int numCandidates = numPartitions - 1; SortKey[] candidates = new SortKey[numCandidates]; int step = (int) Math.ceil((double) sample...
@Test public void testRangeBoundsDivisible() { assertThat( SketchUtil.rangeBounds( 3, SORT_ORDER_COMPARTOR, new SortKey[] { CHAR_KEYS.get("a"), CHAR_KEYS.get("b"), CHAR_KEYS.get("c"), ...
@Override public void createLoginLog(LoginLogCreateReqDTO reqDTO) { LoginLogDO loginLog = BeanUtils.toBean(reqDTO, LoginLogDO.class); loginLogMapper.insert(loginLog); }
@Test public void testCreateLoginLog() { LoginLogCreateReqDTO reqDTO = randomPojo(LoginLogCreateReqDTO.class); // 调用 loginLogService.createLoginLog(reqDTO); // 断言 LoginLogDO loginLogDO = loginLogMapper.selectOne(null); assertPojoEquals(reqDTO, loginLogDO); }
@SuppressWarnings("unchecked") public <T extends Statement> ConfiguredStatement<T> inject( final ConfiguredStatement<T> statement ) { if (!(statement.getStatement() instanceof CreateSource) && !(statement.getStatement() instanceof CreateAsSelect)) { return statement; } try { i...
@Test public void shouldInjectForCreateAsSelect() { // When: final ConfiguredStatement<CreateAsSelect> configured = injector.inject(csasStatement); // Then: assertThat(configured.getStatement(), is(csasWithUnwrapping)); }
public static MapperManager instance(boolean isDataSourceLogEnable) { INSTANCE.dataSourceLogEnable = isDataSourceLogEnable; return INSTANCE; }
@Test void testInstance() { MapperManager instance = MapperManager.instance(false); assertNotNull(instance); }
public static byte[] getNullableSizePrefixedArray(final ByteBuffer buffer) { final int size = buffer.getInt(); return getNullableArray(buffer, size); }
@Test public void getNullableSizePrefixedArrayUnderflow() { // Integer.MAX_VALUE byte[] input = {127, -1, -1, -1}; final ByteBuffer buffer = ByteBuffer.wrap(input); // note, we get a buffer underflow exception instead of an OOME, even though the encoded size // would be 2,147...
@Override public ConfigFileList getConfigFiles(String pluginId, final String destinationFolder, final Collection<CRConfigurationProperty> configurations) { String resolvedExtensionVersion = pluginManager.resolveExtensionVersion(pluginId, CONFIG_REPO_EXTENSION, goSupportedVersions); if (resolvedExten...
@Test public void shouldTalkToPluginToGetConfigFiles() { List<String> deserializedResponse = new ArrayList<>(); deserializedResponse.add("file.yaml"); ConfigFileList files = new ConfigFileList(deserializedResponse, null); when(jsonMessageHandler3.responseMessageForConfigFiles(respons...
static public Entry buildMenuStructure(String xml) { final Reader reader = new StringReader(xml); return buildMenuStructure(reader); }
@Test public void givenXmlWithourContent_createsEmptyStructure() { String xmlWithoutContent = "<FreeplaneUIEntries/>"; Entry builtMenuStructure = XmlEntryStructureBuilder.buildMenuStructure(xmlWithoutContent); Entry menuStructureWithChildEntry = new Entry(); assertThat(builtMenuStructure, equalTo(menuStruc...
@Override public Reference getReference() throws NamingException { return JNDIReferenceFactory.createReference(this.getClass().getName(), this); }
@Test(timeout=240000) public void testGetReference() throws Exception { PooledConnectionFactory factory = createPooledConnectionFactory(); Reference ref = factory.getReference(); assertNotNull(ref); }
public static String getDatabaseRuleNode(final String databaseName, final String ruleName, final String key) { return String.join("/", getDatabaseRuleNode(databaseName, ruleName), key); }
@Test void assertGetDatabaseRuleNode() { assertThat(DatabaseRuleMetaDataNode.getDatabaseRuleNode("foo_db", "foo_rule", "sharding"), is("/metadata/foo_db/rules/foo_rule/sharding")); }
public static Map<String, String> alterCurrentAttributes(boolean create, Map<String, Attribute> all, ImmutableMap<String, String> currentAttributes, ImmutableMap<String, String> newAttributes) { Map<String, String> init = new HashMap<>(); Map<String, String> add = new HashMap<>(); Map<S...
@Test public void alterCurrentAttributes_CreateMode_ShouldReturnOnlyAddedAttributes() { ImmutableMap<String, String> newAttributes = ImmutableMap.of("+attr1", "new_value1", "+attr2", "value2", "+attr3", "value3"); Map<String, String> result = AttributeUtil.alterCurrentAttributes(true, allAttributes...
public static List<String> split(String path) { PathUtils.validatePath(path); return PATH_SPLITTER.splitToList(path); }
@Test public void testSplit() { assertEquals(ZKPaths.split("/"), Collections.emptyList()); assertEquals(ZKPaths.split("/test"), Collections.singletonList("test")); assertEquals(ZKPaths.split("/test/one"), Arrays.asList("test", "one")); assertEquals(ZKPaths.split("/test/one/two"), Arr...
@Override public boolean isState(State expectedState) { return expectedState == this.state; }
@Test void testIsState() throws Exception { final AdaptiveScheduler scheduler = new AdaptiveSchedulerBuilder( createJobGraph(), mainThreadExecutor, EXECUTOR_RESOURCE.getExecutor()) ...
public static PointList sample(PointList input, double maxDistance, DistanceCalc distCalc, ElevationProvider elevation) { PointList output = new PointList(input.size() * 2, input.is3D()); if (input.isEmpty()) return output; int nodes = input.size(); double lastLat = input.getLat(0), last...
@Test public void addsTwoPointsAboveThreshold() { PointList in = new PointList(2, true); in.add(0, 0, 0); in.add(0.75, 0, 0); PointList out = EdgeSampling.sample( in, DistanceCalcEarth.METERS_PER_DEGREE / 4, new DistanceCalcEarth(), ...
@Override public void handleWayTags(int edgeId, EdgeIntAccess edgeIntAccess, ReaderWay way, IntsRef relationFlags) { // TODO for now the node tag overhead is not worth the effort due to very few data points // List<Map<String, Object>> nodeTags = way.getTag("node_tags", null); Boolean b = g...
@Test public void testBasics() { String today = "2023 May 17"; ArrayEdgeIntAccess edgeIntAccess = new ArrayEdgeIntAccess(1); int edgeId = 0; assertEquals(CarTemporalAccess.MISSING, restricted.getEnum(false, edgeId, edgeIntAccess)); ReaderWay way = new ReaderWay(0L); ...
@Override public List<Integer> applyTransforms(List<Integer> originalGlyphIds) { List<Integer> intermediateGlyphsFromGsub = originalGlyphIds; for (String feature : FEATURES_IN_ORDER) { if (!gsubData.isFeatureSupported(feature)) { LOG.debug("the fe...
@Test void testApplyTransforms_o_kar() { // given List<Integer> glyphsAfterGsub = Arrays.asList(108, 89, 101, 97); // when List<Integer> result = gsubWorkerForBengali.applyTransforms(getGlyphIds("বোস")); // then assertEquals(glyphsAfterGsub, result); }
@Override public Object next() { if (_numberOfValuesPerEntry == 1) { return getNextBooleanAsInteger(); } return MultiValueGeneratorHelper .generateMultiValueEntries(_numberOfValuesPerEntry, _random, this::getNextBooleanAsInteger); }
@Test public void testNextMultiValued() { Random random = mock(Random.class); when(random.nextBoolean()) .thenReturn(false, true, false, false, false, true, true, true, true, false, true, false, false, true, true, false, false, false, true, true, false, true, true, true); when(random.n...
@Override public boolean isActive() { return isActive; }
@Test(timeOut = 30000) public void testClientClosedProducerThenSendsMessageAndGetsClosed() throws Exception { resetChannel(); setChannelConnected(); setConnectionVersion(ProtocolVersion.v5.getValue()); serverCnx.cancelKeepAliveTask(); String producerName = "my-producer"; ...
public static URI getUri(String path) { try { URI uri = new URI(path); if (uri.getScheme() != null) { return uri; } else { return new URI(CommonConstants.Segment.LOCAL_SEGMENT_SCHEME + ":" + path); } } catch (URISyntaxException e) { throw new IllegalArgumentExceptio...
@Test public void testGetUri() { assertEquals(URIUtils.getUri("http://foo/bar").toString(), "http://foo/bar"); assertEquals(URIUtils.getUri("http://foo/bar", "table").toString(), "http://foo/bar/table"); assertEquals(URIUtils.getUri("http://foo/bar", "table", "segment+%25").toString(), "http://foo...
@Override public ReservationSubmissionResponse submitReservation( ReservationSubmissionRequest request) throws YarnException, IOException { if (request == null || request.getReservationId() == null || request.getReservationDefinition() == null || request.getQueue() == null) { routerMetrics.in...
@Test public void testSubmitReservationEmptyRequest() throws Exception { LOG.info("Test FederationClientInterceptor : SubmitReservation request empty."); String errorMsg = "Missing submitReservation request or reservationId or reservation definition or queue."; // null request1 LambdaTestUti...
private static SnapshotDiffReport getSnapshotDiffReport( final FileSystem fs, final Path snapshotDir, final String fromSnapshot, final String toSnapshot) throws IOException { try { return (SnapshotDiffReport) getSnapshotDiffReportMethod(fs).invoke( fs, snapshotDir, fromSnapsh...
@Test public void testSync2() throws Exception { initData2(source); initData2(target); enableAndCreateFirstSnapshot(); // make changes under source changeData2(source); dfs.createSnapshot(source, "s2"); SnapshotDiffReport report = dfs.getSnapshotDiffReport(source, "s1", "s2"); System...
@Override public void executeUpdate(final AlterStorageUnitStatement sqlStatement, final ContextManager contextManager) { checkBefore(sqlStatement); Map<String, DataSourcePoolProperties> propsMap = DataSourceSegmentsConverter.convert(database.getProtocolType(), sqlStatement.getStorageUnits()); ...
@Test void assertExecuteUpdateWithDuplicateStorageUnitNames() { assertThrows(DuplicateStorageUnitException.class, () -> executor.executeUpdate(createAlterStorageUnitStatementWithDuplicateStorageUnitNames(), mock(ContextManager.class))); }
@Override public EntityExcerpt createExcerpt(CacheDto cacheDto) { return EntityExcerpt.builder() .id(ModelId.of(cacheDto.id())) .type(ModelTypes.LOOKUP_CACHE_V1) .title(cacheDto.title()) .build(); }
@Test public void createExcerpt() { final CacheDto cacheDto = CacheDto.builder() .id("1234567890") .name("cache-name") .title("Cache Title") .description("Cache Description") .config(new FallbackCacheConfig()) .b...
@Override public boolean encode( @NonNull Resource<GifDrawable> resource, @NonNull File file, @NonNull Options options) { GifDrawable drawable = resource.get(); Transformation<Bitmap> transformation = drawable.getFrameTransformation(); boolean isTransformed = !(transformation instanceof UnitTransfor...
@Test public void testRecyclesTransformedResourceAfterWritingIfTransformedResourceIsDifferent() { when(decoder.getFrameCount()).thenReturn(1); Bitmap expected = Bitmap.createBitmap(100, 200, Bitmap.Config.RGB_565); when(transformedResource.get()).thenReturn(expected); when(frameTransformation.transfor...
@Override public Optional<BlobDescriptor> handleHttpResponseException(ResponseException responseException) throws ResponseException { if (responseException.getStatusCode() != HttpStatusCodes.STATUS_CODE_NOT_FOUND) { throw responseException; } if (responseException.getContent() == null) { ...
@Test public void testHandleHttpResponseException_invalidStatusCode() { ResponseException mockResponseException = Mockito.mock(ResponseException.class); Mockito.when(mockResponseException.getStatusCode()).thenReturn(-1); try { testBlobChecker.handleHttpResponseException(mockResponseException); ...
@Override @Deprecated public <VR> KStream<K, VR> flatTransformValues(final org.apache.kafka.streams.kstream.ValueTransformerSupplier<? super V, Iterable<VR>> valueTransformerSupplier, final String... stateStoreNames) { Objects.requireNonNull(valueTransf...
@Test @SuppressWarnings("deprecation") public void shouldNotAllowNullStoreNameOnFlatTransformValuesWithFlatValueWithKeySupplierAndNamed() { final NullPointerException exception = assertThrows( NullPointerException.class, () -> testStream.flatTransformValues( flatV...
static String encodeHex(byte[] bytes) { final char[] hex = new char[bytes.length * 2]; int i = 0; for (byte b : bytes) { hex[i++] = HEX_DIGITS[(b >> 4) & 0x0f]; hex[i++] = HEX_DIGITS[b & 0x0f]; } return String.valueOf(hex); }
@Test public void encodeHex_Null_Failure() throws Exception { try { PubkeyUtils.encodeHex(null); fail("Should throw null pointer exception when argument is null"); } catch (NullPointerException e) { // success } }
@Override public ObjectNode encode(MappingKey key, CodecContext context) { checkNotNull(key, "Mapping key cannot be null"); final ObjectNode result = context.mapper().createObjectNode(); final JsonCodec<MappingAddress> addressCodec = context.codec(MappingAddress.class); ...
@Test public void testMappingKeyEncode() { MappingAddress address = MappingAddresses.ipv4MappingAddress(IPV4_PREFIX); MappingKey key = DefaultMappingKey.builder() .withAddress(address) .build(); ObjectNode keyJson = keyCodec....
@PublicAPI(usage = ACCESS) public JavaField getField(String name) { return members.getField(name); }
@Test public void get_all_involved_raw_types_returns_component_type_for_array_type() { class SimpleClass { @SuppressWarnings("unused") SimpleClass[][] field; } JavaType arrayType = new ClassFileImporter().importClass(SimpleClass.class).getField("field").getType(); ...
@Override public void shutdown() { scheduledExecutorService.shutdown(); try { web3jService.close(); } catch (IOException e) { throw new RuntimeException("Failed to close web3j service", e); } }
@Test public void testExceptionOnServiceClosure() throws Exception { assertThrows( RuntimeException.class, () -> { doThrow(new IOException("Failed to close")).when(service).close(); web3j.shutdown(); }); }
public static DistCpOptions parse(String[] args) throws IllegalArgumentException { CommandLineParser parser = new CustomParser(); CommandLine command; try { command = parser.parse(cliOptions, args, true); } catch (ParseException e) { throw new IllegalArgumentException("Unable to pars...
@Test public void testParseMaps() { DistCpOptions options = OptionsParser.parse(new String[] { "hdfs://localhost:8020/source/first", "hdfs://localhost:8020/target/"}); assertThat(options.getMaxMaps()).isEqualTo(DistCpConstants.DEFAULT_MAPS); options = OptionsParser.parse(new String[] { ...
public boolean saveToFile( EngineMetaInterface meta ) throws KettleException { return saveToFile( meta, false ); }
@Test public void testNullParamSaveToFile() throws Exception { doCallRealMethod().when( spoon ).saveToFile( any() ); assertFalse( spoon.saveToFile( null ) ); }
@Override public List<Intent> compile(LinkCollectionIntent intent, List<Intent> installable) { SetMultimap<DeviceId, PortNumber> inputPorts = HashMultimap.create(); SetMultimap<DeviceId, PortNumber> outputPorts = HashMultimap.create(); Map<ConnectPoint, Identifier<?>> labels = ImmutableMap....
@Test public void testFilteredConnectPointForMp() { Set<Link> testLinks = ImmutableSet.of( DefaultLink.builder().providerId(PID).src(of1p2).dst(of2p1).type(DIRECT).build(), DefaultLink.builder().providerId(PID).src(of3p2).dst(of2p3).type(DIRECT).build(), Defau...
@Override public <T> T convert(DataTable dataTable, Type type) { return convert(dataTable, type, false); }
@Test void convert_to_unknown_type__throws_exception__with_table_entry_converter_present__throws_exception() { DataTable table = parse("", "| ♘ |"); CucumberDataTableException exception = assertThrows( CucumberDataTableException.class, () -> converter.convert(tabl...
public List<TimerangePreset> convert(final Map<Period, String> timerangeOptions) { if (timerangeOptions == null) { return List.of(); } return timerangeOptions.entrySet() .stream() .map(entry -> new TimerangePreset( periodConvert...
@Test void testConversionOnSomeDefaultRelativeTimerangeOptions() { Map<Period, String> defaults = new LinkedHashMap( Map.of( Period.minutes(15), "15 minutes", Period.hours(8), "8 hours", Period.days(1), "1 day" ...
public HeapRow() { // No-op. }
@Test public void testHeapRow() { Object[] values = new Object[2]; values[0] = new Object(); values[1] = new Object(); HeapRow row = new HeapRow(values); assertEquals(2, row.getColumnCount()); assertSame(values[0], row.get(0)); assertSame(values[1], row.get...
@Override public ObjectNode encode(Instruction instruction, CodecContext context) { checkNotNull(instruction, "Instruction cannot be null"); return new EncodeInstructionCodecHelper(instruction, context).encode(); }
@Test public void modIPv6FlowLabelInstructionTest() { final int flowLabel = 0xfffff; final L3ModificationInstruction.ModIPv6FlowLabelInstruction instruction = (L3ModificationInstruction.ModIPv6FlowLabelInstruction) Instructions.modL3IPv6FlowLabel(flowLabel); ...
@Override public void run() { if (processor != null) { processor.execute(); } else { if (!beforeHook()) { logger.info("before-feature hook returned [false], aborting: {}", this); } else { scenarios.forEachRemaining(this::processScen...
@Test void testCallOnceWithUtilsPresentInKarateConfig() { run("callonce-bg.feature", "classpath:com/intuit/karate/core"); }
@Override public QueryHeader build(final QueryResultMetaData queryResultMetaData, final ShardingSphereDatabase database, final String columnName, final String columnLabel, final int columnIndex) throws SQLException { String schemaName = null == database ? "" : database.getName()...
@Test void assertBuildWithoutDataNodeContainedRule() throws SQLException { QueryResultMetaData queryResultMetaData = createQueryResultMetaData(); QueryHeader actual = new MySQLQueryHeaderBuilder().build( queryResultMetaData, mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS), que...
public static int digitCount(final int value) { return (int)((value + INT_DIGITS[31 - Integer.numberOfLeadingZeros(value | 1)]) >> 32); }
@Test void digitCountIntValue() { for (int i = 0; i < INT_MAX_DIGITS; i++) { final int min = 0 == i ? 0 : INT_POW_10[i]; final int max = INT_MAX_DIGITS - 1 == i ? Integer.MAX_VALUE : INT_POW_10[i + 1] - 1; final int expectedDigitCount = i + 1; asse...
public static <InputT extends PInput, OutputT extends POutput> PTransform<InputT, OutputT> compose(SerializableFunction<InputT, OutputT> fn) { return new PTransform<InputT, OutputT>() { @Override public OutputT expand(InputT input) { return fn.apply(input); } }; }
@Test @Category(NeedsRunner.class) public void testComposeBasicSerializableFunction() throws Exception { PCollection<Integer> output = pipeline .apply(Create.of(1, 2, 3)) .apply( PTransform.compose( (PCollection<Integer> numbers) -> { ...
public TemplateResponse mapToTemplateResponse(ReviewGroup reviewGroup, Template template) { List<SectionResponse> sectionResponses = template.getSectionIds() .stream() .map(templateSection -> mapToSectionResponse(templateSection, reviewGroup)) .toList(); ...
@Test void 템플릿_매핑_시_옵션_그룹에_해당하는_옵션_아이템이_없을_경우_예외가_발생한다() { // given Question question1 = new Question(true, QuestionType.TEXT, "질문", "가이드라인", 1); Question question2 = new Question(true, QuestionType.CHECKBOX, "질문", "가이드라인", 1); questionRepository.saveAll(List.of(question1, question2)...
@Around("@annotation(com.linecorp.flagship4j.javaflagr.annotations.ControllerFeatureToggle)") public Object processControllerFeatureToggleAnnotation(ProceedingJoinPoint joinPoint) throws Throwable { log.info("start processing controllerFeatureToggle annotation"); MethodSignature signature = (MethodS...
@Test public void processFlagrMethodWithControllerFeatureToggleTest() throws Throwable { String methodName = "methodWithControllerFeatureToggle"; FlagrAnnotationTest flagrAnnotationTest = new FlagrAnnotationTest(); Method method = Arrays.stream(flagrAnnotationTest.getClass().getMethods()).fi...
public Map<TopicPartition, String> partitionDirs() { Map<TopicPartition, String> result = new HashMap<>(); data.dirs().forEach(alterDir -> alterDir.topics().forEach(topic -> topic.partitions().forEach(partition -> result.put(new TopicPartition(topic.name()...
@Test public void testPartitionDir() { AlterReplicaLogDirsRequestData data = new AlterReplicaLogDirsRequestData() .setDirs(new AlterReplicaLogDirCollection( asList(new AlterReplicaLogDir() .setPath("/data0") ...
public static AckAnswer ackAnswer(XmlPullParser parser) throws XmlPullParserException, IOException { ParserUtils.assertAtStartTag(parser); long h = ParserUtils.getLongAttribute(parser, "h"); parser.next(); ParserUtils.assertAtEndTag(parser); return new AckAnswer(h); }
@Test public void testParseAckAnswer() throws Exception { long handledPackets = 42 + 42; String ackStanza = XMLBuilder.create("a") .a("xmlns", "urn:xmpp:sm:3") .a("h", String.valueOf(handledPackets)) .asString(outputProperties); StreamManagem...
static CommandLineOptions parse(Iterable<String> options) { CommandLineOptions.Builder optionsBuilder = CommandLineOptions.builder(); List<String> expandedOptions = new ArrayList<>(); expandParamsFiles(options, expandedOptions); Iterator<String> it = expandedOptions.iterator(); while (it.hasNext()) ...
@Test public void assumeFilename() { assertThat( CommandLineOptionsParser.parse(Arrays.asList("--assume-filename", "Foo.java")) .assumeFilename()) .hasValue("Foo.java"); assertThat(CommandLineOptionsParser.parse(Arrays.asList("Foo.java")).assumeFilename()) .isEmpty(...
@Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { if (!configured()) throw new IllegalStateException("Callback handler not configured"); for (Callback callback : callbacks) { if (callback instanceof OAuthBearerTokenCallback)...
@SuppressWarnings("unchecked") @Test public void validOptionsWithExplicitOptionValues() throws IOException, UnsupportedCallbackException { String explicitScope1 = "scope1"; String explicitScope2 = "scope2"; String explicitScopeClaimName = "putScopeInHere"; String prin...
@Override public StringBuffer format(Object obj, StringBuffer result, FieldPosition pos) { return format.format(toArgs((Attributes) obj), result, pos); }
@Test public void testOffset() { Attributes attrs = new Attributes(); attrs.setString(Tag.SeriesNumber, VR.IS, "1"); attrs.setString(Tag.InstanceNumber, VR.IS, "2"); assertEquals("101/1", new AttributesFormat(TEST_PATTERN_OFFSET).format(attrs)); }
@SuppressWarnings("unchecked") private SpscChannelConsumer<E> newConsumer(Object... args) { return mapper.newFlyweight(SpscChannelConsumer.class, "ChannelConsumerTemplate.java", Template.fromFile(Channel.class, "ChannelConsumerTemplate.java"), args); }
@Test public void shouldNotReadFromEmptyChannel() { ChannelConsumer consumer = newConsumer(); assertEmpty(); assertFalse(consumer.read()); }
public static byte[] bigIntegerToBytes(BigInteger b, int numBytes) { checkArgument(b.signum() >= 0, () -> "b must be positive or zero: " + b); checkArgument(numBytes > 0, () -> "numBytes must be positive: " + numBytes); byte[] src = b.toByteArray(); byte[] dest = new byte[numBytes]; ...
@Test(expected = IllegalArgumentException.class) public void bigIntegerToBytes_convertNegativeNumber() { BigInteger b = BigInteger.valueOf(-1); ByteUtils.bigIntegerToBytes(b, 32); }
public <T> Future<Iterable<Map.Entry<ByteString, Iterable<T>>>> multimapFetchAllFuture( boolean omitValues, ByteString encodedTag, String stateFamily, Coder<T> elemCoder) { StateTag<ByteString> stateTag = StateTag.<ByteString>of(Kind.MULTIMAP_ALL, encodedTag, stateFamily) .toBuilder() ...
@Test public void testReadMultimapKeys() throws Exception { Future<Iterable<Map.Entry<ByteString, Iterable<Integer>>>> future = underTest.multimapFetchAllFuture(true, STATE_KEY_1, STATE_FAMILY, INT_CODER); Mockito.verifyNoMoreInteractions(mockWindmill); Windmill.KeyedGetDataRequest.Builder expect...
public boolean eval(ContentFile<?> file) { // TODO: detect the case where a column is missing from the file using file's max field id. return new MetricsEvalVisitor().eval(file); }
@Test public void testNoNulls() { boolean shouldRead = new InclusiveMetricsEvaluator(SCHEMA, isNull("all_nulls")).eval(FILE); assertThat(shouldRead).as("Should read: at least one null value in all null column").isTrue(); shouldRead = new InclusiveMetricsEvaluator(SCHEMA, isNull("some_nulls")).eval(FILE);...
void decode(int streamId, ByteBuf in, Http2Headers headers, boolean validateHeaders) throws Http2Exception { Http2HeadersSink sink = new Http2HeadersSink( streamId, headers, maxHeaderListSize, validateHeaders); // Check for dynamic table size updates, which must occur at the beginning: ...
@Test public void unknownPseudoHeader() throws Exception { final ByteBuf in = Unpooled.buffer(200); try { HpackEncoder hpackEncoder = new HpackEncoder(true); Http2Headers toEncode = new DefaultHttp2Headers(false); toEncode.add(":test", "1"); hpackEnco...
public static boolean isSameMinute(Date date1, Date date2) { final Calendar cal1 = Calendar.getInstance(); final Calendar cal2 = Calendar.getInstance(); cal1.setTime(date1); cal2.setTime(date2); return cal1.get(YEAR) == cal2.get(YEAR) && cal1.get(MONTH) == cal2.ge...
@Test public void testSameMinute() { Assert.assertTrue(isSameMinute(new Date(), new Date())); Assert.assertFalse(isSameMinute(new Date(), new Date(System.currentTimeMillis() + 60 * 1000))); }
@Override protected long getEncodedElementByteSize(BigDecimal value) throws Exception { checkNotNull(value, String.format("cannot encode a null %s", BigDecimal.class.getSimpleName())); return VAR_INT_CODER.getEncodedElementByteSize(value.scale()) + BIG_INT_CODER.getEncodedElementByteSize(value.unscale...
@Test public void testGetEncodedElementByteSize() throws Exception { TestElementByteSizeObserver observer = new TestElementByteSizeObserver(); for (BigDecimal value : TEST_VALUES) { TEST_CODER.registerByteSizeObserver(value, observer); observer.advance(); assertThat( observer.getSu...
static void verifyFixInvalidValues(final List<KiePMMLMiningField> notTargetMiningFields, final PMMLRequestData requestData) { logger.debug("verifyInvalidValues {} {}", notTargetMiningFields, requestData); final Collection<ParameterInfo> requestParams = requestData....
@Test void verifyFixInvalidValuesNotInvalid() { KiePMMLMiningField miningField0 = KiePMMLMiningField.builder("FIELD-0", null) .withDataType(DATA_TYPE.STRING) .withAllowedValues(Arrays.asList("123", "124", "125")) .build(); KiePMMLMiningField miningFiel...
public static String getMaskedStatement(final String query) { try { final ParseTree tree = DefaultKsqlParser.getParseTree(query); return new Visitor().visit(tree); } catch (final Exception | StackOverflowError e) { return fallbackMasking(query); } }
@Test public void shouldMaskSourceConnector() { // Given: final String query = "CREATE SOURCE CONNECTOR `test-connector` WITH (" + " \"connector.class\" = 'PostgresSource', \n" + " 'connection.url' = 'jdbc:postgresql://localhost:5432/my.db',\n" + " `mode`='bulk',\n" + ...
@Override public Credentials getCredential() { return credentials; }
@Test void testGetCredential() { CredentialService credentialService1 = CredentialService.getInstance(); Credentials credential = credentialService1.getCredential(); assertNotNull(credential); }
public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; // Remove the temporary files... if ( data.file != null ) { for ( int i = 1; i < data.file.length; i++ ) { if ( data.file[i] != null ) { data.file[i].delet...
@Test public void checkThatMethodPerformedWithoutError() throws Exception { getJoinRows().dispose( meta, data ); }
@Override public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { }
@Test public void onActivitySaveInstanceState() { mActivityLifecycle.onActivitySaveInstanceState(mActivity, null); }
public static String buildErrorMessage(final Throwable throwable) { if (throwable == null) { return ""; } final List<String> messages = dedup(getErrorMessages(throwable)); final String msg = messages.remove(0); final String causeMsg = messages.stream() .filter(s -> !s.isEmpty()) ...
@Test public void shouldHandleRecursiveExceptionChain() { final Exception cause = new TestException("Something went wrong"); final Throwable e = new TestException("Top level", cause); cause.initCause(e); assertThat( buildErrorMessage(e), is("Top level" + System.lineSeparator() ...
@Override public Long createSmsLog(String mobile, Long userId, Integer userType, Boolean isSend, SmsTemplateDO template, String templateContent, Map<String, Object> templateParams) { SmsLogDO.SmsLogDOBuilder logBuilder = SmsLogDO.builder(); // 根据是否要发送,设置状态 logBui...
@Test public void testCreateSmsLog() { // 准备参数 String mobile = randomString(); Long userId = randomLongId(); Integer userType = randomEle(UserTypeEnum.values()).getValue(); Boolean isSend = randomBoolean(); SmsTemplateDO templateDO = randomPojo(SmsTemplateDO.class, ...
public synchronized void register(String id, MapInterceptor interceptor) { assert !(Thread.currentThread() instanceof PartitionOperationThread); if (id2InterceptorMap.containsKey(id)) { return; } Map<String, MapInterceptor> tmpMap = new HashMap<>(id2InterceptorMap); ...
@Test public void testRegister_whenRegisteredTwice_doNothing() { registry.register(interceptor.id, interceptor); registry.register(interceptor.id, interceptor); assertInterceptorRegistryContainsInterceptor(); }
public void convert(FSConfigToCSConfigConverterParams params) throws Exception { validateParams(params); this.clusterResource = getClusterResource(params); this.convertPlacementRules = params.isConvertPlacementRules(); this.outputDirectory = params.getOutputDirectory(); this.rulesToFile = para...
@Test public void testConversionWhenInvalidPlacementRulesIgnored() throws Exception { FSConfigToCSConfigConverterParams params = createDefaultParamsBuilder() .withClusterResource(CLUSTER_RESOURCE_STRING) .withFairSchedulerXmlConfig(FS_INVALID_PLACEMENT_RULES_XML) .build(); Conve...
public static <T> RBFNetwork<T> fit(T[] x, double[] y, RBF<T>[] rbf) { return fit(x, y, rbf, false); }
@Test public void testAilerons() { System.out.println("ailerons"); MathEx.setSeed(19650218); // to get repeatable results. double[][] x = MathEx.clone(Ailerons.x); MathEx.standardize(x); RegressionValidations<RBFNetwork<double[]>> result = CrossValidation.regression(10, x, ...
public String format(Date then) { if (then == null) then = now(); Duration d = approximateDuration(then); return format(d); }
@Test public void testYearsAgo() throws Exception { PrettyTime t = new PrettyTime(now); Assert.assertEquals("3 years ago", t.format(now.minusYears(3))); }
@Override public void register(String path, ServiceRecord record) throws IOException { op(path, record, addRecordCommand); }
@Test public void testAppRegistration() throws Exception { ServiceRecord record = getMarshal().fromBytes("somepath", APPLICATION_RECORD.getBytes()); getRegistryDNS().register( "/registry/users/root/services/org-apache-slider/test1/", record); // start assessing whether correct records are...
public static <T> T getMapper(Class<T> clazz) { try { List<ClassLoader> classLoaders = collectClassLoaders( clazz.getClassLoader() ); return getMapper( clazz, classLoaders ); } catch ( ClassNotFoundException | NoSuchMethodException e ) { throw new RuntimeExce...
@Test public void shouldReturnImplementationInstance() { Foo mapper = Mappers.getMapper( Foo.class ); assertThat( mapper ).isNotNull(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final P4MatchFieldModel other = (P4MatchFieldModel) obj; return Objects.equals(this.id, other.id)...
@Test public void testEquals() { new EqualsTester() .addEqualityGroup(P4_MATCH_FIELD_MODEL_1, SAME_AS_P4_MATCH_FIELD_MODEL_1) .addEqualityGroup(P4_MATCH_FIELD_MODEL_3, SAME_AS_P4_MATCH_FIELD_MODEL_3) .addEqualityGroup(P4_MATCH_FIELD_MODEL_2) .addEqualityGroup(...
public static String format(TemporalAccessor time, DateTimeFormatter formatter) { if (null == time) { return null; } if(time instanceof Month){ return time.toString(); } if(null == formatter){ formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; } try { return formatter.format(time); } catc...
@Test public void formatCustomTest(){ final String today = TemporalAccessorUtil.format( LocalDate.of(2021, 6, 26), "#sss"); assertEquals("1624636800", today); final String today2 = TemporalAccessorUtil.format( LocalDate.of(2021, 6, 26), "#SSS"); assertEquals("1624636800000", today2); }
static S3ResourceId fromUri(String uri) { Matcher m = S3_URI.matcher(uri); checkArgument(m.matches(), "Invalid S3 URI: [%s]", uri); String scheme = m.group("SCHEME"); String bucket = m.group("BUCKET"); String key = Strings.nullToEmpty(m.group("KEY")); if (!key.startsWith("/")) { key = "/" ...
@Test public void testInvalidPathNoBucketAndSlash() { assertThrows( "Invalid S3 URI: [s3:///]", IllegalArgumentException.class, () -> S3ResourceId.fromUri("s3:///")); }
static Method getGetter(final Class<?> clazz, final String propertyName) { final String getterName = "get" + Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1); final String iserName = "is" + Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1); try {...
@Test public void findNonBooleanGetter() throws Exception { final Method getter = ReflectionUtils.getGetter(Foo.class, "a"); assertNotNull(getter); assertEquals("getA", getter.getName()); }
public OpenAPI read(Class<?> cls) { return read(cls, resolveApplicationPath(), null, false, null, null, new LinkedHashSet<String>(), new ArrayList<Parameter>(), new HashSet<Class<?>>()); }
@Test(description = "Link with Ref") public void testLinkWithRef() { Components components = new Components(); components.addLinks("Link", new Link().description("Link Description").operationId("id")); OpenAPI oas = new OpenAPI() .info(new Info().description("info")) ...
public static List<List<Expr>> candidateOfPartitionByExprs(List<List<Expr>> partitionByExprs) { if (partitionByExprs.isEmpty()) { return Lists.newArrayList(); } PermutationGenerator generator = new PermutationGenerator<Expr>(partitionByExprs); int totalCount = 0; List...
@Test public void testPermutaionsOfPartitionByExprs3() throws Exception { List<List<Expr>> slotRefs = createSlotRefArray(4, 5); for (List<Expr> refs: slotRefs) { System.out.println(slotRefsToInt(refs)); } List<List<Expr>> newSlotRefs = PlanNode.candidateOfPartitionByExprs...
@SuppressWarnings("unchecked") public synchronized T load(File jsonFile) throws IOException, JsonParseException, JsonMappingException { if (!jsonFile.exists()) { throw new FileNotFoundException("No such file: " + jsonFile); } if (!jsonFile.isFile()) { throw new FileNotFoundException("Not...
@Test public void testFileSystemEmptyStatus() throws Throwable { File tempFile = File.createTempFile("Keyval", ".json"); Path tempPath = new Path(tempFile.toURI()); LocalFileSystem fs = FileSystem.getLocal(new Configuration()); try { final FileStatus st = fs.getFileStatus(tempPath); Lambda...
public static List<PlanNodeId> scheduleOrder(PlanNode root) { ImmutableList.Builder<PlanNodeId> schedulingOrder = ImmutableList.builder(); root.accept(new Visitor(), schedulingOrder::add); return schedulingOrder.build(); }
@Test public void testSemiJoinOrder() { PlanBuilder planBuilder = new PlanBuilder(TEST_SESSION, new PlanNodeIdAllocator(), METADATA); VariableReferenceExpression sourceJoin = planBuilder.variable("sourceJoin"); TableScanNode a = planBuilder.tableScan(ImmutableList.of(sourceJoin), Immutab...
public void close() throws SQLException { databaseConnectionManager.unmarkResourceInUse(proxyBackendHandler); proxyBackendHandler.close(); }
@Test void assertClose() throws SQLException { PostgreSQLServerPreparedStatement preparedStatement = new PostgreSQLServerPreparedStatement("", new UnknownSQLStatementContext(new PostgreSQLEmptyStatement()), new HintValueContext(), Collections.emptyList(), Collections.emptyList()); ne...
@SuppressWarnings("unchecked") @Override public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request) throws YarnException, IOException { NodeStatus remoteNodeStatus = request.getNodeStatus(); /** * Here is the node heartbeat sequence... * 1. Check if it's a valid (i.e. not excl...
@Test public void testGracefulDecommissionDefaultTimeoutResolution() throws Exception { Configuration conf = new Configuration(); conf.set(YarnConfiguration.RM_NODES_EXCLUDE_FILE_PATH, excludeHostXmlFile .getAbsolutePath()); writeToHostsXmlFile(excludeHostXmlFile, Pair.of("", null)); rm...
public Result execute() { long start = clock().getTick(); Result result; try { result = check(); } catch (Exception e) { result = Result.unhealthy(e); } result.setDuration(TimeUnit.MILLISECONDS.convert(clock().getTick() - start, TimeUnit.NANOSECOND...
@Test public void returnsResultsWhenExecuted() { final HealthCheck.Result result = mock(HealthCheck.Result.class); when(underlying.execute()).thenReturn(result); assertThat(healthCheck.execute()) .isEqualTo(result); verify(result).setDuration(anyLong()); }
public static Collection<java.nio.file.Path> listFilesInDirectory( final java.nio.file.Path directory, final Predicate<java.nio.file.Path> fileFilter) throws IOException { checkNotNull(directory, "directory"); checkNotNull(fileFilter, "fileFilter"); if (!Files.exists(dir...
@Test void testListDirFailsIfDirectoryDoesNotExist() { final String fileName = "_does_not_exists_file"; assertThatThrownBy( () -> FileUtils.listFilesInDirectory( temporaryFolder.getRoot().resolve(fileName...
public static String toString(RedisCommand<?> command, Object... params) { if (RedisCommands.AUTH.equals(command)) { return "command: " + command + ", params: (password masked)"; } return "command: " + command + ", params: " + LogHelper.toString(params); }
@Test public void toStringWithBigArrays() { String[] strings = new String[15]; Arrays.fill(strings, "0"); int[] ints = new int[15]; Arrays.fill(ints, 1); long[] longs = new long[15]; Arrays.fill(longs, 2L); double[] doubles = new double[15]; Arrays.fil...
@Override public boolean filterPath(Path filePath) { if (getIncludeMatchers().isEmpty() && getExcludeMatchers().isEmpty()) { return false; } // compensate for the fact that Flink paths are slashed final String path = filePath.hasWindowsDrive() ? filePath....
@Test void testExcludeFilesNotInIncludePatterns() { GlobFilePathFilter matcher = new GlobFilePathFilter(Collections.singletonList("dir/*"), Collections.emptyList()); assertThat(matcher.filterPath(new Path("dir/file.txt"))).isFalse(); assertThat(matcher.filterPath(new Path("d...
@Operation(summary = "queryAllProjectListForDependent", description = "QUERY_ALL_PROJECT_LIST_FOR_DEPENDENT_NOTES") @GetMapping(value = "/list-dependent") @ResponseStatus(HttpStatus.OK) @ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR) public Result queryAllProjectListForDependent(@Parameter(hid...
@Test public void testQueryAllProjectListForDependent() { User user = new User(); user.setId(0); Result result = new Result(); putMsg(result, Status.SUCCESS); Mockito.when(projectService.queryAllProjectListForDependent()).thenReturn(result); Result response = projectC...
public void execute() throws DdlException { Map<String, UserVariable> clonedUserVars = new ConcurrentHashMap<>(); boolean hasUserVar = stmt.getSetListItems().stream().anyMatch(var -> var instanceof UserVariable); boolean executeSuccess = true; if (hasUserVar) { clonedUserVars...
@Test public void testUserDefineVariable3() throws Exception { ConnectContext ctx = starRocksAssert.getCtx(); String sql = "set @aVar = 5, @bVar = @aVar + 1, @cVar = @bVar + 1"; SetStmt stmt = (SetStmt) UtFrameUtils.parseStmtWithNewParser(sql, ctx); SetExecutor executor = new SetExec...
@PostConstruct public void doRegister() { DistroClientDataProcessor dataProcessor = new DistroClientDataProcessor(clientManager, distroProtocol); DistroTransportAgent transportAgent = new DistroClientTransportAgent(clusterRpcClientProxy, serverMemberManager); DistroClientTask...
@Test void testDoRegister() { distroClientComponentRegistry.doRegister(); DistroDataStorage dataStorage = componentHolder.findDataStorage(DistroClientDataProcessor.TYPE); assertNotNull(dataStorage); DistroDataProcessor dataProcessor = componentHolder.findDataProcess...