아래의 예제 대로 실행을 하면 Before, test,After 가 순차적으로 진행이 되어야한다.

public class BeforeAfter {

    @Before
    public void SetUp(){
        System.out.println("Before");
    }

    @Test
    void transformation() {
        System.out.println("test");
    }
    @After
    public void after(){
        System.out.println("After");
    }

}

하지만 test 밖에 출력이 되지 않았다. 왜 그런걸까 찾아보니 JUnit5 에서는 @Before, @After 가 @BeforeEach, @AfterEach 로 설정을 해야한다.

JUnit5 의 어노테이션으로 아래의 코드로 다시 실행을 하니 다시 실행이 된다.

public class BeforeAfter {

    @BeforeEach
    public void SetUp(){
        System.out.println("Before");
    }

    @Test
    void transformation() {
        System.out.println("test");
    }
    @AfterEach
    public void after(){
        System.out.println("After");
    }

}

SpringBoot에서 JUnit이 몇버전인지 알고 싶을때 아래로 확인하고 변경하면 된다.

생각없이 그냥 springInitializer에서 다운을 받으면 아래와 같은 설정이 있는데, springboot-2.2.X 이후부터는 Junit5로 설정이 되어있는 것 같다.

    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.2-Release-Notes

spark를 실행 하고 있으면 cleaned accumulator 숫자

INFO org.apache.spark.ContextCleaner - Cleaned accumulator 126 의 형태를 볼수 있다 무엇을 의미 하는 것 일까 ?

 

19:17:36.899 [Spark Context Cleaner] INFO org.apache.spark.ContextCleaner - Cleaned accumulator 126 19:17:36.899 [Spark Context Cleaner] INFO org.apache.spark.ContextCleaner - Cleaned accumulator 145 19:17:36.899 [Spark Context Cleaner] INFO org.apache.spark.ContextCleaner - Cleaned accumulator 152 19:17:36.899 [Spark Context Cleaner] INFO org.apache.spark.ContextCleaner - Cleaned accumulator 130 19:17:36.899 [Spark Context Cleaner] INFO org.apache.spark.ContextCleaner - Cleaned accumulator 144 19:17:36.899 [Spark Context Cleaner] INFO org.apache.spark.ContextCleaner - Cleaned accumulator 142

 

 

org.apache.spark.ContextCleaner 클래스 API 설명

 

RDD, 셔플 및 브로드캐스트 상태를 위한 비동기식 클리너

관련 object가 응용 프로그램 범위를 벗어날대, 처리 될 각 RDD, shuffleDependency 및 관심이 있는 브로드 캐스트에 대한 약한 참조는 유지됩니다.실제로 처리는 별도의 데몬 스레드에서 수행됨.

https://spark.apache.org/docs/1.2.0/api/java/org/apache/spark/ContextCleaner.html

 

stackoverflow 답변 중

 

ContextCleaner는 드라이버에서 실행 된다. SparkContext가 시작될때 작성되고 즉시 시작된다. RDD, 셔플 및 브로드캐스트 상태, accumulate를 정리하는 컨텍스트 클리너 스레드(keepCleaning 메소드 사용). context-cleaner-periodic-gc는 JVM 가비지 콜렉터를 요청함.

https://stackoverflow.com/questions/55452892/contextcleaner-cleaned-accumulator-what-does-it-mean-in-scala-spark

Git remote: Permission to

깃허브 사용중에 아래와같은 에러가 발생하는 경우가 있었다.

remote: Permission to elasticsearchstudy/SaturdaySpring.git denied to DaeyunKim.

fatal: unable to access 'https://github.com/elasticsearchstudy/SaturdaySpring.git': The requested URL returned error: 403

처음엔 프로젝트에서 권한 문제인줄알았는데

찾아보니 아래와 같이 다시 터미널에서 입력해주고 다시 시도하니 된다.

$ git remote set-url origin git@github.com:elasticsearchstudy/SaturdaySpring.git

해결 : https://stackoverflow.com/questions/47465644/github-remote-permission-denied

'BackEnd > ETC' 카테고리의 다른 글

[gradle] CreateProcess error=206  (0) 2020.04.25
http 상태 코드  (0) 2020.01.19
CQRS란 ?  (1) 2020.01.19
STORM 정리  (0) 2017.12.18

+ Recent posts