@Test public void repairInstalledExtension() throws JobException { when(this.authorization.hasAccess(Right.PROGRAM)).thenReturn(true); String wiki = "subwiki"; String extensionId = "fakeextension"; String version = "1.3"; String wikiNamespace = "wiki:subwiki"; InstallRequest expectedInstallRequest = new InstallRequest(); List<String> jobId = ExtensionRequest.getJobId(ExtensionRequest.JOBID_ACTION_PREFIX, extensionId, wikiNamespace); expectedInstallRequest.setId(jobId); DocumentReference userReference = new DocumentReference("wiki", "Alice", "WebHome"); when(this.documentAccessBridge.getCurrentUserReference()).thenReturn(userReference); expectedInstallRequest.setProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, userReference); expectedInstallRequest.setExtensionProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, userReference.toString()); expectedInstallRequest.addExtension(new ExtensionId(extensionId, version)); expectedInstallRequest.addNamespace(wikiNamespace); this.xarExtensionScriptService.repairInstalledExtension(extensionId, version, wiki); ArgumentCaptor<InstallRequest> installRequestArgumentCaptor = ArgumentCaptor.forClass(InstallRequest.class); verify(this.jobExecutor).execute(eq(RepairXarJob.JOBTYPE), installRequestArgumentCaptor.capture()); InstallRequest installRequest = installRequestArgumentCaptor.getValue(); assertEquals(expectedInstallRequest.getId(), installRequest.getId()); assertEquals(expectedInstallRequest.getProperties(), installRequest.getProperties()); }
public Job repairInstalledExtension(String id, String version, String wiki) { setError(null); if (!this.authorization.hasAccess(Right.PROGRAM)) { setError(new JobException("Need programming right to repair a XAR")); return null; } String namespace = getWikiNamespace(wiki); InstallRequest installRequest = new InstallRequest(); installRequest.setId(ExtensionRequest.getJobId(ExtensionRequest.JOBID_ACTION_PREFIX, id, namespace)); DocumentReference currentUserReference = this.documentAccessBridge.getCurrentUserReference(); if (currentUserReference != null) { installRequest.setProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, currentUserReference); installRequest.setExtensionProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, currentUserReference.toString()); } installRequest.addExtension(new ExtensionId(id, version)); if (StringUtils.isNotBlank(namespace)) { installRequest.addNamespace(namespace); } Job job = null; try { job = this.jobExecutor.execute(RepairXarJob.JOBTYPE, installRequest); } catch (Exception e) { setError(e); } return job; }
XarExtensionScriptService extends AbstractExtensionScriptService { public Job repairInstalledExtension(String id, String version, String wiki) { setError(null); if (!this.authorization.hasAccess(Right.PROGRAM)) { setError(new JobException("Need programming right to repair a XAR")); return null; } String namespace = getWikiNamespace(wiki); InstallRequest installRequest = new InstallRequest(); installRequest.setId(ExtensionRequest.getJobId(ExtensionRequest.JOBID_ACTION_PREFIX, id, namespace)); DocumentReference currentUserReference = this.documentAccessBridge.getCurrentUserReference(); if (currentUserReference != null) { installRequest.setProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, currentUserReference); installRequest.setExtensionProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, currentUserReference.toString()); } installRequest.addExtension(new ExtensionId(id, version)); if (StringUtils.isNotBlank(namespace)) { installRequest.addNamespace(namespace); } Job job = null; try { job = this.jobExecutor.execute(RepairXarJob.JOBTYPE, installRequest); } catch (Exception e) { setError(e); } return job; } }
XarExtensionScriptService extends AbstractExtensionScriptService { public Job repairInstalledExtension(String id, String version, String wiki) { setError(null); if (!this.authorization.hasAccess(Right.PROGRAM)) { setError(new JobException("Need programming right to repair a XAR")); return null; } String namespace = getWikiNamespace(wiki); InstallRequest installRequest = new InstallRequest(); installRequest.setId(ExtensionRequest.getJobId(ExtensionRequest.JOBID_ACTION_PREFIX, id, namespace)); DocumentReference currentUserReference = this.documentAccessBridge.getCurrentUserReference(); if (currentUserReference != null) { installRequest.setProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, currentUserReference); installRequest.setExtensionProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, currentUserReference.toString()); } installRequest.addExtension(new ExtensionId(id, version)); if (StringUtils.isNotBlank(namespace)) { installRequest.addNamespace(namespace); } Job job = null; try { job = this.jobExecutor.execute(RepairXarJob.JOBTYPE, installRequest); } catch (Exception e) { setError(e); } return job; }  }
XarExtensionScriptService extends AbstractExtensionScriptService { public Job repairInstalledExtension(String id, String version, String wiki) { setError(null); if (!this.authorization.hasAccess(Right.PROGRAM)) { setError(new JobException("Need programming right to repair a XAR")); return null; } String namespace = getWikiNamespace(wiki); InstallRequest installRequest = new InstallRequest(); installRequest.setId(ExtensionRequest.getJobId(ExtensionRequest.JOBID_ACTION_PREFIX, id, namespace)); DocumentReference currentUserReference = this.documentAccessBridge.getCurrentUserReference(); if (currentUserReference != null) { installRequest.setProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, currentUserReference); installRequest.setExtensionProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, currentUserReference.toString()); } installRequest.addExtension(new ExtensionId(id, version)); if (StringUtils.isNotBlank(namespace)) { installRequest.addNamespace(namespace); } Job job = null; try { job = this.jobExecutor.execute(RepairXarJob.JOBTYPE, installRequest); } catch (Exception e) { setError(e); } return job; }  Job repairInstalledExtension(String id, String version, String wiki); List<String> getDiffJobId(String feature, String namespace); Job diff(String feature, String wiki); ConflictQuestion.ConflictType[] getConflictTypes(); boolean reset(DocumentReference reference, ExtensionId extensionId, List<String> jobId); boolean reset(DocumentReference reference, List<String> jobId); Collection<InstalledExtension> getInstalledExtensions(DocumentReference reference); Document getInstalledExtensionDocument(DocumentReference reference); Document getInstalledExtensionDocument(DocumentReference reference, ExtensionId extensionId); Document getInstalledExtensionDocument(DocumentReference reference, XarInstalledExtension extension); boolean isEditAllowed(DocumentReference documentReference); boolean isDeleteAllowed(DocumentReference documentReference); ProtectionLevel getEditSecurityLevel(DocumentReference userReference, DocumentReference documentReference); ProtectionLevel getDeleteSecurityLevel(DocumentReference userReference, DocumentReference documentReference); @Unstable Boolean isExtensionDocument(DocumentReference documentReference); @Unstable Boolean isCustomizedExtensionDocument(DocumentReference documentReference); }
XarExtensionScriptService extends AbstractExtensionScriptService { public Job repairInstalledExtension(String id, String version, String wiki) { setError(null); if (!this.authorization.hasAccess(Right.PROGRAM)) { setError(new JobException("Need programming right to repair a XAR")); return null; } String namespace = getWikiNamespace(wiki); InstallRequest installRequest = new InstallRequest(); installRequest.setId(ExtensionRequest.getJobId(ExtensionRequest.JOBID_ACTION_PREFIX, id, namespace)); DocumentReference currentUserReference = this.documentAccessBridge.getCurrentUserReference(); if (currentUserReference != null) { installRequest.setProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, currentUserReference); installRequest.setExtensionProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, currentUserReference.toString()); } installRequest.addExtension(new ExtensionId(id, version)); if (StringUtils.isNotBlank(namespace)) { installRequest.addNamespace(namespace); } Job job = null; try { job = this.jobExecutor.execute(RepairXarJob.JOBTYPE, installRequest); } catch (Exception e) { setError(e); } return job; }  Job repairInstalledExtension(String id, String version, String wiki); List<String> getDiffJobId(String feature, String namespace); Job diff(String feature, String wiki); ConflictQuestion.ConflictType[] getConflictTypes(); boolean reset(DocumentReference reference, ExtensionId extensionId, List<String> jobId); boolean reset(DocumentReference reference, List<String> jobId); Collection<InstalledExtension> getInstalledExtensions(DocumentReference reference); Document getInstalledExtensionDocument(DocumentReference reference); Document getInstalledExtensionDocument(DocumentReference reference, ExtensionId extensionId); Document getInstalledExtensionDocument(DocumentReference reference, XarInstalledExtension extension); boolean isEditAllowed(DocumentReference documentReference); boolean isDeleteAllowed(DocumentReference documentReference); ProtectionLevel getEditSecurityLevel(DocumentReference userReference, DocumentReference documentReference); ProtectionLevel getDeleteSecurityLevel(DocumentReference userReference, DocumentReference documentReference); @Unstable Boolean isExtensionDocument(DocumentReference documentReference); @Unstable Boolean isCustomizedExtensionDocument(DocumentReference documentReference);  }