osgi
OSGi 응용 프로그램 통합 테스트에 Pax 시험 사용
수색…
소개
Pax Exam 은 OSGi 컨테이너 (예 : AEM, Apache Karaf) 내의 번들 테스트를 허용합니다. Pax Exam은 대개 JUnit과 함께 사용됩니다.
시작하기
다음은 Pax Exam을 사용한 테스트의 예입니다.
package com.example.project.test;
import static org.junit.Assert.*;
import static org.ops4j.pax.exam.CoreOptions.*;
import javax.inject.Inject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.regression.pde.HelloService;
import org.ops4j.pax.exam.spi.reactors.*;
@RunWith(PaxExam.class)
@ExamReactorStrategy(PerMethod.class)
public class SampleTest {
@Inject
private HelloService helloService;
@Configuration
public Option[] config() {
return options(
mavenBundle("com.example.myproject", "myproject-api", "1.0.0-SNAPSHOT"),
bundle("http://www.example.com/repository/foo-1.2.3.jar"),
junitBundles()
);
}
@Test
public void getHelloService() {
assertNotNull(helloService);
assertEquals("Hello Pax!", helloService.getMessage());
}
}
Pax Exam 4 Page의 코드입니다.
Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow