use of org.mule.test.metadata.extension.LocationKey in project mule by mulesoft.
the class RuntimeMetadataTestCase method injectComposedMetadataKeyIdInstanceInOperation.
@Test
public void injectComposedMetadataKeyIdInstanceInOperation() throws Exception {
LocationKey payload = (LocationKey) flowRunner(SIMPLE_MULTILEVEL_KEY_RESOLVER).run().getMessage().getPayload().getValue();
LocationKey expected = new LocationKey();
expected.setContinent(AMERICA);
expected.setCountry(USA);
expected.setCity(SAN_FRANCISCO);
assertThat(payload, is(expected));
}
use of org.mule.test.metadata.extension.LocationKey in project mule by mulesoft.
the class MetadataKeyIdObjectResolverTestCase method resolveMultiLevelKey.
@Test
public void resolveMultiLevelKey() throws MetadataResolvingException {
setParameters(continentParam, countryParam, cityParam);
setMetadataKeyIdModelProperty(LocationKey.class);
keyIdObjectResolver = new MetadataKeyIdObjectResolver(componentModel);
final Object key = keyIdObjectResolver.resolve(MULTILEVEL_KEY);
assertThat(key, is(instanceOf(LocationKey.class)));
LocationKey locationKey = (LocationKey) key;
assertThat(locationKey, hasProperty(CONTINENT, is(AMERICA)));
assertThat(locationKey, hasProperty(COUNTRY, is(USA)));
assertThat(locationKey, hasProperty(CITY, is(SFO)));
}
use of org.mule.test.metadata.extension.LocationKey in project mule by mulesoft.
the class MetadataKeyIdObjectResolverTestCase method resolveDefaultMultiLevelKey.
@Test
public void resolveDefaultMultiLevelKey() throws MetadataResolvingException {
setParameters(continentParam, countryParam, cityParam);
setMetadataKeyIdModelProperty(LocationKey.class);
when(continentParam.getDefaultValue()).thenReturn(AMERICA);
when(countryParam.getDefaultValue()).thenReturn(USA);
when(cityParam.getDefaultValue()).thenReturn(SFO);
keyIdObjectResolver = new MetadataKeyIdObjectResolver(componentModel);
final Object key = keyIdObjectResolver.resolve();
assertThat(key, is(instanceOf(LocationKey.class)));
LocationKey locationKey = (LocationKey) key;
assertThat(locationKey, hasProperty(CONTINENT, is(AMERICA)));
assertThat(locationKey, hasProperty(COUNTRY, is(USA)));
assertThat(locationKey, hasProperty(CITY, is(SFO)));
}
Aggregations