DDConfigUpdater { public void processWorkitemInstall(@Observes final DesignerWorkitemInstalledEvent workitemInstalledEvent) { addWorkItemToConfig(moduleService.resolveModule(workitemInstalledEvent.getPath()), workitemInstalledEvent.getName(), workitemInstalledEvent.getValue(), workitemInstalledEvent.getResolver()); } DDConfigUpdater(); @Inject  DDConfigUpdater(DDEditorService ddEditorService,
                           KieModuleService moduleService,
                           DDConfigUpdaterHelper configUpdaterHelper); void processResourceAdd(@Observes final ResourceAddedEvent resourceAddedEvent); void processResourceUpdate(@Observes final ResourceUpdatedEvent resourceUpdatedEvent); void processWorkitemInstall(@Observes final DesignerWorkitemInstalledEvent workitemInstalledEvent); void processServiceTaskEvent(@Observes final ServiceTaskResourceEvent serviceResourceEvent); String parseWorkitemValue(String value); String getWorkitemResolver(String value,
                                      String defaultResolver); boolean isValidWorkitem(String name, String value);  }
@Test public void testProcessWorkitemInstall() { ddConfigUpdater.processWorkitemInstall(new DesignerWorkitemInstalledEvent(Mockito.mock(Path.class), "mvel", "new com.myhandlers.MyHandler()", "MyWorkItem", "")); assertNotNull(model.getWorkItemHandlers()); assertEquals(1, model.getWorkItemHandlers().size()); ItemObjectModel objectModel = model.getWorkItemHandlers().get(0); assertNotNull(objectModel); assertEquals("MyWorkItem", objectModel.getName()); assertEquals("mvel", objectModel.getResolver()); assertEquals("new com.myhandlers.MyHandler()", objectModel.getValue()); ddConfigUpdater.processWorkitemInstall(new DesignerWorkitemInstalledEvent(Mockito.mock(Path.class), "mvel", "new com.myhandlers.MyHandler2()", "MyWorkItem", "")); assertNotNull(model.getWorkItemHandlers()); assertEquals(1, model.getWorkItemHandlers().size()); assertEquals("new com.myhandlers.MyHandler()", model.getWorkItemHandlers().get(0).getValue()); ddConfigUpdater.processWorkitemInstall(new DesignerWorkitemInstalledEvent(Mockito.mock(Path.class), "reflection", "com.myhandlers.MyHandler", "MyWorkItem2", "")); assertNotNull(model.getWorkItemHandlers()); assertEquals(2, model.getWorkItemHandlers().size()); ItemObjectModel objectModel2 = model.getWorkItemHandlers().get(1); assertNotNull(objectModel2); assertEquals("MyWorkItem2", objectModel2.getName()); assertEquals("reflection", objectModel2.getResolver()); assertEquals("com.myhandlers.MyHandler", objectModel2.getValue()); ddConfigUpdater.processWorkitemInstall(new DesignerWorkitemInstalledEvent(Mockito.mock(Path.class), "mvel", "new com.myhandlers.MyHandler3()", "", "")); assertNotNull(model.getWorkItemHandlers()); assertEquals(2, model.getWorkItemHandlers().size()); ddConfigUpdater.processWorkitemInstall(new DesignerWorkitemInstalledEvent(Mockito.mock(Path.class), "mvel", "", "MyWorkItem3", "")); assertNotNull(model.getWorkItemHandlers()); assertEquals(2, model.getWorkItemHandlers().size()); ddConfigUpdater.processWorkitemInstall(new DesignerWorkitemInstalledEvent(Mockito.mock(Path.class), "mvel", "", "", "")); assertNotNull(model.getWorkItemHandlers()); assertEquals(2, model.getWorkItemHandlers().size()); ddConfigUpdater.processWorkitemInstall(new DesignerWorkitemInstalledEvent(Mockito.mock(Path.class), "reflection", "mvel: new com.myhandlers.MyHandler4()", "MyWorkItem4", "")); assertNotNull(model.getWorkItemHandlers()); assertEquals(3, model.getWorkItemHandlers().size()); ItemObjectModel objectModel3 = model.getWorkItemHandlers().get(2); assertNotNull(objectModel3); assertEquals("MyWorkItem4", objectModel3.getName()); assertEquals("mvel", objectModel3.getResolver()); assertEquals("new com.myhandlers.MyHandler4()", objectModel3.getValue()); }