use of org.alfresco.repo.model.Repository in project alfresco-remote-api by Alfresco.
the class DownloadRestApiTest method setUp.
public void setUp() {
// Resolve required services
authenticationService = getServer().getApplicationContext().getBean("AuthenticationService", MutableAuthenticationService.class);
authenticationComponent = getServer().getApplicationContext().getBean("authenticationComponent", AuthenticationComponent.class);
contentService = getServer().getApplicationContext().getBean("ContentService", ContentService.class);
nodeService = getServer().getApplicationContext().getBean("NodeService", NodeService.class);
personService = getServer().getApplicationContext().getBean("PersonService", PersonService.class);
// Authenticate as user
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// if user with given user name doesn't already exist then create user
if (this.authenticationService.authenticationExists(TEST_USERNAME) == false) {
// create user
this.authenticationService.createAuthentication(TEST_USERNAME, "password".toCharArray());
// create person properties
PropertyMap personProps = new PropertyMap();
personProps.put(ContentModel.PROP_USERNAME, TEST_USERNAME);
personProps.put(ContentModel.PROP_FIRSTNAME, "FirstName123");
personProps.put(ContentModel.PROP_LASTNAME, "LastName123");
personProps.put(ContentModel.PROP_EMAIL, "FirstName123.LastName123@email.com");
personProps.put(ContentModel.PROP_JOBTITLE, "JobTitle123");
personProps.put(ContentModel.PROP_JOBTITLE, "Organisation123");
// create person node for user
this.personService.createPerson(personProps);
}
Repository repositoryHelper = (Repository) getServer().getApplicationContext().getBean("repositoryHelper");
NodeRef companyHome = repositoryHelper.getCompanyHome();
// Create some static test content
rootFolder = createNode(companyHome, "rootFolder", ContentModel.TYPE_FOLDER, AuthenticationUtil.getAdminUserName());
rootFile = createNodeWithTextContent(companyHome, "rootFile", ContentModel.TYPE_CONTENT, AuthenticationUtil.getAdminUserName(), "Root file content");
level1File = createNodeWithTextContent(rootFolder, "level1File", ContentModel.TYPE_CONTENT, AuthenticationUtil.getAdminUserName(), "Level 1 file content");
level1Folder = createNode(rootFolder, "level1Folder", ContentModel.TYPE_FOLDER, AuthenticationUtil.getAdminUserName());
level2File = createNodeWithTextContent(level1Folder, "level2File", ContentModel.TYPE_CONTENT, AuthenticationUtil.getAdminUserName(), "Level 2 file content");
}
use of org.alfresco.repo.model.Repository in project alfresco-repository by Alfresco.
the class InviteSenderTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
ServiceRegistry services = mockServices();
Repository repository = mockRepository();
sender = new InviteNominatedSender(services, repository, messageService);
lastSetMailModel = null;
}
use of org.alfresco.repo.model.Repository in project alfresco-repository by Alfresco.
the class TemporaryNodesTest method initStaticData.
@BeforeClass
public static void initStaticData() throws Exception {
COCI_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("checkOutCheckInService", CheckOutCheckInService.class);
CONTENT_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("ContentService", ContentService.class);
NODE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("NodeService", NodeService.class);
SITE_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("SiteService", SiteService.class);
TRANSACTION_HELPER = APP_CONTEXT_INIT.getApplicationContext().getBean("retryingTransactionHelper", RetryingTransactionHelper.class);
VERSION_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("VersionService", VersionService.class);
Repository repositoryHelper = APP_CONTEXT_INIT.getApplicationContext().getBean("repositoryHelper", Repository.class);
COMPANY_HOME = repositoryHelper.getCompanyHome();
}
use of org.alfresco.repo.model.Repository in project alfresco-repository by Alfresco.
the class InviteModeratedSenderTest 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(requesterNodeRef);
return repository;
}
use of org.alfresco.repo.model.Repository in project alfresco-repository by Alfresco.
the class ScriptNodeTest method testGetQnamePath.
/**
* ALF-21962: Webscripts - node.qnamePath incorrectly returns ":" for items without namespace prefix
*/
@Test
public void testGetQnamePath() {
Repository repositoryHelper = (Repository) APP_CONTEXT_INIT.getApplicationContext().getBean("repositoryHelper");
NodeRef companyHome = repositoryHelper.getCompanyHome();
{
// test nodes with namespace
NodeRef newNode1 = testNodes.createNode(companyHome, "theTestContent198", ContentModel.TYPE_CONTENT, AuthenticationUtil.getFullyAuthenticatedUser());
// test on content data
ScriptNode sn = new ScriptNode(newNode1, SERVICE_REGISTRY);
sn.setScope(getScope());
ContentData contentData = (ContentData) NODE_SERVICE.getProperty(newNode1, ContentModel.PROP_CONTENT);
assertNull(contentData);
String path = sn.getQnamePath();
assertEquals("/app:company_home/app:theTestContent198", path);
}
{
// test nodes without namespace
QName childName = QName.createQName(null, "theTestContent199");
NodeRef newNodeWithNoNamespace = testNodes.createNodeWithTextContent(companyHome, childName, "theTestContent199", ContentModel.TYPE_CONTENT, AuthenticationUtil.getFullyAuthenticatedUser(), "some content");
// test on content data
ScriptNode sn = new ScriptNode(newNodeWithNoNamespace, SERVICE_REGISTRY);
sn.setScope(getScope());
ContentData contentData = (ContentData) NODE_SERVICE.getProperty(newNodeWithNoNamespace, ContentModel.PROP_CONTENT);
assertNotNull(contentData);
String path = sn.getQnamePath();
assertEquals("/app:company_home/theTestContent199", path);
}
}
Aggregations