use of org.alfresco.repo.rendition.RenditionServiceImpl in project alfresco-repository by Alfresco.
the class ThumbnailServiceImplParameterTest method initMockObjects.
@Before
public void initMockObjects() {
renditionService = new RenditionServiceImpl() {
@Override
public RenditionDefinition loadRenditionDefinition(QName renditionDefinitionName) {
// We're intentionally returning null for this test.
return null;
}
};
renditionService.setActionService(mockActionService);
renditionService.setServiceRegistry(new MockedTestServiceRegistry());
renditionService.setRenditionService2(mockRenditionService2);
when(mockRenditionService2.isCreatedByRenditionService2(any(), any())).thenReturn(false);
ThumbnailServiceImpl thumbs = new ThumbnailServiceImpl() {
@Override
public NodeRef getThumbnailByName(NodeRef node, QName contentProperty, String thumbnailName) {
return null;
}
/**
* In this test the thumbnailRef will be null, so we need to ensure
* it is not dereferenced here.
*/
@Override
public NodeRef getThumbnailNode(ChildAssociationRef thumbnailRef) {
return null;
}
};
thumbs.setRenditionService(renditionService);
thumbs.setThumbnailRegistry(new ThumbnailRegistry() {
@Override
public ThumbnailRenditionConvertor getThumbnailRenditionConvertor() {
return new ThumbnailRenditionConvertor();
}
});
thumbs.setNodeService(mock(NodeService.class));
TransactionServiceImpl transactionServiceImpl = new TransactionServiceImpl() {
@Override
public boolean getAllowWrite() {
return true;
}
@Override
public boolean isReadOnly() {
return false;
}
@Override
public RetryingTransactionHelper getRetryingTransactionHelper() {
RetryingTransactionHelper rth = new RetryingTransactionHelper() {
@Override
public <R> R doInTransaction(RetryingTransactionCallback<R> cb, boolean readOnly, boolean requiresNew) {
try {
return cb.execute();
} catch (Throwable e) {
e.printStackTrace();
}
return null;
}
};
return rth;
}
};
thumbs.setTransactionService(transactionServiceImpl);
thumbnailService = thumbs;
}
Aggregations