focal_method
stringlengths
13
60.9k
test_case
stringlengths
25
109k
public SendResult sendMessage( final String addr, final String brokerName, final Message msg, final SendMessageRequestHeader requestHeader, final long timeoutMillis, final CommunicationMode communicationMode, final SendMessageContext context, final Default...
@Test public void testSendMessageOneWay_Success() throws RemotingException, InterruptedException, MQBrokerException { doNothing().when(remotingClient).invokeOneway(anyString(), any(RemotingCommand.class), anyLong()); SendResult sendResult = mqClientAPI.sendMessage(brokerAddr, brokerName, msg, new Se...
@Override public String toString() { double value = getValue(displayUnit); String integer = String.format(Locale.ENGLISH, "%d", (long) value); String decimal = String.format(Locale.ENGLISH, "%.2f", value); if (decimal.equals(integer + ".00")) { return integer + displayUni...
@Test public void testToString() { assertByteSizeString("42B", "42 B"); assertByteSizeString("42KB", "42 KB"); assertByteSizeString("42MB", "42 MB"); assertByteSizeString("42GB", "42 GB"); assertByteSizeString("42TB", "42 TB"); assertByteSizeString("42PB", "42 PB"); ...
@Override public OAuth2AccessTokenDO refreshAccessToken(String refreshToken, String clientId) { // 查询访问令牌 OAuth2RefreshTokenDO refreshTokenDO = oauth2RefreshTokenMapper.selectByRefreshToken(refreshToken); if (refreshTokenDO == null) { throw exception0(GlobalErrorCodeConstants.BAD...
@Test public void testRefreshAccessToken_expired() { // 准备参数 String refreshToken = randomString(); String clientId = randomString(); // mock 方法 OAuth2ClientDO clientDO = randomPojo(OAuth2ClientDO.class).setClientId(clientId); when(oauth2ClientService.validOAuthClientF...
protected void showModel(EpoxyModel<?> model, boolean show) { if (model.isShown() == show) { return; } model.show(show); notifyModelChanged(model); }
@Test public void testShowModel() { TestModel testModel = new TestModel(); testModel.hide(); testAdapter.addModels(testModel); testAdapter.showModel(testModel); verify(observer).onItemRangeChanged(0, 1, null); assertTrue(testModel.isShown()); checkDifferState(); }
private static int getErrorCode(final int featureCode, final int errorCode) { Preconditions.checkArgument(featureCode >= 0 && featureCode < 100, "The value range of feature code should be [0, 100)."); Preconditions.checkArgument(errorCode >= 0 && errorCode < 100, "The value range of error code should be...
@Test void assertToSQLException() { SQLException actual = new FeatureSQLException(XOpenSQLState.GENERAL_ERROR, 1, 1, "reason") { }.toSQLException(); assertThat(actual.getSQLState(), is(XOpenSQLState.GENERAL_ERROR.getValue())); assertThat(actual.getErrorCode(), is(20101)); ass...
@Override public Producer createProducer() throws Exception { return new FopProducer(this, fopFactory, outputType.getFormatExtended()); }
@Test public void encryptPdfWithUserPassword() throws Exception { if (!canTest()) { // cannot run on CI return; } Endpoint endpoint = context().getEndpoint("fop:pdf"); Producer producer = endpoint.createProducer(); Exchange exchange = new DefaultExcha...
@Transactional(readOnly = true) public TemplateResponse generateReviewForm(String reviewRequestCode) { ReviewGroup reviewGroup = reviewGroupRepository.findByReviewRequestCode(reviewRequestCode) .orElseThrow(() -> new ReviewGroupNotFoundByReviewRequestCodeException(reviewRequestCode)); ...
@Test void 잘못된_리뷰_요청_코드로_리뷰_작성폼을_요청할_경우_예외가_발생한다() { // given ReviewGroup reviewGroup = new ReviewGroup("리뷰이명", "프로젝트명", "reviewRequestCode", "groupAccessCode"); reviewGroupRepository.save(reviewGroup); // when, then assertThatThrownBy(() -> templateService.generateReviewFor...
@Override public void onProjectsDeleted(Set<DeletedProject> projects) { checkNotNull(projects, "projects can't be null"); if (projects.isEmpty()) { return; } Arrays.stream(listeners) .forEach(safelyCallListener(listener -> listener.onProjectsDeleted(projects))); }
@Test @UseDataProvider("oneOrManyDeletedProjects") public void onProjectsDeleted_does_not_fail_if_there_is_no_listener(Set<DeletedProject> projects) { assertThatCode(() -> underTestNoListeners.onProjectsDeleted(projects)).doesNotThrowAnyException(); }
@PostMapping("/verify") public EmailVerifyResult verifyEmail(@RequestBody @Valid EmailVerifyRequest request, @RequestHeader(MijnDigidSession.MIJN_DIGID_SESSION_HEADER) String mijnDigiDsessionId){ MijnDigidSession mijnDigiDSession = retrieveMijnDigiDSession(mijnDigiDs...
@Test public void validEmailVerify() { EmailVerifyRequest request = new EmailVerifyRequest(); request.setVerificationCode("code"); EmailVerifyResult result = new EmailVerifyResult(); result.setStatus(Status.OK); result.setError("error"); result.setRemainingAttempts(6...
public static Comparator<Object[]> getComparator(List<OrderByExpressionContext> orderByExpressions, ColumnContext[] orderByColumnContexts, boolean nullHandlingEnabled) { return getComparator(orderByExpressions, orderByColumnContexts, nullHandlingEnabled, 0, orderByExpressions.size()); }
@Test public void testDescNullsLast() { List<OrderByExpressionContext> orderBys = Collections.singletonList(new OrderByExpressionContext(COLUMN1, DESC, NULLS_LAST)); setUpSingleColumnRows(); _rows.sort(OrderByComparatorFactory.getComparator(orderBys, ENABLE_NULL_HANDLING)); assertEquals(extr...
public Map<String, Double> toNormalizedMap() { Map<String, Double> ret = this.normalizedResources.toNormalizedMap(); ret.put(Constants.COMMON_OFFHEAP_MEMORY_RESOURCE_NAME, offHeap); ret.put(Constants.COMMON_ONHEAP_MEMORY_RESOURCE_NAME, onHeap); return ret; }
@Test public void testNonAckerCPUSetting() { Map<String, Object> topoConf = new HashMap<>(); topoConf.put(Config.TOPOLOGY_ACKER_CPU_PCORE_PERCENT, 40); topoConf.put(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT, 50); NormalizedResourceRequest request = new NormalizedResourceRequest(top...
public DirectoryEntry lookUp( File workingDirectory, JimfsPath path, Set<? super LinkOption> options) throws IOException { checkNotNull(path); checkNotNull(options); DirectoryEntry result = lookUp(workingDirectory, path, options, 0); if (result == null) { // an intermediate file in the path...
@Test public void testLookup_relative_finalSymlink_nofollowLinks() throws IOException { assertExists(lookup("four/five", NOFOLLOW_LINKS), "four", "five"); assertExists(lookup("four/six", NOFOLLOW_LINKS), "four", "six"); assertExists(lookup("four/loop", NOFOLLOW_LINKS), "four", "loop"); }
public static boolean isBase64(CharSequence base64) { if (base64 == null || base64.length() < 2) { return false; } final byte[] bytes = StrUtil.utf8Bytes(base64); if (bytes.length != base64.length()) { // 如果长度不相等,说明存在双字节字符,肯定不是Base64,直接返回false return false; } return isBase64(bytes); }
@Test public void isBase64Test2(){ String base64 = "dW1kb3MzejR3bmljM2J6djAyZzcwbWk5M213Nnk3cWQ3eDJwOHFuNXJsYmMwaXhxbmg0dmxrcmN0anRkbmd3\n" + "ZzcyZWFwanI2NWNneTg2dnp6cmJoMHQ4MHpxY2R6c3pjazZtaQ=="; assertTrue(Base64.isBase64(base64)); // '=' 不位于末尾 base64 = "dW1kb3MzejR3bmljM2J6=djAyZzcwbWk5M213Nnk3cWQ3eDJ...
@Override public PostDO getPost(Long id) { return postMapper.selectById(id); }
@Test public void testGetPost() { // mock 数据 PostDO dbPostDO = randomPostDO(); postMapper.insert(dbPostDO); // 准备参数 Long id = dbPostDO.getId(); // 调用 PostDO post = postService.getPost(id); // 断言 assertNotNull(post); assertPojoEquals(dbP...
@Override public String getColumnName(final int columnIndex) throws SQLException { return resultSetMetaData.getColumnName(columnIndex); }
@Test void assertGetColumnName() throws SQLException { assertThat(queryResultMetaData.getColumnName(1), is("order_id")); }
@Udf(description = "Converts a string representation of a date in the given format" + " into the number of milliseconds since 1970-01-01 00:00:00 UTC/GMT." + " Single quotes in the timestamp format can be escaped with ''," + " for example: 'yyyy-MM-dd''T''HH:mm:ssX'." + " The system default time...
@Test public void shouldThrowOnNullDate() { // When: final Exception e = assertThrows( KsqlFunctionException.class, () -> udf.stringToTimestamp(null, "yyyy-MM-dd") ); // Then: assertThat(e.getMessage(), Matchers.containsString("Failed to parse timestamp 'null' with formatter")); ...
public static Iterator<Row> computeUpdates( Iterator<Row> rowIterator, StructType rowType, String[] identifierFields) { Iterator<Row> carryoverRemoveIterator = removeCarryovers(rowIterator, rowType); ChangelogIterator changelogIterator = new ComputeUpdateIterator(carryoverRemoveIterator, rowType, ...
@Test public void testRowsWithNullValue() { final List<Row> rowsWithNull = Lists.newArrayList( new GenericRowWithSchema(new Object[] {2, null, null, DELETE, 0, 0}, null), new GenericRowWithSchema(new Object[] {3, null, null, INSERT, 0, 0}, null), new GenericRowWithSchem...
@Override public void write(int b) throws IOException { if (buffer.length <= bufferIdx) { flushInternalBuffer(); } buffer[bufferIdx] = (byte) b; ++bufferIdx; }
@Test void testSecondaryWriteFail() throws Exception { DuplicatingCheckpointOutputStream duplicatingStream = createDuplicatingStreamWithFailingSecondary(); testFailingSecondaryStream( duplicatingStream, () -> { for (int i = 0; i < 1...
@Override public String getDocumentationLink(@Nullable String suffix) { return documentationBaseUrl + Optional.ofNullable(suffix).orElse(""); }
@Test public void getDocumentationLink_whenSnapshot_returnLatest() { when(sonarQubeVersion.get().qualifier()).thenReturn("SNAPSHOT"); documentationLinkGenerator = new DefaultDocumentationLinkGenerator(sonarQubeVersion, configuration); String generatedLink = documentationLinkGenerator.getDocumentationLink...
@Override public void kill() throws IOException { LOG.info("Killing {}:{}", supervisorId, workerId); if (shutdownTimer == null) { shutdownTimer = shutdownDuration.time(); } try { if (resourceIsolationManager != null) { resourceIsolationManager....
@Test public void testKill() throws Exception { final String topoId = "test_topology"; final Map<String, Object> superConf = new HashMap<>(); AdvancedFSOps ops = mock(AdvancedFSOps.class); when(ops.doRequiredTopoFilesExist(superConf, topoId)).thenReturn(true); LocalAssignment...
@Override public TSetConfigResponse setConfig(TSetConfigRequest request) throws TException { try { Preconditions.checkState(request.getKeys().size() == request.getValues().size()); Map<String, String> configs = new HashMap<>(); for (int i = 0; i < request.getKeys().size()...
@Test public void testSetFrontendConfig() throws TException { FrontendServiceImpl impl = new FrontendServiceImpl(exeEnv); TSetConfigRequest request = new TSetConfigRequest(); request.keys = Lists.newArrayList("mysql_server_version"); request.values = Lists.newArrayList("5.1.1"); ...
@Override public void writeShort(final int v) throws IOException { ensureAvailable(SHORT_SIZE_IN_BYTES); MEM.putShort(buffer, ARRAY_BYTE_BASE_OFFSET + pos, (short) v); pos += SHORT_SIZE_IN_BYTES; }
@Test public void testWriteShortForVByteOrder() throws Exception { short expected = 100; out.writeShort(expected, ByteOrder.LITTLE_ENDIAN); out.writeShort(expected, ByteOrder.BIG_ENDIAN); short actual1 = Bits.readShort(out.buffer, 0, false); short actual2 = Bits.readShort(out...
@Override public int length() { return length; }
@Test public void testLength() { System.out.println("length"); MultivariateGaussianDistribution instance = new MultivariateGaussianDistribution(mu, 1.0); assertEquals(4, instance.length()); instance = new MultivariateGaussianDistribution(mu, sigma[0]); assertEquals(6, instan...
@Override public Object parse(final String property, final Object value) { if (property.equalsIgnoreCase(KsqlConstants.LEGACY_RUN_SCRIPT_STATEMENTS_CONTENT)) { validator.validate(property, value); return value; } final ConfigItem configItem = resolver.resolve(property, true) .orElseTh...
@Test(expected = IllegalArgumentException.class) public void shouldThrowIfValidatorThrows() { // Given: doThrow(new IllegalArgumentException("Boom")) .when(validator).validate(anyString(), any(Object.class)); // When: parser.parse(ProducerConfig.LINGER_MS_CONFIG, "100"); }
static GlobalPhaseSetup maybeMakeSetup(RankProfilesConfig.Rankprofile rp, RankProfilesEvaluator modelEvaluator) { var model = modelEvaluator.modelForRankProfile(rp.name()); Map<String, RankProfilesConfig.Rankprofile.Normalizer> availableNormalizers = new HashMap<>(); for (var n : rp.normalizer()...
@Test void funcWithArgsSetup() { RankProfilesConfig rpCfg = readConfig("with_mf_funargs"); assertEquals(1, rpCfg.rankprofile().size()); RankProfilesEvaluator rpEvaluator = createEvaluator(rpCfg); var setup = GlobalPhaseSetup.maybeMakeSetup(rpCfg.rankprofile().get(0), rpEvaluator); ...
@Override public V getAndRemove(K name) { int h = hashingStrategy.hashCode(name); return remove0(h, index(h), checkNotNull(name, "name")); }
@Test public void testGetAndRemove() { TestDefaultHeaders headers = newInstance(); headers.add(of("name1"), of("value1")); headers.add(of("name2"), of("value2"), of("value3")); headers.add(of("name3"), of("value4"), of("value5"), of("value6")); assertEquals(of("value1"), hea...
@Override public FileAttributes getFileAttributes() { checkState(this.type == Type.FILE, "Only component of type FILE have a FileAttributes object"); return this.fileAttributes; }
@Test public void isUnitTest_returns_true_if_IsTest_is_set_in_BatchComponent() { ComponentImpl component = buildSimpleComponent(FILE, "file").setFileAttributes(new FileAttributes(true, null, 1)).build(); assertThat(component.getFileAttributes().isUnitTest()).isTrue(); }
@Override public Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException { JWT_LOGGER.trace("Authentication request received for " + request.toString()); if (!(request instanceof HttpServletRequest) && !(response instanceof HttpServletResp...
@Test public void testRedirect() throws IOException, ServerAuthException { JwtAuthenticator authenticator = new JwtAuthenticator(TOKEN_PROVIDER, JWT_TOKEN); HttpServletRequest request = mock(HttpServletRequest.class); expect(request.getMethod()).andReturn(HttpMethod.GET.asString()); expect(request.ge...
@Override public final boolean wasNull() { return wasNull; }
@Test void assertWasNull() { QueryResult queryResult = mock(QueryResult.class); streamMergedResult.setCurrentQueryResult(queryResult); assertFalse(streamMergedResult.wasNull()); }
public static boolean isUnclosedQuote(final String line) { // CHECKSTYLE_RULES.ON: CyclomaticComplexity int quoteStart = -1; for (int i = 0; i < line.length(); ++i) { if (quoteStart < 0 && isQuoteChar(line, i)) { quoteStart = i; } else if (quoteStart >= 0 && isTwoQuoteStart(line, i) && !...
@Test public void shouldFindUnclosedQuote_escapedThree() { // Given: final String line = "some line 'this is in a quote\\\'"; // Then: assertThat(UnclosedQuoteChecker.isUnclosedQuote(line), is(true)); }
public void validateMatcher() throws ValidationException { validate(Validator.lengthValidator(255), getMatcher()); }
@Test void shouldValidateMatcherForLessThan255() throws Exception { user = new User("UserName", new String[]{"Jez,Pavan"}, "user@mail.com", true); user.validateMatcher(); }
@Override public void loadGlue(Glue glue, List<URI> gluePaths) { gluePaths.stream() .filter(gluePath -> CLASSPATH_SCHEME.equals(gluePath.getScheme())) .map(ClasspathSupport::packageName) .map(classFinder::scanForClassesInPackage) .flatMap(Colle...
@Test() void list_of_uris_cant_be_null() { GuiceBackend backend = new GuiceBackend(factory, classLoader); assertThrows(NullPointerException.class, () -> backend.loadGlue(glue, null)); }
@Override public boolean next() throws SQLException { if (getCurrentQueryResult().next()) { return true; } if (!queryResults.hasNext()) { return false; } setCurrentQueryResult(queryResults.next()); boolean hasNext = getCurrentQueryResult().next...
@Test void assertNextForResultSetsAllNotEmpty() throws SQLException { List<QueryResult> queryResults = Arrays.asList(mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS), mock(QueryResult.class, RETURNS_DEEP_STUBS)); for (QueryResult each : queryResults) { ...
public static int getMajorVersion() { return MAJOR_VERSION; }
@Test void getMajorVersion() { assertDoesNotThrow(JVM::getMajorVersion); }
public static int getCloseTimeout(URL url) { String configuredCloseTimeout = System.getProperty(Constants.CLOSE_TIMEOUT_CONFIG_KEY); int defaultCloseTimeout = -1; if (StringUtils.isNotEmpty(configuredCloseTimeout)) { try { defaultCloseTimeout = Integer.parseInt(config...
@Test void testGetCloseTimeout() { URL url1 = URL.valueOf("dubbo://127.0.0.1:12345?heartbeat=10000"); URL url2 = URL.valueOf("dubbo://127.0.0.1:12345?heartbeat=10000&heartbeat.timeout=50000"); URL url3 = URL.valueOf("dubbo://127.0.0.1:12345?heartbeat=10000&heartbeat.timeout=10000"); ...
public static Object convert(final Object o) { if (o == null) { return RubyUtil.RUBY.getNil(); } final Class<?> cls = o.getClass(); final Valuefier.Converter converter = CONVERTER_MAP.get(cls); if (converter != null) { return converter.convert(o); ...
@Test public void testLocalDateTime() { LocalDateTime ldt = LocalDateTime.now(); Object result = Valuefier.convert(ldt); assertEquals(JrubyTimestampExtLibrary.RubyTimestamp.class, result.getClass()); }
public static <K, V> Read<K, V> read() { return new AutoValue_KafkaIO_Read.Builder<K, V>() .setTopics(new ArrayList<>()) .setTopicPartitions(new ArrayList<>()) .setConsumerFactoryFn(KafkaIOUtils.KAFKA_CONSUMER_FACTORY_FN) .setConsumerConfig(KafkaIOUtils.DEFAULT_CONSUMER_PROPERTIES) ...
@Test public void testUnboundedReaderLogsCommitFailure() throws Exception { List<String> topics = ImmutableList.of("topic_a"); PositionErrorConsumerFactory positionErrorConsumerFactory = new PositionErrorConsumerFactory(); UnboundedSource<KafkaRecord<Integer, Long>, KafkaCheckpointMark> source = ...
public <T extends BaseRequest<T, R>, R extends BaseResponse> R execute(BaseRequest<T, R> request) { return api.send(request); }
@Test public void getChatAdministrators() { GetChatAdministratorsResponse response = bot.execute(new GetChatAdministrators(groupId)); for (ChatMember chatMember : response.administrators()) { ChatMemberTest.check(chatMember); if (chatMember.user().firstName().equals("Test Bot...
@Override public List<HttpCookie> getRequestCookies() { return _requestCookies; }
@Test public void testCookiesLocalAttr() throws Exception { URI uri = URI.create("resources"); RequestContext requestContext = new RequestContext(); List<HttpCookie> localCookies = Collections.singletonList(new HttpCookie("test", "value")); requestContext.putLocalAttr(ServerResourceContext.CONTEXT_...
@Override public Result<V, E> search(Graph<V, E> graph, V src, V dst, EdgeWeigher<V, E> weigher, int maxPaths) { checkArguments(graph, src, dst); return internalSearch(graph, src, dst, weigher != null ? weigher : new DefaultEdgeWeigher<>(), ...
@Test(expected = IllegalArgumentException.class) public void noSuchSourceArgument() { graphSearch().search(new AdjacencyListsGraph<>(of(B, C), of(new TestEdge(B, C))), A, H, weigher, 1); }
@Override public List<ApolloAuditLogDTO> queryLogsByOpName(String opName, Date startDate, Date endDate, int page, int size) { if (startDate == null && endDate == null) { return ApolloAuditUtil.logListToDTOList(logService.findByOpName(opName, page, size)); } return ApolloAuditUtil.logListToDTOL...
@Test public void testQueryLogsByOpNameCaseDateIsNull() { final String opName = "query-op-name"; final Date startDate = null; final Date endDate = null; { List<ApolloAuditLog> logList = MockBeanFactory.mockAuditLogListByLength(size); Mockito.when(logService.findByOpName(Mockito.eq(opName),...
@Deprecated public static DynamicTableSource createTableSource( @Nullable Catalog catalog, ObjectIdentifier objectIdentifier, ResolvedCatalogTable catalogTable, ReadableConfig configuration, ClassLoader classLoader, boolean isTemporary) { ...
@Test void testManagedConnector() { final Map<String, String> options = createAllOptions(); options.remove("connector"); final DynamicTableSource actualSource = createTableSource(SCHEMA, options); assertThat(actualSource).isExactlyInstanceOf(TestManagedTableSource.class); }
public GoConfigHolder loadConfigHolder(final String content, Callback callback) throws Exception { CruiseConfig configForEdit; CruiseConfig config; LOGGER.debug("[Config Save] Loading config holder"); configForEdit = deserializeConfig(content); if (callback != null) callback.call...
@Test void shouldLoadAllowOnlySuccessOnSuccessApprovalType() throws Exception { String content = config( """ <pipelines group="first"> <pipeline name="pipeline"> <materials> <hg url="/hgrepo...
@Override public Rule register(String ref, RuleKey ruleKey) { requireNonNull(ruleKey, "ruleKey can not be null"); Rule rule = rulesByUuid.get(ref); if (rule != null) { if (!ruleKey.repository().equals(rule.repository()) || !ruleKey.rule().equals(rule.key())) { throw new IllegalArgumentExcep...
@Test public void register_returns_Rule_object_created_from_arguments() { for (int i = 0; i < someRandomInt(); i++) { String repository = SOME_REPOSITORY + i; String ruleKey = String.valueOf(i); Rule rule = underTest.register(Integer.toString(i), RuleKey.of(repository, ruleKey)); assertTha...
@Override protected Mono<Void> getFallback() { if (isFailedExecution()) { LOG.error("hystrix execute have error: ", getExecutionException()); } final Throwable exception = getExecutionException(); return fallback(exchange, getCallBackUri(), exception); }
@Test public void testGetFallback() { assertThrows(NullPointerException.class, () -> StepVerifier.create(hystrixCommandOnThread.getFallback()).expectSubscription().verifyComplete()); }
@Override synchronized int numBuffered() { return wrapped.numBuffered(); }
@Test public void testNumBufferedWithTopicPartition() { final TopicPartition partition = new TopicPartition("topic", 0); final int numBuffered = 1; when(wrapped.numBuffered(partition)).thenReturn(numBuffered); final int result = synchronizedPartitionGroup.numBuffered(partition); ...
public static <T> boolean isNotNullOrEmpty(Collection<T> collection) { return !isNullOrEmpty(collection); }
@Test void isNotNullOrEmptyIsFalseForEmptyCollection() { assertThat(isNotNullOrEmpty(new ArrayList<>())).isFalse(); }
@Override public ListenableFuture<?> execute(CreateFunction statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Map<NodeRef<com.facebook.presto.sql.tree.Parameter>, Expression> parameterLookup = ...
@Test public void testCreateTemporaryFunction() { SqlParser parser = new SqlParser(); String sqlString = "CREATE TEMPORARY FUNCTION foo() RETURNS int RETURN 1"; CreateFunction statement = (CreateFunction) parser.createStatement(sqlString, ParsingOptions.builder().build()); Transa...
@Override public void emitWatermark(Watermark watermark) { final long newWatermark = watermark.getTimestamp(); if (newWatermark <= maxWatermarkSoFar) { return; } maxWatermarkSoFar = newWatermark; watermarkEmitted.updateCurrentEffectiveWatermark(maxWatermarkSoFar)...
@Test void testWatermarksDoNotRegress() { final CollectingDataOutput<Object> testingOutput = new CollectingDataOutput<>(); final WatermarkToDataOutput wmOutput = new WatermarkToDataOutput(testingOutput); wmOutput.emitWatermark(new org.apache.flink.api.common.eventtime.Watermark(12L)); ...
public static synchronized void configure(DataflowWorkerLoggingOptions options) { if (!initialized) { throw new RuntimeException("configure() called before initialize()"); } // For compatibility reason, we do not call SdkHarnessOptions.getConfiguredLoggerFromOptions // to config the logging for l...
@Test public void testSystemOutRespectsFilterConfig() throws IOException { DataflowWorkerLoggingOptions options = PipelineOptionsFactory.as(DataflowWorkerLoggingOptions.class); options.setDefaultWorkerLogLevel(DataflowWorkerLoggingOptions.Level.ERROR); DataflowWorkerLoggingInitializer.configure(op...
public static boolean isEmptyStatement(String sql) { TokenSource tokens = getLexer(sql, ImmutableSet.of()); while (true) { Token token = tokens.nextToken(); if (token.getType() == Token.EOF) { return true; } if (token.getChannel() != To...
@Test public void testIsEmptyStatement() { assertTrue(isEmptyStatement("")); assertTrue(isEmptyStatement(" ")); assertTrue(isEmptyStatement("\t\n ")); assertTrue(isEmptyStatement("--foo\n --what")); assertTrue(isEmptyStatement("/* oops */")); assertFalse(isEmptyS...
public static String getContentIdentity(String content) { int index = content.indexOf(WORD_SEPARATOR); if (index == -1) { throw new IllegalArgumentException("content does not contain separator"); } return content.substring(0, index); }
@Test void testGetContentIdentityFail() { assertThrows(IllegalArgumentException.class, () -> { String content = "aabbb"; ContentUtils.getContentIdentity(content); }); }
public static String toJson(Object o) { return toJson(o, false); }
@Test void testBeanConversion() { SimplePojo pojo = new SimplePojo(); String s = JsonUtils.toJson(pojo); Match.that(s).isEqualTo("{\"bar\":0,\"foo\":null}"); Map<String, Object> map = Json.of(pojo).asMap(); Match.that(map).isEqualTo("{ foo: null, bar: 0 }"); }
public ClassTemplateSpec generate(DataSchema schema, DataSchemaLocation location) { pushCurrentLocation(location); final ClassTemplateSpec result = processSchema(schema, null, null); popCurrentLocation(); return result; }
@Test(dataProvider = "customTypeDataForRecord") public void testCustomInfoForRecordFields(final List<DataSchema> customTypedSchemas) { final List<RecordDataSchema.Field> fields = customTypedSchemas.stream() .map(RecordDataSchema.Field::new) .peek(field -> field.setName("field_" + _uniqueNumberGe...
static String writeIndexName(Model model, long timeBucket) { String tableName = IndexController.INSTANCE.getTableName(model); if (model.isRecord() && model.isSuperDataset()) { return tableName + Const.LINE + compressTimeBucket(timeBucket / 1000000, SUPER_DATASET_DAY_STEP); } else { ...
@Test public void testIndexRolling() { long secondTimeBucket = 2020_0809_1010_59L; long minuteTimeBucket = 2020_0809_1010L; Assertions.assertEquals( "superDatasetModel-20200809", writeIndexName(superDatasetModel, secondTimeBucket) ); Assertions.assert...
public static String uncompress(byte[] compressedURL) { StringBuffer url = new StringBuffer(); switch (compressedURL[0] & 0x0f) { case EDDYSTONE_URL_PROTOCOL_HTTP_WWW: url.append(URL_PROTOCOL_HTTP_WWW_DOT); break; case EDDYSTONE_URL_PROTOCOL_HTTPS_...
@Test public void testUncompressWithoutTLD() throws MalformedURLException { String testURL = "http://xxx"; byte[] testBytes = {0x02, 'x', 'x', 'x'}; assertEquals(testURL, UrlBeaconUrlCompressor.uncompress(testBytes)); }
@Override public Object convert(String value) { if (isNullOrEmpty(value)) { return value; } if (value.contains("=")) { final Map<String, String> fields = new HashMap<>(); Matcher m = PATTERN.matcher(value); while (m.find()) { ...
@Test public void testFilterWithSingleQuotedValue() { TokenizerConverter f = new TokenizerConverter(new HashMap<String, Object>()); @SuppressWarnings("unchecked") Map<String, String> result = (Map<String, String>) f.convert("otters in k1='v1' more otters"); assertEquals(1, result.si...
public SqlType getExpressionSqlType(final Expression expression) { return getExpressionSqlType(expression, Collections.emptyMap()); }
@Test public void shouldEvaluateTypeForCreateArrayExpressionWithNull() { // Given: Expression expression = new CreateArrayExpression( ImmutableList.of( new UnqualifiedColumnReferenceExp(COL0), new NullLiteral() ) ); // When: final SqlType type = expressionT...
public static String getParent(String path) throws InvalidPathException { return getParentCleaned(cleanPath(path)); }
@Test public void getParent() throws InvalidPathException { // get a parent that is non-root assertEquals("/foo", PathUtils.getParent("/foo/bar")); assertEquals("/foo", PathUtils.getParent("/foo/bar/")); assertEquals("/foo", PathUtils.getParent("/foo/./bar/")); assertEquals("/foo", PathUtils.getPa...
@Subscribe public void onChatMessage(ChatMessage event) { if (event.getType() != ChatMessageType.GAMEMESSAGE) { return; } String message = Text.removeTags(event.getMessage()); if (message.startsWith("Grand Exchange: Finished")) { notifier.notify(config.notifyOnOfferComplete(), message); } else...
@Test public void testNotifyComplete() { when(grandExchangeConfig.notifyOnOfferComplete()).thenReturn(Notification.ON); ChatMessage chatMessage = new ChatMessage(); chatMessage.setType(ChatMessageType.GAMEMESSAGE); chatMessage.setMessage("<col=006000>Grand Exchange: Finished buying 1 x Acorn.</col>"); gra...
@Override public <T> ResponseFuture<T> sendRequest(Request<T> request, RequestContext requestContext) { FutureCallback<Response<T>> callback = new FutureCallback<>(); sendRequest(request, requestContext, callback); return new ResponseFutureImpl<>(callback); }
@SuppressWarnings("deprecation") @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "sendRequestAndGetResponseOptions") public void testRestLiResponseExceptionFuture(SendRequestOption sendRequestOption, GetResponseOption getResponseOption, ...
public void incrementAll(CounterMap<F, S> other) { for (Map.Entry<F, Counter<S>> entry : other.maps.entrySet()) { F key = entry.getKey(); Counter<S> innerCounter = entry.getValue(); for (Map.Entry<S, AtomicDouble> innerEntry : innerCounter.entrySet()) { S valu...
@Test public void testIncrementAll() { CounterMap<Integer, Integer> counterMapA = new CounterMap<>(); counterMapA.incrementCount(0, 0, 1); counterMapA.incrementCount(0, 1, 1); counterMapA.incrementCount(0, 2, 1); counterMapA.incrementCount(1, 0, 1); counterMapA.incre...
@Override public Set<KubevirtFloatingIp> floatingIpsByRouter(String routerName) { checkArgument(!Strings.isNullOrEmpty(routerName), ERR_NULL_ROUTER_NAME); return kubevirtRouterStore.floatingIps().stream() .filter(ips -> routerName.equals(ips.routerName())) .collect(Co...
@Test public void testGetFloatingIpsByRouterName() { createBasicFloatingIpDisassociated(); assertEquals("Number of floating IPs did not match", 1, target.floatingIpsByRouter(ROUTER_NAME).size()); }
public void build(@Nullable SegmentVersion segmentVersion, ServerMetrics serverMetrics) throws Exception { SegmentGeneratorConfig genConfig = new SegmentGeneratorConfig(_tableConfig, _dataSchema); // The segment generation code in SegmentColumnarIndexCreator will throw // exception if start and end t...
@Test public void test10RecordsIndexedRowMajorSegmentBuilder() throws Exception { File tmpDir = new File(TMP_DIR, "tmp_" + System.currentTimeMillis()); TableConfig tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName("testTable") .setTimeColumnName(DATE_TIME_COLUMN) ...
@GET @Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 }) @Override public ClusterInfo get() { return getClusterInfo(); }
@Test public void testClusterMetricsXML() throws JSONException, Exception { WebResource r = resource(); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("metrics").accept("application/xml").get(ClientResponse.class); assertEquals(MediaType.APPLICATION_XML + "; " + JettyUtils...
@SuppressWarnings("deprecation") static Object[] buildArgs(final Object[] positionalArguments, final ResourceMethodDescriptor resourceMethod, final ServerResourceContext context, final DynamicRecordTemplate templa...
@Test(dataProvider = "noOpParameterData") public void testNoOpParamType(Class<?> dataType, Parameter.ParamType paramType) { String paramKey = "testParam"; ServerResourceContext mockResourceContext = EasyMock.createMock(ServerResourceContext.class); @SuppressWarnings({"unchecked","rawtypes"}) Param...
static boolean explicitlyEc2Configured(AwsConfig awsConfig) { return !isNullOrEmptyAfterTrim(awsConfig.getHostHeader()) && awsConfig.getHostHeader().startsWith("ec2"); }
@Test public void explicitlyEc2Configured() { assertTrue(AwsClientConfigurator.explicitlyEc2Configured(AwsConfig.builder().setHostHeader("ec2").build())); assertTrue(AwsClientConfigurator.explicitlyEc2Configured( AwsConfig.builder().setHostHeader("ec2.us-east-1.amazonaws.com").build()));...
@Override public int compare(ChronoZonedDateTime<?> date1, ChronoZonedDateTime<?> date2) { return ChronoZonedDateTime.timeLineOrder().compare(date1, date2); }
@Test void should_disregard_time_zone_difference() { ZonedDateTime now = ZonedDateTime.now(); ZonedDateTime inParis = now.withZoneSameInstant(ZoneId.of("Europe/Paris")); ZonedDateTime inNewYork = now.withZoneSameInstant(ZoneId.of("America/New_York")); assertThat(inParis.compareTo(inNewYork)).as("Buil...
public static long convertBytesToLong(byte[] bytes) { byte[] paddedBytes = paddingTo8Byte(bytes); long temp = 0L; for (int i = 7; i >= 0; i--) { temp = temp | (((long) paddedBytes[i] & 0xff) << (7 - i) * 8); } return temp; }
@Test public void testConvertBytesToLong() { long[] tests = new long[] {Long.MIN_VALUE, -1L, 0, 1L, Long.MAX_VALUE}; for (int i = 0; i < tests.length; i++) { assertEquals(BinaryUtil.convertBytesToLong(convertLongToBytes(tests[i])), tests[i]); } }
public static JibContainerBuilder toJibContainerBuilder( Path projectRoot, Path buildFilePath, Build buildCommandOptions, CommonCliOptions commonCliOptions, ConsoleLogger logger) throws InvalidImageReferenceException, IOException { BuildFileSpec buildFile = toBuildFileSpe...
@Test public void testToJibContainerBuilder_requiredProperties() throws URISyntaxException, IOException, InvalidImageReferenceException { Path buildfile = Paths.get(Resources.getResource("buildfiles/projects/allDefaults/jib.yaml").toURI()); JibContainerBuilder jibContainerBuilder = Build...
static List<byte[]> readPayloadFile(String payloadFilePath, String payloadDelimiter) throws IOException { List<byte[]> payloadByteList = new ArrayList<>(); if (payloadFilePath != null) { Path path = Paths.get(payloadFilePath); System.out.println("Reading payloads from: " + path.t...
@Test public void testReadPayloadFile() throws Exception { File payloadFile = createTempFile("Hello\nKafka"); String payloadFilePath = payloadFile.getAbsolutePath(); String payloadDelimiter = "\n"; List<byte[]> payloadByteList = ProducerPerformance.readPayloadFile(payloadFilePath, p...
@Override public CompletableFuture<ClusterInfo> getBrokerClusterInfo(String address, long timeoutMillis) { CompletableFuture<ClusterInfo> future = new CompletableFuture<>(); RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_BROKER_CLUSTER_INFO, null); remotingCli...
@Test public void assertGetBrokerClusterInfoWithSuccess() throws Exception { ClusterInfo responseBody = new ClusterInfo(); setResponseSuccess(RemotingSerializable.encode(responseBody)); CompletableFuture<ClusterInfo> actual = mqClientAdminImpl.getBrokerClusterInfo(defaultBrokerAddr, defaultT...
@Override public NodeId get() { return new SimpleNodeId(readOrGenerate(filename)); }
@Test void testNonexistentFile() throws IOException { final Path nodeIdPath = tempDir.resolve(NODE_ID_FILENAME); final String filename = nodeIdPath.toAbsolutePath().toString(); final FilePersistedNodeIdProvider provider = new FilePersistedNodeIdProvider(filename); // first let the...
@ApiOperation(value = "Delete a comment on a historic process instance", tags = { "History Process" }, code = 204) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the historic process instance and comment were found and the comment is deleted. Response body is left empty intentiona...
@Test @Deployment(resources = { "org/flowable/rest/service/api/repository/oneTaskProcess.bpmn20.xml" }) public void testGetComments() throws Exception { ProcessInstance pi = null; try { pi = runtimeService.startProcessInstanceByKey("oneTaskProcess"); // Add a comment as...
static List<byte[]> readCertificates(Path path) throws CertificateException { final byte[] bytes; try { bytes = Files.readAllBytes(path); } catch (IOException e) { throw new CertificateException("Couldn't read certificates from file: " + path, e); } final...
@Test(expected = CertificateException.class) public void readCertificatesFailsOnDirectory() throws Exception { final File folder = temporaryFolder.newFolder(); PemReader.readCertificates(folder.toPath()); }
@Override public Object getValue(final int columnIndex, final Class<?> type) throws SQLException { return queryResult.getValue(columnIndex, type); }
@Test void assertGetValue() throws SQLException { QueryResult queryResult = mock(QueryResult.class); when(queryResult.getValue(1, Object.class)).thenReturn("1"); TransparentMergedResult actual = new TransparentMergedResult(queryResult); assertThat(actual.getValue(1, Object.class).toS...
public byte[] readAll() throws IOException { if (pos == 0 && count == buf.length) { pos = count; return buf; } byte[] ret = new byte[count - pos]; super.read(ret); return ret; }
@Test public void testReadAll() throws IOException { assertEquals(TEST_DATA.length, exposedStream.available()); byte[] data = exposedStream.readAll(); assertArrayEquals(TEST_DATA, data); assertSame(TEST_DATA, data); assertEquals(0, exposedStream.available()); }
public Schema toCamelCase() { return this.getFields().stream() .map( field -> { FieldType innerType = field.getType(); if (innerType.getRowSchema() != null) { Schema innerCamelCaseSchema = innerType.getRowSchema().toCamelCase(); innerTy...
@Test public void testToCamelCase() { Schema innerSchema = Schema.builder() .addStringField("my_first_nested_string_field") .addStringField("my_second_nested_string_field") .build(); Schema schema = Schema.builder() .addStringField("my_first_stri...
@Override public CompletableFuture<Void> updateOrCreateTopic(String address, CreateTopicRequestHeader requestHeader, long timeoutMillis) { CompletableFuture<Void> future = new CompletableFuture<>(); RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UPDATE_AND_CREATE_...
@Test public void assertUpdateOrCreateTopicWithSuccess() throws Exception { setResponseSuccess(null); CreateTopicRequestHeader requestHeader = mock(CreateTopicRequestHeader.class); CompletableFuture<Void> actual = mqClientAdminImpl.updateOrCreateTopic(defaultBrokerAddr, requestHeader, defaul...
@Override public void validateSmsCode(SmsCodeValidateReqDTO reqDTO) { validateSmsCode0(reqDTO.getMobile(), reqDTO.getCode(), reqDTO.getScene()); }
@Test public void validateSmsCode_expired() { // 准备参数 SmsCodeValidateReqDTO reqDTO = randomPojo(SmsCodeValidateReqDTO.class, o -> { o.setMobile("15601691300"); o.setScene(randomEle(SmsSceneEnum.values()).getScene()); }); // mock 数据 SqlConstants.init(Db...
@Override public void encode(Event event, OutputStream output) throws IOException { String outputString = (format == null ? JSON_MAPPER.writeValueAsString(event.getData()) : StringInterpolation.evaluate(event, format)) + delimiter; output.write(outputS...
@Test public void testEncodeWithCharset() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] rightSingleQuoteInUtf8 = {(byte) 0xE2, (byte) 0x80, (byte) 0x99}; String rightSingleQuote = new String(rightSingleQuoteInUtf8, Charset.forName("UTF-8")); ...
public static void returnCompressor(Compressor compressor) { if (compressor == null) { return; } // if the compressor can't be reused, don't pool it. if (compressor.getClass().isAnnotationPresent(DoNotPool.class)) { compressor.end(); return; } compressor.reset(); if (paybac...
@Test(timeout = 10000) public void testDoNotPoolCompressorNotUseableAfterReturn() throws Exception { final GzipCodec gzipCodec = new GzipCodec(); gzipCodec.setConf(new Configuration()); // BuiltInGzipCompressor is an explicit example of a Compressor with the @DoNotPool annotation final Compressor co...
@Override public Stadium findById(final Long id) { return stadiumRepository.findById(id); }
@Test void findById는_존재하지_않는_경기장_요청에_예외를_반환한다() { // given final Long stadiumId = -999L; // when // then assertThatThrownBy(() -> stadiumReadService.findById(stadiumId)) .isInstanceOf(StadiumNotFoundException.class); }
@SuppressWarnings("unchecked") public static SelType box(Object o) { if (o == null) { // returned null from a method, representing void or object return SelType.NULL; } SelTypes type = fromClazzToSelType(o.getClass()); switch (type) { case STRING: return SelString.of((String) o); ...
@Test public void testBox() { Object[] testObjects = new Object[] { null, "abc", 1, 1L, true, new String[] {"foo", "bar"}, new Long[] {1L, 2L}, new long[] {1L, 2L}, new Integer[] {3, 4}, new int[] {5, 6, 7}...
public static Set<IDWithIssuer> pidsOf(Attributes attrs) { IDWithIssuer pid = IDWithIssuer.pidOf(attrs); Sequence opidseq = attrs.getSequence(Tag.OtherPatientIDsSequence); if (opidseq == null || opidseq.isEmpty()) if (pid == null) return Collections.emptySet(); ...
@Test public void no_main_id_returns_all() { Attributes rootWithMainId = createIdWithNS(NS); rootWithMainId.newSequence(OtherPatientIDsSequence, 0); Sequence other = rootWithMainId.getSequence(OtherPatientIDsSequence); Attributes otherPatientId = otherPatientIds("other_ns"); ...
public static BytesInput fromInt(int intValue) { return new IntBytesInput(intValue); }
@Test public void testFromInt() throws IOException { int value = RANDOM.nextInt(); ByteArrayOutputStream baos = new ByteArrayOutputStream(4); BytesUtils.writeIntLittleEndian(baos, value); byte[] data = baos.toByteArray(); Supplier<BytesInput> factory = () -> BytesInput.fromInt(value); validat...
@Override public void init(final Properties props) { this.props = props; cryptographicAlgorithm = TypedSPILoader.getService(CryptographicAlgorithm.class, getType(), props); }
@Test void assertCreateNewInstanceWithEmptyAESKey() { assertThrows(AlgorithmInitializationException.class, () -> encryptAlgorithm.init(PropertiesBuilder.build(new Property("aes-key-value", "")))); }
public static TraceTransferBean encoderFromContextBean(TraceContext ctx) { if (ctx == null) { return null; } //build message trace of the transferring entity content bean TraceTransferBean transferBean = new TraceTransferBean(); StringBuilder sb = new StringBuilder(25...
@Test public void testEndTrxTraceDataFormatTest() { TraceContext endTrxContext = new TraceContext(); endTrxContext.setTraceType(TraceType.EndTransaction); endTrxContext.setGroupName("PID-test"); endTrxContext.setRegionId("DefaultRegion"); endTrxContext.setTimeStamp(time); ...
public static <K, E> Collector<E, ImmutableSetMultimap.Builder<K, E>, ImmutableSetMultimap<K, E>> unorderedIndex(Function<? super E, K> keyFunction) { return unorderedIndex(keyFunction, Function.identity()); }
@Test public void unorderedIndex_with_valueFunction_parallel_stream() { SetMultimap<String, String> multimap = HUGE_LIST.parallelStream().collect(unorderedIndex(identity(), identity())); assertThat(multimap.keySet()).isEqualTo(HUGE_SET); }
public <T> Map<String, Object> schemas(Class<? extends T> cls) { return this.schemas(cls, false); }
@SuppressWarnings("unchecked") @Test void task() throws URISyntaxException { Helpers.runApplicationContext((applicationContext) -> { JsonSchemaGenerator jsonSchemaGenerator = applicationContext.getBean(JsonSchemaGenerator.class); Map<String, Object> generate = jsonSchemaGenerato...
@Override public List<CodegenColumnDO> getCodegenColumnListByTableId(Long tableId) { return codegenColumnMapper.selectListByTableId(tableId); }
@Test public void testGetCodegenColumnListByTableId() { // mock 数据 CodegenColumnDO column01 = randomPojo(CodegenColumnDO.class); codegenColumnMapper.insert(column01); CodegenColumnDO column02 = randomPojo(CodegenColumnDO.class); codegenColumnMapper.insert(column02); /...
@Override public int getMaxRequestsPerConnection() { return clientConfig.getPropertyAsInteger(MAX_REQUESTS_PER_CONNECTION, DEFAULT_MAX_REQUESTS_PER_CONNECTION); }
@Test void testGetMaxRequestsPerConnectionOverride() { clientConfig.set(MAX_REQUESTS_PER_CONNECTION, 2000); assertEquals(2000, connectionPoolConfig.getMaxRequestsPerConnection()); }
@Override public ResourceReconcileResult tryReconcileClusterResources( TaskManagerResourceInfoProvider taskManagerResourceInfoProvider) { ResourceReconcileResult.Builder builder = ResourceReconcileResult.builder(); List<TaskManagerInfo> taskManagersIdleTimeout = new ArrayList<>(); ...
@Test void testRedundantResourceShouldBeReserved() { final TaskManagerInfo taskManagerInUse = new TestingTaskManagerInfo( DEFAULT_SLOT_RESOURCE.multiply(5), DEFAULT_SLOT_RESOURCE.multiply(2), DEFAULT_SLOT_RESOURCE); ...
public void poll(RequestFuture<?> future) { while (!future.isDone()) poll(time.timer(Long.MAX_VALUE), future); }
@Test public void blockOnlyForRetryBackoffIfNoInflightRequests() { long retryBackoffMs = 100L; NetworkClient mockNetworkClient = mock(NetworkClient.class); ConsumerNetworkClient consumerClient = new ConsumerNetworkClient(new LogContext(), mockNetworkClient, metadata, time, r...
public static Builder route() { return new RouterFunctionBuilder(); }
@Test void and() { HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); RouterFunction<ServerResponse> routerFunction1 = request -> Optional.empty(); RouterFunction<ServerResponse> routerFunction2 = request -> Optional.of(handlerFunction); RouterFunction<ServerResponse> re...
@Operation(summary = "queryProcessDefinitionByCode", description = "QUERY_PROCESS_DEFINITION_BY_CODE_NOTES") @Parameters({ @Parameter(name = "code", description = "PROCESS_DEFINITION_CODE", required = true, schema = @Schema(implementation = long.class, example = "123456789")) }) @GetMapping(valu...
@Test public void testQueryProcessDefinitionByCode() { String locations = "{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}"; long projectCode = 1L; String name = "dag_test"; String description = "desc test"; long code = 1L; ProcessDef...
public ImmutableMap<String, Pipeline> resolvePipelines(PipelineMetricRegistry pipelineMetricRegistry) { final Map<String, Rule> ruleNameMap = resolveRules(); // Read all pipelines and parse them final ImmutableMap.Builder<String, Pipeline> pipelineIdMap = ImmutableMap.builder(); try (fi...
@Test void resolvePipelinesWithMissingRule() { final var registry = PipelineMetricRegistry.create(metricRegistry, Pipeline.class.getName(), Rule.class.getName()); final var resolver = new PipelineResolver( new PipelineRuleParser(new FunctionRegistry(Map.of())), Pipeli...
@Override public Iterator<IndexKeyEntries> getSqlRecordIteratorBatch(@Nonnull Comparable value, boolean descending) { return getSqlRecordIteratorBatch(value, descending, null); }
@Test public void getRecordsUsingExactValueDescending() { var expectedOrder = List.of(7, 4, 1); var actual = store.getSqlRecordIteratorBatch(1, true); assertResult(expectedOrder, actual); }
public void deleteAllCommentsByBoardId(final Long deletedBoardId) { commentRepository.deleteAllByBoardId(deletedBoardId); }
@Test void 댓글을_게시글_id로_모두_제거한다() { // given Comment saved = commentRepository.save(댓글_생성()); // when assertDoesNotThrow(() -> commentService.deleteAllCommentsByBoardId(saved.getBoardId())); // then List<CommentSimpleResponse> result = commentQueryService.findAllComm...
private Namespace(String[] levels) { this.levels = levels; }
@Test public void testNamespace() { String[] levels = {"a", "b", "c", "d"}; Namespace namespace = Namespace.of(levels); assertThat(namespace).isNotNull(); assertThat(namespace.levels()).hasSize(4); assertThat(namespace).hasToString("a.b.c.d"); for (int i = 0; i < levels.length; i++) { as...