use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class ObjectCreatorUtils method createFolder.
public static Folder createFolder(String name, Long parentId) {
Folder folder = new Folder();
folder.setName(name);
folder.setParentId(parentId);
return folder;
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class IssueManagerTest method testDeleteIssuesWhenEntityWasDeleted.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testDeleteIssuesWhenEntityWasDeleted() {
when(authManager.getAuthorizedUser()).thenReturn(AUTHOR);
Folder folder = new Folder();
folder.setName(FOLDER_NAME_2);
folder.setOwner(AUTHOR);
folderDao.createFolder(folder);
EntityVO entityVO = new EntityVO(folder.getId(), AclClass.FOLDER);
IssueVO issueVO = getIssueVO(ISSUE_NAME, ISSUE_TEXT, entityVO);
issueManager.createIssue(issueVO);
folderManager.delete(folder.getId());
List<Issue> issues = issueManager.loadIssuesForEntity(entityVO);
assertTrue(CollectionUtils.isEmpty(issues));
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class IssueManagerTest method setUp.
@Before
public void setUp() throws Exception {
Folder folder = new Folder();
folder.setName(FOLDER_NAME);
folder.setOwner(AUTHOR);
folderDao.createFolder(folder);
folderDao.loadFolder(folder.getId());
entityVO = new EntityVO(folder.getId(), AclClass.FOLDER);
testAttachment = new Attachment();
testAttachment.setName("test");
testAttachment.setPath("///");
testAttachment.setCreatedDate(new Date());
testAttachment.setOwner(AUTHOR);
attachmentDao.createAttachment(testAttachment);
Preference systemDataStorage = SystemPreferences.DATA_STORAGE_SYSTEM_DATA_STORAGE_NAME.toPreference();
systemDataStorage.setName(TEST_SYSTEM_DATA_STORAGE);
when(preferenceManager.getPreference(SystemPreferences.DATA_STORAGE_SYSTEM_DATA_STORAGE_NAME)).thenReturn(TEST_SYSTEM_DATA_STORAGE);
when(dataStorageManager.loadByNameOrId(TEST_SYSTEM_DATA_STORAGE)).thenReturn(testSystemDataStorage);
when(dataStorageManager.deleteDataStorageItems(any(), any(), any())).thenReturn(1);
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderApiServiceTest method createTemplateAndGetProject.
private void createTemplateAndGetProject() {
Folder folder = new Folder();
folder.setName(FOLDER_NAME);
folder.setParentId(parent.getId());
when(folderManager.create(folder)).thenReturn(folder);
folderApiService.create(folder);
when(folderManager.createFromTemplate(anyObject(), anyString())).thenReturn(folder);
folderApiService.createFromTemplate(folder, "template");
FolderWithMetadata folderWithMetadata = new FolderWithMetadata();
folderWithMetadata.setId(parent.getId());
when(folderManager.getProject(anyLong(), anyObject())).thenReturn(folderWithMetadata);
folderApiService.getProject(folderWithMetadata.getId(), AclClass.FOLDER);
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderApiServiceTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
ReflectionTestUtils.setField(folderApiService, "folderManager", folderManager);
testUserSid = new AclTestDao.AclSid(true, TEST_USER);
aclTestDao.createAclSid(testUserSid);
testUser2Sid = new AclTestDao.AclSid(true, TEST_USER2);
aclTestDao.createAclSid(testUser2Sid);
AclTestDao.AclClass folderAclClass = new AclTestDao.AclClass(Folder.class.getCanonicalName());
aclTestDao.createAclClassIfNotPresent(folderAclClass);
AclTestDao.AclClass pipelineAclClass = new AclTestDao.AclClass(Pipeline.class.getCanonicalName());
aclTestDao.createAclClassIfNotPresent(pipelineAclClass);
// Initial creating of parent folder
parent = new Folder();
parent.setName("testParent");
parent.setOwner(TEST_USER);
folderDao.createFolder(parent);
childFolder = new Folder();
childFolder.setName(FOLDER_NAME);
childFolder.setParentId(parent.getId());
childFolder.setOwner(TEST_USER2);
pipeline1 = constructPipeline(TEST_PIPELINE1, TEST_PIPELINE_REPO, childFolder.getId());
pipeline1.setOwner(TEST_USER2);
pipelineDao.createPipeline(pipeline1);
childFolder.getPipelines().add(pipeline1);
childFolder.setParent(parent);
folderDao.createFolder(childFolder);
// ACL's for Parent folder
parentAclObjectIdentity = new AclTestDao.AclObjectIdentity(testUserSid, parent.getId(), folderAclClass.getId(), null, true);
aclTestDao.createObjectIdentity(parentAclObjectIdentity);
parentAclEntry = new AclTestDao.AclEntry(parentAclObjectIdentity, 1, testUserSid, AclPermission.WRITE.getMask(), true);
aclTestDao.createAclEntry(parentAclEntry);
pipelineAclObjectIdentity = new AclTestDao.AclObjectIdentity(testUser2Sid, pipeline1.getId(), pipelineAclClass.getId(), parentAclObjectIdentity, false);
aclTestDao.createObjectIdentity(pipelineAclObjectIdentity);
pipelineAclEntry = new AclTestDao.AclEntry(pipelineAclObjectIdentity, 1, testUser2Sid, AclPermission.READ.getMask(), false);
aclTestDao.createAclEntry(pipelineAclEntry);
childAclObjectIdentity = new AclTestDao.AclObjectIdentity(testUser2Sid, childFolder.getId(), folderAclClass.getId(), parentAclObjectIdentity, true);
aclTestDao.createObjectIdentity(childAclObjectIdentity);
childAclEntry = new AclTestDao.AclEntry(childAclObjectIdentity, 1, testUser2Sid, AclPermission.WRITE.getMask(), true);
aclTestDao.createAclEntry(childAclEntry);
// deny write for child folder fro TEST_USER
AclTestDao.AclEntry denyChildAclEntry = new AclTestDao.AclEntry(childAclObjectIdentity, 2, testUserSid, AclPermission.NO_WRITE.getMask(), true);
aclTestDao.createAclEntry(denyChildAclEntry);
}
Aggregations