Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

AKKA를 학습하기위해서는, 자신에게 맞는 유닛테스트 가능한 구조를 설계하는것이 중요합니다.

여기서 소개되는 방식은 UnitTest를 위한 최상의 설계는 아니며 , 학습과정에서 액터패턴을

검증하고 시도하는것에 대한 불편함을 현재까지 조금씩 개선한 버젼입니다.

src : git-CachedbApplicationTests.java

...


Code Block
languagejava
themeEmacs
public class ActorBase {
   
   protected final Logger log = LoggerFactory.getLogger(this.getClass());
   
   public void runAll() {
      
   }
   
   protected ActorSystem system;
   protected SpringExtension ext;
   
   public ActorSystem getSystem() {
      return system;
   }
   public void setSystem(ActorSystem system) {
      this.system = system;
   }
   public SpringExtension getExt() {
      return ext;
   }
   public void setExt(SpringExtension ext) {
      this.ext = ext;
   }
}

Image RemovedImage Added





Actor는 기본적으로 공통적으로 사용되는 ActorSystem 이 있으며, 외부로부터 설정이 가능해야합니다.

...

전체실행을 할수 있으며 부분실패에대해 집중도 할수가 있습니다.


동시성 처리 가능 유닛테스트 이해하기

Code Block
languagejava
themeEmacs
protected void actorTest2() {         
    new TestKit(system) {{
       final ActorRef testActor = system.actorOf( ext.props("testActor"),"test1");                  
      testActor.tell( "hi", getRef() );        
         // await the correct response
       expectMsg(java.time.Duration.ofSeconds(1), "hi too");
       
    }};   
}


실시간으로 처리되고 적재되는 메시지를 검증할수 있는 새로운 방법이 필요하며

...