use of org.kie.internal.runtime.conf.ObjectModelResolver in project jbpm by kiegroup.
the class ReflectionObjectModelResolverTest method testSimpleNoArgObjectModel.
@Test
public void testSimpleNoArgObjectModel() {
ObjectModel model = new ObjectModel("org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject");
ObjectModelResolver resolver = new ReflectionObjectModelResolver();
Object result = resolver.getInstance(model, this.getClass().getClassLoader(), new HashMap<String, Object>());
assertNotNull(result);
assertTrue(result instanceof SimpleCustomObject);
assertEquals("default", ((SimpleCustomObject) result).getName());
}
use of org.kie.internal.runtime.conf.ObjectModelResolver in project jbpm by kiegroup.
the class MVELObjectModelResolverTest method testComplexStaticObjectModel.
@Test
public void testComplexStaticObjectModel() {
ObjectModel model = new ObjectModel("String.valueOf(10).substring(1)");
ObjectModelResolver resolver = new MVELObjectModelResolver();
Object result = resolver.getInstance(model, this.getClass().getClassLoader(), new HashMap<String, Object>());
assertNotNull(result);
assertTrue(result instanceof String);
assertEquals("0", ((String) result));
}
use of org.kie.internal.runtime.conf.ObjectModelResolver in project jbpm by kiegroup.
the class MVELObjectModelResolverTest method testSimpleNoArgObjectModel.
@Test
public void testSimpleNoArgObjectModel() {
ObjectModel model = new ObjectModel("new org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject()");
ObjectModelResolver resolver = new MVELObjectModelResolver();
Object result = resolver.getInstance(model, this.getClass().getClassLoader(), new HashMap<String, Object>());
assertNotNull(result);
assertTrue(result instanceof SimpleCustomObject);
assertEquals("default", ((SimpleCustomObject) result).getName());
}
use of org.kie.internal.runtime.conf.ObjectModelResolver in project jbpm by kiegroup.
the class ReflectionObjectModelResolverTest method testSimpleSingleStringArgObjectModel.
@Test
public void testSimpleSingleStringArgObjectModel() {
ObjectModel model = new ObjectModel("org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject", new Object[] { "john" });
ObjectModelResolver resolver = new ReflectionObjectModelResolver();
Object result = resolver.getInstance(model, this.getClass().getClassLoader(), new HashMap<String, Object>());
assertNotNull(result);
assertTrue(result instanceof SimpleCustomObject);
assertEquals("john", ((SimpleCustomObject) result).getName());
}
use of org.kie.internal.runtime.conf.ObjectModelResolver 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());
}
Aggregations