Search in sources :

Example 6 with SimpleCustomObject

use of org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject in project jbpm by kiegroup.

the class ReflectionObjectModelResolverTest method testSimpleNestedObjectArgObjectModel.

@Test
public void testSimpleNestedObjectArgObjectModel() {
    ObjectModel model = new ObjectModel("org.jbpm.runtime.manager.impl.deploy.testobject.ThirdLevelCustomObject", new Object[] { new ObjectModel("org.jbpm.runtime.manager.impl.deploy.testobject.EmbedingCustomObject", new Object[] { new ObjectModel("org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject", new Object[] { "john" }), "testing object model" }) });
    ObjectModelResolver resolver = new ReflectionObjectModelResolver();
    Object result = resolver.getInstance(model, this.getClass().getClassLoader(), new HashMap<String, Object>());
    assertNotNull(result);
    assertTrue(result instanceof ThirdLevelCustomObject);
    assertEquals("testing object model", ((ThirdLevelCustomObject) result).getEmbeddedObject().getDescription());
    SimpleCustomObject customObject = ((ThirdLevelCustomObject) result).getEmbeddedObject().getCustomObject();
    assertNotNull(customObject);
    assertEquals("john", customObject.getName());
}
Also used : ObjectModel(org.kie.internal.runtime.conf.ObjectModel) NamedObjectModel(org.kie.internal.runtime.conf.NamedObjectModel) ThirdLevelCustomObject(org.jbpm.runtime.manager.impl.deploy.testobject.ThirdLevelCustomObject) ObjectModelResolver(org.kie.internal.runtime.conf.ObjectModelResolver) ThirdLevelCustomObject(org.jbpm.runtime.manager.impl.deploy.testobject.ThirdLevelCustomObject) SimpleCustomObject(org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject) EmbedingCustomObject(org.jbpm.runtime.manager.impl.deploy.testobject.EmbedingCustomObject) SimpleCustomObject(org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject) Test(org.junit.Test)

Example 7 with SimpleCustomObject

use of org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject in project jbpm by kiegroup.

the class ReflectionObjectModelResolverTest method testSimpleContextValueObjectModel.

@Test
public void testSimpleContextValueObjectModel() {
    ObjectModel model = new ObjectModel("org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject", new Object[] { "context" });
    ObjectModelResolver resolver = new ReflectionObjectModelResolver();
    Map<String, Object> contextParam = new HashMap<String, Object>();
    contextParam.put("context", "value from the context");
    Object result = resolver.getInstance(model, this.getClass().getClassLoader(), contextParam);
    assertNotNull(result);
    assertTrue(result instanceof SimpleCustomObject);
    assertEquals("value from the context", ((SimpleCustomObject) result).getName());
}
Also used : ObjectModel(org.kie.internal.runtime.conf.ObjectModel) NamedObjectModel(org.kie.internal.runtime.conf.NamedObjectModel) HashMap(java.util.HashMap) ObjectModelResolver(org.kie.internal.runtime.conf.ObjectModelResolver) ThirdLevelCustomObject(org.jbpm.runtime.manager.impl.deploy.testobject.ThirdLevelCustomObject) SimpleCustomObject(org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject) EmbedingCustomObject(org.jbpm.runtime.manager.impl.deploy.testobject.EmbedingCustomObject) SimpleCustomObject(org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject) Test(org.junit.Test)

Aggregations

SimpleCustomObject (org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject)7 Test (org.junit.Test)7 ObjectModelResolver (org.kie.internal.runtime.conf.ObjectModelResolver)7 EmbedingCustomObject (org.jbpm.runtime.manager.impl.deploy.testobject.EmbedingCustomObject)6 ThirdLevelCustomObject (org.jbpm.runtime.manager.impl.deploy.testobject.ThirdLevelCustomObject)6 NamedObjectModel (org.kie.internal.runtime.conf.NamedObjectModel)6 ObjectModel (org.kie.internal.runtime.conf.ObjectModel)6 HashMap (java.util.HashMap)1