use of org.xwiki.extension.repository.CoreExtensionRepository in project xwiki-platform by xwiki.
the class DistributionPingDataProviderTest method provideData.
@Test
public void provideData() throws Exception {
InstanceId id = new InstanceId(UUID.randomUUID().toString());
InstanceIdManager idManager = this.mocker.getInstance(InstanceIdManager.class);
when(idManager.getInstanceId()).thenReturn(id);
ExtensionId environmentExtensionId = new ExtensionId("environmentextensionid", "2.0");
CoreExtension environmentExtension = mock(CoreExtension.class);
when(environmentExtension.getId()).thenReturn(environmentExtensionId);
CoreExtensionRepository CoreExtensionRepository = this.mocker.getInstance(CoreExtensionRepository.class);
when(CoreExtensionRepository.getEnvironmentExtension()).thenReturn(environmentExtension);
Map<String, Object> data = this.mocker.getComponentUnderTest().provideData();
assertEquals(3, data.size());
assertEquals("environmentextensionid", data.get("distributionId"));
assertEquals("2.0", data.get("distributionVersion"));
assertEquals(id.getInstanceId(), data.get("instanceId"));
}
Aggregations