Commit | Line | Data |
---|---|---|
eb1bab5b | 1 | /******************************************************************************* |
54f2dcc0 | 2 | * Copyright (c) 2012, 2014 Ericsson |
b0318660 | 3 | * |
eb1bab5b BH |
4 | * All rights reserved. This program and the accompanying materials are |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
b0318660 | 8 | * |
eb1bab5b BH |
9 | * Contributors: |
10 | * Bernd Hufmann - Initial API and implementation | |
11 | *******************************************************************************/ | |
2ba3d0a1 | 12 | |
8e8c0226 | 13 | package org.eclipse.linuxtools.lttng2.control.core.tests.model.impl; |
eb1bab5b | 14 | |
8e8c0226 AM |
15 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.IBaseEventInfo; |
16 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.IChannelInfo; | |
17 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.IDomainInfo; | |
18 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.IEventInfo; | |
19 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.IFieldInfo; | |
20 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.IProbeEventInfo; | |
21 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.ISessionInfo; | |
22 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.ISnapshotInfo; | |
23 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.IUstProviderInfo; | |
24 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement; | |
25 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEventType; | |
26 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel; | |
27 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceSessionState; | |
28 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.BaseEventInfo; | |
29 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.ChannelInfo; | |
30 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.DomainInfo; | |
31 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.EventInfo; | |
32 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.FieldInfo; | |
33 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.ProbeEventInfo; | |
34 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.SessionInfo; | |
35 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.SnapshotInfo; | |
36 | import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.UstProviderInfo; | |
eb1bab5b BH |
37 | |
38 | /** | |
b0318660 | 39 | * Test facility to constants across test case |
eb1bab5b | 40 | */ |
4e0b52e0 | 41 | @SuppressWarnings("javadoc") |
eb1bab5b | 42 | public class ModelImplFactory { |
b0318660 | 43 | |
eb1bab5b BH |
44 | private ISessionInfo fSessionInfo1 = null; |
45 | private ISessionInfo fSessionInfo2 = null; | |
46 | private IDomainInfo fDomainInfo1 = null; | |
47 | private IDomainInfo fDomainInfo2 = null; | |
48 | private IChannelInfo fChannelInfo1 = null; | |
49 | private IChannelInfo fChannelInfo2 = null; | |
50 | private IEventInfo fEventInfo1 = null; | |
51 | private IEventInfo fEventInfo2 = null; | |
52 | private IEventInfo fEventInfo3 = null; | |
d4514365 BH |
53 | private IFieldInfo fFieldInfo1 = null; |
54 | private IFieldInfo fFieldInfo2 = null; | |
eb1bab5b BH |
55 | private IBaseEventInfo fBaseEventInfo1 = null; |
56 | private IBaseEventInfo fBaseEventInfo2 = null; | |
57 | private IUstProviderInfo fUstProviderInfo1 = null; | |
58 | private IUstProviderInfo fUstProviderInfo2 = null; | |
d132bcc7 BH |
59 | private IProbeEventInfo fProbeEventInfo1 = null; |
60 | private IProbeEventInfo fProbeEventInfo2 = null; | |
589d0d33 BH |
61 | private ISnapshotInfo fSnapshotInfo1 = null; |
62 | private ISnapshotInfo fSnapshotInfo2 = null; | |
b0318660 | 63 | |
eb1bab5b | 64 | public ModelImplFactory() { |
d4514365 BH |
65 | |
66 | fFieldInfo1 = new FieldInfo("intfield"); | |
67 | fFieldInfo1.setFieldType("int"); | |
68 | fFieldInfo2 = new FieldInfo("stringfield"); | |
69 | fFieldInfo2.setFieldType("string"); | |
70 | ||
eb1bab5b BH |
71 | fBaseEventInfo1 = new BaseEventInfo("event1"); |
72 | fBaseEventInfo1.setEventType(TraceEventType.UNKNOWN); | |
73 | fBaseEventInfo1.setLogLevel(TraceLogLevel.TRACE_ERR); | |
d4514365 BH |
74 | fBaseEventInfo1.addField(fFieldInfo1); |
75 | fBaseEventInfo1.addField(fFieldInfo2); | |
76 | fBaseEventInfo1.setFilterExpression("intField==10"); | |
77 | ||
eb1bab5b BH |
78 | fBaseEventInfo2 = new BaseEventInfo("event2"); |
79 | fBaseEventInfo2.setEventType(TraceEventType.TRACEPOINT); | |
4775bcbf | 80 | fBaseEventInfo1.setLogLevel(TraceLogLevel.TRACE_DEBUG); |
b0318660 | 81 | |
eb1bab5b BH |
82 | fEventInfo1 = new EventInfo("event1"); |
83 | fEventInfo1.setEventType(TraceEventType.TRACEPOINT); | |
54f2dcc0 BH |
84 | fEventInfo1.setLogLevelType("=="); |
85 | fEventInfo1.setLogLevel(TraceLogLevel.TRACE_DEBUG); | |
eb1bab5b BH |
86 | fEventInfo1.setState(TraceEnablement.ENABLED); |
87 | ||
88 | fEventInfo2 = new EventInfo("event2"); | |
54f2dcc0 BH |
89 | fEventInfo2.setLogLevelType("<="); |
90 | fEventInfo2.setLogLevel(TraceLogLevel.TRACE_INFO); | |
eb1bab5b BH |
91 | fEventInfo2.setEventType(TraceEventType.UNKNOWN); |
92 | fEventInfo2.setState(TraceEnablement.DISABLED); | |
b0318660 | 93 | |
eb1bab5b BH |
94 | fEventInfo3 = new EventInfo("event3"); |
95 | fEventInfo3.setEventType(TraceEventType.TRACEPOINT); | |
96 | fEventInfo3.setState(TraceEnablement.DISABLED); | |
97 | ||
98 | fUstProviderInfo1 = new UstProviderInfo("myUST1"); | |
99 | fUstProviderInfo1.setPid(1234); | |
100 | fUstProviderInfo1.addEvent(fBaseEventInfo1); | |
101 | ||
102 | fUstProviderInfo2 = new UstProviderInfo("myUST2"); | |
103 | fUstProviderInfo2.setPid(2345); | |
104 | fUstProviderInfo2.addEvent(fBaseEventInfo1); | |
105 | fUstProviderInfo2.addEvent(fBaseEventInfo2); | |
106 | ||
107 | fChannelInfo1 = new ChannelInfo("channel1"); | |
108 | fChannelInfo1.setSwitchTimer(10L); | |
109 | fChannelInfo1.setOverwriteMode(true); | |
110 | fChannelInfo1.setReadTimer(11L); | |
111 | fChannelInfo1.setState(TraceEnablement.DISABLED); | |
112 | fChannelInfo1.setNumberOfSubBuffers(12); | |
113 | fChannelInfo1.setOutputType("splice()"); | |
114 | fChannelInfo1.setSubBufferSize(13L); | |
115 | fChannelInfo1.addEvent(fEventInfo1); | |
116 | ||
117 | fChannelInfo2 = new ChannelInfo("channel2"); | |
118 | fChannelInfo2.setSwitchTimer(1L); | |
119 | fChannelInfo2.setOverwriteMode(false); | |
120 | fChannelInfo2.setReadTimer(2L); | |
121 | fChannelInfo2.setState(TraceEnablement.ENABLED); | |
122 | fChannelInfo2.setNumberOfSubBuffers(3); | |
123 | fChannelInfo2.setOutputType("mmap()"); | |
124 | fChannelInfo2.setSubBufferSize(4L); | |
125 | fChannelInfo2.addEvent(fEventInfo2); | |
126 | fChannelInfo2.addEvent(fEventInfo3); | |
b0318660 | 127 | |
eb1bab5b BH |
128 | fDomainInfo1 = new DomainInfo("test1"); |
129 | fDomainInfo1.addChannel(fChannelInfo1); | |
130 | ||
131 | fDomainInfo2 = new DomainInfo("test2"); | |
132 | fDomainInfo2.addChannel(fChannelInfo1); | |
133 | fDomainInfo2.addChannel(fChannelInfo2); | |
b0318660 | 134 | |
eb1bab5b BH |
135 | fSessionInfo1 = new SessionInfo("session1"); |
136 | fSessionInfo1.setSessionPath("/home/user"); | |
137 | fSessionInfo1.setSessionState(TraceSessionState.ACTIVE); | |
138 | fSessionInfo1.addDomain(fDomainInfo1); | |
139 | ||
140 | fSessionInfo2 = new SessionInfo("session2"); | |
141 | fSessionInfo2.setSessionPath("/home/user1"); | |
142 | fSessionInfo2.setSessionState(TraceSessionState.INACTIVE); | |
143 | fSessionInfo2.addDomain(fDomainInfo1); | |
144 | fSessionInfo2.addDomain(fDomainInfo2); | |
f3b33d40 | 145 | fSessionInfo2.setStreamedTrace(true); |
d132bcc7 BH |
146 | |
147 | fProbeEventInfo1 = new ProbeEventInfo("probeEvent1"); | |
148 | fProbeEventInfo1.setEventType(TraceEventType.TRACEPOINT); | |
149 | fProbeEventInfo1.setState(TraceEnablement.ENABLED); | |
150 | fProbeEventInfo1.setAddress("0xc1231234"); | |
151 | ||
152 | fProbeEventInfo2 = new ProbeEventInfo("probeEvent2"); | |
1f07c96c | 153 | fProbeEventInfo2.setEventType(TraceEventType.FUNCTION); |
d132bcc7 BH |
154 | fProbeEventInfo2.setState(TraceEnablement.DISABLED); |
155 | fProbeEventInfo2.setOffset("0x100"); | |
156 | fProbeEventInfo2.setSymbol("init_post"); | |
589d0d33 BH |
157 | |
158 | fSnapshotInfo1 = new SnapshotInfo("snapshot-1"); | |
159 | fSnapshotInfo1.setId(1); | |
160 | fSnapshotInfo1.setSnapshotPath("/home/user/lttng-trace/mysession/"); | |
161 | fSnapshotInfo2 = new SnapshotInfo("other-snapshot"); | |
162 | fSnapshotInfo2.setId(1); | |
163 | fSnapshotInfo2.setSnapshotPath("net4://172.0.0.1:1234/"); | |
164 | fSnapshotInfo2.setStreamedSnapshot(true); | |
165 | ||
166 | fSessionInfo1.setSnapshotInfo(fSnapshotInfo1); | |
eb1bab5b | 167 | } |
b0318660 | 168 | |
eb1bab5b BH |
169 | public ISessionInfo getSessionInfo1() { |
170 | return fSessionInfo1; | |
171 | } | |
172 | ||
173 | public ISessionInfo getSessionInfo2() { | |
174 | return fSessionInfo2; | |
175 | } | |
176 | ||
177 | public IDomainInfo getDomainInfo1() { | |
178 | return fDomainInfo1; | |
179 | } | |
180 | ||
181 | public IDomainInfo getDomainInfo2() { | |
182 | return fDomainInfo2; | |
183 | } | |
184 | ||
185 | public IChannelInfo getChannel1() { | |
186 | return fChannelInfo1; | |
187 | } | |
188 | ||
189 | public IChannelInfo getChannel2() { | |
190 | return fChannelInfo2; | |
191 | } | |
192 | ||
193 | public IEventInfo getEventInfo1() { | |
194 | return fEventInfo1; | |
195 | } | |
196 | ||
197 | public IEventInfo getEventInfo2() { | |
198 | return fEventInfo2; | |
199 | } | |
200 | ||
201 | public IEventInfo getEventInfo3() { | |
202 | return fEventInfo3; | |
203 | } | |
b0318660 | 204 | |
eb1bab5b BH |
205 | public IBaseEventInfo getBaseEventInfo1() { |
206 | return fBaseEventInfo1; | |
207 | } | |
208 | ||
209 | public IBaseEventInfo getBaseEventInfo2() { | |
210 | return fBaseEventInfo2; | |
211 | } | |
b0318660 | 212 | |
eb1bab5b BH |
213 | public IUstProviderInfo getUstProviderInfo1() { |
214 | return fUstProviderInfo1; | |
215 | } | |
216 | ||
217 | public IUstProviderInfo getUstProviderInfo2() { | |
218 | return fUstProviderInfo2; | |
219 | } | |
b0318660 | 220 | |
d132bcc7 BH |
221 | public IProbeEventInfo getProbeEventInfo1() { |
222 | return fProbeEventInfo1; | |
223 | } | |
224 | ||
225 | public IProbeEventInfo getProbeEventInfo2() { | |
226 | return fProbeEventInfo2; | |
227 | } | |
228 | ||
d4514365 BH |
229 | public IFieldInfo getFieldInfo1() { |
230 | return fFieldInfo1; | |
231 | } | |
232 | ||
233 | public IFieldInfo getFieldInfo2() { | |
234 | return fFieldInfo2; | |
235 | } | |
589d0d33 BH |
236 | |
237 | public ISnapshotInfo getSnapshotInfo1() { | |
238 | return fSnapshotInfo1; | |
239 | } | |
240 | ||
241 | public ISnapshotInfo getSnapshotInfo2() { | |
242 | return fSnapshotInfo2; | |
243 | } | |
eb1bab5b | 244 | } |