fuweng11 commented on code in PR #10412: URL: https://github.com/apache/inlong/pull/10412#discussion_r1638129822
########## inlong-manager/manager-schedule/src/test/java/org/apache/inlong/schedule/quartz/MockJob.java: ########## @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.inlong.schedule.quartz; + +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicInteger; + +public class MockJob extends QuartzOfflineSyncJob { + + private static final Logger LOGGER = LoggerFactory.getLogger(MockJob.class); + + public static CountDownLatch countDownLatch; + private static AtomicInteger counter = new AtomicInteger(0); + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + if (countDownLatch.getCount() > 0) { + countDownLatch.countDown(); + } + LOGGER.info("### MockJob executed " + counter.incrementAndGet()); Review Comment: LOGGER.info("MockJob executed " + counter.incrementAndGet()); ########## inlong-manager/manager-schedule/src/test/java/org/apache/inlong/schedule/quartz/MockJob.java: ########## @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.inlong.schedule.quartz; + +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicInteger; + +public class MockJob extends QuartzOfflineSyncJob { + + private static final Logger LOGGER = LoggerFactory.getLogger(MockJob.class); + + public static CountDownLatch countDownLatch; + private static AtomicInteger counter = new AtomicInteger(0); + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + if (countDownLatch.getCount() > 0) { + countDownLatch.countDown(); + } + LOGGER.info("### MockJob executed " + counter.incrementAndGet()); + } + + public static void setCount(int count) { + countDownLatch = new CountDownLatch(count); + counter.set(0); + LOGGER.info("### MockJob has been reset."); Review Comment: LOGGER.info("MockJob has been reset."); -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
