-
- ControlLoopResponse clresp = outcome.getControlLoopResponse();
- assertNotNull(clresp);
-
- assertEquals(DEFAULT_ACTOR, clresp.getFrom());
- assertEquals("DCAE", clresp.getTarget());
- assertEquals(CL_NAME, clresp.getClosedLoopControlName());
- assertEquals(EVENT_POLICY_NAME, clresp.getPolicyName());
- assertEquals(EVENT_POLICY_VERSION, clresp.getPolicyVersion());
- assertEquals(EVENT_VERSION, clresp.getVersion());
- assertEquals(REQ_ID, clresp.getRequestId());
- assertNotNull(clresp.getPayload());
- }
-
- @Test
- public void testStartPreprocessorAsync() throws Exception {
- final CompletableFuture<OperationOutcome> future2 = new CompletableFuture<>();
- context = mock(ControlLoopEventContext.class);
- when(context.getEvent()).thenReturn(event);
- params = params.toBuilder().context(context).build();
-
- AtomicBoolean guardStarted = new AtomicBoolean();
-
- operation = new SdnrOperation(params, config) {
- @Override
- protected CompletableFuture<OperationOutcome> startGuardAsync() {
- guardStarted.set(true);
- return super.startGuardAsync();
- }
- };
- CompletableFuture<OperationOutcome> future3 = operation.startPreprocessorAsync();
-
- assertNotNull(future3);
- assertFalse(future.isDone());
- assertTrue(guardStarted.get());
-
- future2.complete(params.makeOutcome());
- assertTrue(executor.runAll(100));
- assertTrue(future3.isDone());
- assertEquals(PolicyResult.SUCCESS, future3.get().getResult());