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
.lttng
.ui
.tests
.control
.model
.impl
;
14 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.IBaseEventInfo
;
15 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.IChannelInfo
;
16 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.IDomainInfo
;
17 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.IEventInfo
;
18 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.ISessionInfo
;
19 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.IUstProviderInfo
;
20 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.TraceEnablement
;
21 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.TraceEventType
;
22 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.TraceLogLevel
;
23 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.TraceSessionState
;
24 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.BaseEventInfo
;
25 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.ChannelInfo
;
26 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.DomainInfo
;
27 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.EventInfo
;
28 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.SessionInfo
;
29 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
.UstProviderInfo
;
32 * Test facility to constants across test case
34 @SuppressWarnings("nls")
35 public class ModelImplFactory
{
37 private ISessionInfo fSessionInfo1
= null;
38 private ISessionInfo fSessionInfo2
= null;
39 private IDomainInfo fDomainInfo1
= null;
40 private IDomainInfo fDomainInfo2
= null;
41 private IChannelInfo fChannelInfo1
= null;
42 private IChannelInfo fChannelInfo2
= null;
43 private IEventInfo fEventInfo1
= null;
44 private IEventInfo fEventInfo2
= null;
45 private IEventInfo fEventInfo3
= null;
46 private IBaseEventInfo fBaseEventInfo1
= null;
47 private IBaseEventInfo fBaseEventInfo2
= null;
48 private IUstProviderInfo fUstProviderInfo1
= null;
49 private IUstProviderInfo fUstProviderInfo2
= null;
51 public ModelImplFactory() {
52 fBaseEventInfo1
= new BaseEventInfo("event1");
53 fBaseEventInfo1
.setEventType(TraceEventType
.UNKNOWN
);
54 fBaseEventInfo1
.setLogLevel(TraceLogLevel
.TRACE_ERR
);
55 fBaseEventInfo2
= new BaseEventInfo("event2");
56 fBaseEventInfo2
.setEventType(TraceEventType
.TRACEPOINT
);
57 fBaseEventInfo1
.setLogLevel(TraceLogLevel
.TRACE_DEBUG
);
59 fEventInfo1
= new EventInfo("event1");
60 fEventInfo1
.setEventType(TraceEventType
.TRACEPOINT
);
61 fEventInfo1
.setState(TraceEnablement
.ENABLED
);
63 fEventInfo2
= new EventInfo("event2");
64 fEventInfo2
.setEventType(TraceEventType
.UNKNOWN
);
65 fEventInfo2
.setState(TraceEnablement
.DISABLED
);
67 fEventInfo3
= new EventInfo("event3");
68 fEventInfo3
.setEventType(TraceEventType
.TRACEPOINT
);
69 fEventInfo3
.setState(TraceEnablement
.DISABLED
);
71 fUstProviderInfo1
= new UstProviderInfo("myUST1");
72 fUstProviderInfo1
.setPid(1234);
73 fUstProviderInfo1
.addEvent(fBaseEventInfo1
);
75 fUstProviderInfo2
= new UstProviderInfo("myUST2");
76 fUstProviderInfo2
.setPid(2345);
77 fUstProviderInfo2
.addEvent(fBaseEventInfo1
);
78 fUstProviderInfo2
.addEvent(fBaseEventInfo2
);
80 fChannelInfo1
= new ChannelInfo("channel1");
81 fChannelInfo1
.setSwitchTimer(10L);
82 fChannelInfo1
.setOverwriteMode(true);
83 fChannelInfo1
.setReadTimer(11L);
84 fChannelInfo1
.setState(TraceEnablement
.DISABLED
);
85 fChannelInfo1
.setNumberOfSubBuffers(12);
86 fChannelInfo1
.setOutputType("splice()");
87 fChannelInfo1
.setSubBufferSize(13L);
88 fChannelInfo1
.addEvent(fEventInfo1
);
90 fChannelInfo2
= new ChannelInfo("channel2");
91 fChannelInfo2
.setSwitchTimer(1L);
92 fChannelInfo2
.setOverwriteMode(false);
93 fChannelInfo2
.setReadTimer(2L);
94 fChannelInfo2
.setState(TraceEnablement
.ENABLED
);
95 fChannelInfo2
.setNumberOfSubBuffers(3);
96 fChannelInfo2
.setOutputType("mmap()");
97 fChannelInfo2
.setSubBufferSize(4L);
98 fChannelInfo2
.addEvent(fEventInfo2
);
99 fChannelInfo2
.addEvent(fEventInfo3
);
101 fDomainInfo1
= new DomainInfo("test1");
102 fDomainInfo1
.addChannel(fChannelInfo1
);
104 fDomainInfo2
= new DomainInfo("test2");
105 fDomainInfo2
.addChannel(fChannelInfo1
);
106 fDomainInfo2
.addChannel(fChannelInfo2
);
108 fSessionInfo1
= new SessionInfo("session1");
109 fSessionInfo1
.setSessionPath("/home/user");
110 fSessionInfo1
.setSessionState(TraceSessionState
.ACTIVE
);
111 fSessionInfo1
.addDomain(fDomainInfo1
);
113 fSessionInfo2
= new SessionInfo("session2");
114 fSessionInfo2
.setSessionPath("/home/user1");
115 fSessionInfo2
.setSessionState(TraceSessionState
.INACTIVE
);
116 fSessionInfo2
.addDomain(fDomainInfo1
);
117 fSessionInfo2
.addDomain(fDomainInfo2
);
120 public ISessionInfo
getSessionInfo1() {
121 return fSessionInfo1
;
124 public ISessionInfo
getSessionInfo2() {
125 return fSessionInfo2
;
128 public IDomainInfo
getDomainInfo1() {
132 public IDomainInfo
getDomainInfo2() {
136 public IChannelInfo
getChannel1() {
137 return fChannelInfo1
;
140 public IChannelInfo
getChannel2() {
141 return fChannelInfo2
;
144 public IEventInfo
getEventInfo1() {
148 public IEventInfo
getEventInfo2() {
152 public IEventInfo
getEventInfo3() {
156 public IBaseEventInfo
getBaseEventInfo1() {
157 return fBaseEventInfo1
;
160 public IBaseEventInfo
getBaseEventInfo2() {
161 return fBaseEventInfo2
;
164 public IUstProviderInfo
getUstProviderInfo1() {
165 return fUstProviderInfo1
;
168 public IUstProviderInfo
getUstProviderInfo2() {
169 return fUstProviderInfo2
;