2014-01-14 2 views
0

IBM Worklight Adapter의 통합 테스트를위한 POC를 개발 중입니다. 그렇게하면 RESTAssured framework을 사용하고 있습니다. 보안 테스트가 적용된 어댑터가 있습니다. XML 코드 조각 : 내 테스트에서IBM Worklight Adapter와 보안 테스트의 통합 테스트

<procedure name="submitAuthentication" />

내가 SubmitAuthentication 어댑터를 호출하고있어 그때 getCatalog 어댑터를 호출 해요 : 인증의

<procedure name="getCatalog" 
securityTest="SingleStepAuthAdapter-securityTest" /> 

나는 다른 어댑터가 있습니다. 이 오류 응답 다음 날 반환 :

런타임 : 자원 '시저 : SampleHttpAdapter.getCatalog'영역 'SingleStepAuthRealm'에서 인증 된 경우에만 액세스 할 수 해야합니다. 이 인증이 getCatalog의 내 요청에 지속되지 않는 것 같아 응답으로 당

public void testGetCatalog() { 

    Response response = RestAssured.given().get(BASE_URL.concat("SampleHttpAdapter& 
    procedure=submitAuthentication&parameters=[\"worklight\",\"worklight\"]")); 
    String sessionid = response.getSessionId(); 
    Cookie cookie1 = new Cookie.Builder("JSESSIONID", sessionid).build(); 
    System.out.println("cookie value" + cookie1.getValue()); 
    RequestSpecification spec_two = new RequestSpecBuilder().addCookie(cookie1) 
    .setSessionId(sessionid).build(); 
    Response catalog_response = RestAssured.given() 
    .spec(spec_two) 
    .get(BASE_URL.concat("SampleHttpAdapter&procedure=getCatalog&parameters=[]")); 
    String catalog_json = catalog_response.asString(); 
    System.out.println(catalog_json); 
} 

:

다음은 내가 실행하고있어 테스트 케이스이다. 내가 어떻게 할 수 있니?

답변

1

어댑터 절차가 어떻게 작성되었는지 알지 못하는 경우 위의 문제를 조사하기가 어렵습니다. submitAuthentication과 getCatalog의 어댑터 프로 시저를 포함시킬 수 있습니까?

인증 과정의 작동 방식을 자세하게 설명하는 어댑터 기반 인증에 대한 예제 및 학습서 Worklight proivides를 포함시킬 수 있습니다. 단일 단계 어댑터 인증을 수행하므로이 프로젝트를 기초로 사용할 수도 있습니다. 제공하는 메커니즘을 인증에 사용하고 테스트를 위해 getCatalog 메소드를 추가하십시오.

어댑터 기반 인증 발표 : http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v610/08_03_Adapter_based_authentication.pdf

어댑터 기반 인증 프로젝트 : http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v610/AdapterBasedAuthenticationProject.zip