本文整理汇总了Java中akka.testkit.javadsl.TestKit.expectMsgClass方法的典型用法代码示例。如果您正苦于以下问题:Java TestKit.expectMsgClass方法的具体用法?Java TestKit.expectMsgClass怎么用?Java TestKit.expectMsgClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类akka.testkit.javadsl.TestKit
的用法示例。
在下文中一共展示了TestKit.expectMsgClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCourseProgress
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@Test
public void testCourseProgress(){
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request actorMessage = new Request();
actorMessage.put(JsonKey.REQUESTED_BY , userId);
actorMessage.put(JsonKey.BATCH_ID , batchId);
actorMessage.put(JsonKey.PERIOD , "fromBegining");
actorMessage.setOperation(ActorOperations.COURSE_PROGRESS_METRICS.getValue());
subject.tell(actorMessage, probe.getRef());
Response res= probe.expectMsgClass(duration("100 second"),Response.class);
System.out.println("SUCCESS");
System.out.println("SUCCESS");
}
示例2: test19ApproveOrgExc
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@Test
public void test19ApproveOrgExc(){
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request reqObj = new Request();
reqObj.setOperation(ActorOperations.APPROVE_ORG.getValue());
HashMap<String, Object> innerMap = new HashMap<>();
Map<String , Object> orgMap = new HashMap<String , Object>();
orgMap.put(JsonKey.ORGANISATION_ID , null);
innerMap.put(JsonKey.ORGANISATION , orgMap);
reqObj.setRequest(innerMap);
subject.tell(reqObj, probe.getRef());
probe.expectMsgClass(duration("200 second"),ProjectCommonException.class);
}
示例3: test27AddMemberToOrgExpUserIdNull
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@Test
public void test27AddMemberToOrgExpUserIdNull(){
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request reqObj = new Request();
reqObj.setOperation(ActorOperations.ADD_MEMBER_ORGANISATION.getValue());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.ORGANISATION_ID , orgId);
innerMap.put(JsonKey.USER_ID , null);
reqObj.getRequest().put(JsonKey.USER_ORG , innerMap);
reqObj.getRequest().put(JsonKey.REQUESTED_BY , "user1");
subject.tell(reqObj, probe.getRef());
ProjectCommonException resp = probe.expectMsgClass(duration("200 second"),ProjectCommonException.class);
}
示例4: Z19TestapproveUserOrg
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@Test
public void Z19TestapproveUserOrg(){
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request reqObj = new Request();
reqObj.setOperation(ActorOperations.APPROVE_USER_ORGANISATION.getValue());
Map<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.USER_ID,userId);
innerMap.put(JsonKey.ORGANISATION_ID,orgId2);
List<String> roles = new ArrayList<>();
roles.add("PUBLIC");
innerMap.put(JsonKey.ROLES,roles);
reqObj.getRequest().put(JsonKey.REQUESTED_BY,userIdnew);
Map<String, Object> request = new HashMap<String, Object>();
request.put(JsonKey.USER_ORG, innerMap);
reqObj.setRequest(request);
subject.tell(reqObj, probe.getRef());
probe.expectMsgClass(duration("200 second"), Response.class);
}
示例5: testCourseProgressReport
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@Test
public void testCourseProgressReport(){
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request actorMessage = new Request();
actorMessage.put(JsonKey.REQUESTED_BY , userId);
actorMessage.put(JsonKey.BATCH_ID , batchId);
actorMessage.put(JsonKey.PERIOD , "fromBegining");
actorMessage.put(JsonKey.FORMAT, "csv");
actorMessage.setOperation(ActorOperations.COURSE_PROGRESS_METRICS_REPORT.getValue());
subject.tell(actorMessage, probe.getRef());
Response res= probe.expectMsgClass(duration("100 second"),Response.class);
}
示例6: testCGetSection
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@Test
public void testCGetSection(){
boolean section = false;
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request reqObj = new Request();
reqObj.setOperation(ActorOperations.GET_SECTION.getValue());
reqObj.getRequest().put(JsonKey.ID, sectionId);
subject.tell(reqObj, probe.getRef());
Response response = probe.expectMsgClass(Response.class);
Map<String,Object> result = response.getResult();
List<Map<String,Object>> sectionList = (List<Map<String, Object>>) result.get(JsonKey.RESPONSE);
for(Map<String,Object> sec : sectionList){
if(null != sec.get(JsonKey.SECTION_NAME) && ((String)sec.get(JsonKey.SECTION_NAME)).equals("Test Section")){
section = true;
}
}
assertTrue(section);
}
示例7: testCourseProgressReportWithInvalidBatchIdNull
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@Test
public void testCourseProgressReportWithInvalidBatchIdNull(){
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request actorMessage = new Request();
actorMessage.put(JsonKey.REQUESTED_BY , userId);
actorMessage.put(JsonKey.BATCH_ID , "");
actorMessage.put(JsonKey.PERIOD , "fromBegining");
actorMessage.put(JsonKey.FORMAT, "csv");
actorMessage.setOperation(ActorOperations.COURSE_PROGRESS_METRICS_REPORT.getValue());
subject.tell(actorMessage, probe.getRef());
ProjectCommonException res= probe.expectMsgClass(duration("100 second"),ProjectCommonException.class);
}
示例8: test28RemoveMemberFromOrgExpInvalidRequestData
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@Test
public void test28RemoveMemberFromOrgExpInvalidRequestData(){
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request reqObj = new Request();
reqObj.setOperation(ActorOperations.REMOVE_MEMBER_ORGANISATION.getValue());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.ORGANISATION_ID , orgId);
innerMap.put(JsonKey.USER_ID , null);
reqObj.getRequest().put(JsonKey.USER_ORG , null);
reqObj.getRequest().put(JsonKey.REQUESTED_BY , "user1");
subject.tell(reqObj, probe.getRef());
ProjectCommonException resp = probe.expectMsgClass(duration("200 second"),ProjectCommonException.class);
}
示例9: updateGeoLocationTestWithNullId
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@Test
public void updateGeoLocationTestWithNullId(){
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request actorMessage = new Request();
actorMessage.getRequest().put(JsonKey.REQUESTED_BY, userId);
actorMessage.getRequest().put(JsonKey.LOCATION, "updated location");
actorMessage.getRequest().put(JsonKey.TYPE, type);
actorMessage.getRequest().put(JsonKey.LOCATION_ID, null);
actorMessage.setOperation(ActorOperations.UPDATE_GEO_LOCATION.getValue());
subject.tell(actorMessage, probe.getRef());
ProjectCommonException res = probe.expectMsgClass(duration("100 second"), ProjectCommonException.class);
}
示例10: onReceiveTestWithInvalidOperation
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
public void onReceiveTestWithInvalidOperation() throws Throwable {
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request reqObj = new Request();
reqObj.setRequestId("1211");
reqObj.setOperation("INVALID_OPERATION");
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.COURSE, reqObj.getRequest());
innerMap.put(JsonKey.USER_ID, "USR1");
innerMap.put(JsonKey.ID, "");
reqObj.setRequest(innerMap);
subject.tell(reqObj, probe.getRef());
probe.expectMsgClass(duration("100 second"), ProjectCommonException.class);
}
示例11: test16userubulkUpload001wGetStatus
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@Test
public void test16userubulkUpload001wGetStatus(){
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request reqObj = new Request();
reqObj.setOperation(ActorOperations.GET_BULK_OP_STATUS.getValue());
HashMap<String, Object> innerMap = new HashMap<>();
Map<String , Object> orgMap = new HashMap<String , Object>();
reqObj.getRequest().put(JsonKey.PROCESS_ID , userUploadProcessId);
System.out.println("USER UPLOAD PROCESS ID "+userUploadProcessId);
if(null != userUploadProcessId){
subject.tell(reqObj, probe.getRef());
Response res = probe.expectMsgClass(duration("200 second"),Response.class);
/*String respon = (String)res.get(JsonKey.RESPONSE);
System.out.println(respon);*/
List<Map<String , Object>> list = (List<Map<String, Object>>) res.get(JsonKey.RESPONSE);
if(!list.isEmpty()){
Map<String , Object> map = list.get(0);
Object[] list1 = (Object[]) map.get(JsonKey.SUCCESS_RESULT);
map = (Map<String, Object>) list1[0];
userId = (String)map.get(JsonKey.USER_ID);
System.out.println("USER ID "+userId);
}
}
}
示例12: userchangePasswordSuccess2
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@Test
public void userchangePasswordSuccess2(){
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request reqObj = new Request();
reqObj.setOperation(ActorOperations.FORGOT_PASSWORD.getValue());
Map<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.USERNAME,("[email protected]"));
Map<String, Object> request = new HashMap<String, Object>();
request.put(JsonKey.USER, innerMap);
reqObj.setRequest(request);
subject.tell(reqObj, probe.getRef());
probe.expectMsgClass(duration("200 second"), Response.class);
}
示例13: Z13TestgetUserDetails
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@Test
public void Z13TestgetUserDetails(){
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request reqObj = new Request();
reqObj.getRequest().put(JsonKey.REGISTERED_ORG_ID, "as");
reqObj.getRequest().put(JsonKey.ROOT_ORG_ID, "as");
reqObj.setOperation(ActorOperations.DOWNLOAD_USERS.getValue());
subject.tell(reqObj, probe.getRef());
probe.expectMsgClass(duration("200 second"), Response.class);
}
示例14: testA2CreateBatch
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
public void testA2CreateBatch(){
PowerMockito.mockStatic(EkStepRequestUtil.class);
Map<String , Object> ekstepResponse = new HashMap<String , Object>();
ekstepResponse.put("count" , 10);
Object[] ekstepMockResult = {ekstepResponse};
when( EkStepRequestUtil.searchContent(Mockito.anyString() , Mockito.anyMap()) ).thenReturn(ekstepMockResult);
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request reqObj = new Request();
reqObj.setOperation(ActorOperations.CREATE_BATCH.getValue());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.COURSE_ID, courseId);
innerMap.put(JsonKey.NAME, "DUMMY_COURSE_NAME2");
innerMap.put(JsonKey.ENROLLMENT_TYPE, "invite-only");
innerMap.put(JsonKey.START_DATE , (String)format.format(new Date()));
innerMap.put(JsonKey.HASHTAGID ,hashTagId2 );
Calendar now = Calendar.getInstance();
now.add(Calendar.DAY_OF_MONTH, 5);
Date after5Days = now.getTime();
innerMap.put(JsonKey.END_DATE , (String)format.format(after5Days));
List<String> createdFr = new ArrayList<>();
createdFr.add("ORG_001");
innerMap.put(JsonKey.COURSE_CREATED_FOR, createdFr);
List<String> mentors = new ArrayList<>();
mentors.add(userId);
innerMap.put(JsonKey.MENTORS, mentors);
reqObj.getRequest().put(JsonKey.BATCH, innerMap);
subject.tell(reqObj, probe.getRef());
Response response = probe.expectMsgClass(duration("1000 second"),Response.class);
batchId2 = (String) response.getResult().get(JsonKey.BATCH_ID);
System.out.println("batchId2 : "+batchId2);
}
示例15: testCourseConsumptionInvalidPeriod
import akka.testkit.javadsl.TestKit; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test
public void testCourseConsumptionInvalidPeriod() {
TestKit probe = new TestKit(system);
ActorRef subject = system.actorOf(props);
Request actorMessage = new Request();
actorMessage.put(JsonKey.COURSE_ID, "mclr309f39");
actorMessage.put(JsonKey.PERIOD, "10d");
actorMessage.setOperation(ActorOperations.COURSE_CREATION_METRICS.getValue());
subject.tell(actorMessage, probe.getRef());
ProjectCommonException e = probe.expectMsgClass(duration("10 second"), ProjectCommonException.class);
Assert.assertEquals("INVALID_PERIOD", e.getCode());
}