Search in sources :

Example 1 with Descriptor

use of org.alfresco.service.descriptor.Descriptor in project alfresco-remote-api by Alfresco.

the class RenditionsDataCollectorTest method setUp.

@Before
public void setUp() {
    mockDescriptorDAO = mock(DescriptorDAO.class);
    mockCollectorService = mock(HBDataCollectorService.class);
    mockScheduler = mock(HeartBeatJobScheduler.class);
    Descriptor mockDescriptor = mock(Descriptor.class);
    when(mockDescriptor.getId()).thenReturn("mock_id");
    when(mockDescriptorDAO.getDescriptor()).thenReturn(mockDescriptor);
    renditionsDataCollector = new RenditionsDataCollector("acs.repository.renditions", "1.0", "0 0 0 ? * *", mockScheduler);
    renditionsDataCollector.setHbDataCollectorService(mockCollectorService);
    renditionsDataCollector.setCurrentRepoDescriptorDAO(mockDescriptorDAO);
}
Also used : RenditionsDataCollector(org.alfresco.heartbeat.RenditionsDataCollector) HeartBeatJobScheduler(org.alfresco.heartbeat.jobs.HeartBeatJobScheduler) HBDataCollectorService(org.alfresco.service.cmr.repository.HBDataCollectorService) Descriptor(org.alfresco.service.descriptor.Descriptor) DescriptorDAO(org.alfresco.repo.descriptor.DescriptorDAO) Before(org.junit.Before)

Example 2 with Descriptor

use of org.alfresco.service.descriptor.Descriptor in project alfresco-repository by Alfresco.

the class ExportDb method execute.

public void execute() {
    PropertyCheck.mandatory(this, "dataSource", dataSource);
    PropertyCheck.mandatory(this, "dialect", dialect);
    PropertyCheck.mandatory(this, "descriptorService", descriptorService);
    Connection connection = null;
    try {
        connection = dataSource.getConnection();
        connection.setAutoCommit(false);
        Descriptor descriptor = descriptorService.getServerDescriptor();
        int schemaVersion = descriptor.getSchema();
        execute(connection, schemaVersion);
    } catch (Exception e) {
        throw new RuntimeException("Unable to execute export.", e);
    } finally {
        try {
            if (connection != null) {
                connection.close();
            }
        } catch (Throwable e) {
        // Little can be done at this stage.
        }
    }
}
Also used : Connection(java.sql.Connection) Descriptor(org.alfresco.service.descriptor.Descriptor) SQLException(java.sql.SQLException) IOException(java.io.IOException)

Example 3 with Descriptor

use of org.alfresco.service.descriptor.Descriptor in project alfresco-repository by Alfresco.

the class TransferServiceImplTest method getMockDescriptorService.

private DescriptorService getMockDescriptorService(String repositoryId) {
    DescriptorService descriptorService = mock(DescriptorService.class);
    Descriptor descriptor = mock(Descriptor.class);
    when(descriptor.getId()).thenReturn(repositoryId);
    when(descriptorService.getCurrentRepositoryDescriptor()).thenReturn(descriptor);
    when(descriptorService.getServerDescriptor()).thenReturn(serverDescriptor);
    return descriptorService;
}
Also used : Descriptor(org.alfresco.service.descriptor.Descriptor) DescriptorService(org.alfresco.service.descriptor.DescriptorService)

Example 4 with Descriptor

use of org.alfresco.service.descriptor.Descriptor in project alfresco-repository by Alfresco.

the class TransferServiceToBeRefactoredTest method getMockDescriptorService.

// copy node
private DescriptorService getMockDescriptorService(String repositoryId) {
    DescriptorService descriptorService = mock(DescriptorService.class);
    Descriptor descriptor = mock(Descriptor.class);
    when(descriptor.getId()).thenReturn(repositoryId);
    when(descriptorService.getCurrentRepositoryDescriptor()).thenReturn(descriptor);
    when(descriptorService.getServerDescriptor()).thenReturn(serverDescriptor);
    return descriptorService;
}
Also used : Descriptor(org.alfresco.service.descriptor.Descriptor) DescriptorService(org.alfresco.service.descriptor.DescriptorService)

Example 5 with Descriptor

use of org.alfresco.service.descriptor.Descriptor in project alfresco-repository by Alfresco.

the class RepositoryDescriptorDAOImpl method getDescriptor.

@Override
public Descriptor getDescriptor() {
    Descriptor descriptor = null;
    try {
        // retrieve system descriptor
        final NodeRef descriptorNodeRef = getDescriptorNodeRef(false);
        // create appropriate descriptor
        if (descriptorNodeRef != null) {
            final Map<QName, Serializable> properties = this.nodeService.getProperties(descriptorNodeRef);
            descriptor = new RepositoryDescriptor(properties);
        }
    } catch (final RuntimeException e) {
        if (logger.isErrorEnabled()) {
            logger.error("getDescriptor: ", e);
        }
        throw e;
    } catch (final Error e) {
        if (logger.isErrorEnabled()) {
            logger.error("getDescriptor: ", e);
        }
        throw e;
    }
    return descriptor;
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) Serializable(java.io.Serializable) QName(org.alfresco.service.namespace.QName) Descriptor(org.alfresco.service.descriptor.Descriptor) BaseDescriptor(org.alfresco.repo.descriptor.DescriptorServiceImpl.BaseDescriptor)

Aggregations

Descriptor (org.alfresco.service.descriptor.Descriptor)26 DescriptorService (org.alfresco.service.descriptor.DescriptorService)7 HeartBeatJobScheduler (org.alfresco.heartbeat.jobs.HeartBeatJobScheduler)6 DescriptorDAO (org.alfresco.repo.descriptor.DescriptorDAO)6 HBDataCollectorService (org.alfresco.service.cmr.repository.HBDataCollectorService)6 Before (org.junit.Before)6 RetryingTransactionHelper (org.alfresco.repo.transaction.RetryingTransactionHelper)5 ServiceRegistry (org.alfresco.service.ServiceRegistry)5 NodeRef (org.alfresco.service.cmr.repository.NodeRef)4 LicenseDescriptor (org.alfresco.service.license.LicenseDescriptor)4 BaseSpringTest (org.alfresco.util.BaseSpringTest)4 Test (org.junit.Test)4 Date (java.util.Date)3 HashMap (java.util.HashMap)3 RetryingTransactionCallback (org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)3 IOException (java.io.IOException)2 Serializable (java.io.Serializable)2 Connection (java.sql.Connection)2 SQLException (java.sql.SQLException)2 Properties (java.util.Properties)2