Package org.openengsb.core.workflow.api.model

Examples of org.openengsb.core.workflow.api.model.RemoteEvent


    }

    @Test
    public void testWrapRemoteEvent_shouldWrapEvent() throws Exception {
        TestEvent event = new TestEvent(3L, "bla");
        RemoteEvent wrapEvent = RemoteEventUtil.wrapEvent(event);
        Map<String, String> properties = wrapEvent.getNestedEventProperties();
        assertThat(wrapEvent.getClassName(), is(TestEvent.class.getName()));
        assertThat(properties.get("processId"), is("3"));
    }
View Full Code Here


        assertThat(properties.get("processId"), is("3"));
    }

    @Test
    public void testRegisterEvent_shouldRegisterEvent() throws Exception {
        RemoteEvent reg = new RemoteEvent(TestEvent.class.getName());
        reg.setProcessId(3L);
        regService.registerEvent(reg, "testPort", "test://localhost");
        service.processEvent(new TestEvent());
        verify(outgoingPort, timeout(5000)).send(any(MethodCallMessage.class));
    }
View Full Code Here

        verify(outgoingPort, timeout(5000)).send(any(MethodCallMessage.class));
    }

    @Test
    public void testRegisterEvent_shouldCreateRule() throws Exception {
        RemoteEvent reg = new RemoteEvent(TestEvent.class.getName());
        int oldCount = manager.listAll(RuleBaseElementType.Rule).size();
        regService.registerEvent(reg, "testPort", "test://localhost");
        assertThat(manager.listAll(RuleBaseElementType.Rule).size(), is(oldCount + 1));
    }
View Full Code Here

    @Test
    public void testRegisterEvent_shouldProcessRemoteEvent() throws Exception {
        CountDownLatch latch = new CountDownLatch(1);
        trackInvocations((DummyExampleDomain) domains.get("example"), latch).doSomething("it works");

        RemoteEvent reg = new RemoteEvent(TestEvent.class.getName());
        regService.registerEvent(reg, "testPort", "test://localhost", "workflowService");
        String ruleCode = "when RemoteEvent() then example.doSomething(\"it works\");";
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "react to remote-event"), ruleCode);
        service.processEvent(new TestEvent());
        assertThat("did not call example.doSomething() after RemoteEvent", latch.await(5, TimeUnit.SECONDS), is(true));
View Full Code Here

    @Test
    public void testRegisterMultipleEvents_shouldOnlyProcessOneEvent() throws Exception {
        CountDownLatch latch = new CountDownLatch(1);
        trackInvocations((DummyExampleDomain) domains.get("example"), latch).doSomething("it works");

        RemoteEvent reg = new RemoteEvent(TestEvent.class.getName());
        regService.registerEvent(reg, "testPort", "test://localhost", "workflowService");
        RemoteEvent reg2 = new RemoteEvent(TestEvent.class.getName());
        Map<String, String> nestedEventProperties = new HashMap<String, String>();
        nestedEventProperties.put("value", "testValue");
        reg2.setNestedEventProperties(nestedEventProperties);
        regService.registerEvent(reg2, "testPort", "test://localhost", "workflowService");
        String ruleCode = "when RemoteEvent() then example.doSomething(\"it works\");";
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "react to remote-event"), ruleCode);
        service.processEvent(new TestEvent());
View Full Code Here

    private RemoteEventUtil() {
    }

    public static RemoteEvent wrapEvent(Event event) {
        RemoteEvent result = new RemoteEvent(event.getClass().getName());
        PropertyDescriptor[] propertyDescriptors = BeanUtils.getPropertyDescriptors(event.getClass());
        Map<String, String> nestedEventProperties = result.getNestedEventProperties();
        for (PropertyDescriptor pd : propertyDescriptors) {
            Method readMethod = pd.getReadMethod();
            LOGGER.debug("writing property {} to event", pd.getName());
            try {
                Object value = readMethod.invoke(event);
View Full Code Here

TOP

Related Classes of org.openengsb.core.workflow.api.model.RemoteEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.