Search in sources :

Example 1 with TestCar

use of org.apache.qpid.server.model.testmodels.hierarchy.TestCar in project qpid-broker-j by apache.

the class ConfiguredObjectToMapConverterTest method createEngineWithContext.

private TestEngine createEngineWithContext() {
    setTestSystemProperty(TEST_SYSTEM_PROPERTY1_NAME, TEST_SYSTEM_PROPERTY1_ACTUAL_VALUE);
    setTestSystemProperty(TEST_SYSTEM_PROPERTY2_NAME, TEST_SYSTEM_PROPERTY2_ACTUAL_VALUE);
    Model model = org.apache.qpid.server.model.testmodels.hierarchy.TestModel.getInstance();
    final Map<String, Object> carAttributes = new HashMap<>();
    carAttributes.put(ConfiguredObject.NAME, "myCar");
    Map<String, String> carContext = new HashMap<>();
    carContext.put(PARENT_CONTEXT_PROPERTY1_NAME, PARENT_CONTEXT_PROPERTY1_ACTUAL_VALUE);
    carContext.put(PARENT_CONTEXT_PROPERTY2_NAME, PARENT_CONTEXT_PROPERTY2_ACTUAL_VALUE);
    carAttributes.put(ConfiguredObject.CONTEXT, carContext);
    TestCar car = model.getObjectFactory().create(TestCar.class, carAttributes, null);
    final Map<String, Object> engineAttributes = new HashMap<>();
    engineAttributes.put(ConfiguredObject.NAME, "myEngine");
    engineAttributes.put(ConfiguredObject.TYPE, TestElecEngineImpl.TEST_ELEC_ENGINE_TYPE);
    Map<String, String> engineContext = new HashMap<>();
    engineContext.put(CHILD_CONTEXT_PROPERTY_NAME, CHILD_CONTEXT_PROPERTY_ACTUAL_VALUE);
    engineAttributes.put(ConfiguredObject.CONTEXT, engineContext);
    return (TestEngine) car.createChild(TestEngine.class, engineAttributes);
}
Also used : HashMap(java.util.HashMap) Model(org.apache.qpid.server.model.Model) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) TestEngine(org.apache.qpid.server.model.testmodels.hierarchy.TestEngine) TestCar(org.apache.qpid.server.model.testmodels.hierarchy.TestCar)

Aggregations

HashMap (java.util.HashMap)1 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)1 Model (org.apache.qpid.server.model.Model)1 TestCar (org.apache.qpid.server.model.testmodels.hierarchy.TestCar)1 TestEngine (org.apache.qpid.server.model.testmodels.hierarchy.TestEngine)1