use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderApiServiceTest method testCreateFolderByNotAdminOrFolderManagerAndWrite.
@Test(expected = AccessDeniedException.class)
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
@WithMockUser(username = TEST_USER2)
public void testCreateFolderByNotAdminOrFolderManagerAndWrite() {
Folder folder = new Folder();
folder.setName(FOLDER_NAME);
folder.setParentId(parent.getId());
when(folderManager.create(folder)).thenReturn(folder);
folderApiService.create(folder);
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class IssueApiServiceTest method setUp.
@Before
public void setUp() {
Folder folder = new Folder();
folder.setName(TEST_FOLDER_NAME);
folder.setOwner(USER_OWNER);
folderDao.createFolder(folder);
// Mock ACL
AclTestDao.AclSid testUserSid = new AclTestDao.AclSid(true, USER_OWNER);
aclTestDao.createAclSid(testUserSid);
AclTestDao.AclClass folderAclClass = new AclTestDao.AclClass(Folder.class.getCanonicalName());
aclTestDao.createAclClassIfNotPresent(folderAclClass);
AclTestDao.AclObjectIdentity objectIdentity = new AclTestDao.AclObjectIdentity(testUserSid, folder.getId(), folderAclClass.getId(), null, true);
aclTestDao.createObjectIdentity(objectIdentity);
AclTestDao.AclEntry aclEntry = new AclTestDao.AclEntry(objectIdentity, 1, testUserSid, AclPermission.READ.getMask(), true);
aclTestDao.createAclEntry(aclEntry);
AclTestDao.AclSid noPermissionUserSid = new AclTestDao.AclSid(true, NO_PERMISSION_USER);
aclTestDao.createAclSid(noPermissionUserSid);
entityVO = new EntityVO(folder.getId(), AclClass.FOLDER);
createdIssue = new Issue();
createdIssue.setName(ISSUE_NAME);
createdIssue.setText(ISSUE_TEXT);
createdIssue.setAuthor(USER_OWNER);
createdIssue.setEntity(entityVO);
createdIssue.setStatus(IssueStatus.OPEN);
issueDao.createIssue(createdIssue);
createdIssueComment = new IssueComment();
createdIssueComment.setIssueId(createdIssue.getId());
createdIssueComment.setAuthor(USER_OWNER);
createdIssueComment.setText(COMMENT_TEXT);
issueCommentDao.createComment(createdIssueComment);
AclTestDao.AclSid canReadUserSid = new AclTestDao.AclSid(true, CAN_READ_USER);
aclTestDao.createAclSid(canReadUserSid);
aclEntry = new AclTestDao.AclEntry(objectIdentity, 2, canReadUserSid, AclPermission.READ.getMask(), true);
aclTestDao.createAclEntry(aclEntry);
verify(notificationManager, Mockito.never()).notifyIssue(any(), any(), any());
Mockito.doNothing().when(attachmentFileManager).deleteAttachments(Mockito.anyListOf(Attachment.class));
attachment = new Attachment();
attachment.setName("testAttachment");
attachment.setCreatedDate(new Date());
attachment.setPath("///");
attachment.setOwner(TEST_USER);
attachmentDao.createAttachment(attachment);
Mockito.doNothing().when(attachmentFileManager).deleteAttachments(Mockito.anyListOf(Attachment.class));
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderManagerGetProjectTest method getProjectShouldWorkWithFolderAsInputEntity.
@Test
public void getProjectShouldWorkWithFolderAsInputEntity() {
Mockito.when(entityManager.load(Matchers.any(AclClass.class), Matchers.any(Long.class))).thenReturn(folder3);
Folder actualFolder = folderManager.getProject(folder3.getId(), AclClass.FOLDER);
assertFolders(folder2, actualFolder);
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderManagerGetProjectTest method getProjectShouldWorkWithPipelineAsInputEntity.
@Test
public void getProjectShouldWorkWithPipelineAsInputEntity() {
Pipeline pipeline = new Pipeline();
pipeline.setId(1L);
pipeline.setParent(folder3);
Mockito.when(entityManager.load(Matchers.any(AclClass.class), Matchers.any(Long.class))).thenReturn(pipeline);
Folder actualFolder = folderManager.getProject(pipeline.getId(), AclClass.PIPELINE);
assertFolders(folder2, actualFolder);
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderManagerGetProjectTest method getProjectShouldWorkWithConfigurationAsInputEntity.
@Test
public void getProjectShouldWorkWithConfigurationAsInputEntity() {
RunConfiguration configuration = new RunConfiguration();
configuration.setId(1L);
configuration.setParent(folder3);
Mockito.when(entityManager.load(Matchers.any(AclClass.class), Matchers.any(Long.class))).thenReturn(configuration);
Folder actualFolder = folderManager.getProject(configuration.getId(), AclClass.CONFIGURATION);
assertFolders(folder2, actualFolder);
}
Aggregations