use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class RunConfigurationManager method update.
@Transactional(propagation = Propagation.REQUIRED)
public RunConfiguration update(RunConfigurationVO configuration) {
validateConfiguration(runConfigurationMapper.toRunConfiguration(configuration));
RunConfiguration dbConfiguration = load(configuration.getId());
dbConfiguration.setName(configuration.getName());
dbConfiguration.setDescription(configuration.getDescription());
dbConfiguration.setEntries(configuration.getEntries());
if (configuration.getParentId() != null) {
dbConfiguration.setParent(new Folder(configuration.getParentId()));
} else {
dbConfiguration.setParent(null);
}
return runConfigurationDao.update(dbConfiguration);
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderApiServiceTest method testCreateUpdateCloneDeleteFolderByAllowedUser.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW)
@WithMockUser(username = TEST_USER, roles = FOLDER_MANAGER_ROLE)
public void testCreateUpdateCloneDeleteFolderByAllowedUser() {
Folder folder = new Folder();
folder.setName(FOLDER_NAME);
folder.setParentId(parent.getId());
folder.setId(parent.getId());
when(folderManager.create(folder)).thenReturn(folder);
folderApiService.create(folder);
when(folderManager.load(anyLong())).thenReturn(folder);
folderApiService.load(folder.getId());
String newName = "New name";
folder.setName(newName);
when(folderManager.update(folder)).thenReturn(folder);
folderApiService.update(folder);
assertEquals(newName, folderApiService.load(folder.getId()).getName());
when(folderManager.lockFolder(anyLong())).thenReturn(folder);
folderApiService.lockFolder(folder.getId());
when(folderManager.unlockFolder(anyLong())).thenReturn(folder);
folderApiService.unlockFolder(folder.getId());
when(folderManager.cloneFolder(anyLong(), anyLong(), anyString())).thenReturn(folder);
folderApiService.cloneFolder(folder.getId(), parent.getId(), "Name");
when(folderManager.delete(anyLong())).thenReturn(folder);
folderApiService.delete(folder.getId());
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderApiServiceTest method testDeleteFolderByAdmin.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW)
@WithMockUser(username = TEST_USER2, roles = ADMIN_ROLE)
public void testDeleteFolderByAdmin() {
Folder folder = new Folder();
folder.setName(FOLDER_NAME);
folder.setParentId(parent.getId());
when(folderManager.create(folder)).thenReturn(folder);
Folder createdFolder = folderApiService.create(folder);
when(folderManager.delete(anyLong())).thenReturn(folder);
folderApiService.delete(createdFolder.getId());
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderManagerGetProjectTest method getProjectShouldWorkWithDataStorageAsInputEntity.
@Test
public void getProjectShouldWorkWithDataStorageAsInputEntity() {
S3bucketDataStorage dataStorage = new S3bucketDataStorage(1L, "dataStorage", "path_to_bucket");
dataStorage.setParent(folder3);
Mockito.when(entityManager.load(Matchers.any(AclClass.class), Matchers.any(Long.class))).thenReturn(dataStorage);
Folder actualFolder = folderManager.getProject(dataStorage.getId(), AclClass.DATA_STORAGE);
assertFolders(folder2, actualFolder);
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderManagerGetProjectTest method getProjectShouldWorkWithMetadataAsInputEntity.
@Test
public void getProjectShouldWorkWithMetadataAsInputEntity() {
MetadataEntity metadataEntity = new MetadataEntity();
metadataEntity.setId(1L);
metadataEntity.setParent(folder3);
Mockito.when(entityManager.load(Matchers.any(AclClass.class), Matchers.any(Long.class))).thenReturn(metadataEntity);
Folder actualFolder = folderManager.getProject(metadataEntity.getId(), AclClass.METADATA_ENTITY);
assertFolders(folder2, actualFolder);
}
Aggregations