| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2012 Ericsson |
| 3 | * |
| 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 |
| 8 | * |
| 9 | * Contributors: |
| 10 | * Bernd Hufmann - Initial API and implementation |
| 11 | *******************************************************************************/ |
| 12 | package org.eclipse.linuxtools.lttng.ui.tests.control.model.impl; |
| 13 | |
| 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.IProbeEventInfo; |
| 19 | import org.eclipse.linuxtools.lttng.ui.views.control.model.ISessionInfo; |
| 20 | import org.eclipse.linuxtools.lttng.ui.views.control.model.IUstProviderInfo; |
| 21 | import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEnablement; |
| 22 | import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEventType; |
| 23 | import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceLogLevel; |
| 24 | import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceSessionState; |
| 25 | import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventInfo; |
| 26 | import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.ChannelInfo; |
| 27 | import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.DomainInfo; |
| 28 | import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.EventInfo; |
| 29 | import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.ProbeEventInfo; |
| 30 | import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.SessionInfo; |
| 31 | import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.UstProviderInfo; |
| 32 | |
| 33 | /** |
| 34 | * Test facility to constants across test case |
| 35 | */ |
| 36 | @SuppressWarnings("nls") |
| 37 | public class ModelImplFactory { |
| 38 | |
| 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; |
| 54 | |
| 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); |
| 62 | |
| 63 | fEventInfo1 = new EventInfo("event1"); |
| 64 | fEventInfo1.setEventType(TraceEventType.TRACEPOINT); |
| 65 | fEventInfo1.setState(TraceEnablement.ENABLED); |
| 66 | |
| 67 | fEventInfo2 = new EventInfo("event2"); |
| 68 | fEventInfo2.setEventType(TraceEventType.UNKNOWN); |
| 69 | fEventInfo2.setState(TraceEnablement.DISABLED); |
| 70 | |
| 71 | fEventInfo3 = new EventInfo("event3"); |
| 72 | fEventInfo3.setEventType(TraceEventType.TRACEPOINT); |
| 73 | fEventInfo3.setState(TraceEnablement.DISABLED); |
| 74 | |
| 75 | fUstProviderInfo1 = new UstProviderInfo("myUST1"); |
| 76 | fUstProviderInfo1.setPid(1234); |
| 77 | fUstProviderInfo1.addEvent(fBaseEventInfo1); |
| 78 | |
| 79 | fUstProviderInfo2 = new UstProviderInfo("myUST2"); |
| 80 | fUstProviderInfo2.setPid(2345); |
| 81 | fUstProviderInfo2.addEvent(fBaseEventInfo1); |
| 82 | fUstProviderInfo2.addEvent(fBaseEventInfo2); |
| 83 | |
| 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); |
| 93 | |
| 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); |
| 104 | |
| 105 | fDomainInfo1 = new DomainInfo("test1"); |
| 106 | fDomainInfo1.addChannel(fChannelInfo1); |
| 107 | |
| 108 | fDomainInfo2 = new DomainInfo("test2"); |
| 109 | fDomainInfo2.addChannel(fChannelInfo1); |
| 110 | fDomainInfo2.addChannel(fChannelInfo2); |
| 111 | |
| 112 | fSessionInfo1 = new SessionInfo("session1"); |
| 113 | fSessionInfo1.setSessionPath("/home/user"); |
| 114 | fSessionInfo1.setSessionState(TraceSessionState.ACTIVE); |
| 115 | fSessionInfo1.addDomain(fDomainInfo1); |
| 116 | |
| 117 | fSessionInfo2 = new SessionInfo("session2"); |
| 118 | fSessionInfo2.setSessionPath("/home/user1"); |
| 119 | fSessionInfo2.setSessionState(TraceSessionState.INACTIVE); |
| 120 | fSessionInfo2.addDomain(fDomainInfo1); |
| 121 | fSessionInfo2.addDomain(fDomainInfo2); |
| 122 | |
| 123 | fProbeEventInfo1 = new ProbeEventInfo("probeEvent1"); |
| 124 | fProbeEventInfo1.setEventType(TraceEventType.TRACEPOINT); |
| 125 | fProbeEventInfo1.setState(TraceEnablement.ENABLED); |
| 126 | fProbeEventInfo1.setAddress("0xc1231234"); |
| 127 | |
| 128 | fProbeEventInfo2 = new ProbeEventInfo("probeEvent2"); |
| 129 | fProbeEventInfo2.setEventType(TraceEventType.UNKNOWN); |
| 130 | fProbeEventInfo2.setState(TraceEnablement.DISABLED); |
| 131 | fProbeEventInfo2.setOffset("0x100"); |
| 132 | fProbeEventInfo2.setSymbol("init_post"); |
| 133 | } |
| 134 | |
| 135 | public ISessionInfo getSessionInfo1() { |
| 136 | return fSessionInfo1; |
| 137 | } |
| 138 | |
| 139 | public ISessionInfo getSessionInfo2() { |
| 140 | return fSessionInfo2; |
| 141 | } |
| 142 | |
| 143 | public IDomainInfo getDomainInfo1() { |
| 144 | return fDomainInfo1; |
| 145 | } |
| 146 | |
| 147 | public IDomainInfo getDomainInfo2() { |
| 148 | return fDomainInfo2; |
| 149 | } |
| 150 | |
| 151 | public IChannelInfo getChannel1() { |
| 152 | return fChannelInfo1; |
| 153 | } |
| 154 | |
| 155 | public IChannelInfo getChannel2() { |
| 156 | return fChannelInfo2; |
| 157 | } |
| 158 | |
| 159 | public IEventInfo getEventInfo1() { |
| 160 | return fEventInfo1; |
| 161 | } |
| 162 | |
| 163 | public IEventInfo getEventInfo2() { |
| 164 | return fEventInfo2; |
| 165 | } |
| 166 | |
| 167 | public IEventInfo getEventInfo3() { |
| 168 | return fEventInfo3; |
| 169 | } |
| 170 | |
| 171 | public IBaseEventInfo getBaseEventInfo1() { |
| 172 | return fBaseEventInfo1; |
| 173 | } |
| 174 | |
| 175 | public IBaseEventInfo getBaseEventInfo2() { |
| 176 | return fBaseEventInfo2; |
| 177 | } |
| 178 | |
| 179 | public IUstProviderInfo getUstProviderInfo1() { |
| 180 | return fUstProviderInfo1; |
| 181 | } |
| 182 | |
| 183 | public IUstProviderInfo getUstProviderInfo2() { |
| 184 | return fUstProviderInfo2; |
| 185 | } |
| 186 | |
| 187 | public IProbeEventInfo getProbeEventInfo1() { |
| 188 | return fProbeEventInfo1; |
| 189 | } |
| 190 | |
| 191 | public IProbeEventInfo getProbeEventInfo2() { |
| 192 | return fProbeEventInfo2; |
| 193 | } |
| 194 | |
| 195 | } |