use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.
the class FirecloudRunner method validateRootEntityType.
private void validateRootEntityType(Long rootEntityClassId) {
Assert.notNull(rootEntityClassId, "Root entity class ID is required for creating new configuration.");
MetadataClass rootEntityClass = metadataEntityManager.loadClass(rootEntityClassId);
Assert.notNull(rootEntityClass.getFireCloudClassName(), String.format("Firecloud type must be provider for entity type %s.", rootEntityClass.getName()));
}
use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.
the class FolderDaoTest method testCreateAndLoadFolderWithMetadata.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testCreateAndLoadFolderWithMetadata() {
Folder folder = getFolder();
// create
folderDao.createFolder(folder);
Map<String, Integer> metadata = new HashMap<>();
metadata.put(CLASS_NAME_1, 1);
folder.setMetadata(metadata);
// add metadata
MetadataEntity metadataEntity = new MetadataEntity();
metadataEntity.setName(TEST_ENTITY_NAME_1);
MetadataClass metadataClass = createMetadataClass();
metadataEntity.setClassEntity(metadataClass);
metadataEntity.setParent(folder);
Map<String, PipeConfValue> data = new HashMap<>();
data.put(DATA_KEY_1, new PipeConfValue(DATA_TYPE_1, DATA_VALUE_1));
metadataEntity.setData(data);
metadataEntityDao.createMetadataEntity(metadataEntity);
Folder loaded = folderDao.loadFolder(folder.getId());
assertEquals(folder.getId(), loaded.getId());
assertEquals(folder.getName(), loaded.getName());
assertEquals(folder.getMetadata(), loaded.getMetadata());
assertNull(folder.getParentId());
Map<String, Integer> loadedMetadata = loaded.getMetadata();
assertTrue(!loadedMetadata.isEmpty() && loadedMetadata.size() == 1);
assertEquals(metadataEntity.getClassEntity().getName(), loadedMetadata.keySet().toArray()[0]);
assertEquals(1, loadedMetadata.get(CLASS_NAME_1).intValue());
}
use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.
the class MetadataEntityConverterTest method getMetadataClass.
private static MetadataClass getMetadataClass(String name, FireCloudClass type) {
MetadataClass entityClass = new MetadataClass();
entityClass.setName(name);
entityClass.setFireCloudClassName(type);
return entityClass;
}
use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.
the class MetadataWriterTest method entity.
private MetadataEntity entity(final String entityClass, final String id, final Map<String, PipeConfValue> data) {
final MetadataEntity metadataEntity = new MetadataEntity();
metadataEntity.setExternalId(id);
metadataEntity.setData(data);
final MetadataClass metadataClass = new MetadataClass();
metadataClass.setName(entityClass);
metadataEntity.setClassEntity(metadataClass);
return metadataEntity;
}
use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.
the class MetadataEntityMapperTest method shouldMapMetadataEntity.
@Test
void shouldMapMetadataEntity() throws IOException {
MetadataEntityMapper mapper = new MetadataEntityMapper();
MetadataClass metadataClass = new MetadataClass(1L, "Sample");
MetadataEntity metadataEntity = new MetadataEntity();
metadataEntity.setClassEntity(metadataClass);
metadataEntity.setId(1L);
metadataEntity.setExternalId("external");
metadataEntity.setParent(new Folder(1L));
metadataEntity.setName(TEST_NAME);
metadataEntity.setData(Collections.singletonMap(TEST_KEY, new PipeConfValue("string", TEST_VALUE)));
EntityContainer<MetadataEntity> container = EntityContainer.<MetadataEntity>builder().entity(metadataEntity).permissions(PERMISSIONS_CONTAINER).build();
XContentBuilder contentBuilder = mapper.map(container);
verifyMetadataEntity(metadataEntity, EXPECTED_METADATA, contentBuilder);
verifyPermissions(PERMISSIONS_CONTAINER, contentBuilder);
}
Aggregations