Java Code Examples for org.alfresco.service.ServiceRegistry#getDescriptorService()

The following examples show how to use org.alfresco.service.ServiceRegistry#getDescriptorService() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DescriptorServiceTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Test installed repository descriptor
 */
@Test
public void testInstalledRepositoryDescriptor()
{
    ServiceRegistry registry = (ServiceRegistry)applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    DescriptorService descriptorService = registry.getDescriptorService();
    Descriptor repoDescriptor = descriptorService.getInstalledRepositoryDescriptor();
    
    String major = repoDescriptor.getVersionMajor();
    String minor = repoDescriptor.getVersionMinor();
    String revision = repoDescriptor.getVersionRevision();
    String label = repoDescriptor.getVersionLabel();
    String build = repoDescriptor.getVersionBuild();
    String version = major + "." + minor + "."  + revision;
    version = buildVersionString(version, label, build);
    
    assertEquals(version, repoDescriptor.getVersion());
    
    int schemaVersion = repoDescriptor.getSchema();
    assertTrue("Repository schema version must be greater than -1", schemaVersion > -1);
}
 
Example 2
Source File: DescriptorServiceTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testReadOnlyLicenseLoad_ALF10110() throws Exception
{
    QName vetoName = QName.createQName("{test}veto");
    TransactionServiceImpl txnService = (TransactionServiceImpl) applicationContext.getBean("TransactionService");
    ServiceRegistry registry = (ServiceRegistry)applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    DescriptorService descriptorService = registry.getDescriptorService();
    // Veto writes
    try
    {
        txnService.setAllowWrite(false, vetoName);
        // Now reload the license
        descriptorService.loadLicense();
    }
    finally
    {
        txnService.setAllowWrite(true, vetoName);
    }
}
 
Example 3
Source File: DescriptorServiceTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Test server decriptor
 */
@Test
public void testServerDescriptor()
{
    ServiceRegistry registry = (ServiceRegistry)applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    DescriptorService descriptorService = registry.getDescriptorService();
    Descriptor serverDescriptor = descriptorService.getServerDescriptor();
    
    String major = serverDescriptor.getVersionMajor();
    String minor = serverDescriptor.getVersionMinor();
    String revision = serverDescriptor.getVersionRevision();
    String label = serverDescriptor.getVersionLabel();
    String build = serverDescriptor.getVersionBuild();
    String edition = serverDescriptor.getEdition();
    String id = serverDescriptor.getId();
    
    String version = major + "." + minor + "."  + revision;
    version = buildVersionString(version, label, build);
    
    assertEquals(version, serverDescriptor.getVersion());
    
    int schemaVersion = serverDescriptor.getSchema();
    assertTrue("Server schema version must be greater than 0", schemaVersion > 0);
    
    assertNotNull("edition is null", edition);
    assertEquals("id ", id, "Unknown");
}
 
Example 4
Source File: DescriptorServiceTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Test current repository descriptor
 */
@Test
public void testCurrentRepositoryDescriptor()
{
    ServiceRegistry registry = (ServiceRegistry)applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    DescriptorService descriptorService = registry.getDescriptorService();
    Descriptor repoDescriptor = descriptorService.getCurrentRepositoryDescriptor();
    
    String major = repoDescriptor.getVersionMajor();
    String minor = repoDescriptor.getVersionMinor();
    String revision = repoDescriptor.getVersionRevision();
    String label = repoDescriptor.getVersionLabel();
    String build = repoDescriptor.getVersionBuild();
    String id = repoDescriptor.getId();
    
    String version = major + "." + minor + "."  + revision;
    version = buildVersionString(version, label, build);
   
    assertEquals(version, repoDescriptor.getVersion());
    
    assertNotNull("repository id is null", id);
    assertNotNull("major is null", major);
    assertNotNull("minor is null", minor);
    assertNotNull("revision is null", revision);
    
    int schemaVersion = repoDescriptor.getSchema();
    assertTrue("Repository schema version must be greater than -1", schemaVersion > -1);
}
 
Example 5
Source File: DescriptorServiceTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void testCompareDescriptors()
{
    ServiceRegistry registry = (ServiceRegistry)applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    DescriptorService descriptorService = registry.getDescriptorService();
    Descriptor serverDescriptor = descriptorService.getServerDescriptor();
    Descriptor repoDescriptor = descriptorService.getCurrentRepositoryDescriptor();
    
    String major1 = repoDescriptor.getVersionMajor();
    String minor1 = repoDescriptor.getVersionMinor();
    String revision1 = repoDescriptor.getVersionRevision();
    String label1 = repoDescriptor.getVersionLabel();
    String build1 = repoDescriptor.getVersionBuild();
    String id1 = repoDescriptor.getId();
    
    String major2 = serverDescriptor.getVersionMajor();
    String minor2 = serverDescriptor.getVersionMinor();
    String revision2 = serverDescriptor.getVersionRevision();
    String label2 = serverDescriptor.getVersionLabel();
    String build2 = serverDescriptor.getVersionBuild();
    String id2 = serverDescriptor.getId();
    
    assertEquals("major version different", major1, major2);
    assertEquals("minor version different", minor1, minor2);
    assertEquals("revision version different", revision1, revision2);
    assertEquals("label version different", label1, label2);
    assertEquals("build version different", build1, build2);
    

}