use of com.epam.pipeline.entity.metadata.PipeConfValue in project cloud-pipeline by epam.
the class MetadataEntityConverterTest method shouldFailIfFireCloudClassIsNull.
@Test(expected = IllegalArgumentException.class)
public void shouldFailIfFireCloudClassIsNull() {
MetadataClass entityClass = new MetadataClass();
entityClass.setName(PARTICIPANT_TYPE_NAME);
Map<String, PipeConfValue> participantData = new HashMap<>();
participantData.put(TEST_ARGUMENT1, new PipeConfValue(STRING_TYPE, TEST_VALUE_1));
MetadataEntity participant = getEntity(entityClass, PARTICIPANT_ENTITY_ID1, participantData);
MetadataEntityConverter.convert(Collections.singletonList(participant));
}
use of com.epam.pipeline.entity.metadata.PipeConfValue in project cloud-pipeline by epam.
the class BucketPostProcessorImplTest method shouldHandleSimpleBucketName.
@Test
public void shouldHandleSimpleBucketName() {
PipeConfValue value = new PipeConfValue(bucketPostProcessor.supportedType(), BUCKET_NAME_ORIGINAL);
bucketPostProcessor.process(PARAM_NAME, value);
assertEquals(BUCKET_NAME_NORMALIZED, value.getValue());
}
use of com.epam.pipeline.entity.metadata.PipeConfValue in project cloud-pipeline by epam.
the class MetadataManagerTest method setup.
@Before
public void setup() {
expectedData.put(KEY_1, new PipeConfValue(TYPE, VALUE_1));
expectedData.put(KEY_2, new PipeConfValue(TYPE, VALUE_2));
metadataEntry.setEntity(entityVO);
metadataEntry.setData(expectedData);
}
use of com.epam.pipeline.entity.metadata.PipeConfValue in project cloud-pipeline by epam.
the class MetadataManagerTest method assertFileContent.
private void assertFileContent(String exampleContent, String fileName) throws IOException {
try (InputStream inputStream = IOUtils.toInputStream(exampleContent, "UTF-8")) {
Map<String, PipeConfValue> actualData = metadataManager.convertFileContentToMetadata(new MockMultipartFile(fileName, fileName, null, inputStream));
Assert.assertEquals(expectedData, actualData);
}
}
use of com.epam.pipeline.entity.metadata.PipeConfValue in project cloud-pipeline by epam.
the class FolderManagerTest method testGetProjectFolderFromProjectTree.
@Test
public void testGetProjectFolderFromProjectTree() {
Map<String, PipeConfValue> data = new HashMap<>();
data.put(DATA_KEY_1, new PipeConfValue(DATA_TYPE_1, DATA_VALUE_1));
Map<String, PipeConfValue> dataWithIndicator = new HashMap<>();
dataWithIndicator.put(DATA_KEY_1, new PipeConfValue(DATA_TYPE_1, PROJECT_INDICATOR_VALUE));
FolderWithMetadata folder = initFolderWithMetadata(new FolderWithMetadata(), 1L, "folder", null, data);
FolderWithMetadata folder1 = initFolderWithMetadata(new FolderWithMetadata(), 2L, "folder1", folder.getId(), dataWithIndicator);
FolderWithMetadata folder2 = initFolderWithMetadata(new FolderWithMetadata(), 3L, "folder2", folder1.getId(), data);
Map<Long, FolderWithMetadata> folders = new HashMap<>();
folders.put(folder.getId(), folder);
folders.put(folder1.getId(), folder1);
folders.put(folder2.getId(), folder2);
Set<Pair<String, String>> indicators = new HashSet<>();
indicators.add(new ImmutablePair<>(DATA_KEY_1, PROJECT_INDICATOR_VALUE));
// case: single indicator
Folder actualFolder = folderManager.getProjectFolder(folders, folder2.getId(), indicators);
assertEquals(folder1.getId(), actualFolder.getId());
assertEquals(folder1.getName(), actualFolder.getName());
assertEquals(folder1.getParentId(), actualFolder.getParentId());
assertEquals(folder1.getOwner(), actualFolder.getOwner());
// case: several indicators
indicators.add(new ImmutablePair<>(PROJECT_INDICATOR_VALUE, DATA_KEY_1));
dataWithIndicator = new HashMap<>();
dataWithIndicator.put(PROJECT_INDICATOR_VALUE, new PipeConfValue(DATA_TYPE_1, DATA_KEY_1));
folder2.setData(dataWithIndicator);
folders.put(folder2.getId(), folder2);
actualFolder = folderManager.getProjectFolder(folders, folder2.getId(), indicators);
assertEquals(folder2.getId(), actualFolder.getId());
assertEquals(folder2.getName(), actualFolder.getName());
assertEquals(folder2.getParentId(), actualFolder.getParentId());
assertEquals(folder2.getOwner(), actualFolder.getOwner());
// case: no matches (null parent)
folder1.setData(data);
folder2.setData(data);
folders.put(folder1.getId(), folder1);
folders.put(folder2.getId(), folder2);
actualFolder = folderManager.getProjectFolder(folders, folder2.getId(), indicators);
assertNull(actualFolder);
// case: no matches (no null parent)
folders.remove(folder.getId());
actualFolder = folderManager.getProjectFolder(folders, folder2.getId(), indicators);
assertNull(actualFolder);
}
Aggregations