focal_method
stringlengths
13
60.9k
test_case
stringlengths
25
109k
@Override protected ObjectPermissions getPermissions() { return mPermissions.get(); }
@Test public void getPermissionsDefault() { Mockito.when(mClient.getS3AccountOwner()).thenThrow(AmazonClientException.class); ObjectUnderFileSystem.ObjectPermissions permissions = mS3UnderFileSystem.getPermissions(); Assert.assertEquals(DEFAULT_OWNER, permissions.getGroup()); Assert.assertEquals(DEFAU...
public static FEEL_1_1Parser parse(FEELEventListenersManager eventsManager, String source, Map<String, Type> inputVariableTypes, Map<String, Object> inputVariables, Collection<FEELFunction> additionalFunctions, List<FEELProfile> profiles, FEELTypeRegistry typeRegistry) { CharStream input = CharStreams.fromStrin...
@Test void logicalNegation() { String inputExpression = "not ( true )"; BaseNode neg = parse( inputExpression ); assertThat( neg).isInstanceOf(FunctionInvocationNode.class); assertThat( neg.getResultType()).isEqualTo(BuiltInType.UNKNOWN); assertThat( neg.getText()).isEqualTo...
@Override public void applyFlowRules(FlowRule... flowRules) { checkPermission(FLOWRULE_WRITE); apply(buildFlowRuleOperations(true, null, flowRules)); }
@Test public void flowMetrics() { FlowRule f1 = flowRule(1, 1); FlowRule f2 = flowRule(2, 2); FlowRule f3 = flowRule(3, 3); mgr.applyFlowRules(f1, f2, f3); FlowEntry fe1 = new DefaultFlowEntry(f1); FlowEntry fe2 = new DefaultFlowEntry(f2); //FlowRule update...
public static boolean isSystemGroup(String group) { if (StringUtils.isBlank(group)) { return false; } String groupInLowerCase = group.toLowerCase(); for (String prefix : SYSTEM_GROUP_PREFIX_LIST) { if (groupInLowerCase.startsWith(prefix)) { return ...
@Test public void testIsSystemGroup_NullGroup_ReturnsFalse() { String group = null; boolean result = BrokerMetricsManager.isSystemGroup(group); assertThat(result).isFalse(); }
public void validate(ExternalIssueReport report, Path reportPath) { if (report.rules != null && report.issues != null) { Set<String> ruleIds = validateRules(report.rules, reportPath); validateIssuesCctFormat(report.issues, ruleIds, reportPath); } else if (report.rules == null && report.issues != nul...
@Test public void validate_whenDeprecatedReportMissingSeverity_shouldThrowException() throws IOException { ExternalIssueReport report = read(DEPRECATED_REPORTS_LOCATION); report.issues[0].severity = null; assertThatThrownBy(() -> validator.validate(report, reportPath)) .isInstanceOf(IllegalStateExc...
protected static String encrypt(String... args) throws Exception { int iterations = args.length == 2 ? Integer.parseInt(args[1]) : DEFAULT_ITERATIONS; EncryptionReplacer replacer = new EncryptionReplacer(); String xmlPath = System.getProperty("hazelcast.config"); Properties properties = ...
@Test public void testGenerateEncryptedLegacy() throws Exception { assumeAlgorithmsSupported("PBKDF2WithHmacSHA1", "DES"); String xml = "<hazelcast xmlns=\"http://www.hazelcast.com/schema/config\">\n" + XML_LEGACY_CONFIG + "</hazelcast>"; File configFile = createFileWithString(xml); ...
protected static boolean isMatchingMetricTags(Set<Tag> meterTags, Set<Tag> expectedTags) { if (!meterTags.containsAll(expectedTags)) { return false; } return expectedTags.stream().allMatch(tag -> isMatchingTag(meterTags, tag)); }
@Test void matchingMetricTagsReturnsTrue() { meterTags.add(Tag.of("key", "value")); Set<Tag> expectedTags = new HashSet<>(); expectedTags.add(Tag.of("key", "value")); assertTrue(MetricsUtils.isMatchingMetricTags(meterTags, expectedTags)); }
@Override public JobManagerRunner get(JobID jobId) { assertJobRegistered(jobId); return this.jobManagerRunners.get(jobId); }
@Test void testGet() { final JobID jobId = new JobID(); final JobManagerRunner jobManagerRunner = TestingJobManagerRunner.newBuilder().setJobId(jobId).build(); testInstance.register(jobManagerRunner); assertThat(testInstance.get(jobId)).isEqualTo(jobManagerRunner); ...
@Override public void onMsg(TbContext ctx, TbMsg msg) throws TbNodeException { ctx.tellNext(msg, checkMatches(msg) ? TbNodeConnectionType.TRUE : TbNodeConnectionType.FALSE); }
@Test void givenTypePolygonAndConfigWithoutPerimeterKeyName_whenOnMsg_thenExceptionMissingPerimeterDefinitionOldVersion() throws TbNodeException { // GIVEN var config = new TbGpsGeofencingFilterNodeConfiguration().defaultConfiguration(); config.setPerimeterKeyName(null); node.init(ct...
@Description("logarithm to base 10") @ScalarFunction @SqlType(StandardTypes.DOUBLE) public static double log10(@SqlType(StandardTypes.DOUBLE) double num) { return Math.log10(num); }
@Test public void testLog10() { for (double doubleValue : DOUBLE_VALUES) { assertFunction("log10(" + doubleValue + ")", DOUBLE, Math.log10(doubleValue)); } assertFunction("log10(NULL)", DOUBLE, null); }
public static Boolean judge(final ConditionData conditionData, final String realData) { if (Objects.isNull(conditionData) || StringUtils.isBlank(conditionData.getOperator())) { return false; } PredicateJudge predicateJudge = newInstance(conditionData.getOperator()); if (!(pre...
@Test public void testRegexJudge() { conditionData.setOperator(OperatorEnum.REGEX.getAlias()); conditionData.setParamValue("[/a-zA-Z0-9]+"); assertTrue(PredicateJudgeFactory.judge(conditionData, "/http/test")); assertFalse(PredicateJudgeFactory.judge(conditionData, "/http?/test")); ...
public Plan validateReservationUpdateRequest( ReservationSystem reservationSystem, ReservationUpdateRequest request) throws YarnException { ReservationId reservationId = request.getReservationId(); Plan plan = validateReservation(reservationSystem, reservationId, AuditConstants.UPDATE_RESERV...
@Test public void testUpdateReservationNoDefinition() { ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl(); request.setReservationId(ReservationSystemTestUtil.getNewReservationId()); Plan plan = null; try { plan = rrValidator.validateReservationUpdateRequest(rSystem, request...
static DbTypeParser getDbTypeParser() { if (dbTypeParser == null) { synchronized (JdbcUtils.class) { if (dbTypeParser == null) { dbTypeParser = EnhancedServiceLoader.load(DbTypeParser.class, SqlParserType.SQL_PARSER_TYPE_DRUID); } } ...
@Test public void testDbTypeParserLoading() { DbTypeParser dbTypeParser = JdbcUtils.getDbTypeParser(); Assertions.assertNotNull(dbTypeParser); }
public static boolean isAnonymousUser(final String customerId) { return customerId != null && customerId.toLowerCase(Locale.ROOT).equals( CONFLUENT_SUPPORT_CUSTOMER_ID_DEFAULT); }
@Test public void testInvalidAnonymousUser() { String[] invalidIds = Stream.concat( CustomerIdExamples.INVALID_ANONYMOUS_IDS.stream(), CustomerIdExamples.VALID_CUSTOMER_IDS.stream()). toArray(String[]::new); for (String invalidId : invalidIds) { assertFalse(invalidId + " is a val...
@Override public List<VFSFile> getFiles( VFSFile file, String filters, VariableSpace space ) throws FileException { ConnectionFileName fileName = getConnectionFileName( file ); if ( fileName.isConnectionRoot() ) { VFSConnectionDetails details = getExistingDetails( fileName ); if ( usesBuckets( d...
@Test( expected = FileException.class ) public void testGetFilesOfConnectionUsingBucketsThrowsIfEmptyBuckets() throws Exception { GetFilesOfConnectionUsingBucketsScenario scenario = new GetFilesOfConnectionUsingBucketsScenario(); mockDetailsProviderLocations( scenario.details1, scenario.provider ); vfsFi...
@Override public void onDataReceived(@NonNull final BluetoothDevice device, @NonNull final Data data) { super.onDataReceived(device, data); if (data.size() < 3) { onInvalidDataReceived(device, data); return; } final int opCode = data.getIntValue(Data.FORMAT_UINT8, 0); if (opCode != OP_CODE_NUMBER_OF_...
@Test public void onRecordAccessOperationError_abortUnsuccessful() { final Data data = new Data(new byte[] { 6, 0, 3, 7 }); callback.onDataReceived(null, data); assertEquals(7, error); }
public void encryptColumns( String inputFile, String outputFile, List<String> paths, FileEncryptionProperties fileEncryptionProperties) throws IOException { Path inPath = new Path(inputFile); Path outPath = new Path(outputFile); RewriteOptions options = new RewriteOptions.Builder(conf, inPath, o...
@Test public void testNoEncryption() throws IOException { String[] encryptColumns = {}; testSetup("GZIP"); columnEncryptor.encryptColumns( inputFile.getFileName(), outputFile, Arrays.asList(encryptColumns), EncDecProperties.getFileEncryptionProperties(encryptColumns, Parque...
@Override public Optional<IdentifierValue> getAlias() { return Optional.empty(); }
@Test void assertGetAliasWhenAbsent() { assertFalse(new ShorthandProjection(new IdentifierValue("owner"), Collections.emptyList()).getAlias().isPresent()); }
void handleStatement(final QueuedCommand queuedCommand) { throwIfNotConfigured(); handleStatementWithTerminatedQueries( queuedCommand.getAndDeserializeCommand(commandDeserializer), queuedCommand.getAndDeserializeCommandId(), queuedCommand.getStatus(), Mode.EXECUTE, queue...
@Test @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_INFERRED") public void shouldExecutePlannedCommandWithMergedConfig() { // Given: final Map<String, String> savedConfigs = ImmutableMap.of("biz", "baz"); plannedCommand = new Command( CREATE_STREAM_FOO_STATEMENT, emptyMap(), saved...
T getFunction(final List<SqlArgument> arguments) { // first try to get the candidates without any implicit casting Optional<T> candidate = findMatchingCandidate(arguments, false); if (candidate.isPresent()) { return candidate.get(); } else if (!supportsImplicitCasts) { throw createNoMatchin...
@Test public void shouldNotMatchVarargDifferentStructs() { // Given: givenFunctions( function(OTHER, 0, ArrayType.of(STRUCT1)) ); // When: final Exception e = assertThrows( KsqlException.class, () -> udfIndex.getFunction(ImmutableList.of(SqlArgument.of(STRUCT1_ARG), SqlArg...
public FEELFnResult<Boolean> invoke(@ParameterName( "list" ) List list) { if ( list == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "list", "cannot be null")); } boolean result = true; boolean containsNull = false; // Spec. definitio...
@Test void invokeArrayParamEmptyArray() { FunctionTestUtil.assertResult(allFunction.invoke(new Object[]{}), true); }
@Override public String getSchema() { return dialectDatabaseMetaData.getSchema(connection); }
@Test void assertGetSchema() throws SQLException { when(connection.getSchema()).thenReturn(TEST_SCHEMA); MetaDataLoaderConnection connection = new MetaDataLoaderConnection(databaseType, this.connection); assertThat(connection.getSchema(), is(TEST_SCHEMA)); }
public static Regression<double[]> fit(double[][] x, double[] y, double eps, double C, double tol) { smile.base.svm.SVR<double[]> svr = new smile.base.svm.SVR<>(new LinearKernel(), eps, C, tol); KernelMachine<double[]> svm = svr.fit(x, y); return new Regression<>() { final LinearKer...
@Test public void tesDiabetes() { System.out.println("Diabetes"); MathEx.setSeed(19650218); // to get repeatable results. GaussianKernel kernel = new GaussianKernel(5.0); RegressionValidations<Regression<double[]>> result = CrossValidation.regression(10, Diabetes.x, Diabetes.y, ...
public Method getMethod() { return method; }
@Test public void testGetMethod() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { MethodDesc methodDesc = getMethodDesc(); assertThat(methodDesc.getMethod()).isEqualTo(method); }
@Override protected TableRecords getUndoRows() { return sqlUndoLog.getBeforeImage(); }
@Test public void getUndoRows() { Assertions.assertEquals(executor.getUndoRows(), executor.getSqlUndoLog().getBeforeImage()); }
public static String unescape(String escaped) { boolean escaping = false; StringBuilder newString = new StringBuilder(); for (char c : escaped.toCharArray()) { if (!escaping) { if (c == ESCAPE_CHAR) { escaping = true; } else { newString.append(c); } } else { if (c == 'n') { n...
@Test public void testWithEscape() { assertEquals("Hello\\World!", StringUtil.unescape("Hello\\\\World!")); assertEquals("Hello \\\\World!", StringUtil.unescape("Hello \\\\\\\\World!")); }
public boolean contains(short version) { return version >= min && version <= max; }
@Test public void testContains() { assertTrue(v(1, 1).contains((short) 1)); assertFalse(v(1, 1).contains((short) 2)); assertTrue(v(1, 2).contains((short) 1)); assertFalse(v(4, 10).contains((short) 3)); assertTrue(v(2, 12).contains((short) 11)); }
public AvailableServiceResponse getAvailableServices() { AWSPolicy awsPolicy = buildAwsSetupPolicy(); ArrayList<AvailableService> services = new ArrayList<>(); String policy; try { policy = objectMapper.writeValueAsString(awsPolicy); } catch (JsonProcessingException...
@Test public void testAvailableServices() { AvailableServiceResponse services = awsService.getAvailableServices(); // There should be one service. assertEquals(1, services.total()); assertEquals(1, services.services().size()); // CloudWatch should be in the list of availab...
public StepInstanceRestartResponse toStepRestartResponse() { return StepInstanceRestartResponse.builder() .workflowId(this.workflowId) .workflowVersionId(this.workflowVersionId) .workflowInstanceId(this.workflowInstanceId) .workflowRunId(this.workflowRunId) .stepId(this.stepI...
@Test public void testToStepRestartResponse() { RunResponse res = RunResponse.from(stepInstance, TimelineLogEvent.info("bar")); StepInstanceRestartResponse response = res.toStepRestartResponse(); Assert.assertEquals(InstanceRunStatus.CREATED, response.getStatus()); res = RunResponse.from(instance, "fo...
public LoggerContext configure() { LoggerContext ctx = helper.getRootContext(); ctx.reset(); helper.enableJulChangePropagation(ctx); configureConsole(ctx); configureWithLogbackWritingToFile(ctx); helper.apply( LogLevelConfig.newBuilder(helper.getRootLoggerName()) .rootLevelFor(P...
@Test public void gobbler_logger_writes_to_console_without_formatting_when_running_from_command_line() { emulateRunFromCommandLine(false); LoggerContext ctx = underTest.configure(); Logger gobblerLogger = ctx.getLogger(LOGGER_GOBBLER); verifyGobblerConsoleAppender(gobblerLogger); assertThat(gobb...
public static <InputT> ByBuilder<InputT> of(PCollection<InputT> input) { return named(null).of(input); }
@Test public void testBuild_implicitName() { final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings()); final PCollection<String> filtered = Filter.of(dataset).by(s -> !s.equals("")).output(); final Filter filter = (Filter) TestUtils.getProducer(filtered); assertFalse(...
@Udf public <T extends Comparable<? super T>> T arrayMin(@UdfParameter( description = "Array of values from which to find the minimum") final List<T> input) { if (input == null) { return null; } T candidate = null; for (T thisVal : input) { if (thisVal != null) { if (candida...
@Test public void shouldReturnValueForMixedInput() { final List<String> input = Arrays.asList(null, "foo", null, "bar", null); assertThat(udf.arrayMin(input), is("bar")); }
@Override public ExecuteContext after(ExecuteContext context) { ThreadLocalUtils.removeRequestTag(); return context; }
@Test public void testAfter() { ThreadLocalUtils.addRequestTag(Collections.singletonMap("bar", Collections.singletonList("foo"))); Assert.assertNotNull(ThreadLocalUtils.getRequestTag()); // Test the after method to verify if thread variables are released interceptor.after(context); ...
public void run(OutputReceiver<PartitionRecord> receiver, Instant startTime) { List<ByteStringRange> streamPartitions = changeStreamDao.generateInitialChangeStreamPartitions(); for (ByteStringRange partition : streamPartitions) { metrics.incListPartitionsCount(); String uid = UniqueIdGenerat...
@Test public void testGenerateInitialPartitionsFromStartTime() { Range.ByteStringRange partition1 = Range.ByteStringRange.create("", "b"); Range.ByteStringRange partition2 = Range.ByteStringRange.create("b", ""); List<Range.ByteStringRange> partitionRecordList = Arrays.asList(partition1, partition2); ...
@Override public void setLoadedCoreExtensions(Set<CoreExtension> coreExtensions) { checkState(this.coreExtensions == null, "Repository has already been initialized"); this.coreExtensions = ImmutableSet.copyOf(coreExtensions); this.installedCoreExtensions = new HashSet<>(coreExtensions.size()); }
@Test public void setLoadedCoreExtensions_fails_with_NPE_if_argument_is_null() { assertThatThrownBy(() -> underTest.setLoadedCoreExtensions(null)) .isInstanceOf(NullPointerException.class); }
@Override public int run(String[] args) throws Exception { try { webServiceClient = WebServiceClient.getWebServiceClient().createClient(); return runCommand(args); } finally { if (yarnClient != null) { yarnClient.close(); } if (webServiceClient != null) { webServi...
@Test (timeout = 5000) public void testWithFileInputForOptionOut() throws Exception { String localDir = "target/SaveLogs"; Path localPath = new Path(localDir); FileSystem fs = FileSystem.get(conf); ApplicationId appId1 = ApplicationId.newInstance(0, 1); LogsCLI cli = createCli(); // Specify a...
@Override public Output load(String streamOutputId) throws NotFoundException { final Output output = coll.findOneById(streamOutputId); if (output == null) { throw new NotFoundException("Couldn't find output with id " + streamOutputId); } return output; }
@Test @MongoDBFixtures("OutputServiceImplTest.json") public void loadReturnsExistingOutput() throws NotFoundException { final Output output = outputService.load("54e3deadbeefdeadbeef0001"); assertThat(output.getId()).isEqualTo("54e3deadbeefdeadbeef0001"); }
@Override public void setTimestamp(final Path file, final TransferStatus status) throws BackgroundException { if(file.isVolume()) { log.warn(String.format("Skip setting timestamp for %s", file)); return; } try { if(null != status.getModified()) { ...
@Test public void testSetTimestampDirectory() throws Exception { final DriveFileIdProvider fileid = new DriveFileIdProvider(session); final Path home = DriveHomeFinderService.MYDRIVE_FOLDER; final Path test = new DriveDirectoryFeature(session, fileid).mkdir( new Path(home, ne...
@Override public boolean needToLoad(FilterInvoker invoker) { AbstractInterfaceConfig<?, ?> config = invoker.getConfig(); String enabled = config.getParameter(SentinelConstants.SOFA_RPC_SENTINEL_ENABLED); if (StringUtils.isNotBlank(enabled)) { return Boolean.parseBoolean(enabled)...
@Test public void testNeedToLoadProviderAndConsumer() { SentinelSofaRpcProviderFilter providerFilter = new SentinelSofaRpcProviderFilter(); ProviderConfig providerConfig = new ProviderConfig(); providerConfig.setInterfaceId(Serializer.class.getName()); providerConfig.setId("AAA"); ...
@Override public void publish(ScannerReportWriter writer) { for (final DefaultInputFile inputFile : componentCache.allChangedFilesToPublish()) { File iofile = writer.getSourceFile(inputFile.scannerId()); try (OutputStream output = new BufferedOutputStream(new FileOutputStream(iofile)); InputS...
@Test public void publishSourceWithLastEmptyLine() throws Exception { FileUtils.write(sourceFile, "1\n2\n3\n4\n", StandardCharsets.ISO_8859_1); publisher.publish(writer); File out = writer.getSourceFile(inputFile.scannerId()); assertThat(FileUtils.readFileToString(out, StandardCharsets.UTF_8)).isEqu...
public static List<PMMLModel> getPMMLModels(PMMLRuntimeContext pmmlContext) { logger.debug("getPMMLModels {}", pmmlContext); Collection<GeneratedExecutableResource> finalResources = getAllGeneratedExecutableResources(pmmlContext.getGeneratedResourcesMap().get(PMML_STRING)); logge...
@Test void getPMMLModels() { List<PMMLModel> retrieved = PMMLRuntimeHelper.getPMMLModels(getPMMLContext(FILE_NAME, MODEL_NAME, memoryCompilerClassLoader)); assertThat(retrieved).isNotNull().hasSize(1); // defined in I...
public static String[] getAddresses(String netAddress, String partialAddress) { String[] parAddStrArray = StringUtils.split(partialAddress.substring(1, partialAddress.length() - 1), ","); String address = netAddress.substring(0, netAddress.indexOf("{")); String[] addressStrArray = new String[par...
@Test public void testGetAddresses() { String address = "1.1.1.{1,2,3,4}"; String[] addressArray = AclUtils.getAddresses(address, "{1,2,3,4}"); List<String> newAddressList = new ArrayList<>(Arrays.asList(addressArray)); List<String> addressList = new ArrayList<>(); addressLi...
public static String getCertFingerPrint(Certificate cert) { byte [] digest = null; try { byte[] encCertInfo = cert.getEncoded(); MessageDigest md = MessageDigest.getInstance("SHA-1"); digest = md.digest(encCertInfo); } catch (Exception e) { logger...
@Test public void testGetCertFingerPrintCarol() throws Exception { X509Certificate cert = null; try (InputStream is = Config.getInstance().getInputStreamFromFile("carol.crt")){ CertificateFactory cf = CertificateFactory.getInstance("X.509"); cert = (X509Certificate) cf.genera...
public static OffsetBasedPagination forStartRowNumber(int startRowNumber, int pageSize) { checkArgument(startRowNumber >= 1, "startRowNumber must be >= 1"); checkArgument(pageSize >= 1, "page size must be >= 1"); return new OffsetBasedPagination(startRowNumber - 1, pageSize); }
@Test void equals_whenDifferentClasses_shouldBeFalse() { Assertions.assertThat(OffsetBasedPagination.forStartRowNumber(15, 20)).isNotEqualTo("not an OffsetBasedPagination object"); }
public static long findAndVerifyWindowGrace(final GraphNode graphNode) { return findAndVerifyWindowGrace(graphNode, ""); }
@Test public void shouldExtractGraceFromSessionAncestorThroughStatelessParent() { final SessionWindows windows = SessionWindows.ofInactivityGapAndGrace(ofMillis(10L), ofMillis(1234L)); final StatefulProcessorNode<String, Long> graceGrandparent = new StatefulProcessorNode<>( "asdf", ...
@Override public int hashCode() { return Objects.hash(taskId, topicPartitions); }
@Test public void shouldBeEqualsIfSameObject() { final TaskMetadataImpl same = new TaskMetadataImpl( TASK_ID, TOPIC_PARTITIONS, COMMITTED_OFFSETS, END_OFFSETS, TIME_CURRENT_IDLING_STARTED); assertThat(taskMetadata, equalTo(same)); a...
public void connect(ServerRoutingInstance serverRoutingInstance) throws InterruptedException, TimeoutException { _serverToChannelMap.computeIfAbsent(serverRoutingInstance, ServerChannel::new).connect(); }
@Test(dataProvider = "parameters") public void testConnect(boolean nativeTransportEnabled) throws Exception { BrokerMetrics brokerMetrics = mock(BrokerMetrics.class); NettyConfig nettyConfig = new NettyConfig(); nettyConfig.setNativeTransportsEnabled(nativeTransportEnabled); QueryRouter queryRou...
@Override public boolean isInputConsumable( SchedulingExecutionVertex executionVertex, Set<ExecutionVertexID> verticesToDeploy, Map<ConsumedPartitionGroup, Boolean> consumableStatusCache) { for (ConsumedPartitionGroup consumedPartitionGroup : executionVert...
@Test void testAllFinishedHybridInput() { final TestingSchedulingTopology topology = new TestingSchedulingTopology(); final List<TestingSchedulingExecutionVertex> producers = topology.addExecutionVertices().withParallelism(2).finish(); final List<TestingSchedulingExecutionV...
@Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { final int response = session.getClient().stat(directory.getAbsolute()); if(FTPReply.isPositiveCompletion(response)) { return reader...
@Test public void testList() throws Exception { final ListService service = new FTPStatListService(session, new CompositeFileEntryParser(Collections.singletonList(new UnixFTPEntryParser()))); final Path directory = new FTPWorkdirService(session).find(); final Path file = new Path...
@Override public ConsumerBuilder<T> topics(List<String> topicNames) { checkArgument(topicNames != null && !topicNames.isEmpty(), "Passed in topicNames list should not be null or empty."); topicNames.stream().forEach(topicName -> checkArgument(StringUtils.isNotBlank(to...
@Test(expectedExceptions = IllegalArgumentException.class) public void testConsumerBuilderImplWhenTopicNamesHasBlankTopic() { List<String> topicNames = Arrays.asList("my-topic", " "); consumerBuilderImpl.topics(topicNames); }
@Override public void login(final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { final Credentials credentials = authorizationService.validate(); try { final StringBuilder url = new StringBuilder(); url.append(host.getProtocol().getScheme().to...
@Test public void testLogin() throws Exception { assertNotEquals(StringUtils.EMPTY, session.getHost().getCredentials().getUsername()); }
List<Token> tokenize() throws ScanException { List<Token> tokenList = new ArrayList<Token>(); StringBuffer buf = new StringBuffer(); while (pointer < patternLength) { char c = pattern.charAt(pointer); pointer++; switch (state) { case LITERAL_STATE: handleLiteralState(c,...
@Test public void testMultipleRecursion() throws ScanException { List<Token> tl = new TokenStream("%-1(%d %45(%class %file))").tokenize(); List<Token> witness = new ArrayList<Token>(); witness.add(Token.PERCENT_TOKEN); witness.add(new Token(Token.FORMAT_MODIFIER, "-1")); witness.add(Token.BARE_COM...
public static String extractCharset(String line, String defaultValue) { if (line == null) { return defaultValue; } final String[] parts = line.split(" "); String charsetInfo = ""; for (var part : parts) { if (part.startsWith("charset")) { ...
@DisplayName("with the charset information in the middle") @Test void testExtractCharsetInTheMiddle() { assertEquals("UTF-8", TelegramAsyncHandler.extractCharset("Content-Type: text/plain; name=\"some-name\"; charset=UTF-8", StandardCharsets.US_ASCII.name())); }
public static TypeDescription convert(Schema schema) { final TypeDescription root = TypeDescription.createStruct(); final Types.StructType schemaRoot = schema.asStruct(); for (Types.NestedField field : schemaRoot.asStructType().fields()) { TypeDescription orcColumnType = convert(field.fieldId(), field...
@Test public void testRoundtripConversionNested() { Types.StructType leafStructType = Types.StructType.of( optional(6, "leafLongCol", Types.LongType.get()), optional(7, "leafBinaryCol", Types.BinaryType.get())); Types.StructType nestedStructType = Types.StructType.of( ...
@Nonnull @Override public ResultIterator<SqlRow> iterator() { if (iterator == null) { iterator = new RowToSqlRowIterator(rootResultConsumer.iterator()); return iterator; } else { throw new IllegalStateException("Iterator can be requested only once."); } ...
@Test public void when_hasNextInterrupted_then_interrupted() { // this query is a continuous one, but never returns any rows (all are filtered out) SqlResult sqlResult = instance().getSql().execute("select * from table(generate_stream(1)) where v < 0"); AtomicBoolean interruptedOk = new Atom...
@Override public List<String> getAllProjectPermissions() { return projectPermissions; }
@Test public void projectPermissions_must_be_ordered() { assertThat(underTest.getAllProjectPermissions()) .containsExactly("admin", "codeviewer", "issueadmin", "securityhotspotadmin", "scan", "user"); }
public Object valueFrom(Struct struct) { return valueFrom(struct, true); }
@Test void shouldReturnNullValueWhenFieldNotFoundInMap() { Map<String, Object> foo = new HashMap<>(); foo.put("bar", 42); foo.put("baz", null); Map<String, Object> map = new HashMap<>(); map.put("foo", foo); assertNull(pathV2("un.known").valueFrom(map)); assertNu...
@Override public Integer call() throws Exception { super.call(); EnvironmentEndpoint endpoint = applicationContext.getBean(EnvironmentEndpoint.class); stdOut(JacksonMapper.ofYaml().writeValueAsString(endpoint.getEnvironmentInfo())); return 0; }
@Test void run() { ByteArrayOutputStream out = new ByteArrayOutputStream(); System.setOut(new PrintStream(out)); try (ApplicationContext ctx = ApplicationContext.run(Environment.CLI, Environment.TEST)) { PicocliRunner.call(ConfigPropertiesCommand.class, ctx); assert...
static double evaluateAugmentedNormalizedTermFrequency(int calculatedLevenshteinDistance, List<String> texts) { Map<String, Long> wordFrequencies = texts.stream().collect(Collectors.groupingBy(Function.identity(), counting())); int maxFrequency = wordFrequencies.values().stream() ...
@Test void evaluateAugmentedNormalizedTermFrequency() { Map<Integer, String> source = new HashMap<>(); int maxFrequency = 23; source.put(maxFrequency, "aword"); source.put(19, "anotherword"); source.put(5, "adifferentword"); source.put(3, "lastword"); List<Str...
@Override public boolean replace(long key, long oldValue, long newValue) { assert oldValue != nullValue : "replace() called with null-sentinel oldValue " + nullValue; assert newValue != nullValue : "replace() called with null-sentinel newValue " + nullValue; final long valueAddr = hsa.get(key); ...
@Test public void testReplace() throws Exception { long key = newKey(); long value = newValue(); assertEqualsKV(MISSING_VALUE, map.replace(key, value), key, value); map.put(key, value); long newValue = newValue(); assertEqualsKV(value, map.replace(key, newValue), k...
public void createBackupLog(UUID callerUuid, UUID txnId) { createBackupLog(callerUuid, txnId, false); }
@Test public void createBackupLog_whenNotCreated() { UUID callerUuid = UuidUtil.newUnsecureUUID(); txService.createBackupLog(callerUuid, TXN); assertTxLogState(TXN, ACTIVE); }
@Override public String toString() { return String.format("NormalKey(id:%d createTime:%d)", id, createTime); }
@Test public void testToString() { String expected = String.format("NormalKey(id:%d createTime:%d)", normalKey.getId(), normalKey.getCreateTime()); assertEquals(expected, normalKey.toString()); }
public static int max(int a, int b, int c) { return Math.max(Math.max(a, b), c); }
@Test public void testMax_3args() { System.out.println("max"); int a = -1; int b = 0; int c = 1; int expResult = 1; int result = MathEx.max(a, b, c); assertEquals(expResult, result); }
static void validateCsvFormat(CSVFormat format) { String[] header = checkArgumentNotNull(format.getHeader(), "Illegal %s: header is required", CSVFormat.class); checkArgument(header.length > 0, "Illegal %s: header cannot be empty", CSVFormat.class); checkArgument( !format.getAllowMissingCo...
@Test public void givenCSVFormatWithNullHeader_throwsException() { CSVFormat format = csvFormat(); String gotMessage = assertThrows( IllegalArgumentException.class, () -> CsvIOParseHelpers.validateCsvFormat(format)) .getMessage(); assertEquals("Illegal class org.apache....
@Override public Set<IndexSet> getAll() { return ImmutableSet.copyOf(findAllMongoIndexSets()); }
@Test public void getAllShouldBeCachedForNonEmptyList() { final IndexSetConfig indexSetConfig = mock(IndexSetConfig.class); final List<IndexSetConfig> indexSetConfigs = Collections.singletonList(indexSetConfig); final MongoIndexSet indexSet = mock(MongoIndexSet.class); when(mongoInde...
static String headerLine(CSVFormat csvFormat) { return String.join(String.valueOf(csvFormat.getDelimiter()), csvFormat.getHeader()); }
@Test public void givenCustomRecordSeparator_isNoop() { CSVFormat csvFormat = csvFormat().withRecordSeparator("😆"); PCollection<String> input = pipeline.apply(Create.of(headerLine(csvFormat), "a,1,1.1😆b,2,2.2😆c,3,3.3")); CsvIOStringToCsvRecord underTest = new CsvIOStringToCsvRecord(csvFormat);...
public static <RestrictionT, PositionT> RestrictionTracker<RestrictionT, PositionT> observe( RestrictionTracker<RestrictionT, PositionT> restrictionTracker, ClaimObserver<PositionT> claimObserver) { if (restrictionTracker instanceof RestrictionTracker.HasProgress) { return new RestrictionTrackerOb...
@Test public void testObservingClaims() { RestrictionTracker<String, String> observedTracker = new RestrictionTracker() { @Override public boolean tryClaim(Object position) { return "goodClaim".equals(position); } @Override public Object curr...
public static int digitCount(final int value) { return (int)((value + INT_DIGITS[31 - Integer.numberOfLeadingZeros(value | 1)]) >> 32); }
@Test void digitCountLongValue() { for (int i = 0; i < LONG_MAX_DIGITS; i++) { final long min = 0 == i ? 0 : LONG_POW_10[i]; final long max = LONG_MAX_DIGITS - 1 == i ? Long.MAX_VALUE : LONG_POW_10[i + 1] - 1; final int expectedDigitCount = i + 1; ...
@Override public void monitor(RedisServer master) { connection.sync(RedisCommands.SENTINEL_MONITOR, master.getName(), master.getHost(), master.getPort().intValue(), master.getQuorum().intValue()); }
@Test public void testMonitor() { Collection<RedisServer> masters = connection.masters(); RedisServer master = masters.iterator().next(); master.setName(master.getName() + ":"); connection.monitor(master); }
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; DBSessions dbSes...
@Test public void doFilter_unloads_Settings_even_if_UserSessionInitializer_removeUserSession_fails() throws Exception { RuntimeException thrown = mockUserSessionInitializerRemoveUserSessionFailing(); try { underTest.doFilter(request, response, chain); fail("A RuntimeException should have been thr...
@Override public long nextBackOffMillis() { // Make sure we have not gone over the maximum elapsed time. if (getElapsedTimeMillis() > maxElapsedTimeMillis) { return maxElapsedTimeMillis; } int randomizedInterval = getRandomValueFromInterval(randomizationFa...
@Test public void testBackOff() { int testInitialInterval = 500; double testRandomizationFactor = 0.1; double testMultiplier = 2.0; int testMaxInterval = 5000; int testMaxElapsedTime = 900000; ExponentialBackOff backOffPolicy = new ExponentialBackOff....
@Override @Transactional(rollbackFor = Exception.class) @LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_CREATE_SUB_TYPE, bizNo = "{{#user.id}}", success = SYSTEM_USER_CREATE_SUCCESS) public Long createUser(UserSaveReqVO createReqVO) { // 1.1 校验账户配合 tenantService.handleT...
@Test public void testCreatUser_max() { // 准备参数 UserSaveReqVO reqVO = randomPojo(UserSaveReqVO.class); // mock 账户额度不足 TenantDO tenant = randomPojo(TenantDO.class, o -> o.setAccountCount(-1)); doNothing().when(tenantService).handleTenantInfo(argThat(handler -> { ha...
@Override public NodeLabelsInfo getLabelsOnNode(HttpServletRequest hsr, String nodeId) throws IOException { try { long startTime = clock.getTime(); Collection<SubClusterInfo> subClustersActive = federationFacade.getActiveSubClusters(); final HttpServletRequest hsrCopy = clone(hsr); C...
@Test public void testGetLabelsOnNode() throws Exception { NodeLabelsInfo nodeLabelsInfo = interceptor.getLabelsOnNode(null, "node1"); Assert.assertNotNull(nodeLabelsInfo); Assert.assertEquals(2, nodeLabelsInfo.getNodeLabelsName().size()); List<String> nodeLabelsName = nodeLabelsInfo.getNodeLabelsNam...
@Override public Consumer<Packet> get() { return responseHandler; }
@Test public void get_whenResponseThreads() { supplier = newSupplier(1); assertInstanceOf(AsyncSingleThreadedResponseHandler.class, supplier.get()); }
@Override protected Set<StepField> getUsedFields( final JsonInputMeta meta ) { Set<StepField> usedFields = new HashSet<>(); if ( meta.isAcceptingFilenames() && StringUtils.isNotEmpty( meta.getAcceptingField() ) ) { final Set<String> inpusStepNames = getInputStepNames( meta, meta.getAcceptingField() ); ...
@Test public void testGetUsedFields_isNotAcceptingFilenames() throws Exception { when( meta.isAcceptingFilenames() ).thenReturn( false ); Set<StepField> usedFields = analyzer.getUsedFields( meta ); assertNotNull( usedFields ); assertEquals( 0, usedFields.size() ); }
public static String[] splitOnSpace(String s) { return PATTERN_SPACE.split(s); }
@Test void testSplitOnSpace_happyPath() { String[] result = StringUtil.splitOnSpace("a b c"); assertArrayEquals(new String[] {"a", "b", "c"}, result); }
public String generatePushDownFilter(List<String> writtenPartitions, List<FieldSchema> partitionFields, HiveSyncConfig config) { PartitionValueExtractor partitionValueExtractor = ReflectionUtils .loadClass(config.getStringOrDefault(META_SYNC_PARTITION_EXTRACTOR_CLASS)); List<Partition> partitions = wr...
@Test public void testPushDownFilters() { Properties props = new Properties(); HiveSyncConfig config = new HiveSyncConfig(props); List<FieldSchema> partitionFieldSchemas = new ArrayList<>(4); partitionFieldSchemas.add(new FieldSchema("date", "date")); partitionFieldSchemas.add(new FieldSchema("yea...
@Udf public <T extends Comparable<? super T>> T arrayMin(@UdfParameter( description = "Array of values from which to find the minimum") final List<T> input) { if (input == null) { return null; } T candidate = null; for (T thisVal : input) { if (thisVal != null) { if (candida...
@Test public void shouldFindBigIntMin() { final List<Long> input = Arrays.asList(1L, 3L, -2L); assertThat(udf.arrayMin(input), is(Long.valueOf(-2))); }
@ShellMethod(key = "show rollback", value = "Show details of a rollback instant") public String showRollback( @ShellOption(value = {"--instant"}, help = "Rollback instant") String rollbackInstant, @ShellOption(value = {"--limit"}, help = "Limit #rows to be displayed", defaultValue = "10") Integer limit, ...
@Test public void testShowRollback() throws IOException { // get instant HoodieActiveTimeline activeTimeline = HoodieCLI.getTableMetaClient().getActiveTimeline(); Stream<HoodieInstant> rollback = activeTimeline.getRollbackTimeline().filterCompletedInstants().getInstantsAsStream(); HoodieInstant instan...
@Override public List<String> listTableNames(String dbName) { try { return new ArrayList<>(tableNameCache.get(dbName)); } catch (ExecutionException e) { LOG.error("listTableNames error", e); return Collections.emptyList(); } }
@Test public void testListTableNames() { List<String> project = odpsMetadata.listTableNames("project"); Assert.assertEquals(Collections.singletonList("tableName"), project); }
public static void downloadFromHttpUrl(String destPkgUrl, File targetFile) throws IOException { final URL url = new URL(destPkgUrl); final URLConnection connection = url.openConnection(); if (StringUtils.isNotEmpty(url.getUserInfo())) { final AuthenticationDataBasic authBasic = new A...
@Test public void testDownloadFile() throws Exception { final String jarHttpUrl = "https://repo1.maven.org/maven2/org/apache/pulsar/pulsar-common/2.4.2/pulsar-common-2.4.2.jar"; final File file = Files.newTemporaryFile(); file.deleteOnExit(); assertThat(file.length()).isZero(); ...
@VisibleForTesting @SuppressWarnings("nullness") // ok to have nullable elements on stream static String renderName(String prefix, MetricResult<?> metricResult) { MetricKey key = metricResult.getKey(); MetricName name = key.metricName(); String step = key.stepName(); return Streams.concat( ...
@Test public void testRenderName() { MetricResult<Object> metricResult = MetricResult.create( MetricKey.create( "myStep.one.two(three)", MetricName.named("myNameSpace//", "myName()")), 123, 456); String renderedName = SparkBeamMetric.renderName("", m...
public Schema mergeTables( Map<FeatureOption, MergingStrategy> mergingStrategies, Schema sourceSchema, List<SqlNode> derivedColumns, List<SqlWatermark> derivedWatermarkSpecs, SqlTableConstraint derivedPrimaryKey) { SchemaBuilder schemaBuilder = ...
@Test void mergeWithIncludeFailsOnDuplicateRegularColumnAndComputeColumn() { Schema sourceSchema = Schema.newBuilder().column("one", DataTypes.INT()).build(); List<SqlNode> derivedColumns = Arrays.asList( regularColumn("two", DataTypes.INT()), ...
public void migrate(Connection connection) throws SQLException { try { log.info("Upgrading database, this might take a while depending on the size of the database."); List<String> messages = List.of( repeat("*", "", 72), "WARNING: Shutting down yo...
@Test public void shouldRunMigrationOnRequestedConnection() throws Exception { try (MockedStatic<DataMigrationRunner> migration = mockStatic(DataMigrationRunner.class); Connection connection = dummyH2Connection()) { migrator.migrate(connection); verify(liquibase).update(); ...
@Override public Node upload(final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final ThreadPool pool = ThreadPoolFactory.get("multipart", con...
@Test public void testUploadMultipleParts() throws Exception { final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session); final SDSDirectS3UploadFeature feature = new SDSDirectS3UploadFeature(session, nodeid, new SDSDelegatingWriteFeature(session, nodeid, new SDSDirectS3WriteFeature(session, n...
@SuppressWarnings({"BooleanExpressionComplexity", "CyclomaticComplexity"}) public static boolean isScalablePushQuery( final Statement statement, final KsqlExecutionContext ksqlEngine, final KsqlConfig ksqlConfig, final Map<String, Object> overrides ) { if (!isPushV2Enabled(ksqlConfig, ov...
@Test public void isScalablePushQuery_true_configLatest() { try(MockedStatic<ColumnExtractor> columnExtractor = mockStatic(ColumnExtractor.class)) { // When: expectIsSPQ(ColumnName.of("foo"), columnExtractor); when(ksqlConfig.getKsqlStreamConfigProp(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG)) ...
@Override public final Object getValue(final int columnIndex, final Class<?> type) throws SQLException { ShardingSpherePreconditions.checkNotContains(INVALID_MEMORY_TYPES, type, () -> new SQLFeatureNotSupportedException(String.format("Get value from `%s`", type.getName()))); Object result = currentR...
@Test void assertGetValue() throws SQLException { when(memoryResultSetRow.getCell(1)).thenReturn("1"); assertThat(memoryMergedResult.getValue(1, Object.class).toString(), is("1")); }
@Override public Query normalizeQuery(final Query query, final ParameterProvider parameterProvider) { return query.toBuilder() .query(ElasticsearchQueryString.of(this.queryStringDecorators.decorate(query.query().queryString(), parameterProvider, query))) .filter(normalizeFilt...
@Test void decoratesSearchTypes() { final Query query = Query.builder() .searchTypes( Collections.singleton(MessageList.builder() .query(ElasticsearchQueryString.of("action:index")) .build()) ...
@Udf(description = "Returns first substring of the input that matches the given regex pattern") public String regexpExtract( @UdfParameter(description = "The regex pattern") final String pattern, @UdfParameter(description = "The input string to apply regex on") final String input ) { return regexpEx...
@Test public void shouldReturnNullOnNullValue() { assertNull(udf.regexpExtract(null, null)); assertNull(udf.regexpExtract(null, null, null)); assertNull(udf.regexpExtract(null, "", 1)); assertNull(udf.regexpExtract("some string", null, 1)); assertNull(udf.regexpExtract("some string", "", null)); ...
@Override public synchronized boolean tryReturnRecordAt( boolean isAtSplitPoint, @Nullable ShufflePosition groupStart) { if (lastGroupStart == null && !isAtSplitPoint) { throw new IllegalStateException( String.format("The first group [at %s] must be at a split point", groupStart.toString()))...
@Test public void testNonSplitPointRecordWithDifferentPosition() throws Exception { GroupingShuffleRangeTracker tracker = new GroupingShuffleRangeTracker(ofBytes(3, 0, 0), ofBytes(5, 0, 0)); tracker.tryReturnRecordAt(true, ofBytes(3, 4, 5)); expected.expect(IllegalStateException.class); tracke...
@Config("session-property-manager.config-file") public FileSessionPropertyManagerConfig setConfigFile(File configFile) { this.configFile = configFile; return this; }
@Test public void testDefaults() { assertRecordedDefaults(recordDefaults(FileSessionPropertyManagerConfig.class) .setConfigFile(null)); }
@Override public void accept(Props props) { if (isClusterEnabled(props)) { checkClusterProperties(props); } }
@Test @UseDataProvider("validIPv4andIPv6Addresses") public void accept_does_not_verify_h2_on_search_node(String host) { mockValidHost(host); mockLocalNonLoopback(host); TestAppSettings settings = newSettingsForSearchNode(host, of("sonar.jdbc.url", "jdbc:h2:mem")); // do not fail new ClusterSett...
public static GenericData get() { return INSTANCE; }
@Test void arraySet() { Schema schema = Schema.createArray(Schema.create(Schema.Type.INT)); GenericArray<Integer> array = new GenericData.Array<>(10, schema); array.clear(); for (int i = 0; i < 10; ++i) array.add(i); assertEquals(10, array.size()); assertEquals(Integer.valueOf(0), array....
@Override public KeyValueIterator<Windowed<K>, V> backwardFetch(final K key) { Objects.requireNonNull(key, "key cannot be null"); return new MeteredWindowedKeyValueIterator<>( wrapped().backwardFetch(keyBytes(key)), fetchSensor, iteratorDurationSensor, ...
@Test public void shouldThrowNullPointerOnBackwardFetchIfToIsNull() { setUpWithoutContext(); assertThrows(NullPointerException.class, () -> store.backwardFetch("from", null)); }
public static String compareMd5ResultString(List<String> changedGroupKeys) throws IOException { if (null == changedGroupKeys) { return ""; } StringBuilder sb = new StringBuilder(); for (String groupKey : changedGroupKeys) { String[] dataIdGroupId = GroupKey.parseK...
@Test public void assetCompareMd5ResultString() throws IOException { Assert.isTrue("".equals(Md5Util.compareMd5ResultString(null))); String result = "prescription%02dynamic-threadpool-example%02message-consume%01" + "prescription%02dynamic-threadpool-example%02message-produce%01"; ...
public static String[] splitToSteps(String path, boolean preserveRootAsStep) { if (path == null) { return null; } if (preserveRootAsStep && path.equals(SHARE_ROOT)) { return new String[] { SHARE_ROOT }; } var includeRoot = preserveRootAsStep && path.star...
@Test void splitAbsoluteWithoutPreservingRootShouldReturnStepsOnly() { assertArrayEquals(new String[] { "1", "2" }, FilesPath.splitToSteps("/1/2", false)); }
public static String formatExpression(final Expression expression) { return formatExpression(expression, FormatOptions.of(s -> false)); }
@Test public void shouldFormatSearchedCaseExpression() { final SearchedCaseExpression expression = new SearchedCaseExpression( Collections.singletonList( new WhenClause(new StringLiteral("foo"), new LongLiteral(1))), Optional.empty()); assertThat(ExpressionFormatter...
public static URI parse(String gluePath) { requireNonNull(gluePath, "gluePath may not be null"); if (gluePath.isEmpty()) { return rootPackageUri(); } // Legacy from the Cucumber Eclipse plugin // Older versions of Cucumber allowed it. if (CLASSPATH_SCHEME_PRE...
@Test void can_parse_absolute_path_form() { URI uri = GluePath.parse("/com/example/app"); assertAll( () -> assertThat(uri.getScheme(), is("classpath")), () -> assertThat(uri.getSchemeSpecificPart(), is("/com/example/app"))); }
@Override public void metricChange(final KafkaMetric metric) { if (!THROUGHPUT_METRIC_NAMES.contains(metric.metricName().name()) || !StreamsMetricsImpl.TOPIC_LEVEL_GROUP.equals(metric.metricName().group())) { return; } addMetric( metric, getQueryId(metric), getTopic...
@Test public void shouldAggregateMetricsByQueryIdInSharedRuntimes() { // Given: final Map<String, String> sharedRuntimeQueryTags = ImmutableMap.of( "logical_cluster_id", "lksqlc-12345", "query-id", "CTAS_TEST_5", "member", "_confluent_blahblah_query-1-blahblah", "topic", TOPIC_NAME ...
@Override public boolean isEmpty() { return size() == 0; }
@Test public void isEmpty_whenEmpty() { assertTrue(queue.isEmpty()); }