@Test public void resolveInstalledExtensionDependencyOnNamespace() throws Exception { String namespace = "wiki:math"; String extensionId = "test:extension"; ExtensionDependency extensionDependency = mock(ExtensionDependency.class); doThrow(ResolveException.class).when(this.coreExtensionRepository).resolve(extensionDependency); InstalledExtension extension = mock(InstalledExtension.class); when(extensionDependency.getId()).thenReturn(extensionId); when(this.installedExtensionRepository.getInstalledExtension(extensionId, namespace)).thenReturn(extension); Version version = mock(Version.class); when(extension.getId()).thenReturn(new ExtensionId(extensionId, version)); VersionConstraint versionConstraint = mock(VersionConstraint.class); when(extensionDependency.getVersionConstraint()).thenReturn(versionConstraint); when(versionConstraint.containsVersion(version)).thenReturn(true); assertSame(extension, this.mocker.getComponentUnderTest().resolveExtension(extensionDependency, namespace)); }
@Override public Extension resolveExtension(ExtensionId extensionId) throws ResolveException { try { return this.coreExtensionRepository.resolve(extensionId); } catch (ResolveException notACoreExtension) { return resolveExtensionFromInstalled(extensionId); } }
DefaultExtensionManager implements ExtensionManager, Initializable { @Override public Extension resolveExtension(ExtensionId extensionId) throws ResolveException { try { return this.coreExtensionRepository.resolve(extensionId); } catch (ResolveException notACoreExtension) { return resolveExtensionFromInstalled(extensionId); } } }
DefaultExtensionManager implements ExtensionManager, Initializable { @Override public Extension resolveExtension(ExtensionId extensionId) throws ResolveException { try { return this.coreExtensionRepository.resolve(extensionId); } catch (ResolveException notACoreExtension) { return resolveExtensionFromInstalled(extensionId); } }  }
DefaultExtensionManager implements ExtensionManager, Initializable { @Override public Extension resolveExtension(ExtensionId extensionId) throws ResolveException { try { return this.coreExtensionRepository.resolve(extensionId); } catch (ResolveException notACoreExtension) { return resolveExtensionFromInstalled(extensionId); } }  @Override void initialize(); @Override Extension resolveExtension(ExtensionId extensionId); @Override @Deprecated Extension resolveExtension(ExtensionDependency extensionDependency); @Override Extension resolveExtension(ExtensionDependency extensionDependency, String namespace); @Override ExtensionRepository getRepository(String repositoryId); @Override Extension getAccessibleExtension(String feature, Namespace namespace); @Override IterableResult<Extension> searchAccessibleExtensions(Namespace namespace, ExtensionQuery query); }
DefaultExtensionManager implements ExtensionManager, Initializable { @Override public Extension resolveExtension(ExtensionId extensionId) throws ResolveException { try { return this.coreExtensionRepository.resolve(extensionId); } catch (ResolveException notACoreExtension) { return resolveExtensionFromInstalled(extensionId); } }  @Override void initialize(); @Override Extension resolveExtension(ExtensionId extensionId); @Override @Deprecated Extension resolveExtension(ExtensionDependency extensionDependency); @Override Extension resolveExtension(ExtensionDependency extensionDependency, String namespace); @Override ExtensionRepository getRepository(String repositoryId); @Override Extension getAccessibleExtension(String feature, Namespace namespace); @Override IterableResult<Extension> searchAccessibleExtensions(Namespace namespace, ExtensionQuery query);  }