use of org.alfresco.repo.model.Repository in project alfresco-repository by Alfresco.
the class InviteSenderTest method mockRepository.
/**
* Mocks up a Repository that will return the inviter as the current user.
*
* @return Repository
*/
private Repository mockRepository() {
Repository repository = mock(Repository.class);
when(repository.getPerson()).thenReturn(inviter.node);
return repository;
}
use of org.alfresco.repo.model.Repository in project alfresco-repository by Alfresco.
the class InviteModeratedSenderTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
ServiceRegistry services = mockServices();
Repository repository = mockRepository();
inviteModeratedSender = new InviteModeratedSender(services, repository, messageService);
}
use of org.alfresco.repo.model.Repository in project alfresco-repository by Alfresco.
the class AbstractActivitiComponentTest method setUp.
@Before
public void setUp() throws Exception {
mockNamespaceService();
mockDictionaryService();
mockNodeService();
mockSearchService();
mockPermissionService();
mockPersonService();
mockAuthorityDAO();
mockServiceRegistry();
Repository repoHelper = mock(Repository.class);
when(repoHelper.getCompanyHome()).thenReturn(companyHomeNode);
workflowEngine.setRepositoryHelper(repoHelper);
// Also add custom type
// TODO: Should come from configuration
ScriptNodeVariableType variableType = new ScriptNodeVariableType();
variableType.setServiceRegistry(serviceRegistry);
// ((ProcessEngineImpl)processEngine).getProcessEngineConfiguration().getVariableTypes().addType(variableType, 1);
// Use util to set current user to admin
AuthenticationUtil.setFullyAuthenticatedUser("admin");
workflowEngine.afterPropertiesSet();
}
use of org.alfresco.repo.model.Repository in project alfresco-remote-api by Alfresco.
the class TestEnterpriseAtomPubTCK method setup.
@Before
public void setup() throws Exception {
JettyComponent jetty = getTestFixture().getJettyComponent();
final SearchService searchService = (SearchService) jetty.getApplicationContext().getBean("searchService");
;
final NodeService nodeService = (NodeService) jetty.getApplicationContext().getBean("nodeService");
final FileFolderService fileFolderService = (FileFolderService) jetty.getApplicationContext().getBean("fileFolderService");
final NamespaceService namespaceService = (NamespaceService) jetty.getApplicationContext().getBean("namespaceService");
final TransactionService transactionService = (TransactionService) jetty.getApplicationContext().getBean("transactionService");
final String name = "abc" + System.currentTimeMillis();
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {
@Override
public Void execute() throws Throwable {
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
Repository repositoryHelper = (Repository) jetty.getApplicationContext().getBean("repositoryHelper");
NodeRef companyHome = repositoryHelper.getCompanyHome();
fileFolderService.create(companyHome, name, ContentModel.TYPE_FOLDER).getNodeRef();
return null;
}
}, false, true);
int port = jetty.getPort();
Map<String, String> cmisParameters = new HashMap<String, String>();
cmisParameters.put(TestParameters.DEFAULT_RELATIONSHIP_TYPE, "R:cm:replaces");
cmisParameters.put(TestParameters.DEFAULT_TEST_FOLDER_PARENT, "/" + name);
clientContext = new OpenCMISClientContext(BindingType.ATOMPUB, MessageFormat.format(CMIS_URL, "localhost", String.valueOf(port), "alfresco"), "admin", "admin", cmisParameters, jetty.getApplicationContext());
overrideVersionableAspectProperties(jetty.getApplicationContext());
}
use of org.alfresco.repo.model.Repository in project alfresco-remote-api by Alfresco.
the class ContentGetTest method testRelativePath.
/**
* MNT-16380
*/
public void testRelativePath() throws Exception {
Repository repositoryHelper = (Repository) getServer().getApplicationContext().getBean("repositoryHelper");
NodeRef companyHome = repositoryHelper.getCompanyHome();
rootFolder = createNode(companyHome, "rootFolder", ContentModel.TYPE_FOLDER);
NodeRef doc1 = createNodeWithTextContent(rootFolder, "doc1", ContentModel.TYPE_CONTENT, "doc1 file content");
NodeRef folderX = createNode(rootFolder, "X", ContentModel.TYPE_FOLDER);
NodeRef folderY = createNode(folderX, "Y", ContentModel.TYPE_FOLDER);
NodeRef folderZ = createNode(folderY, "Z", ContentModel.TYPE_FOLDER);
NodeRef doc2 = createNodeWithTextContent(folderZ, "doc2", ContentModel.TYPE_CONTENT, "doc2 file content");
// uri with relative path at the end
String uri = URL_CONTENT_DOWNLOAD + doc1.getId() + "/X/Y/Z/doc2";
Response resp = sendRequest(new GetRequest(uri), 200);
// check if we really have doc2 as target
Assert.assertEquals("doc2 file content", resp.getContentAsString());
}
Aggregations