コード例 #1
0
 @Before
 public void setUp() throws Exception {
   mockService =
       mock(
           GenericApiGWTServiceAsync.class,
           withSettings().extraInterfaces(ServiceDefTarget.class));
   fakeScheduler = new FakeGWTScheduler();
   CommunicationProvider communicationsProvider =
       new GWTRPCCommunicationProvider(mockService, mockXsrfService, mockXsrfRpcRequestBuilder);
   when(mockXsrfRpcRequestBuilder.getXsrfToken())
       .thenReturn(new XsrfToken("Something")); // $NON-NLS-1$
   OperationProcessor operationProcessor = new OperationProcessor(communicationsProvider);
   operationProcessor.setScheduler(fakeScheduler);
   VdcOperationManager operationsManager = new VdcOperationManager(operationProcessor);
   operationsManager.setLoggedIn(true);
   frontend =
       new Frontend(
           operationsManager,
           mockCanDoActionErrorsTranslator,
           mockVdsmErrorsTranslator,
           mockEventBus);
   frontend.setEventsHandler(mockEventsHandler);
   frontend.setConstants(mockConstants);
   frontend.frontendFailureEvent = mockFrontendFailureEvent;
   frontend.setLoginHandler(mockLoginHandler);
   when(mockAsyncQuery.getDel()).thenReturn(mockAsyncCallback);
   when(mockConstants.noCanDoActionMessage()).thenReturn(NO_MESSAGE);
 }
コード例 #2
0
 @Before
 public void setUp() throws Exception {
   fakeScheduler = new FakeGWTScheduler();
   CommunicationProvider communicationsProvider = new GWTRPCCommunicationProvider(mockService);
   OperationProcessor operationProcessor = new OperationProcessor(communicationsProvider);
   operationProcessor.setScheduler(fakeScheduler);
   VdcOperationManager operationsManager = new VdcOperationManager(operationProcessor);
   operationsManager.setLoggedIn(true);
   frontend =
       new Frontend(
           operationsManager,
           mockCanDoActionErrorsTranslator,
           mockVdsmErrorsTranslator,
           mockEventBus);
   frontend.queryCompleteEvent = queryCompleteEvent;
   frontend.queryStartedEvent = queryStartEvent;
   frontend.frontendFailureEvent = mockFrontendFailureEvent;
   frontend.frontendNotLoggedInEvent = mockFrontendNotLoggedInEvent;
   frontend.subscribe(new VdcQueryType[] {VdcQueryType.Search});
   frontend.setEventsHandler(mockEventsHandler);
   frontend.setConstants(mockConstants);
   when(mockAsyncQuery.getContext()).thenReturn("test"); // $NON-NLS-1$
   when(mockAsyncQuery.getDel()).thenReturn(mockAsyncCallback);
 }