@Test public void testSendEvent() throws Exception { addHelloWorldRule(); ContextCurrentService contextService = getOsgiService(ContextCurrentService.class); contextService.createContext("42"); ContextHolder.get().setCurrentContextId("42"); Dictionary<String, Object> properties = new Hashtable<String, Object>(); String[] clazzes = new String[] {Domain.class.getName(), ExampleDomain.class.getName()}; properties.put("id", "dummyLog"); properties.put("location.42", new String[] {"example"}); DummyLogDomain logService = new DummyLogDomain(); getBundleContext().registerService(clazzes, logService, properties); LogEvent e = new LogEvent(); e.setName("42"); e.setLevel(LogLevel.INFO); ExampleDomainEvents exampleEvents = getOsgiService(ExampleDomainEvents.class); // this should be routed through the domain, which forwards it to the workflow service exampleEvents.raiseEvent(e); assertThat(logService.isWasCalled(), is(true)); }
@Before public void setUp() throws Exception { ContextCurrentService contextService = getOsgiService(ContextCurrentService.class); if (!contextService.getAvailableContexts().contains("it-taskbox")) { contextService.createContext("it-taskbox"); } ContextHolder.get().setCurrentContextId("it-taskbox"); ruleManager = getOsgiService(RuleManager.class); workflowService = getOsgiService(WorkflowService.class); taskboxService = getOsgiService(TaskboxService.class); }