초기셋팅

This commit is contained in:
jazz
2025-12-18 10:04:46 +09:00
commit b68aa39bfb
387 changed files with 54028 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
package com.wb.domainserver.app.jobs;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import com.wb.domainserver.BatchApplication;
import com.wb.domainserver.common.config.GconeSourceConfig;
@SpringBootTest(classes = {
AppPushConfig.class,
GconeSourceConfig.class,
BatchApplication.class
})
@TestPropertySource(properties = {
"spring.main.allow-bean-definition-overriding=true",
"spring.profiles.active=dev"
})
public class AppPushJobTest {
@Autowired
private JobLauncher jobLauncher;
@Autowired
@Qualifier("appPushJob") // AppPushConfig에서 선언한 Job 이름
private Job appPushJob;
@Test
public void runAppPushJob() throws Exception {
JobParameters jobParameters = new JobParametersBuilder()
.addLong("time", System.currentTimeMillis()) // 동일 실행 방지용
.toJobParameters();
JobExecution execution = jobLauncher.run(appPushJob, jobParameters);
System.out.println("▶▶ 실행 결과: " + execution.getStatus());
System.out.println("▶▶ 실행 대상 Job: " + appPushJob.getName());
if (execution.getStatus() != BatchStatus.COMPLETED) {
throw new IllegalStateException("배치 실패: " + execution.getExitStatus().getExitDescription());
}
}
}