Search in sources :

Example 1 with ReferenceMetadataInput

use of io.gravitee.rest.api.portal.rest.model.ReferenceMetadataInput in project gravitee-management-rest-api by gravitee-io.

the class ReferenceMetadataMapperTest method testConvertInputToNewMetadataEntity.

@Test
public void testConvertInputToNewMetadataEntity() {
    // init
    ReferenceMetadataInput metadataInput = new ReferenceMetadataInput();
    metadataInput.setDefaultValue(METADATA_DEFAULT_VALUE);
    metadataInput.setValue(METADATA_VALUE);
    metadataInput.setFormat(ReferenceMetadataFormatType.valueOf(METADATA_FORMAT));
    metadataInput.setName(METADATA_NAME);
    // Test
    final NewApplicationMetadataEntity newApplicationMetadataEntity = referenceMetadataMapper.convert(metadataInput, METADATA_APPLICATION_ID);
    assertNotNull(newApplicationMetadataEntity);
    assertEquals(METADATA_APPLICATION_ID, newApplicationMetadataEntity.getApplicationId());
    assertEquals(METADATA_DEFAULT_VALUE, newApplicationMetadataEntity.getDefaultValue());
    assertEquals(METADATA_NAME, newApplicationMetadataEntity.getName());
    assertEquals(METADATA_VALUE, newApplicationMetadataEntity.getValue());
    assertEquals(MetadataFormat.valueOf(METADATA_FORMAT), newApplicationMetadataEntity.getFormat());
}
Also used : NewApplicationMetadataEntity(io.gravitee.rest.api.model.NewApplicationMetadataEntity) ReferenceMetadataInput(io.gravitee.rest.api.portal.rest.model.ReferenceMetadataInput) Test(org.junit.Test)

Example 2 with ReferenceMetadataInput

use of io.gravitee.rest.api.portal.rest.model.ReferenceMetadataInput in project gravitee-management-rest-api by gravitee-io.

the class ReferenceMetadataMapperTest method testConvertInputToUpdateMetadataEntity.

@Test
public void testConvertInputToUpdateMetadataEntity() {
    // init
    ReferenceMetadataInput metadataInput = new ReferenceMetadataInput();
    metadataInput.setDefaultValue(METADATA_DEFAULT_VALUE);
    metadataInput.setValue(METADATA_VALUE);
    metadataInput.setFormat(ReferenceMetadataFormatType.valueOf(METADATA_FORMAT));
    metadataInput.setName(METADATA_NAME);
    // Test
    final UpdateApplicationMetadataEntity updateApplicationMetadataEntity = referenceMetadataMapper.convert(metadataInput, METADATA_APPLICATION_ID, METADATA_KEY);
    assertNotNull(updateApplicationMetadataEntity);
    assertEquals(METADATA_APPLICATION_ID, updateApplicationMetadataEntity.getApplicationId());
    assertEquals(METADATA_DEFAULT_VALUE, updateApplicationMetadataEntity.getDefaultValue());
    assertEquals(METADATA_NAME, updateApplicationMetadataEntity.getName());
    assertEquals(METADATA_KEY, updateApplicationMetadataEntity.getKey());
    assertEquals(METADATA_VALUE, updateApplicationMetadataEntity.getValue());
    assertEquals(MetadataFormat.valueOf(METADATA_FORMAT), updateApplicationMetadataEntity.getFormat());
}
Also used : UpdateApplicationMetadataEntity(io.gravitee.rest.api.model.UpdateApplicationMetadataEntity) ReferenceMetadataInput(io.gravitee.rest.api.portal.rest.model.ReferenceMetadataInput) Test(org.junit.Test)

Aggregations

ReferenceMetadataInput (io.gravitee.rest.api.portal.rest.model.ReferenceMetadataInput)2 Test (org.junit.Test)2 NewApplicationMetadataEntity (io.gravitee.rest.api.model.NewApplicationMetadataEntity)1 UpdateApplicationMetadataEntity (io.gravitee.rest.api.model.UpdateApplicationMetadataEntity)1