1 /*******************************************************************************
2 * Copyright (c) 2012 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 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.lttng2
.core
.tests
.control
.model
.impl
;
14 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IBaseEventInfo
;
15 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IChannelInfo
;
16 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IDomainInfo
;
17 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IEventInfo
;
18 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IProbeEventInfo
;
19 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.ISessionInfo
;
20 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IUstProviderInfo
;
21 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.TraceEnablement
;
22 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.TraceEventType
;
23 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.TraceLogLevel
;
24 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.TraceSessionState
;
25 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.impl
.BaseEventInfo
;
26 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.impl
.ChannelInfo
;
27 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.impl
.DomainInfo
;
28 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.impl
.EventInfo
;
29 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.impl
.ProbeEventInfo
;
30 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.impl
.SessionInfo
;
31 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.impl
.UstProviderInfo
;
34 * Test facility to constants across test case
36 @SuppressWarnings({"nls", "javadoc"})
37 public class ModelImplFactory
{
39 private ISessionInfo fSessionInfo1
= null;
40 private ISessionInfo fSessionInfo2
= null;
41 private IDomainInfo fDomainInfo1
= null;
42 private IDomainInfo fDomainInfo2
= null;
43 private IChannelInfo fChannelInfo1
= null;
44 private IChannelInfo fChannelInfo2
= null;
45 private IEventInfo fEventInfo1
= null;
46 private IEventInfo fEventInfo2
= null;
47 private IEventInfo fEventInfo3
= null;
48 private IBaseEventInfo fBaseEventInfo1
= null;
49 private IBaseEventInfo fBaseEventInfo2
= null;
50 private IUstProviderInfo fUstProviderInfo1
= null;
51 private IUstProviderInfo fUstProviderInfo2
= null;
52 private IProbeEventInfo fProbeEventInfo1
= null;
53 private IProbeEventInfo fProbeEventInfo2
= null;
55 public ModelImplFactory() {
56 fBaseEventInfo1
= new BaseEventInfo("event1");
57 fBaseEventInfo1
.setEventType(TraceEventType
.UNKNOWN
);
58 fBaseEventInfo1
.setLogLevel(TraceLogLevel
.TRACE_ERR
);
59 fBaseEventInfo2
= new BaseEventInfo("event2");
60 fBaseEventInfo2
.setEventType(TraceEventType
.TRACEPOINT
);
61 fBaseEventInfo1
.setLogLevel(TraceLogLevel
.TRACE_DEBUG
);
63 fEventInfo1
= new EventInfo("event1");
64 fEventInfo1
.setEventType(TraceEventType
.TRACEPOINT
);
65 fEventInfo1
.setState(TraceEnablement
.ENABLED
);
67 fEventInfo2
= new EventInfo("event2");
68 fEventInfo2
.setEventType(TraceEventType
.UNKNOWN
);
69 fEventInfo2
.setState(TraceEnablement
.DISABLED
);
71 fEventInfo3
= new EventInfo("event3");
72 fEventInfo3
.setEventType(TraceEventType
.TRACEPOINT
);
73 fEventInfo3
.setState(TraceEnablement
.DISABLED
);
75 fUstProviderInfo1
= new UstProviderInfo("myUST1");
76 fUstProviderInfo1
.setPid(1234);
77 fUstProviderInfo1
.addEvent(fBaseEventInfo1
);
79 fUstProviderInfo2
= new UstProviderInfo("myUST2");
80 fUstProviderInfo2
.setPid(2345);
81 fUstProviderInfo2
.addEvent(fBaseEventInfo1
);
82 fUstProviderInfo2
.addEvent(fBaseEventInfo2
);
84 fChannelInfo1
= new ChannelInfo("channel1");
85 fChannelInfo1
.setSwitchTimer(10L);
86 fChannelInfo1
.setOverwriteMode(true);
87 fChannelInfo1
.setReadTimer(11L);
88 fChannelInfo1
.setState(TraceEnablement
.DISABLED
);
89 fChannelInfo1
.setNumberOfSubBuffers(12);
90 fChannelInfo1
.setOutputType("splice()");
91 fChannelInfo1
.setSubBufferSize(13L);
92 fChannelInfo1
.addEvent(fEventInfo1
);
94 fChannelInfo2
= new ChannelInfo("channel2");
95 fChannelInfo2
.setSwitchTimer(1L);
96 fChannelInfo2
.setOverwriteMode(false);
97 fChannelInfo2
.setReadTimer(2L);
98 fChannelInfo2
.setState(TraceEnablement
.ENABLED
);
99 fChannelInfo2
.setNumberOfSubBuffers(3);
100 fChannelInfo2
.setOutputType("mmap()");
101 fChannelInfo2
.setSubBufferSize(4L);
102 fChannelInfo2
.addEvent(fEventInfo2
);
103 fChannelInfo2
.addEvent(fEventInfo3
);
105 fDomainInfo1
= new DomainInfo("test1");
106 fDomainInfo1
.addChannel(fChannelInfo1
);
108 fDomainInfo2
= new DomainInfo("test2");
109 fDomainInfo2
.addChannel(fChannelInfo1
);
110 fDomainInfo2
.addChannel(fChannelInfo2
);
112 fSessionInfo1
= new SessionInfo("session1");
113 fSessionInfo1
.setSessionPath("/home/user");
114 fSessionInfo1
.setSessionState(TraceSessionState
.ACTIVE
);
115 fSessionInfo1
.addDomain(fDomainInfo1
);
117 fSessionInfo2
= new SessionInfo("session2");
118 fSessionInfo2
.setSessionPath("/home/user1");
119 fSessionInfo2
.setSessionState(TraceSessionState
.INACTIVE
);
120 fSessionInfo2
.addDomain(fDomainInfo1
);
121 fSessionInfo2
.addDomain(fDomainInfo2
);
123 fProbeEventInfo1
= new ProbeEventInfo("probeEvent1");
124 fProbeEventInfo1
.setEventType(TraceEventType
.TRACEPOINT
);
125 fProbeEventInfo1
.setState(TraceEnablement
.ENABLED
);
126 fProbeEventInfo1
.setAddress("0xc1231234");
128 fProbeEventInfo2
= new ProbeEventInfo("probeEvent2");
129 fProbeEventInfo2
.setEventType(TraceEventType
.UNKNOWN
);
130 fProbeEventInfo2
.setState(TraceEnablement
.DISABLED
);
131 fProbeEventInfo2
.setOffset("0x100");
132 fProbeEventInfo2
.setSymbol("init_post");
135 public ISessionInfo
getSessionInfo1() {
136 return fSessionInfo1
;
139 public ISessionInfo
getSessionInfo2() {
140 return fSessionInfo2
;
143 public IDomainInfo
getDomainInfo1() {
147 public IDomainInfo
getDomainInfo2() {
151 public IChannelInfo
getChannel1() {
152 return fChannelInfo1
;
155 public IChannelInfo
getChannel2() {
156 return fChannelInfo2
;
159 public IEventInfo
getEventInfo1() {
163 public IEventInfo
getEventInfo2() {
167 public IEventInfo
getEventInfo3() {
171 public IBaseEventInfo
getBaseEventInfo1() {
172 return fBaseEventInfo1
;
175 public IBaseEventInfo
getBaseEventInfo2() {
176 return fBaseEventInfo2
;
179 public IUstProviderInfo
getUstProviderInfo1() {
180 return fUstProviderInfo1
;
183 public IUstProviderInfo
getUstProviderInfo2() {
184 return fUstProviderInfo2
;
187 public IProbeEventInfo
getProbeEventInfo1() {
188 return fProbeEventInfo1
;
191 public IProbeEventInfo
getProbeEventInfo2() {
192 return fProbeEventInfo2
;