| 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.lttng2.core.tests.control.model.impl; |
| 13 | |
| 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.IFieldInfo; |
| 19 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IProbeEventInfo; |
| 20 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo; |
| 21 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IUstProviderInfo; |
| 22 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEnablement; |
| 23 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType; |
| 24 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel; |
| 25 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceSessionState; |
| 26 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BaseEventInfo; |
| 27 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.ChannelInfo; |
| 28 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.DomainInfo; |
| 29 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.EventInfo; |
| 30 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.FieldInfo; |
| 31 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.ProbeEventInfo; |
| 32 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.SessionInfo; |
| 33 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.UstProviderInfo; |
| 34 | |
| 35 | /** |
| 36 | * Test facility to constants across test case |
| 37 | */ |
| 38 | @SuppressWarnings({"nls", "javadoc"}) |
| 39 | public class ModelImplFactory { |
| 40 | |
| 41 | private ISessionInfo fSessionInfo1 = null; |
| 42 | private ISessionInfo fSessionInfo2 = null; |
| 43 | private IDomainInfo fDomainInfo1 = null; |
| 44 | private IDomainInfo fDomainInfo2 = null; |
| 45 | private IChannelInfo fChannelInfo1 = null; |
| 46 | private IChannelInfo fChannelInfo2 = null; |
| 47 | private IEventInfo fEventInfo1 = null; |
| 48 | private IEventInfo fEventInfo2 = null; |
| 49 | private IEventInfo fEventInfo3 = null; |
| 50 | private IFieldInfo fFieldInfo1 = null; |
| 51 | private IFieldInfo fFieldInfo2 = null; |
| 52 | private IBaseEventInfo fBaseEventInfo1 = null; |
| 53 | private IBaseEventInfo fBaseEventInfo2 = null; |
| 54 | private IUstProviderInfo fUstProviderInfo1 = null; |
| 55 | private IUstProviderInfo fUstProviderInfo2 = null; |
| 56 | private IProbeEventInfo fProbeEventInfo1 = null; |
| 57 | private IProbeEventInfo fProbeEventInfo2 = null; |
| 58 | |
| 59 | public ModelImplFactory() { |
| 60 | |
| 61 | fFieldInfo1 = new FieldInfo("intfield"); |
| 62 | fFieldInfo1.setFieldType("int"); |
| 63 | fFieldInfo2 = new FieldInfo("stringfield"); |
| 64 | fFieldInfo2.setFieldType("string"); |
| 65 | |
| 66 | fBaseEventInfo1 = new BaseEventInfo("event1"); |
| 67 | fBaseEventInfo1.setEventType(TraceEventType.UNKNOWN); |
| 68 | fBaseEventInfo1.setLogLevel(TraceLogLevel.TRACE_ERR); |
| 69 | fBaseEventInfo1.addField(fFieldInfo1); |
| 70 | fBaseEventInfo1.addField(fFieldInfo2); |
| 71 | fBaseEventInfo1.setFilterExpression("intField==10"); |
| 72 | |
| 73 | fBaseEventInfo2 = new BaseEventInfo("event2"); |
| 74 | fBaseEventInfo2.setEventType(TraceEventType.TRACEPOINT); |
| 75 | fBaseEventInfo1.setLogLevel(TraceLogLevel.TRACE_DEBUG); |
| 76 | |
| 77 | fEventInfo1 = new EventInfo("event1"); |
| 78 | fEventInfo1.setEventType(TraceEventType.TRACEPOINT); |
| 79 | fEventInfo1.setState(TraceEnablement.ENABLED); |
| 80 | |
| 81 | fEventInfo2 = new EventInfo("event2"); |
| 82 | fEventInfo2.setEventType(TraceEventType.UNKNOWN); |
| 83 | fEventInfo2.setState(TraceEnablement.DISABLED); |
| 84 | |
| 85 | fEventInfo3 = new EventInfo("event3"); |
| 86 | fEventInfo3.setEventType(TraceEventType.TRACEPOINT); |
| 87 | fEventInfo3.setState(TraceEnablement.DISABLED); |
| 88 | |
| 89 | fUstProviderInfo1 = new UstProviderInfo("myUST1"); |
| 90 | fUstProviderInfo1.setPid(1234); |
| 91 | fUstProviderInfo1.addEvent(fBaseEventInfo1); |
| 92 | |
| 93 | fUstProviderInfo2 = new UstProviderInfo("myUST2"); |
| 94 | fUstProviderInfo2.setPid(2345); |
| 95 | fUstProviderInfo2.addEvent(fBaseEventInfo1); |
| 96 | fUstProviderInfo2.addEvent(fBaseEventInfo2); |
| 97 | |
| 98 | fChannelInfo1 = new ChannelInfo("channel1"); |
| 99 | fChannelInfo1.setSwitchTimer(10L); |
| 100 | fChannelInfo1.setOverwriteMode(true); |
| 101 | fChannelInfo1.setReadTimer(11L); |
| 102 | fChannelInfo1.setState(TraceEnablement.DISABLED); |
| 103 | fChannelInfo1.setNumberOfSubBuffers(12); |
| 104 | fChannelInfo1.setOutputType("splice()"); |
| 105 | fChannelInfo1.setSubBufferSize(13L); |
| 106 | fChannelInfo1.addEvent(fEventInfo1); |
| 107 | |
| 108 | fChannelInfo2 = new ChannelInfo("channel2"); |
| 109 | fChannelInfo2.setSwitchTimer(1L); |
| 110 | fChannelInfo2.setOverwriteMode(false); |
| 111 | fChannelInfo2.setReadTimer(2L); |
| 112 | fChannelInfo2.setState(TraceEnablement.ENABLED); |
| 113 | fChannelInfo2.setNumberOfSubBuffers(3); |
| 114 | fChannelInfo2.setOutputType("mmap()"); |
| 115 | fChannelInfo2.setSubBufferSize(4L); |
| 116 | fChannelInfo2.addEvent(fEventInfo2); |
| 117 | fChannelInfo2.addEvent(fEventInfo3); |
| 118 | |
| 119 | fDomainInfo1 = new DomainInfo("test1"); |
| 120 | fDomainInfo1.addChannel(fChannelInfo1); |
| 121 | |
| 122 | fDomainInfo2 = new DomainInfo("test2"); |
| 123 | fDomainInfo2.addChannel(fChannelInfo1); |
| 124 | fDomainInfo2.addChannel(fChannelInfo2); |
| 125 | |
| 126 | fSessionInfo1 = new SessionInfo("session1"); |
| 127 | fSessionInfo1.setSessionPath("/home/user"); |
| 128 | fSessionInfo1.setSessionState(TraceSessionState.ACTIVE); |
| 129 | fSessionInfo1.addDomain(fDomainInfo1); |
| 130 | |
| 131 | fSessionInfo2 = new SessionInfo("session2"); |
| 132 | fSessionInfo2.setSessionPath("/home/user1"); |
| 133 | fSessionInfo2.setSessionState(TraceSessionState.INACTIVE); |
| 134 | fSessionInfo2.addDomain(fDomainInfo1); |
| 135 | fSessionInfo2.addDomain(fDomainInfo2); |
| 136 | |
| 137 | fProbeEventInfo1 = new ProbeEventInfo("probeEvent1"); |
| 138 | fProbeEventInfo1.setEventType(TraceEventType.TRACEPOINT); |
| 139 | fProbeEventInfo1.setState(TraceEnablement.ENABLED); |
| 140 | fProbeEventInfo1.setAddress("0xc1231234"); |
| 141 | |
| 142 | fProbeEventInfo2 = new ProbeEventInfo("probeEvent2"); |
| 143 | fProbeEventInfo2.setEventType(TraceEventType.UNKNOWN); |
| 144 | fProbeEventInfo2.setState(TraceEnablement.DISABLED); |
| 145 | fProbeEventInfo2.setOffset("0x100"); |
| 146 | fProbeEventInfo2.setSymbol("init_post"); |
| 147 | } |
| 148 | |
| 149 | public ISessionInfo getSessionInfo1() { |
| 150 | return fSessionInfo1; |
| 151 | } |
| 152 | |
| 153 | public ISessionInfo getSessionInfo2() { |
| 154 | return fSessionInfo2; |
| 155 | } |
| 156 | |
| 157 | public IDomainInfo getDomainInfo1() { |
| 158 | return fDomainInfo1; |
| 159 | } |
| 160 | |
| 161 | public IDomainInfo getDomainInfo2() { |
| 162 | return fDomainInfo2; |
| 163 | } |
| 164 | |
| 165 | public IChannelInfo getChannel1() { |
| 166 | return fChannelInfo1; |
| 167 | } |
| 168 | |
| 169 | public IChannelInfo getChannel2() { |
| 170 | return fChannelInfo2; |
| 171 | } |
| 172 | |
| 173 | public IEventInfo getEventInfo1() { |
| 174 | return fEventInfo1; |
| 175 | } |
| 176 | |
| 177 | public IEventInfo getEventInfo2() { |
| 178 | return fEventInfo2; |
| 179 | } |
| 180 | |
| 181 | public IEventInfo getEventInfo3() { |
| 182 | return fEventInfo3; |
| 183 | } |
| 184 | |
| 185 | public IBaseEventInfo getBaseEventInfo1() { |
| 186 | return fBaseEventInfo1; |
| 187 | } |
| 188 | |
| 189 | public IBaseEventInfo getBaseEventInfo2() { |
| 190 | return fBaseEventInfo2; |
| 191 | } |
| 192 | |
| 193 | public IUstProviderInfo getUstProviderInfo1() { |
| 194 | return fUstProviderInfo1; |
| 195 | } |
| 196 | |
| 197 | public IUstProviderInfo getUstProviderInfo2() { |
| 198 | return fUstProviderInfo2; |
| 199 | } |
| 200 | |
| 201 | public IProbeEventInfo getProbeEventInfo1() { |
| 202 | return fProbeEventInfo1; |
| 203 | } |
| 204 | |
| 205 | public IProbeEventInfo getProbeEventInfo2() { |
| 206 | return fProbeEventInfo2; |
| 207 | } |
| 208 | |
| 209 | public IFieldInfo getFieldInfo1() { |
| 210 | return fFieldInfo1; |
| 211 | } |
| 212 | |
| 213 | public IFieldInfo getFieldInfo2() { |
| 214 | return fFieldInfo2; |
| 215 | } |
| 216 | } |