use of io.gravitee.rest.api.portal.rest.model.ReferenceMetadata in project gravitee-management-rest-api by gravitee-io.
the class ReferenceMetadataMapper method convert.
public ReferenceMetadata convert(ApplicationMetadataEntity applicationMetadataEntity) {
final ReferenceMetadata applicationReferenceMetadata = new ReferenceMetadata();
applicationReferenceMetadata.setApplication(applicationMetadataEntity.getApplicationId());
applicationReferenceMetadata.setDefaultValue(applicationMetadataEntity.getDefaultValue());
if (applicationMetadataEntity.getFormat() != null) {
applicationReferenceMetadata.setFormat(ReferenceMetadataFormatType.valueOf(applicationMetadataEntity.getFormat().name()));
} else {
applicationReferenceMetadata.setFormat(ReferenceMetadataFormatType.STRING);
}
applicationReferenceMetadata.setKey(applicationMetadataEntity.getKey());
applicationReferenceMetadata.setName(applicationMetadataEntity.getName());
applicationReferenceMetadata.setValue(applicationMetadataEntity.getValue());
return applicationReferenceMetadata;
}
use of io.gravitee.rest.api.portal.rest.model.ReferenceMetadata in project gravitee-management-rest-api by gravitee-io.
the class ReferenceMetadataMapperTest method testConvertEntityToPojo.
@Test
public void testConvertEntityToPojo() {
// init
ApplicationMetadataEntity applicationMetadataEntity = new ApplicationMetadataEntity();
applicationMetadataEntity.setApplicationId(METADATA_APPLICATION_ID);
applicationMetadataEntity.setDefaultValue(METADATA_DEFAULT_VALUE);
applicationMetadataEntity.setValue(METADATA_VALUE);
applicationMetadataEntity.setFormat(MetadataFormat.valueOf(METADATA_FORMAT));
applicationMetadataEntity.setKey(METADATA_KEY);
applicationMetadataEntity.setName(METADATA_NAME);
// Test
final ReferenceMetadata referenceMetadata = referenceMetadataMapper.convert(applicationMetadataEntity);
assertNotNull(referenceMetadata);
assertEquals(METADATA_APPLICATION_ID, referenceMetadata.getApplication());
assertEquals(METADATA_DEFAULT_VALUE, referenceMetadata.getDefaultValue());
assertEquals(METADATA_KEY, referenceMetadata.getKey());
assertEquals(METADATA_NAME, referenceMetadata.getName());
assertEquals(METADATA_VALUE, referenceMetadata.getValue());
assertEquals(ReferenceMetadataFormatType.valueOf(METADATA_FORMAT), referenceMetadata.getFormat());
}
Aggregations