Skip to content
Permalink
Browse files Browse the repository at this point in the history
XWIKI-19856: Bad execution setup on the context macro
* 13.10.x compatible test
  • Loading branch information
tmortagne committed Sep 9, 2022
1 parent dd3f473 commit 4b75f21
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Expand Up @@ -169,6 +169,8 @@ public List<Block> execute(ContextMacroParameters parameters, String content, Ma
// Reuse the very generic async rendering framework (even if we don't do async and caching) since it's taking
// care of many other things
BlockAsyncRendererConfiguration configuration = createBlockAsyncRendererConfiguration(null, xdom, context);
configuration.setAsyncAllowed(false);
configuration.setCacheAllowed(false);

Map<String, Object> backupObjects = new HashMap<>();
try {
Expand Down
Expand Up @@ -22,7 +22,6 @@
import java.util.Arrays;
import java.util.Collections;

import javax.inject.Inject;
import javax.inject.Named;

import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -51,8 +50,10 @@
import org.xwiki.test.TestEnvironment;
import org.xwiki.test.annotation.ComponentList;
import org.xwiki.test.junit5.mockito.ComponentTest;
import org.xwiki.test.junit5.mockito.InjectComponentManager;
import org.xwiki.test.junit5.mockito.InjectMockComponents;
import org.xwiki.test.junit5.mockito.MockComponent;
import org.xwiki.test.mockito.MockitoComponentManager;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
Expand Down Expand Up @@ -80,9 +81,6 @@

private static final DocumentReference SOURCE_REFERENCE = new DocumentReference("wiki", "space", "source");

@Inject
protected BlockAsyncRendererExecutor executor;

@MockComponent
private DocumentAccessBridge dab;

Expand All @@ -100,11 +98,16 @@
private DocumentReferenceResolver<String> macroReferenceResolver;

@MockComponent
protected DocumentReferenceResolver<String> resolver;
private DocumentReferenceResolver<String> resolver;

@InjectMockComponents
private ContextMacro macro;

@InjectComponentManager
private MockitoComponentManager componentManager;

private BlockAsyncRendererExecutor executor;

@BeforeEach
public void beforeEach() throws Exception
{
Expand All @@ -117,6 +120,8 @@ public void beforeEach() throws Exception

when(this.macroReferenceResolver.resolve(eq("target"), any())).thenReturn(TARGET_REFERENCE);
when(this.resolver.resolve("source")).thenReturn(SOURCE_REFERENCE);

this.executor = this.componentManager.getInstance(BlockAsyncRendererExecutor.class);
}

@Test
Expand Down

0 comments on commit 4b75f21

Please sign in to comment.