Search in sources :

Example 6 with ObjectModelResolver

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());
}
Also used : ObjectModel(org.kie.internal.runtime.conf.ObjectModel) NamedObjectModel(org.kie.internal.runtime.conf.NamedObjectModel) 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 ObjectModelResolver

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));
}
Also used : ObjectModel(org.kie.internal.runtime.conf.ObjectModel) ObjectModelResolver(org.kie.internal.runtime.conf.ObjectModelResolver) SimpleCustomObject(org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject) Test(org.junit.Test)

Example 8 with ObjectModelResolver

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());
}
Also used : ObjectModel(org.kie.internal.runtime.conf.ObjectModel) ObjectModelResolver(org.kie.internal.runtime.conf.ObjectModelResolver) SimpleCustomObject(org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject) SimpleCustomObject(org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject) Test(org.junit.Test)

Example 9 with ObjectModelResolver

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());
}
Also used : ObjectModel(org.kie.internal.runtime.conf.ObjectModel) NamedObjectModel(org.kie.internal.runtime.conf.NamedObjectModel) 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 10 with ObjectModelResolver

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());
}
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)

Aggregations

ObjectModelResolver (org.kie.internal.runtime.conf.ObjectModelResolver)11 SimpleCustomObject (org.jbpm.runtime.manager.impl.deploy.testobject.SimpleCustomObject)10 Test (org.junit.Test)10 ObjectModel (org.kie.internal.runtime.conf.ObjectModel)10 EmbedingCustomObject (org.jbpm.runtime.manager.impl.deploy.testobject.EmbedingCustomObject)7 ThirdLevelCustomObject (org.jbpm.runtime.manager.impl.deploy.testobject.ThirdLevelCustomObject)7 NamedObjectModel (org.kie.internal.runtime.conf.NamedObjectModel)7 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 CaseEventListener (org.jbpm.casemgmt.api.event.CaseEventListener)1 NotifyParentCaseEventListener (org.jbpm.casemgmt.impl.wih.NotifyParentCaseEventListener)1 Cacheable (org.kie.internal.runtime.Cacheable)1 Closeable (org.kie.internal.runtime.Closeable)1 DeploymentDescriptor (org.kie.internal.runtime.conf.DeploymentDescriptor)1