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);
}
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.
}
}
}
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;
}
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;
}
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;
}
Aggregations