- setter.accept(originalValue);
- }
-
- @Test
- public void testStartPreprocessorAsync() {
- assertNotNull(oper.startPreprocessorAsync());
- }
-
- @Test
- public void testObtainVfCount_testGetVfCount_testSetVfCount() throws Exception {
- // insert CQ data so it's there for the check
- context.setProperty(AaiCqResponse.CONTEXT_KEY, makeCqResponse());
-
- // shouldn't actually need to do anything
- assertNull(oper.obtainVfCount());
-
- // verify that the count was stored
- Integer vfcount = context.getProperty(VF_COUNT_KEY);
- assertEquals(VF_COUNT, vfcount);
- assertEquals(VF_COUNT.intValue(), oper.getVfCount());
-
- // change the count and then verify that it isn't overwritten by another call
- oper.setVfCount(VF_COUNT + 1);
-
- assertNull(oper.obtainVfCount());
- vfcount = context.getProperty(VF_COUNT_KEY);
- assertEquals(VF_COUNT + 1, vfcount.intValue());
- assertEquals(VF_COUNT + 1, oper.getVfCount());
- }
-
- /**
- * Tests obtainVfCount() when it actually has to query.
- */
- @Test
- public void testObtainVfCountQuery() throws Exception {
- CompletableFuture<OperationOutcome> future2 = oper.obtainVfCount();
- assertNotNull(future2);
- assertTrue(executor.runAll(100));
-
- // not done yet
- assertFalse(future2.isDone());
-
- provideCqResponse(makeCqResponse());
-
- assertTrue(executor.runAll(100));
- assertTrue(future2.isDone());
- assertEquals(PolicyResult.SUCCESS, future2.get().getResult());
-
- // verify that the count was stored
- Integer vfcount = context.getProperty(VF_COUNT_KEY);
- assertEquals(VF_COUNT, vfcount);
-
- // repeat - shouldn't need to do anything now
- assertNull(oper.obtainVfCount());