Search in sources :

Example 1 with CoreExtensionRepository

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"));
}
Also used : InstanceIdManager(org.xwiki.instance.InstanceIdManager) CoreExtension(org.xwiki.extension.CoreExtension) InstanceId(org.xwiki.instance.InstanceId) CoreExtensionRepository(org.xwiki.extension.repository.CoreExtensionRepository) ExtensionId(org.xwiki.extension.ExtensionId) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 CoreExtension (org.xwiki.extension.CoreExtension)1 ExtensionId (org.xwiki.extension.ExtensionId)1 CoreExtensionRepository (org.xwiki.extension.repository.CoreExtensionRepository)1 InstanceId (org.xwiki.instance.InstanceId)1 InstanceIdManager (org.xwiki.instance.InstanceIdManager)1