use of org.xwiki.platform.wiki.creationjob.WikiCreationRequest in project xwiki-platform by xwiki.
the class AddUsersStepTest method execute.
@Test
public void execute() throws Exception {
WikiCreationRequest request = new WikiCreationRequest();
request.setWikiId("wikiId");
List<String> members = new ArrayList<>();
request.setMembers(members);
// Test
mocker.getComponentUnderTest().execute(request);
// Verify
verify(wikiUserManager).addMembers(members, "wikiId");
}
use of org.xwiki.platform.wiki.creationjob.WikiCreationRequest in project xwiki-platform by xwiki.
the class ProvisionWikiStepTest method executeWhenException.
@Test
public void executeWhenException() throws Exception {
WikiCreationRequest request = new WikiCreationRequest();
request.setWikiId("wikiId");
request.setWikiSource(WikiSource.EXTENSION);
ExtensionId extensionId = new ExtensionId("id", "version");
request.setExtensionId(extensionId);
// Mocks
WikiCreationException exception = new WikiCreationException("Exception in ExtensionInstaller");
doThrow(exception).when(extensionInstaller).installExtension("wikiId", extensionId);
// Test
WikiCreationException caughtException = null;
try {
mocker.getComponentUnderTest().execute(request);
} catch (WikiCreationException e) {
caughtException = e;
}
// Verify
assertNotNull(caughtException);
assertEquals("Failed to provision the wiki [wikiId].", caughtException.getMessage());
assertEquals(exception, caughtException.getCause());
verify(observationManager).notify(eq(new WikiProvisioningEvent("wikiId")), eq("wikiId"), eq(xcontext));
verify(observationManager).notify(eq(new WikiProvisioningFailedEvent("wikiId")), eq("wikiId"), eq(xcontext));
}
Aggregations