focal_method
stringlengths
13
60.9k
test_case
stringlengths
25
109k
public static <T> AvroCoder<T> reflect(TypeDescriptor<T> type) { return reflect((Class<T>) type.getRawType()); }
@Test public void testPojoEncoding() throws Exception { Pojo value = new Pojo("Hello", 42, DATETIME_A); AvroCoder<Pojo> coder = AvroCoder.reflect(Pojo.class); CoderProperties.coderDecodeEncodeEqual(coder, value); }
@Override public ExecuteResult execute(final ServiceContext serviceContext, final ConfiguredKsqlPlan plan, final boolean restoreInProgress) { try { final ExecuteResult result = EngineExecutor .create(primaryContext, serviceContext, plan.getConfig()) .execut...
@Test public void shouldExecuteInsertIntoStream() { // Given: setupKsqlEngineWithSharedRuntimeEnabled(); KsqlEngineTestUtil.execute( serviceContext, ksqlEngine, "create stream bar as select * from orders;", ksqlConfig, Collections.emptyMap() ); // When: ...
public static FlinkJobServerDriver fromParams(String[] args) { return fromConfig(parseArgs(args)); }
@Test(timeout = 30_000) public void testJobServerDriver() throws Exception { FlinkJobServerDriver driver = null; Thread driverThread = null; final PrintStream oldErr = System.err; ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream newErr = new PrintStream(baos); try { ...
@Override public void startAsync() throws Exception { doAction(Executable::startAsync); }
@Test public void shouldStartAll() throws Exception { // When: multiExecutable.startAsync(); // Then: final InOrder inOrder = Mockito.inOrder(executable1, executable2); inOrder.verify(executable1).startAsync(); inOrder.verify(executable2).startAsync(); inOrder.verifyNoMoreInteractions(); ...
@Override public InitialContextFactory createInitialContextFactory(Hashtable<?, ?> environment) throws NamingException { String className = environment != null ? (String) environment.get(Context.INITIAL_CONTEXT_FACTORY) : null; if (className == null) { return new ServerInitialContextFactory(name...
@Test public void testNoIllegalAccessJDKInitialContextFactories() throws NamingException { ServerInitialContextFactoryBuilder builder = new ServerInitialContextFactoryBuilder(); Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory"); ...
Iterator<String> iterator() { if (serverUrls.isEmpty()) { LOGGER.error("[{}] [iterator-serverlist] No server address defined!", name); } return new ServerAddressIterator(serverUrls); }
@Test void testIterator() { List<String> addrs = new ArrayList<>(); String addr = "1.1.1.1:8848"; addrs.add(addr); final ServerListManager mgr = new ServerListManager(addrs, "aaa"); // new iterator final Iterator<String> it = mgr.iterator(); assertTru...
@Override public Row projectColumnsToWrite(Row in) { return partitionIndexes.length == 0 ? in : Row.project(in, nonPartitionIndexes); }
@Test void testProjectColumnsToWrite() { Row projected1 = new RowPartitionComputer( "", new String[] {"f1", "p1", "p2", "f2"}, new String[] {"p1", "p2"}) .projectColumnsToW...
@Override public void sendSmsCode(SmsCodeSendReqDTO reqDTO) { SmsSceneEnum sceneEnum = SmsSceneEnum.getCodeByScene(reqDTO.getScene()); Assert.notNull(sceneEnum, "验证码场景({}) 查找不到配置", reqDTO.getScene()); // 创建验证码 String code = createSmsCode(reqDTO.getMobile(), reqDTO.getScene(), reqDTO....
@Test public void sendSmsCode_tooFast() { // mock 数据 SmsCodeDO smsCodeDO = randomPojo(SmsCodeDO.class, o -> o.setMobile("15601691300").setTodayIndex(1)); smsCodeMapper.insert(smsCodeDO); // 准备参数 SmsCodeSendReqDTO reqDTO = randomPojo(SmsCodeSendReqDTO.class, o ...
@Override public int read() throws IOException { checkStream(); return (read(oneByte, 0, oneByte.length) == -1) ? -1 : (oneByte[0] & 0xff); }
@Test public void testReadBuffer() throws IOException { // 32 buf.length < 52 TEST_STRING.length() byte[] buf = new byte[32]; int bytesToRead = TEST_STRING.length(); int i = 0; while (bytesToRead > 0) { int n = Math.min(bytesToRead, buf.length); int bytesRead = decompressorStream.read(...
public void matches(@Nullable String regex) { checkNotNull(regex); if (actual == null) { failWithActual("expected a string that matches", regex); } else if (!actual.matches(regex)) { if (regex.equals(actual)) { failWithoutActual( fact("expected to match", regex), ...
@Test public void stringMatchesStringFailNull() { expectFailureWhenTestingThat(null).matches(".*aaa.*"); assertFailureValue("expected a string that matches", ".*aaa.*"); }
public static int getLinkCount(File fileName) throws IOException { if (fileName == null) { throw new IOException( "invalid argument to getLinkCount: file name is null"); } if (!fileName.exists()) { throw new FileNotFoundException(fileName + " not found."); } if (supportsHardLi...
@Test public void testGetLinkCount() throws IOException { //at beginning of world, check that source files have link count "1" //since they haven't been hardlinked yet assertEquals(1, getLinkCount(x1)); assertEquals(1, getLinkCount(x2)); assertEquals(1, getLinkCount(x3)); }
@Override public void onMsg(TbContext ctx, TbMsg msg) { JsonObject json = JsonParser.parseString(msg.getData()).getAsJsonObject(); String tmp; if (msg.getOriginator().getEntityType() != EntityType.DEVICE) { ctx.tellFailure(msg, new RuntimeException("Message originator is not a de...
@Test public void givenRequestUUID_whenOnMsg_thenVerifyRequest() { given(ctxMock.getRpcService()).willReturn(rpcServiceMock); given(ctxMock.getTenantId()).willReturn(TENANT_ID); String requestUUID = "b795a241-5a30-48fb-92d5-46b864d47130"; TbMsgMetaData metadata = new TbMsgMetaData()...
@PublicAPI(usage = ACCESS) public static ArchRule testClassesShouldResideInTheSamePackageAsImplementation() { return testClassesShouldResideInTheSamePackageAsImplementation("Test"); }
@Test public void test_class_in_same_package_should_fail_when_test_class_reside_in_different_package_as_implementation() { assertThatRule(testClassesShouldResideInTheSamePackageAsImplementation()) .checking(new ClassFileImporter().importPackagesOf(ImplementationClassWithWrongTestClassPackage...
public static <T> TimeLimiterOperator<T> of(TimeLimiter timeLimiter) { return new TimeLimiterOperator<>(timeLimiter); }
@Test public void doNotTimeoutUsingFlux() { given(timeLimiter.getTimeLimiterConfig()) .willReturn(toConfig(Duration.ofMinutes(1))); Flux<?> flux = Flux.interval(Duration.ofMillis(1), Schedulers.single()) .take(2) .transformDeferred(TimeLimiterOperator.of(timeLimi...
public <E extends Enum<E>> void logControlSessionStateChange( final E oldState, final E newState, final long controlSessionId) { final int length = sessionStateChangeLength(oldState, newState); final int captureLength = captureLength(length); final int encodedLength =...
@Test void logControlSessionStateChange() { final int offset = ALIGNMENT * 4; logBuffer.putLong(CAPACITY + TAIL_POSITION_OFFSET, offset); final ChronoUnit from = ChronoUnit.CENTURIES; final ChronoUnit to = ChronoUnit.MICROS; final long id = 555_000_000_000L; final...
@Override public void start() throws Exception { if (!state.compareAndSet(State.LATENT, State.STARTED)) { throw new IllegalStateException(); } try { client.create().creatingParentContainersIfNeeded().forPath(queuePath); } catch (KeeperException.NodeExistsExce...
@Test public void testSafetyWithCrash() throws Exception { final int itemQty = 100; DistributedQueue<TestQueueItem> producerQueue = null; DistributedQueue<TestQueueItem> consumerQueue1 = null; DistributedQueue<TestQueueItem> consumerQueue2 = null; CuratorFramework producerC...
@Override @Nullable public byte[] readByteArray(@Nonnull String fieldName) throws IOException { return readIncompatibleField(fieldName, BYTE_ARRAY, super::readByteArray); }
@Test(expected = IncompatibleClassChangeError.class) public void testReadLongArray_IncompatibleClass() throws Exception { reader.readByteArray("byte"); }
@Override public KTable<Windowed<K>, V> aggregate(final Initializer<V> initializer) { return aggregate(initializer, Materialized.with(null, null)); }
@Test public void timeWindowAggregateManyWindowsTest() { final KTable<Windowed<String>, String> customers = groupedStream.cogroup(MockAggregator.TOSTRING_ADDER) .windowedBy(TimeWindows.of(ofMillis(500L))).aggregate( MockInitializer.STRING_INIT, Materialized.with(Serd...
public String getActualFilePath() { return this.actualFilePath; }
@Test public void testGetActualFilePath() { Dependency instance = new Dependency(); String expResult = "file.tar"; instance.setSha1sum("non-null value"); instance.setActualFilePath(expResult); String result = instance.getActualFilePath(); assertEquals(expResult, resul...
@Override public JooqEndpoint getEndpoint() { return (JooqEndpoint) super.getEndpoint(); }
@Test public void testConsumerNoDelete() throws InterruptedException { MockEndpoint mockResult = getMockEndpoint("mock:resultBookStoreRecord"); MockEndpoint mockInserted = getMockEndpoint("mock:insertedBookStoreRecord"); mockResult.expectedMessageCount(1); mockInserted.expectedMessag...
@Override public boolean requiresCleanupOfRecoverableState() { // we can't clean up any state prior to commit // see discussion: https://github.com/apache/flink/pull/15599#discussion_r623127365 return false; }
@Test public void testRequiresCleanupOfRecoverableState() { assertFalse(writer.requiresCleanupOfRecoverableState()); }
public String csv(String text) { if (text == null || text.isEmpty()) { return "\"\""; } final String str = text.trim().replace("\n", " "); if (str.trim().length() == 0) { return "\"\""; } return StringEscapeUtils.escapeCsv(str); }
@Test public void testCsv() { String text = null; EscapeTool instance = new EscapeTool(); String expResult = "\"\""; String result = instance.csv(text); assertEquals(expResult, result); text = ""; expResult = "\"\""; result = instance.csv(text); ...
protected long parseTimestamp(final String timestamp) { if(null == timestamp) { return -1; } try { final Date parsed = new MDTMSecondsDateFormatter().parse(timestamp); return parsed.getTime(); } catch(InvalidDateException e) { log.w...
@Test public void testParseTimestampInvalid() { final long time = new FTPMlsdListResponseReader().parseTimestamp("2013"); assertEquals(-1L, time); }
public Map<String, String> getPropertiesWithPrefix(String prefix) { return getPropertiesWithPrefix(prefix, false); }
@Test public void testGetPropertiesWithFullyQualifiedName() { ConfigurationProperties configurationProperties = new ConfigurationProperties(PROPERTIES); Map<String, String> props = configurationProperties .getPropertiesWithPrefix("root.1.2", true); Assert.assertEquals(4, props.size()); ...
public List<CompactionTask> produce() { // get all CF files sorted by key range start (L1+) List<SstFileMetaData> sstSortedByCfAndStartingKeys = metadataSupplier.get().stream() .filter(l -> l.level() > 0) // let RocksDB deal with L0 .sorte...
@Test void testMaxParallelCompactions() { assertThat( produce( configBuilder() .setMaxFilesToCompact(1) .setMaxParallelCompactions(2) ...
public FEELFnResult<Boolean> invoke(@ParameterName("list") List list) { if (list == null) { return FEELFnResult.ofResult(false); } boolean result = false; for (final Object element : list) { if (element != null && !(element instanceof Boolean)) { r...
@Test void invokeBooleanParamFalse() { FunctionTestUtil.assertResult(anyFunction.invoke(false), false); }
@Override public double getMean() { if (values.length == 0) { return 0; } double sum = 0; for (long value : values) { sum += value; } return sum / values.length; }
@Test public void calculatesTheMeanValue() throws Exception { assertThat(snapshot.getMean()) .isEqualTo(3.0); }
public static void free(final DirectBuffer buffer) { if (null != buffer) { free(buffer.byteBuffer()); } }
@Test void freeIsANoOpIfDirectBufferIsNull() { BufferUtil.free((DirectBuffer)null); }
public ClusterStateBundle.FeedBlock inferContentClusterFeedBlockOrNull(ContentCluster cluster) { if (!feedBlockEnabled) { return null; } var nodeInfos = cluster.getNodeInfos(); var exhaustions = enumerateNodeResourceExhaustionsAcrossAllNodes(nodeInfos); if (exhaustion...
@Test void missing_or_malformed_rpc_addresses_are_emitted_as_unknown_hostnames() { var calc = new ResourceExhaustionCalculator(true, mapOf(usage("disk", 0.5), usage("memory", 0.8))); var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", 0.51), usage("memory", 0.79)), forN...
@Override public void update(Observable o, Object arg) { if (!(o instanceof NodeListener)) { return; } if (arg == null || !(arg instanceof NodeEvent[])) { return; } NodeEvent[] events = (NodeEvent[]) arg; if (events.length <= 0) { ...
@Test public void testUpdate_onlyOneLeftToRemove() { haDataSource.getDataSourceMap().put("foo", new MockDataSource("foo")); NodeEvent event = new NodeEvent(); event.setNodeName("foo"); event.setType(NodeEventTypeEnum.DELETE); updater.update(new FileNodeListener(), new NodeE...
@Override public Integer doCall() throws Exception { JsonObject pluginConfig = loadConfig(); JsonObject plugins = pluginConfig.getMap("plugins"); Optional<PluginType> camelPlugin = PluginType.findByName(name); if (camelPlugin.isPresent()) { if (command == null) { ...
@Test public void shouldGenerateProperties() throws Exception { PluginAdd command = new PluginAdd(new CamelJBangMain().withPrinter(printer)); command.name = "foo"; command.doCall(); Assertions.assertEquals("", printer.getOutput()); Assertions.assertEquals("{\"plugins\":{\"f...
@Around(CLIENT_INTERFACE_BATCH_REMOVE_CONFIG) public Object removeConfigByIdsAround(ProceedingJoinPoint pjp, HttpServletRequest request, List<Long> ids) throws Throwable { final ConfigChangePointCutTypes configChangePointCutType = ConfigChangePointCutTypes.REMOVE_BATCH_HTTP; final List<C...
@Test void testRemoveConfigByIdsAround() throws Throwable { Mockito.when(configChangePluginService.executeType()).thenReturn(ConfigChangeExecuteTypes.EXECUTE_AFTER_TYPE); ProceedingJoinPoint proceedingJoinPoint = Mockito.mock(ProceedingJoinPoint.class); HttpServletRequest request = Mockito.m...
@Override public Table getTable(String dbName, String tblName) { if (metastore.isPresent()) { return metastore.get().getTable(dbName, tblName); } String fullTableName = getKuduFullTableName(dbName, tblName); try { if (!kuduClient.tableExists(fullTableName)) { ...
@Test public void testGetTable(@Mocked org.apache.kudu.client.KuduTable mockedTable) throws KuduException { KuduMetadata metadata = new KuduMetadata(KUDU_CATALOG, new HdfsEnvironment(), KUDU_MASTER, true, SCHEMA_EMULATION_PREFIX, Optional.empty()); new Expectations() { { ...
@Override public DataType getType() { return DataType.META_DATA; }
@Test public void testGetType() { DataType expected = DataType.META_DATA; DataType actual = executorSubscriber.getType(); assertEquals(expected, actual); }
public boolean isValid(String value) { if (value == null) { return false; } URI uri; // ensure value is a valid URI try { uri = new URI(value); } catch (URISyntaxException e) { return false; } // OK, perfom additional validatio...
@Test public void testValidator290() { UrlValidator validator = new UrlValidator(); assertTrue(validator.isValid("http://xn--h1acbxfam.idn.icann.org/")); // assertTrue(validator.isValid("http://xn--e1afmkfd.xn--80akhbyknj4f")); // Internationalized country code top-level domains ...
public static void smooth(PointList pointList, double maxElevationDelta) { internSmooth(pointList, 0, pointList.size() - 1, maxElevationDelta); }
@Test public void smoothRamer2() { PointList pl2 = new PointList(3, true); pl2.add(0.001, 0.001, 50); pl2.add(0.0015, 0.0015, 160); pl2.add(0.0016, 0.0015, 150); pl2.add(0.0017, 0.0015, 220); pl2.add(0.002, 0.002, 20); EdgeElevationSmoothingRamer.smooth(pl2, 1...
public static PDImageXObject createFromFile(PDDocument document, File file) throws IOException { return createFromFile(document, file, 0); }
@Test void testCreateFromFileNumberLock() throws IOException { // copy the source file to a temp directory, as we will be deleting it String tiffG3Path = "src/test/resources/org/apache/pdfbox/pdmodel/graphics/image/ccittg3.tif"; File copiedTiffFile = new File(TESTRESULTSDIR, "ccittg3n.ti...
@Override synchronized public void close() { if (stream != null) { IOUtils.cleanupWithLogger(LOG, stream); stream = null; } }
@Test(timeout=120000) public void testRandomBytes() throws Exception { OsSecureRandom random = getOsSecureRandom(); // len = 16 checkRandomBytes(random, 16); // len = 32 checkRandomBytes(random, 32); // len = 128 checkRandomBytes(random, 128); // len = 256 checkRandomBytes(random, ...
public static RunResponse from(WorkflowInstance instance, int state) { return RunResponse.builder() .workflowId(instance.getWorkflowId()) .workflowVersionId(instance.getWorkflowVersionId()) .workflowInstanceId(instance.getWorkflowInstanceId()) .workflowRunId(instance.getWorkflowRunId...
@Test public void testBuildFromStepId() { RunResponse res = RunResponse.from(instance, "foo"); Assert.assertEquals(RunResponse.Status.DELEGATED, res.getStatus()); res = RunResponse.from(instance, null); Assert.assertEquals(RunResponse.Status.NON_TERMINAL_ERROR, res.getStatus()); }
@Override @CheckForNull public EmailMessage format(Notification notification) { if (!BuiltInQPChangeNotification.TYPE.equals(notification.getType())) { return null; } BuiltInQPChangeNotificationBuilder profilesNotification = parse(notification); StringBuilder message = new StringBuilder("The ...
@Test public void notification_contains_count_of_removed_rules() { String profileName = newProfileName(); String languageKey = newLanguageKey(); String languageName = newLanguageName(); BuiltInQPChangeNotificationBuilder notification = new BuiltInQPChangeNotificationBuilder() .addProfile(Profile...
@Converter(fallback = true) public static <T> T convertTo(Class<T> type, Exchange exchange, Object value, TypeConverterRegistry registry) { if (NodeInfo.class.isAssignableFrom(value.getClass())) { // use a fallback type converter so we can convert the embedded body if the value is NodeInfo ...
@Test public void convertToDOMSource() { DOMSource source = context.getTypeConverter().convertTo(DOMSource.class, exchange, doc); assertNotNull(source); String string = context.getTypeConverter().convertTo(String.class, exchange, source); assertEquals(CONTENT, string); }
static < RequestT, ResponseT, CallerSetupTeardownT extends Caller<RequestT, ResponseT> & SetupTeardown> Call<RequestT, ResponseT> ofCallerAndSetupTeardown( CallerSetupTeardownT implementsCallerAndSetupTeardown, Coder<ResponseT> responseTCoder) { implementsCallerAndSetup...
@Test public void givenSetupTeardownNotSerializable_throwsError() { assertThrows( IllegalArgumentException.class, () -> Call.ofCallerAndSetupTeardown( new UnSerializableCallerWithSetupTeardown(), NON_DETERMINISTIC_RESPONSE_CODER)); }
@Override public String getServletInfo() { return SERVLET_NAME; }
@Test public void getServletInfo_shouldReturnOwnDefinedServletName() { ApiV2Servlet underTest = new ApiV2Servlet(); assertThat(underTest.getServletInfo()) .isEqualTo(ApiV2Servlet.SERVLET_NAME); }
@Override public void createNode(OpenstackNode osNode) { checkNotNull(osNode, ERR_NULL_NODE); OpenstackNode updatedNode; if (osNode.intgBridge() == null && osNode.type() != CONTROLLER) { String deviceIdStr = genDpid(deviceIdCounter.incrementAndGet()); checkNotNull(d...
@Test(expected = IllegalArgumentException.class) public void testCreateDuplicateNode() { target.createNode(COMPUTE_1); target.createNode(COMPUTE_1); }
public static Builder forPage(int page) { return new Builder(page); }
@Test void forPage_fails_with_IAE_if_page_is_0() { assertThatThrownBy(() -> forPage(0)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("page index must be >= 1"); }
public static int scanForGap( final UnsafeBuffer termBuffer, final int termId, final int termOffset, final int limitOffset, final GapHandler handler) { int offset = termOffset; do { final int frameLength = frameLengthVolatile(termBuffer, of...
@Test void shouldReportNoGapWhenHwmIsInPadding() { final int paddingLength = align(HEADER_LENGTH, FRAME_ALIGNMENT) * 2; final int tail = LOG_BUFFER_CAPACITY - paddingLength; final int highWaterMark = LOG_BUFFER_CAPACITY - paddingLength + HEADER_LENGTH; when(termBuffer.getIntVola...
@Override public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) { ObjectUtil.checkNotNull(command, "command"); ObjectUtil.checkNotNull(unit, "unit"); if (initialDelay < 0) { throw new IllegalArgumentException( ...
@Test public void testScheduleAtFixedRateRunnableNegative() { final TestScheduledEventExecutor executor = new TestScheduledEventExecutor(); assertThrows(IllegalArgumentException.class, new Executable() { @Override public void execute() { executor.scheduleAtFix...
@Override public Map<ExecutionAttemptID, ExecutionSlotAssignment> allocateSlotsFor( List<ExecutionAttemptID> executionAttemptIds) { final Map<ExecutionVertexID, ExecutionAttemptID> vertexIdToExecutionId = new HashMap<>(); executionAttemptIds.forEach( executionId -> ...
@Test void testSchedulePendingRequestBulkTimeoutCheck() { TestingPhysicalSlotRequestBulkChecker bulkChecker = new TestingPhysicalSlotRequestBulkChecker(); AllocationContext context = createBulkCheckerContextWithEv12GroupAndEv3Group(bulkChecker); context.allocateSlotsFor(EV1,...
@SuppressWarnings("MethodLength") static void dissectControlRequest( final ArchiveEventCode eventCode, final MutableDirectBuffer buffer, final int offset, final StringBuilder builder) { int encodedLength = dissectLogHeader(CONTEXT, eventCode, buffer, offset, builder); ...
@Test void controlRequestStopPosition() { internalEncodeLogHeader(buffer, 0, 12, 32, () -> 10_000_000_000L); final StopPositionRequestEncoder requestEncoder = new StopPositionRequestEncoder(); requestEncoder.wrapAndApplyHeader(buffer, LOG_HEADER_LENGTH, headerEncoder) .contro...
public <T extends Tuple> DataSource<T> tupleType(Class<T> targetType) { Preconditions.checkNotNull(targetType, "The target type class must not be null."); if (!Tuple.class.isAssignableFrom(targetType)) { throw new IllegalArgumentException( "The target type must be a subcl...
@Test void testFieldTypes() { CsvReader reader = getCsvReader(); DataSource<Item> items = reader.tupleType(Item.class); TypeInformation<?> info = items.getType(); if (!info.isTupleType()) { fail(""); } else { TupleTypeInfo<?> tinfo = (TupleTypeInfo<?>...
@Override public boolean remove(String key) { repo.lock(key); try { return repo.remove(key) != null; } finally { repo.unlock(key); } }
@Test public void testRemove() throws Exception { // ADD key to remove assertTrue(repo.add(key01)); assertTrue(repo.add(key02)); assertEquals(2, cache.size()); // CLEAR repo repo.clear(); assertEquals(0, cache.size()); }
@Override public boolean equals(Object obj) { if (obj instanceof COSString) { COSString strObj = (COSString) obj; return getString().equals(strObj.getString()) && forceHexForm == strObj.forceHexForm; } return false; }
@Test void testEquals() { // Check all these several times for consistency for (int i = 0; i < 10; i++) { // Reflexive COSString x1 = new COSString("Test"); assertEquals(x1, x1); // Symmetry i.e. if x == y then y == x COSString...
public static boolean match(String pattern, String string) { assertSingleByte(string); return match(pattern.getBytes(StandardCharsets.US_ASCII), string.getBytes(StandardCharsets.US_ASCII)); }
@Test public void testValidInputBytes() { assertFalse(GlobMatcher.match(new byte[] { 'a', '*', 'b'}, new byte[] { 'a', 'a', 'a' })); assertTrue(GlobMatcher.match(new byte[] { 'a', '*', 'b'}, new byte[] { 'a', 'a', 'a', 'b' })); assertTrue(GlobMatcher.match(new byte[] { 'a', '*', '[', '0', '-', '9',...
@OnlyForTest Future<Message> getHeartbeatInFly() { return this.heartbeatInFly; }
@Test public void testSetErrorTimeout() throws Exception { final Replicator r = getReplicator(); this.id.unlock(); assertNull(r.getHeartbeatInFly()); final RpcRequests.AppendEntriesRequest request = createEmptyEntriesRequest(true); Mockito.when( this.rpcService.ap...
@VisibleForTesting List<KeyValue<String, Object>> buildTemplateParams(SmsTemplateDO template, Map<String, Object> templateParams) { return template.getParams().stream().map(key -> { Object value = templateParams.get(key); if (value == null) { throw exception(SMS_SEND_...
@Test public void testBuildTemplateParams_paramMiss() { // 准备参数 SmsTemplateDO template = randomPojo(SmsTemplateDO.class, o -> o.setParams(Lists.newArrayList("code"))); Map<String, Object> templateParams = new HashMap<>(); // mock 方法 // 调用,并断言异常 assert...
static Optional<String> globalResponseError(Optional<ClientResponse> response) { if (!response.isPresent()) { return Optional.of("Timeout"); } if (response.get().authenticationException() != null) { return Optional.of("AuthenticationException"); } if (resp...
@Test public void testNoGlobalResponseError() { assertEquals(Optional.empty(), AssignmentsManager.globalResponseError(Optional.of( new ClientResponse(null, null, "", 0, 0, false, null, null, new AssignReplicasToDirsResponse( new AssignR...
@Override public CompletableFuture<Void> relinquishMastership(DeviceId deviceId) { checkPermission(CLUSTER_WRITE); return store.relinquishRole(localNodeId, deviceId) .thenAccept(this::post) .thenApply(v -> null); }
@Test public void relinquishMastership() { //no backups - should just turn to NONE for device. mgr.setRole(NID_LOCAL, DEV_MASTER, MASTER); assertEquals("wrong role:", MASTER, mgr.getLocalRole(DEV_MASTER)); mgr.relinquishMastership(DEV_MASTER); assertNull("wrong master:", mgr....
@Override public boolean dropTable(TableIdentifier identifier, boolean purge) { if (!tableExists(identifier)) { return false; } EcsURI tableObjectURI = tableURI(identifier); if (purge) { // if re-use the same instance, current() will throw exception. TableOperations ops = newTableOp...
@Test public void testDropTable() { ecsCatalog.createTable(TableIdentifier.of("a"), SCHEMA); assertThat(ecsCatalog.dropTable(TableIdentifier.of("unknown"))) .as("Drop an unknown table return false") .isFalse(); assertThat(ecsCatalog.dropTable(TableIdentifier.of("a"), true)).as("Drop a ta...
public void registerDelaySuppliers(String tableName, String segmentName, String columnName, int partition, Supplier<Integer> numDocsDelaySupplier, Supplier<Long> timeMsDelaySupplier) { _lock.lock(); try { TableDelay tableDelay = _tableToPartitionToDelayMs.getOrDefault(tableName, new TableDelay(table...
@Test public void testEmitsMaxDelayPerPartition() { _realtimeLuceneIndexingDelayTracker.registerDelaySuppliers("table1", "segment1", "column1", 1, () -> 10, () -> 20L); _realtimeLuceneIndexingDelayTracker.registerDelaySuppliers("table1", "segment2", "column1", 1, () -> 5, () -> 15L); _realtimeLuceneIndexi...
public boolean overlaps(final BoundingBox pBoundingBox, double pZoom) { //FIXME this is a total hack but it works around a number of issues related to vertical map //replication and horiztonal replication that can cause polygons to completely disappear when //panning if (pZoom < 3) ...
@Test public void testNorthernBoundsSimple() { //item's southern bounds of itemis just out of view BoundingBox view = new BoundingBox(2, 2, -2, -2); BoundingBox item = new BoundingBox(2.1, 2, 0, -2); Assert.assertTrue(view.overlaps(item, 4)); item = new BoundingBox(2.1, 2,...
@Override public List<Set<TopicPartition>> assignPartitions(Cluster cluster, int numMetricFetchers) { if (numMetricFetchers != SUPPORTED_NUM_METRIC_FETCHER) { throw new IllegalArgumentException("DefaultMetricSamplerPartitionAssignor supports only a single metric fetcher."); } // Create an array to h...
@Test public void testAssignment() { int maxNumPartitionsForTopic = -1; int totalNumPartitions = 0; // Prepare the metadata Set<PartitionInfo> partitions = new HashSet<>(); for (int i = 0; i < NUM_TOPICS; i++) { // Random number of partitions ranging from 4 to 400 int randomNumPartitio...
@NonNull @Override public EncodeStrategy getEncodeStrategy(@NonNull Options options) { Boolean encodeTransformation = options.get(ENCODE_TRANSFORMATION); return encodeTransformation != null && encodeTransformation ? EncodeStrategy.TRANSFORMED : EncodeStrategy.SOURCE; }
@Test public void testEncodeStrategy_withEncodeTransformationTrue_returnsTransformed() { assertThat(encoder.getEncodeStrategy(options)).isEqualTo(EncodeStrategy.TRANSFORMED); }
@PublicAPI(usage = ACCESS, state = EXPERIMENTAL) public static CreatorByRootClass defineByRootClasses(Predicate<? super JavaClass> rootClassPredicate) { return CreatorByRootClass.from(rootClassPredicate); }
@Test public void rejects_overlapping_modules_by_root_classes() { JavaClasses invalidExamples = new ClassFileImporter().importPackages(getExamplePackage("invalid")); assertThatThrownBy( () -> ArchModules .defineByRootClasses(javaClass -> javaClass.getSimpleNa...
@Override public ValidationResult responseMessageForIsRepositoryConfigurationValid(String responseBody) { return jsonResultMessageHandler.toValidationResult(responseBody); }
@Test public void shouldBuildSuccessValidationResultFromCheckRepositoryConfigurationValidResponse() throws Exception { assertThat(messageHandler.responseMessageForIsRepositoryConfigurationValid("").isSuccessful(), is(true)); assertThat(messageHandler.responseMessageForIsRepositoryConfigurationValid(...
public static ConfigDefinitionKey parseConfigName(Element configE) { if (!configE.getNodeName().equals("config")) { throw new IllegalArgumentException("The root element must be 'config', but was '" + configE.getNodeName() + "'"); } if (!configE.hasAttribute("name")) { th...
@Test void testNameParsing() { Element configRoot = getDocument(new StringReader("<config name=\"test.function-test\" version=\"1\">" + "<int_val>1</int_val> +" + "</config>")); ConfigDefinitionKey key = DomConfigPayloadBuilder.parseConfigName(configRoot); ass...
@Override public Multimap<String, String> findBundlesForUnloading(final LoadData loadData, final ServiceConfiguration conf) { selectedBundlesCache.clear(); Map<String, BrokerData> brokersData = loadData.getBrokerData(); Map<String, BundleData> loadBundleData = loadData.getBundleDataForLoadSh...
@Test public void testOverloadBrokerSelect() { conf.setMaxUnloadBundleNumPerShedding(1); conf.setMaxUnloadPercentage(0.5); int numBrokers = 5; int numBundles = 5; LoadData loadData = new LoadData(); LocalBrokerData[] localBrokerDatas = new LocalBrokerData[]{ ...
private <T> RestResponse<T> get(final String path, final Class<T> type) { return executeRequestSync(HttpMethod.GET, path, null, r -> deserialize(r.getBody(), type), Optional.empty()); }
@Test public void shouldPostQueryRequest_chunkHandler_closeEarly() { ksqlTarget = new KsqlTarget(httpClient, socketAddress, localProperties, authHeader, HOST, Collections.emptyMap(), RequestOptions.DEFAULT_TIMEOUT); executor.submit(this::expectPostQueryRequestChunkHandler); assertThatEventually(r...
@Override public void init(DatabaseMetaData metaData) throws SQLException { checkState(!initialized, "onInit() must be called once"); Version version = checkDbVersion(metaData, MIN_SUPPORTED_VERSION); supportsNullNotDistinct = version.compareTo(MIN_NULL_NOT_DISTINCT_VERSION) >= 0; initialized = tru...
@Test void init_throws_ISE_if_called_twice() throws Exception { DatabaseMetaData metaData = newMetadata(11, 0); underTest.init(metaData); assertThatThrownBy(() -> underTest.init(metaData)) .isInstanceOf(IllegalStateException.class) .hasMessage("onInit() must be called once"); }
public void execute(int[] bytecode) { for (var i = 0; i < bytecode.length; i++) { Instruction instruction = Instruction.getInstruction(bytecode[i]); switch (instruction) { case LITERAL: // Read the next byte from the bytecode. int value = bytecode[++i]; // Push the ...
@Test void testPlaySound() { var wizardNumber = 0; var bytecode = new int[3]; bytecode[0] = LITERAL.getIntValue(); bytecode[1] = wizardNumber; bytecode[2] = PLAY_SOUND.getIntValue(); var vm = new VirtualMachine(); vm.execute(bytecode); assertEquals(0, vm.getStack().size()); asser...
@Override public ObjectNode encode(RemoteMepEntry remoteMepEntry, CodecContext context) { checkNotNull(remoteMepEntry, "Mep cannot be null"); ObjectNode result = context.mapper().createObjectNode() .put("remoteMepId", remoteMepEntry.remoteMepId().toString()) .put("rem...
@Test public void testEncodeRemoteMepEntryCodecContext() { ObjectNode node = mapper.createObjectNode(); node.set("remoteMep", context.codec(RemoteMepEntry.class) .encode(remoteMep1, context)); assertEquals(10, node.get("remoteMep").get("remoteMepId").asInt()); }
@Override public void register(Component component) { checkComponent(component); checkArgument(component.getType() == Component.Type.FILE, "component must be a file"); checkState(analysisMetadataHolder.isPullRequest() || !analysisMetadataHolder.isFirstAnalysis(), "No file can be registered on first branch...
@Test @UseDataProvider("anyTypeButFile") public void register_fails_with_IAE_if_component_is_not_a_file(Component.Type anyTypeButFile) { Component component = newComponent(anyTypeButFile); assertThatThrownBy(() -> underTest.register(component)) .isInstanceOf(IllegalArgumentException.class) .has...
@Override public Collection<LocalDataQueryResultRow> getRows(final ShowSQLParserRuleStatement sqlStatement, final ContextManager contextManager) { SQLParserRuleConfiguration ruleConfig = rule.getConfiguration(); return Collections.singleton(new LocalDataQueryResultRow(null != ruleConfig.getParseTree...
@Test void assertSQLParserRule() throws SQLException { engine.executeQuery(); Collection<LocalDataQueryResultRow> actual = engine.getRows(); assertThat(actual.size(), is(1)); Iterator<LocalDataQueryResultRow> iterator = actual.iterator(); LocalDataQueryResultRow row = iterato...
public static String addCspHeadersWithNonceToResponse(HttpResponse httpResponse) { final String nonce = getNonce(); List<String> cspPolicies = List.of( "default-src 'self'", "base-uri 'none'", "connect-src 'self' http: https:", "font-src 'self' data:;" + "img-src * data: blob:", ...
@Test public void addCspHeadersWithNonceToResponse_whenCalled_shouldAddNonceToCspHeaders() { HttpResponse httpServletResponse = mock(HttpResponse.class); String nonce = addCspHeadersWithNonceToResponse(httpServletResponse); verify(httpServletResponse).setHeader(eq("Content-Security-Policy"), contains("s...
public double[][] test(DataFrame data) { DataFrame x = formula.x(data); int n = x.nrow(); int ntrees = trees.length; double[][] prediction = new double[ntrees][n]; for (int j = 0; j < n; j++) { Tuple xj = x.get(j); double base = b; for (int i...
@Test public void testAileronsLAD() { test(Loss.lad(), "ailerons", Ailerons.formula, Ailerons.data, 0.0002); }
public static MySQLCommandPacket newInstance(final MySQLCommandPacketType commandPacketType, final MySQLPacketPayload payload, final ConnectionSession connectionSession) { switch (commandPacketType) { case COM_QUIT: return new MySQLCom...
@Test void assertNewInstanceWithComStmtExecutePacket() { when(payload.readInt1()).thenReturn(MySQLNewParametersBoundFlag.PARAMETER_TYPE_EXIST.getValue()); when(payload.readInt4()).thenReturn(1); when(payload.getByteBuf().getIntLE(anyInt())).thenReturn(1); ServerPreparedStatementRegis...
@VisibleForTesting static int combinationCount(int arrayLength, int combinationLength) { try { /* * Then combinationCount(n, k) = combinationCount(n-1, k-1) * n/k (https://en.wikipedia.org/wiki/Combination#Number_of_k-combinations) * The formula is recursive. Here, ...
@Test public void testCombinationCount() { for (int n = 0; n < 5; n++) { for (int k = 0; k <= n; k++) { assertEquals(combinationCount(n, k), factorial(n) / factorial(n - k) / factorial(k)); } } assertEquals(combinationCount(42, 7), 26978328); ...
@Override public AppResponse process(Flow flow, AppRequest body) { Map<String, String> registration = digidClient.pollLetter(appSession.getAccountId(), appSession.getRegistrationId(), flow.getName().equals(ReApplyActivateActivationCode.NAME)); if (registration.get(lowerUnderscore(GBA_STATUS)).equal...
@Test void processStatusRequest(){ when(digidClientMock.pollLetter(mockedAppSession.getAccountId(), mockedAppSession.getRegistrationId(), false)).thenReturn(gbaStatusResponseRequest); AppResponse appResponse = letterPolling.process(mockedFlow, mockedAbstractAppRequest); assertTrue(appRespo...
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (this.connectionId == null ? 0 : this.connectionId.hashCode()); result = prime * result + (this.host == null ? 0 : this.host.hashCode()); result = prime * result + this.port; ...
@Test public void testEqual2() { ConnectionId id1 = new ConnectionId("host", 1202, "id"); ConnectionId id2 = new ConnectionId("host", 1202, "id"); assertEquals(id1.hashCode(), id2.hashCode(), "Hash code must be equal"); }
public static Map<String, AdvertisedListener> validateAndAnalysisAdvertisedListener(ServiceConfiguration config) { if (StringUtils.isBlank(config.getAdvertisedListeners())) { return Collections.emptyMap(); } Optional<String> firstListenerName = Optional.empty(); Map<String, L...
@Test(expectedExceptions = IllegalArgumentException.class) public void testDifferentListenerWithSameHostPort() { ServiceConfiguration config = new ServiceConfiguration(); config.setAdvertisedListeners(" internal:pulsar://127.0.0.1:6660," + " external:pulsar://127.0.0.1:6660"); config.setInte...
@Override public JreInfoRestResponse getJreMetadata(String id) { return Optional.ofNullable(metadata.get(id)) .orElseThrow(() -> new NotFoundException("JRE not found for id: " + id)); }
@Test void getJreMetadata_shouldFail_whenJreNotFound() { assertThatThrownBy(() -> jresHandler.getJreMetadata("4")) .isInstanceOf(NotFoundException.class) .hasMessage("JRE not found for id: 4"); }
public int computeThreshold(StreamConfig streamConfig, CommittingSegmentDescriptor committingSegmentDescriptor, @Nullable SegmentZKMetadata committingSegmentZKMetadata, String newSegmentName) { long desiredSegmentSizeBytes = streamConfig.getFlushThresholdSegmentSizeBytes(); if (desiredSegmentSizeBytes <= ...
@Test public void testUseLastSegmentsThresholdIfSegmentIsCommittingDueToForceCommit() { long committingSegmentSizeBytes = 500_000L; int committingSegmentSizeThreshold = 25_000; SegmentFlushThresholdComputer computer = new SegmentFlushThresholdComputer(); CommittingSegmentDescriptor committingSegmentD...
public static long computeStartOfNextMinute(long now) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date(now)); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.SECOND, 0); cal.add(Calendar.MINUTE, 1); return cal.getTime().getTime(); }
@Test public void testMinute() { // Mon Nov 20 18:05:17,522 CET 2006 long now = 1164042317522L; // Mon Nov 20 18:06:00 CET 2006 long expected = 1164042360000L; long computed = TimeUtil.computeStartOfNextMinute(now); Assertions.assertEquals(expected - now, 1000 * 42 +...
@Override public int partition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes, Cluster cluster) { int nextValue = nextValue(topic); List<PartitionInfo> availablePartitions = cluster.availablePartitionsForTopic(topic); if (!availablePartitions.isEmpty()) { ...
@Test public void testRoundRobinWithNullKeyBytes() { final String topicA = "topicA"; final String topicB = "topicB"; List<PartitionInfo> allPartitions = asList(new PartitionInfo(topicA, 0, NODES[0], NODES, NODES), new PartitionInfo(topicA, 1, NODES[1], NODES, NODES), new Par...
@VisibleForTesting static StreamExecutionEnvironment createStreamExecutionEnvironment(FlinkPipelineOptions options) { return createStreamExecutionEnvironment( options, MoreObjects.firstNonNull(options.getFilesToStage(), Collections.emptyList()), options.getFlinkConfDir()); }
@Test public void shouldAcceptExplicitlySetIdleSourcesFlagWithoutCheckpointing() { // Checkpointing disabled, accept flag FlinkPipelineOptions options = getDefaultPipelineOptions(); options.setShutdownSourcesAfterIdleMs(42L); FlinkExecutionEnvironments.createStreamExecutionEnvironment(options); as...
@Override public Collection<LocalDataQueryResultRow> getRows(final ExportStorageNodesStatement sqlStatement, final ContextManager contextManager) { checkSQLStatement(contextManager.getMetaDataContexts().getMetaData(), sqlStatement); String exportedData = generateExportData(contextManager.getMetaData...
@Test void assertExecuteWithDatabaseName() { when(database.getName()).thenReturn("normal_db"); Map<String, StorageUnit> storageUnits = createStorageUnits(); when(database.getResourceMetaData().getStorageUnits()).thenReturn(storageUnits); when(database.getRuleMetaData().getConfigurati...
public FEELFnResult<TemporalAmount> invoke(@ParameterName("from") Temporal from, @ParameterName("to") Temporal to) { if ( from == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "from", "cannot be null")); } if ( to == null ) { return FEELF...
@Test void invokeYearLocalDate() { FunctionTestUtil.assertResult( yamFunction.invoke(LocalDate.of(2017, 6, 12), Year.of(2020)), ComparablePeriod.of(2, 6, 0)); }
@Override public int compareTo(DateTimeStamp dateTimeStamp) { return comparator.compare(this,dateTimeStamp); }
@Test void testCompareEqualsTimeStamp() { DateTimeStamp object1 = new DateTimeStamp("2018-04-04T10:10:00.586-0100", 123); DateTimeStamp object2 = new DateTimeStamp("2018-04-04T10:10:00.586-0100", 123); assertEquals(0, object2.compareTo(object1)); }
public static Sensor processRateSensor(final String threadId, final StreamsMetricsImpl streamsMetrics) { final Sensor sensor = streamsMetrics.threadLevelSensor(threadId, PROCESS + RATE_SUFFIX, RecordingLevel.INFO); final Map<String, String> tagMap =...
@Test public void shouldGetProcessRateSensor() { final String operation = "process"; final String operationRate = "process" + RATE_SUFFIX; final String totalDescription = "The total number of calls to process"; final String rateDescription = "The average per-second number of calls to...
@Override public void shutdown(Callback<None> callback) { _client.shutdown(callback); }
@Test public void testShutdown() { Client client = EasyMock.createMock(Client.class); @SuppressWarnings("unchecked") Callback<None> callback = EasyMock.createMock(Callback.class); Capture<Callback<None>> callbackCapture = EasyMock.newCapture(); // Underlying client's shutdown should be invoked...
@VisibleForTesting static Comparator<ActualProperties> streamingExecutionPreference(PreferredProperties preferred) { // Calculating the matches can be a bit expensive, so cache the results between comparisons LoadingCache<List<LocalProperty<VariableReferenceExpression>>, List<Optional<LocalPrope...
@Test public void testPickLayoutGroupedWithSort() { Comparator<ActualProperties> preference = streamingExecutionPreference (PreferredProperties.local(ImmutableList.of(grouped("a"), sorted("b", ASC_NULLS_FIRST)))); List<ActualProperties> input = ImmutableList.<ActualProperties>bu...
@Override public DescriptiveUrlBag toUrl(final Path file) { return new DescriptiveUrlBag(Collections.singletonList( new DescriptiveUrl(URI.create(String.format("https://webmail.freenet.de/web/?goTo=share&path=/%s#cloud", URIEncoder.encode(PathRelativizer.relativize(PathNormalizer...
@Test public void testToUrlRoot() { final FreenetUrlProvider provider = new FreenetUrlProvider(new Host(new FreenetProtocol(), "dav.freenet.de", 443, "/webdav")); final DescriptiveUrlBag urls = provider.toUrl(new Path("/webdav", EnumSet.of(Path.Type.directory))); assertEquals(1, urls.size())...
@Override public Iterable<FileSystem<?>> fromOptions(@Nonnull PipelineOptions options) { final List<Configuration> configurations = options.as(HadoopFileSystemOptions.class).getHdfsConfiguration(); if (configurations == null) { // nothing to register return Collections.emptyList(); } ...
@Test public void testServiceLoader() { HadoopFileSystemOptions options = PipelineOptionsFactory.as(HadoopFileSystemOptions.class); options.setHdfsConfiguration(ImmutableList.of(configuration)); for (FileSystemRegistrar registrar : Lists.newArrayList(ServiceLoader.load(FileSystemRegistrar.class).i...
public Options getPaimonOptions() { return this.paimonOptions; }
@Test public void testCreatePaimonConnectorWithOSS() { Map<String, String> properties = new HashMap<>(); properties.put("paimon.catalog.warehouse", "oss://bucket/warehouse"); properties.put("paimon.catalog.type", "filesystem"); String accessKeyValue = "oss_access_key"; String...
@Override public boolean remove(Object o) { checkNotNull(o, "Item to be removed cannot be null."); return items.remove(serializer.encode(o)); }
@Test public void testRemove() throws Exception { //Test removal fillSet(10, set); for (int i = 0; i < 10; i++) { assertEquals("The size of the set is wrong.", 10 - i, set.size()); assertTrue("The first removal should be true.", set.remove(i)); assertFalse...
public ScaledView withUnitsPrecise(final String name, final ScaleUnits scaleUnits) { return new ScaledView(name, this::getElapsedNanos, scaleUnits.nanoRelativeDecimalShift); }
@Test public void withUnitsPrecise() { final ManualAdvanceClock clock = new ManualAdvanceClock(Instant.now()); final UptimeMetric uptimeMetric = new UptimeMetric("up_millis", clock::nanoTime); clock.advance(Duration.ofNanos(123_456_789_987L)); // 123.xx seconds // set-up: ensure adv...
public static boolean satisfiesRequires(String version, String requires) { String requiresVersion = StringUtils.trim(requires); // an exact version x.y.z will implicitly mean the same as >=x.y.z if (requiresVersion.matches("^\\d+\\.\\d+\\.\\d+$")) { // If exact versions are not allo...
@Test void satisfiesRequires() { // match all requires String systemVersion = "0.0.0"; String requires = ">=2.2.0"; boolean result = VersionUtils.satisfiesRequires(systemVersion, requires); assertThat(result).isTrue(); systemVersion = "2.0.0"; requires = "*";...
public static Level toLevel(String sArg) { return toLevel(sArg, Level.DEBUG); }
@Test public void withSpaceAround( ) { assertEquals(Level.INFO, Level.toLevel(" INFO ")); }
public RunResponse restartDirectly( RunResponse restartStepInfo, RunRequest runRequest, boolean blocking) { WorkflowInstance instance = restartStepInfo.getInstance(); String stepId = restartStepInfo.getStepId(); validateStepId(instance, stepId, Actions.StepInstanceAction.RESTART); StepInstance ste...
@Test public void testRestartDirectlyWhileForeachStepRunning() { stepInstance.getRuntimeState().setStatus(StepInstance.Status.RUNNING); ((TypedStep) stepInstance.getDefinition()).setType(StepType.FOREACH); ForeachArtifact artifact = new ForeachArtifact(); artifact.setForeachWorkflowId("maestro-foreach...
@Override public String getSQLListOfSchemas( DatabaseMeta databaseMeta ) { String databaseName = getDatabaseName(); if ( databaseMeta != null ) { databaseName = databaseMeta.environmentSubstitute( databaseName ); } return "SELECT SCHEMA_NAME AS \"name\" FROM " + databaseName + ".INFORMATION_SCHE...
@Test public void testGetSQLListOfSchemasWithParameter() { SnowflakeHVDatabaseMeta snowflakeHVDatabaseMeta = spy( new SnowflakeHVDatabaseMeta() ); String databaseName = UUID.randomUUID().toString(); String databaseNameSubstitute = UUID.randomUUID().toString(); doReturn( databaseName ).when( snowflakeH...
public DefaultMQProducer getProducer() { return producer; }
@Test public void testTransactionListener() { assertThat(((TransactionMQProducer) rocketMQTemplate.getProducer()).getTransactionListener()).isNotNull(); }