Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: beab56e2a48a3d8e57fcf24d54a2b890376b593c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*******************************************************************************
 * Copyright (c) 2016 protos software gmbh (http://www.protos.de).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * CONTRIBUTORS:
 * 		Jan Belle (initial contribution)
 *
 *******************************************************************************/

#ifndef SRC_MESSAGING_MESSAGEDISPATCHERTEST_H_
#define SRC_MESSAGING_MESSAGEDISPATCHERTEST_H_

#include "util/etTestSuite.h"
#include "common/messaging/RTObject.h"
#include "common/messaging/IMessageReceiver.h"

class MessageDispatcherTest: public etTestSuite {
public:
	MessageDispatcherTest(void) :
			etTestSuite("MessageDispatcherTest") {
	}

protected:
	void testConstructors(void);
	void testFreeAddresses(void);
	void testDispatching(void);

	void runAllTestCases(void);
};

class SimpleMessageReceiver: public etRuntime::RTObject,
		public etRuntime::IMessageReceiver {
public:
	SimpleMessageReceiver(IRTObject *parent, const etRuntime::String& name,
			const etRuntime::Address& address) :
				RTObject(parent, name), m_address(address), m_lastMessage(NULL) {
	}

	void receive(const etRuntime::Message* msg) {
		m_lastMessage = msg;
	}
	const etRuntime::Address& getAddress(void) const {
		return m_address;
	}

	const etRuntime::Message* getLastReceivedMessagePtr(void) const {
		return m_lastMessage;
	}

private:
	etRuntime::Address m_address;
	const etRuntime::Message *m_lastMessage;
};

#endif /* SRC_MESSAGING_MESSAGEDISPATCHERTEST_H_ */

Back to the top