@Test public void installExtensionWithException() throws Exception { WikiCreationException caughtException = null; try { mocker.getComponentUnderTest().installExtension("wikiId", new ExtensionId("extensionId", "version")); } catch (WikiCreationException e) { caughtException = e; } assertNotNull(caughtException); assertEquals("Failed to install the extension [extensionId/version] on the wiki [wikiId].", caughtException.getMessage()); assertTrue(caughtException.getCause() instanceof ComponentLookupException); }
public void installExtension(String wikiId, ExtensionId extensionId) throws WikiCreationException { try { InstallRequest installRequest = new InstallRequest(); installRequest.setId(Arrays.asList(WikiCreationJob.JOB_ID_PREFIX, "install", wikiId)); installRequest.addExtension(extensionId); installRequest.addNamespace("wiki:" + wikiId); installRequest.setProperty(PROPERTY_USERREFERENCE, SUPERADMIN_REFERENCE); InstallJob job = componentManager.getInstance(Job.class, InstallJob.JOBTYPE); job.initialize(installRequest); job.run(); } catch (ComponentLookupException e) { throw new WikiCreationException(String.format("Failed to install the extension [%s] on the wiki [%s].", extensionId.toString(), wikiId), e); } }
ExtensionInstaller { public void installExtension(String wikiId, ExtensionId extensionId) throws WikiCreationException { try { InstallRequest installRequest = new InstallRequest(); installRequest.setId(Arrays.asList(WikiCreationJob.JOB_ID_PREFIX, "install", wikiId)); installRequest.addExtension(extensionId); installRequest.addNamespace("wiki:" + wikiId); installRequest.setProperty(PROPERTY_USERREFERENCE, SUPERADMIN_REFERENCE); InstallJob job = componentManager.getInstance(Job.class, InstallJob.JOBTYPE); job.initialize(installRequest); job.run(); } catch (ComponentLookupException e) { throw new WikiCreationException(String.format("Failed to install the extension [%s] on the wiki [%s].", extensionId.toString(), wikiId), e); } } }
ExtensionInstaller { public void installExtension(String wikiId, ExtensionId extensionId) throws WikiCreationException { try { InstallRequest installRequest = new InstallRequest(); installRequest.setId(Arrays.asList(WikiCreationJob.JOB_ID_PREFIX, "install", wikiId)); installRequest.addExtension(extensionId); installRequest.addNamespace("wiki:" + wikiId); installRequest.setProperty(PROPERTY_USERREFERENCE, SUPERADMIN_REFERENCE); InstallJob job = componentManager.getInstance(Job.class, InstallJob.JOBTYPE); job.initialize(installRequest); job.run(); } catch (ComponentLookupException e) { throw new WikiCreationException(String.format("Failed to install the extension [%s] on the wiki [%s].", extensionId.toString(), wikiId), e); } }  }
ExtensionInstaller { public void installExtension(String wikiId, ExtensionId extensionId) throws WikiCreationException { try { InstallRequest installRequest = new InstallRequest(); installRequest.setId(Arrays.asList(WikiCreationJob.JOB_ID_PREFIX, "install", wikiId)); installRequest.addExtension(extensionId); installRequest.addNamespace("wiki:" + wikiId); installRequest.setProperty(PROPERTY_USERREFERENCE, SUPERADMIN_REFERENCE); InstallJob job = componentManager.getInstance(Job.class, InstallJob.JOBTYPE); job.initialize(installRequest); job.run(); } catch (ComponentLookupException e) { throw new WikiCreationException(String.format("Failed to install the extension [%s] on the wiki [%s].", extensionId.toString(), wikiId), e); } }  void installExtension(String wikiId, ExtensionId extensionId); }
ExtensionInstaller { public void installExtension(String wikiId, ExtensionId extensionId) throws WikiCreationException { try { InstallRequest installRequest = new InstallRequest(); installRequest.setId(Arrays.asList(WikiCreationJob.JOB_ID_PREFIX, "install", wikiId)); installRequest.addExtension(extensionId); installRequest.addNamespace("wiki:" + wikiId); installRequest.setProperty(PROPERTY_USERREFERENCE, SUPERADMIN_REFERENCE); InstallJob job = componentManager.getInstance(Job.class, InstallJob.JOBTYPE); job.initialize(installRequest); job.run(); } catch (ComponentLookupException e) { throw new WikiCreationException(String.format("Failed to install the extension [%s] on the wiki [%s].", extensionId.toString(), wikiId), e); } }  void installExtension(String wikiId, ExtensionId extensionId);  }