1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
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
10 * Bernd Hufmann - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.lttng2
.control
.core
.tests
.model
.impl
;
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
;
39 * Test facility to constants across test case
41 @SuppressWarnings("javadoc")
42 public class ModelImplFactory
{
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;
53 private IFieldInfo fFieldInfo1
= null;
54 private IFieldInfo fFieldInfo2
= null;
55 private IBaseEventInfo fBaseEventInfo1
= null;
56 private IBaseEventInfo fBaseEventInfo2
= null;
57 private IUstProviderInfo fUstProviderInfo1
= null;
58 private IUstProviderInfo fUstProviderInfo2
= null;
59 private IProbeEventInfo fProbeEventInfo1
= null;
60 private IProbeEventInfo fProbeEventInfo2
= null;
61 private ISnapshotInfo fSnapshotInfo1
= null;
62 private ISnapshotInfo fSnapshotInfo2
= null;
64 public ModelImplFactory() {
66 fFieldInfo1
= new FieldInfo("intfield");
67 fFieldInfo1
.setFieldType("int");
68 fFieldInfo2
= new FieldInfo("stringfield");
69 fFieldInfo2
.setFieldType("string");
71 fBaseEventInfo1
= new BaseEventInfo("event1");
72 fBaseEventInfo1
.setEventType(TraceEventType
.UNKNOWN
);
73 fBaseEventInfo1
.setLogLevel(TraceLogLevel
.TRACE_ERR
);
74 fBaseEventInfo1
.addField(fFieldInfo1
);
75 fBaseEventInfo1
.addField(fFieldInfo2
);
76 fBaseEventInfo1
.setFilterExpression("intField==10");
78 fBaseEventInfo2
= new BaseEventInfo("event2");
79 fBaseEventInfo2
.setEventType(TraceEventType
.TRACEPOINT
);
80 fBaseEventInfo1
.setLogLevel(TraceLogLevel
.TRACE_DEBUG
);
82 fEventInfo1
= new EventInfo("event1");
83 fEventInfo1
.setEventType(TraceEventType
.TRACEPOINT
);
84 fEventInfo1
.setLogLevelType("==");
85 fEventInfo1
.setLogLevel(TraceLogLevel
.TRACE_DEBUG
);
86 fEventInfo1
.setState(TraceEnablement
.ENABLED
);
88 fEventInfo2
= new EventInfo("event2");
89 fEventInfo2
.setLogLevelType("<=");
90 fEventInfo2
.setLogLevel(TraceLogLevel
.TRACE_INFO
);
91 fEventInfo2
.setEventType(TraceEventType
.UNKNOWN
);
92 fEventInfo2
.setState(TraceEnablement
.DISABLED
);
94 fEventInfo3
= new EventInfo("event3");
95 fEventInfo3
.setEventType(TraceEventType
.TRACEPOINT
);
96 fEventInfo3
.setState(TraceEnablement
.DISABLED
);
98 fUstProviderInfo1
= new UstProviderInfo("myUST1");
99 fUstProviderInfo1
.setPid(1234);
100 fUstProviderInfo1
.addEvent(fBaseEventInfo1
);
102 fUstProviderInfo2
= new UstProviderInfo("myUST2");
103 fUstProviderInfo2
.setPid(2345);
104 fUstProviderInfo2
.addEvent(fBaseEventInfo1
);
105 fUstProviderInfo2
.addEvent(fBaseEventInfo2
);
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
);
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
);
128 fDomainInfo1
= new DomainInfo("test1");
129 fDomainInfo1
.addChannel(fChannelInfo1
);
131 fDomainInfo2
= new DomainInfo("test2");
132 fDomainInfo2
.addChannel(fChannelInfo1
);
133 fDomainInfo2
.addChannel(fChannelInfo2
);
135 fSessionInfo1
= new SessionInfo("session1");
136 fSessionInfo1
.setSessionPath("/home/user");
137 fSessionInfo1
.setSessionState(TraceSessionState
.ACTIVE
);
138 fSessionInfo1
.addDomain(fDomainInfo1
);
140 fSessionInfo2
= new SessionInfo("session2");
141 fSessionInfo2
.setSessionPath("/home/user1");
142 fSessionInfo2
.setSessionState(TraceSessionState
.INACTIVE
);
143 fSessionInfo2
.addDomain(fDomainInfo1
);
144 fSessionInfo2
.addDomain(fDomainInfo2
);
145 fSessionInfo2
.setStreamedTrace(true);
147 fProbeEventInfo1
= new ProbeEventInfo("probeEvent1");
148 fProbeEventInfo1
.setEventType(TraceEventType
.TRACEPOINT
);
149 fProbeEventInfo1
.setState(TraceEnablement
.ENABLED
);
150 fProbeEventInfo1
.setAddress("0xc1231234");
152 fProbeEventInfo2
= new ProbeEventInfo("probeEvent2");
153 fProbeEventInfo2
.setEventType(TraceEventType
.FUNCTION
);
154 fProbeEventInfo2
.setState(TraceEnablement
.DISABLED
);
155 fProbeEventInfo2
.setOffset("0x100");
156 fProbeEventInfo2
.setSymbol("init_post");
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);
166 fSessionInfo1
.setSnapshotInfo(fSnapshotInfo1
);
169 public ISessionInfo
getSessionInfo1() {
170 return fSessionInfo1
;
173 public ISessionInfo
getSessionInfo2() {
174 return fSessionInfo2
;
177 public IDomainInfo
getDomainInfo1() {
181 public IDomainInfo
getDomainInfo2() {
185 public IChannelInfo
getChannel1() {
186 return fChannelInfo1
;
189 public IChannelInfo
getChannel2() {
190 return fChannelInfo2
;
193 public IEventInfo
getEventInfo1() {
197 public IEventInfo
getEventInfo2() {
201 public IEventInfo
getEventInfo3() {
205 public IBaseEventInfo
getBaseEventInfo1() {
206 return fBaseEventInfo1
;
209 public IBaseEventInfo
getBaseEventInfo2() {
210 return fBaseEventInfo2
;
213 public IUstProviderInfo
getUstProviderInfo1() {
214 return fUstProviderInfo1
;
217 public IUstProviderInfo
getUstProviderInfo2() {
218 return fUstProviderInfo2
;
221 public IProbeEventInfo
getProbeEventInfo1() {
222 return fProbeEventInfo1
;
225 public IProbeEventInfo
getProbeEventInfo2() {
226 return fProbeEventInfo2
;
229 public IFieldInfo
getFieldInfo1() {
233 public IFieldInfo
getFieldInfo2() {
237 public ISnapshotInfo
getSnapshotInfo1() {
238 return fSnapshotInfo1
;
241 public ISnapshotInfo
getSnapshotInfo2() {
242 return fSnapshotInfo2
;