ExecutionContext { public MethodInvocationAuthorizer getMethodInvocationAuthorizer() { return methodInvocationAuthorizer; } ExecutionContext(Object[] bindArguments, InternalCache cache); MethodInvocationAuthorizer getMethodInvocationAuthorizer(); CachePerfStats getCachePerfStats(); Set addDependencies(CompiledValue cv, Set<RuntimeIterator> set); Map getDependencyGraph(); void setDependencyGraph(Map<CompiledValue, Set<RuntimeIterator>> dependencyGraph); Object getBindArgument(int index); void bindIterator(RuntimeIterator itr); CompiledValue resolve(String name); void newScope(int scopeID); void popScope(); List getCurrentIterators(); List getCurrScopeDpndntItrsBasedOnSingleIndpndntItr(RuntimeIterator rIter); InternalCache getCache(); void addToIndependentRuntimeItrMap(CompiledIteratorDef itrDef); void addToIndependentRuntimeItrMapForIndexCreation(CompiledIteratorDef itrDef); void setBindArguments(Object[] bindArguments); int getScopeNum(); void reset(); BucketRegion getBucketRegion(); void setBucketRegion(PartitionedRegion pr, BucketRegion bukRgn); PartitionedRegion getPartitionedRegion(); Object cacheGet(Object key); Object cacheGet(Object key, Object defaultValue); boolean isCqQueryContext(); List getBucketList(); void pushExecCache(int scopeNum); void popExecCache(); Query getQuery(); void setBucketList(List list); PdxString getSavedPdxString(int index); boolean isDistinct(); void setDistinct(boolean distinct); void setIsPRQueryNode(boolean isPRQueryNode); boolean isCanceled(); CacheRuntimeException getQueryCanceledException(); void setQueryCanceledException(final CacheRuntimeException queryCanceledException);  }
@Test public void constructorShouldUseConfiguredMethodAuthorizer() { InternalCache mockCache = mock(InternalCache.class); QueryConfigurationService mockService = mock(QueryConfigurationService.class); when(mockCache.getService(QueryConfigurationService.class)).thenReturn(mockService); MethodInvocationAuthorizer noOpAuthorizer = QueryConfigurationServiceImpl.getNoOpAuthorizer(); when(mockService.getMethodAuthorizer()).thenReturn(noOpAuthorizer); ExecutionContext executionContextNoOpAuthorizer = new ExecutionContext(null, mockCache); assertThat(executionContextNoOpAuthorizer.getMethodInvocationAuthorizer()) .isSameAs(noOpAuthorizer); MethodInvocationAuthorizer restrictedAuthorizer = new RestrictedMethodAuthorizer(mockCache); when(mockService.getMethodAuthorizer()).thenReturn(restrictedAuthorizer); ExecutionContext executionContextRestrictedAuthorizer = new ExecutionContext(null, mockCache); assertThat(executionContextRestrictedAuthorizer.getMethodInvocationAuthorizer()) .isSameAs(restrictedAuthorizer); }