use of org.apache.qpid.server.model.AncestorAttributeResolver in project qpid-broker-j by apache.
the class AncestorAttributeResolverTest method testResolveToSelf.
public void testResolveToSelf() throws Exception {
_ancestorAttributeResolver = new AncestorAttributeResolver(_car);
String actual = _ancestorAttributeResolver.resolve("ancestor:testcar:name", null);
assertEquals(CAR_NAME, actual);
}
use of org.apache.qpid.server.model.AncestorAttributeResolver in project qpid-broker-j by apache.
the class AncestorAttributeResolverTest method testResolveAncestorAttributeOfTypeConfiguredObject.
public void testResolveAncestorAttributeOfTypeConfiguredObject() throws Exception {
Map<String, Object> carAttributes = new HashMap<>();
carAttributes.put(ConfiguredObject.NAME, CAR_NAME);
carAttributes.put(ConfiguredObject.TYPE, TestKitCarImpl.TEST_KITCAR_TYPE);
carAttributes.put("alternateEngine", _engine);
_car = _model.getObjectFactory().create(TestCar.class, carAttributes, null);
_ancestorAttributeResolver = new AncestorAttributeResolver(_car);
String actual = _ancestorAttributeResolver.resolve("ancestor:testcar:alternateEngine", null);
assertEquals("Unexpected resolved ancestor attribute of type ConfiguredObject", _engine.getId().toString(), actual);
}
use of org.apache.qpid.server.model.AncestorAttributeResolver in project qpid-broker-j by apache.
the class AncestorAttributeResolverTest method testResolveToParent.
public void testResolveToParent() throws Exception {
_ancestorAttributeResolver = new AncestorAttributeResolver(_engine);
String actual = _ancestorAttributeResolver.resolve("ancestor:testcar:name", null);
assertEquals(CAR_NAME, actual);
}
use of org.apache.qpid.server.model.AncestorAttributeResolver in project qpid-broker-j by apache.
the class AncestorAttributeResolverTest method testUnrecognisedCategoryName.
public void testUnrecognisedCategoryName() throws Exception {
_ancestorAttributeResolver = new AncestorAttributeResolver(_car);
String actual = _ancestorAttributeResolver.resolve("ancestor:notacategoty:name", null);
assertNull(actual);
}
use of org.apache.qpid.server.model.AncestorAttributeResolver in project qpid-broker-j by apache.
the class AncestorAttributeResolverTest method testResolveAncestorAttributeOfTypeMap.
public void testResolveAncestorAttributeOfTypeMap() throws Exception {
Map<String, Object> carAttributes = new HashMap<>();
carAttributes.put(ConfiguredObject.NAME, CAR_NAME);
carAttributes.put(ConfiguredObject.TYPE, TestKitCarImpl.TEST_KITCAR_TYPE);
Map<String, Object> parameters = new HashMap<>();
parameters.put("int", 1);
parameters.put("string", "value");
carAttributes.put("parameters", parameters);
_car = _model.getObjectFactory().create(TestCar.class, carAttributes, null);
_ancestorAttributeResolver = new AncestorAttributeResolver(_car);
String actual = _ancestorAttributeResolver.resolve("ancestor:testcar:parameters", null);
ObjectMapper objectMapper = new ObjectMapper();
Map<Object, Object> data = objectMapper.readValue(actual, HashMap.class);
assertEquals("Unexpected resolved ancestor attribute of type Map", parameters, data);
}
Aggregations