use of org.xwiki.extension.test.EmptyExtension in project xwiki-platform by xwiki.
the class WikiCopiedEventListenerTest method setUp.
@Before
public void setUp() throws Exception {
this.localExtensionRepository = this.repositoryUtil.getComponentManager().getInstance(LocalExtensionRepository.class);
this.installedExtensionRepository = this.repositoryUtil.getComponentManager().getInstance(InstalledExtensionRepository.class);
this.observation = this.repositoryUtil.getComponentManager().getInstance(ObservationManager.class);
// Extensions
EmptyExtension extension = new EmptyExtension(new ExtensionId("id", "version"), "xar");
EmptyExtension extensionDependency = new EmptyExtension(new ExtensionId("dependency", "version"), "xar");
extension.addDependency(new DefaultExtensionDependency(extensionDependency.getId().getId(), new DefaultVersionConstraint(null, extensionDependency.getId().getVersion())));
this.localExtensionDependency1 = this.localExtensionRepository.storeExtension(extensionDependency);
this.localExtension1 = this.localExtensionRepository.storeExtension(extension);
}
use of org.xwiki.extension.test.EmptyExtension in project xwiki-platform by xwiki.
the class ExtensionInstanceOutputFilterStreamTest method testImportExtensionId.
// tests
@Test
public void testImportExtensionId() throws FilterException, ResolveException, UnsupportedEncodingException {
doReturn(new EmptyExtension(new ExtensionId("extensionid1", "version1"), "test")).when(this.extensionRepositoryMock).resolve(new ExtensionId("extensionid1", "version1"));
doReturn(new EmptyExtension(new ExtensionId("extensionid2", "version2"), "test")).when(this.extensionRepositoryMock).resolve(new ExtensionId("extensionid2", "version2"));
importFromXML("extensionid");
Assert.assertNull(this.installedExtensionRepository.getInstalledExtension("extensionid1", null));
Assert.assertNotNull(this.installedExtensionRepository.getInstalledExtension("extensionid1", "namespace1"));
Assert.assertEquals("version1", this.installedExtensionRepository.getInstalledExtension("extensionid1", "namespace1").getId().getVersion().getValue());
Assert.assertNull(this.installedExtensionRepository.getInstalledExtension("extensionid2", null));
Assert.assertNotNull(this.installedExtensionRepository.getInstalledExtension("extensionid2", "wiki:wiki2"));
Assert.assertEquals("version2", this.installedExtensionRepository.getInstalledExtension("extensionid2", "wiki:wiki2").getId().getVersion().getValue());
}
use of org.xwiki.extension.test.EmptyExtension in project xwiki-platform by xwiki.
the class ExtensionInstanceOutputFilterStreamTest method testImportExtensionIdWithoutNamespace.
@Test
public void testImportExtensionIdWithoutNamespace() throws FilterException, ResolveException, UnsupportedEncodingException {
doReturn(new EmptyExtension(new ExtensionId("extensionid", "version"), "test")).when(this.extensionRepositoryMock).resolve(new ExtensionId("extensionid", "version"));
importFromXML("extensionidwithoutnamespace");
Assert.assertNotNull(this.installedExtensionRepository.getInstalledExtension("extensionid", null));
Assert.assertNotNull(this.installedExtensionRepository.getInstalledExtension("extensionid", "namespace"));
Assert.assertEquals("version", this.installedExtensionRepository.getInstalledExtension("extensionid", "namespace").getId().getVersion().getValue());
}
Aggregations