plus some very simple warnings.
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
/*******************************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Francois Chouinard - Initial API and implementation
*******************************************************************************/
* Test suite for the Activator class
* <p>
*/
+@SuppressWarnings("javadoc")
public class ActivatorTest extends TestCase {
// ------------------------------------------------------------------------
/*******************************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Francois Chouinard - Initial API and implementation
*******************************************************************************/
* <b><u>AllTests</u></b>
* <p>
*/
+@SuppressWarnings("javadoc")
public class AllTests {
public static Test suite() {
/*******************************************************************************
* Copyright (c) 2011 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
import junit.framework.Test;
import junit.framework.TestSuite;
+@SuppressWarnings("javadoc")
public class AllTests {
public static Test suite() {
-
+
TestSuite suite = new TestSuite(AllTests.class.getName());
//$JUnit-BEGIN$
suite.addTestSuite(BaseEventInfoTest.class);
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
/**
* The class <code>BaseEventInfoTest</code> contains test for the class <code>{@link BaseEventInfo}</code>.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class BaseEventInfoTest extends TestCase {
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
private IBaseEventInfo fEventInfo1 = null;
private IBaseEventInfo fEventInfo2 = null;
-
+
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
@Override
public void setUp() throws Exception {
super.setUp();
- ModelImplFactory factory = new ModelImplFactory();
+ ModelImplFactory factory = new ModelImplFactory();
fEventInfo1 = factory.getBaseEventInfo1();
fEventInfo2 = factory.getBaseEventInfo2();
}
public void testBaseEventInfo() {
BaseEventInfo fixture = new BaseEventInfo("event");
assertNotNull(fixture);
-
+
TraceEventType result = fixture.getEventType();
-
+
assertEquals("event", fixture.getName());
assertEquals("unknown", result.getInName());
assertEquals("UNKNOWN", result.name());
assertEquals("UNKNOWN", result.toString());
assertEquals(3, result.ordinal());
-
+
TraceLogLevel level = fixture.getLogLevel();
assertEquals("TRACE_DEBUG", level.getInName());
assertEquals("TRACE_DEBUG", level.name());
*/
public void testEventInfoCopy() {
BaseEventInfo info = new BaseEventInfo((BaseEventInfo)fEventInfo1);
-
+
assertEquals(fEventInfo1.getName(), info.getName());
assertEquals(fEventInfo1.getEventType(), info.getEventType());
assertEquals(fEventInfo1.getLogLevel(), info.getLogLevel());
// Success
}
}
-
+
/**
* Run the TraceEventType getEventType() method test.
*
assertEquals("UNKNOWN", result.name());
assertEquals("UNKNOWN", result.toString());
assertEquals(3, result.ordinal());
-
+
fixture.setEventType("");
result = fixture.getEventType();
assertEquals("unknown", result.getInName());
assertEquals("UNKNOWN", result.name());
assertEquals("UNKNOWN", result.toString());
assertEquals(3, result.ordinal());
-
+
fixture.setEventType("tracepoint");
result = fixture.getEventType();
assertNotNull(result);
assertEquals("TRACEPOINT", result.name());
assertEquals("TRACEPOINT", result.toString());
assertEquals(0, result.ordinal());
-
+
fixture.setEventType("syscall");
result = fixture.getEventType();
assertNotNull(result);
assertEquals("SYSCALL", result.name());
assertEquals("SYSCALL", result.toString());
assertEquals(1, result.ordinal());
-
+
fixture.setEventType("probe");
result = fixture.getEventType();
assertNotNull(result);
public void testSetEventType_2() {
BaseEventInfo fixture = new BaseEventInfo("event");
fixture.setEventType(TraceEventType.TRACEPOINT);
-
+
TraceEventType result = fixture.getEventType();
-
+
assertNotNull(result);
assertEquals("tracepoint", result.getInName());
assertEquals("TRACEPOINT", result.name());
assertEquals("TRACEPOINT", result.toString());
assertEquals(0, result.ordinal());
-
+
fixture.setEventType(TraceEventType.UNKNOWN);
result = fixture.getEventType();
-
+
assertNotNull(result);
assertEquals("unknown", result.getInName());
assertEquals("UNKNOWN", result.name());
assertEquals("UNKNOWN", result.toString());
assertEquals(3, result.ordinal());
-
+
fixture.setEventType(TraceEventType.SYSCALL);
result = fixture.getEventType();
assertNotNull(result);
assertEquals("SYSCALL", result.name());
assertEquals("SYSCALL", result.toString());
assertEquals(1, result.ordinal());
-
+
fixture.setEventType(TraceEventType.PROBE);
result = fixture.getEventType();
assertNotNull(result);
assertEquals(2, result.ordinal());
}
-
+
/**
* Run the void setLogLevel(TraceLogLevel) method test.
* Run the TraceLogLevel getLogLevel() method test
- *
+ *
*/
public void testSetLogLevel1() {
BaseEventInfo fixture = new BaseEventInfo("event");
fixture.setEventType(TraceEventType.TRACEPOINT);
fixture.setLogLevel(TraceLogLevel.TRACE_CRIT);
-
+
// 2 set/get-operations are enough to test the method
TraceLogLevel result = fixture.getLogLevel();
assertNotNull(result);
assertEquals(2, result.ordinal());
fixture.setLogLevel(TraceLogLevel.TRACE_DEBUG_FUNCTION);
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_DEBUG_FUNCTION", result.getInName());
assertEquals("TRACE_DEBUG_FUNCTION", result.toString());
assertEquals(12, result.ordinal());
}
-
+
/**
* Run the void setLogLevel(String) method test.
* Run the TraceLogLevel getLogLevel() method test
- *
+ *
*/
public void testSetLogLevel2() {
BaseEventInfo fixture = new BaseEventInfo("event");
fixture.setEventType(TraceEventType.TRACEPOINT);
fixture.setLogLevel("TRACE_EMERG");
-
+
TraceLogLevel result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_EMERG", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_ALERT");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_ALERT", result.getInName());
assertEquals("TRACE_ALERT", result.name());
assertEquals(1, result.ordinal());
-
+
//------------------------
fixture.setLogLevel("TRACE_CRIT");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_CRIT", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_ERR");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_ERR", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_WARNING");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_WARNING", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_NOTICE");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_NOTICE", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_INFO");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_INFO", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_DEBUG_SYSTEM");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_DEBUG_SYSTEM", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_DEBUG_PROGRAM");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_DEBUG_PROGRAM", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_DEBUG_PROCESS");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_DEBUG_PROCESS", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_DEBUG_MODULE");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_DEBUG_MODULE", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_DEBUG_UNIT");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_DEBUG_UNIT", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_DEBUG_FUNCTION");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_DEBUG_FUNCTION", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_DEBUG_LINE");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_DEBUG_LINE", result.getInName());
//------------------------
fixture.setLogLevel("TRACE_DEBUG");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_DEBUG", result.getInName());
//-------------------------
fixture.setLogLevel("LEVEL_UNKNOWN");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("LEVEL_UNKNOWN", result.getInName());
assertEquals("LEVEL_UNKNOWN", result.name());
assertEquals(15, result.ordinal());
-
+
fixture.setLogLevel("garbage");
-
+
result = fixture.getLogLevel();
assertNotNull(result);
assertEquals("TRACE_DEBUG", result.getInName());
assertEquals("TRACE_DEBUG", result.name());
assertEquals(14, result.ordinal());
}
-
+
/**
* Run the String toString() method test.
assertTrue("equals", !fEventInfo1.equals(fEventInfo2));
assertTrue("equals", !fEventInfo2.equals(fEventInfo1));
}
-
+
public void testEqualsSymmetry() {
BaseEventInfo info1 = new BaseEventInfo((BaseEventInfo)fEventInfo1);
BaseEventInfo info2 = new BaseEventInfo((BaseEventInfo)fEventInfo2);
assertTrue("equals", info2.equals(fEventInfo2));
assertTrue("equals", fEventInfo2.equals(info2));
}
-
+
public void testEqualsTransivity() {
BaseEventInfo info1 = new BaseEventInfo((BaseEventInfo)fEventInfo1);
BaseEventInfo info2 = new BaseEventInfo((BaseEventInfo)fEventInfo1);
assertTrue("equals", info2.equals(info3));
assertTrue("equals", info1.equals(info3));
}
-
+
public void testEqualsNull() {
assertTrue("equals", !fEventInfo1.equals(null));
assertTrue("equals", !fEventInfo2.equals(null));
}
-
+
// ------------------------------------------------------------------------
// hashCode
// ------------------------------------------------------------------------
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
* The class <code>ChannelInfoTest</code> contains tests for the class <code>{@link ChannelInfo}</code>.
*
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class ChannelInfoTest extends TestCase {
// ------------------------------------------------------------------------
// Test data
// ------------------------------------------------------------------------
private IChannelInfo fChannelInfo1 = null;
private IChannelInfo fChannelInfo2 = null;
-
+
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
-
+
/**
* Perform pre-test initialization.
*
// ------------------------------------------------------------------------
// Tests
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public void testChannelInfo() {
ChannelInfo result = new ChannelInfo("test");
assertNotNull(result);
-
+
assertEquals("test", result.getName());
assertEquals(0, result.getNumberOfSubBuffers());
assertEquals("", result.getOutputType());
public void testChannelInfoCopy() {
ChannelInfo channelInfo = new ChannelInfo((ChannelInfo)fChannelInfo1);
-
+
assertEquals(fChannelInfo1.getName(), channelInfo.getName());
assertEquals(fChannelInfo1.getNumberOfSubBuffers(), channelInfo.getNumberOfSubBuffers());
assertEquals(fChannelInfo1.getOutputType(), channelInfo.getOutputType());
assertEquals(fChannelInfo1.getState(), channelInfo.getState());
assertEquals(fChannelInfo1.getSwitchTimer(), channelInfo.getSwitchTimer());
assertEquals(fChannelInfo1.getEvents().length, channelInfo.getEvents().length);
-
+
IEventInfo[] orignalEvents = fChannelInfo1.getEvents();
IEventInfo[] resultEvents = channelInfo.getEvents();
for (int i = 0; i < orignalEvents.length; i++) {
fixture.setNumberOfSubBuffers(1);
fixture.setOutputType("");
fixture.setSubBufferSize(1L);
-
+
// add an event
IEventInfo event = new EventInfo("event");
fixture.addEvent(event);
long switchTimer = fixture.getSwitchTimer();
assertEquals(2L, switchTimer);
-
+
boolean mode = fixture.isOverwriteMode();
assertTrue(mode);
-
+
long readTimer = fixture.getReadTimer();
assertEquals(3L, readTimer);
-
+
TraceEnablement state = fixture.getState();
assertEquals("disabled", state.getInName());
-
+
long numSubBuffers = fixture.getNumberOfSubBuffers();
assertEquals(4, numSubBuffers);
-
+
String outputType = fixture.getOutputType();
assertEquals("splice()", outputType);
-
+
long subBufferSize = fixture.getSubBufferSize();
assertEquals(1L, subBufferSize);
switchTimer = fixture.getSwitchTimer();
assertEquals(5L, switchTimer);
-
+
mode = fixture.isOverwriteMode();
assertFalse(mode);
-
+
readTimer = fixture.getReadTimer();
assertEquals(6L, readTimer);
-
+
state = fixture.getState();
assertEquals("enabled", state.getInName());
-
+
numSubBuffers = fixture.getNumberOfSubBuffers();
assertEquals(7, numSubBuffers);
-
+
outputType = fixture.getOutputType();
assertEquals("mmap()", outputType);
-
+
subBufferSize = fixture.getSubBufferSize();
assertEquals(8L, subBufferSize);
}
fixture.setOutputType("");
fixture.setSubBufferSize(1L);
List<IEventInfo> events = new LinkedList<IEventInfo>();
-
+
for (int i = 0; i < 2; i++) {
IEventInfo info = new EventInfo("event" + i);
info.setEventType("tracepoint");
fixture.setEvents(events);
IEventInfo[] infos = fixture.getEvents();
-
+
assertEquals(events.size(), infos.length);
-
+
for (int i = 0; i < infos.length; i++) {
assertEquals(events.get(i), infos[i]);
}
// add additional test code here
assertEquals("[ChannelInfo([TraceInfo(Name=channel1)],State=DISABLED,OverwriteMode=true,SubBuffersSize=13,NumberOfSubBuffers=12,SwitchTimer=10,ReadTimer=11,output=splice(),Events=[EventInfo([BaseEventInfo([TraceInfo(Name=event1)],type=TRACEPOINT,level=TRACE_DEBUG)],State=ENABLED)])]", result);
}
-
+
// ------------------------------------------------------------------------
// equals
// ------------------------------------------------------------------------
assertTrue("equals", !fChannelInfo1.equals(fChannelInfo2));
assertTrue("equals", !fChannelInfo2.equals(fChannelInfo1));
}
-
+
public void testEqualsSymmetry() {
ChannelInfo event1 = new ChannelInfo((ChannelInfo)fChannelInfo1);
ChannelInfo event2 = new ChannelInfo((ChannelInfo)fChannelInfo2);
assertTrue("equals", event2.equals(fChannelInfo2));
assertTrue("equals", fChannelInfo2.equals(event2));
}
-
+
public void testEqualsTransivity() {
ChannelInfo channel1 = new ChannelInfo((ChannelInfo)fChannelInfo1);
ChannelInfo channel2 = new ChannelInfo((ChannelInfo)fChannelInfo1);
assertTrue("equals", channel2.equals(channel3));
assertTrue("equals", channel1.equals(channel3));
}
-
+
public void testEqualsNull() throws Exception {
assertTrue("equals", !fChannelInfo1.equals(null));
assertTrue("equals", !fChannelInfo2.equals(null));
}
-
+
// ------------------------------------------------------------------------
// hashCode
// ------------------------------------------------------------------------
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
* The class <code>ChannelInfoTest</code> contains tests for the class <code>{@link DomainInfo}</code>.
*
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class DomainInfoTest extends TestCase {
// ------------------------------------------------------------------------
// Test data
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
-
+
/**
* Perform pre-test initialization.
*
// ------------------------------------------------------------------------
// Tests
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public void testDomainInfo() {
DomainInfo result = new DomainInfo("test");
assertNotNull(result);
-
+
assertEquals("test", result.getName());
assertEquals(0, result.getChannels().length);
}
*
*/
public void testGetAndSetters() {
-
+
// Note that addChannel() has been executed in setUp()
// check get method here
assertEquals(1, fDomainInfo1.getChannels().length);
assertNotNull(fDomainInfo1.getChannels()[0]);
assertEquals(fChannelInfo1, fDomainInfo1.getChannels()[0]);
-
+
IDomainInfo domain = new DomainInfo("domain");
List<IChannelInfo> list = new LinkedList<IChannelInfo>();
list.add(fChannelInfo1);
list.add(fChannelInfo2);
domain.setChannels(list);
-
+
IChannelInfo[] result = domain.getChannels();
assertEquals(2, result.length);
assertEquals(fChannelInfo1, result[0]);
assertEquals("[DomainInfo([TraceInfo(Name=test1)],Channels=[ChannelInfo([TraceInfo(Name=channel1)],State=DISABLED,OverwriteMode=true,SubBuffersSize=13,NumberOfSubBuffers=12,SwitchTimer=10,ReadTimer=11,output=splice(),Events=[EventInfo([BaseEventInfo([TraceInfo(Name=event1)],type=TRACEPOINT,level=TRACE_DEBUG)],State=ENABLED)])],isKernel=false)]", result);
}
-
+
// ------------------------------------------------------------------------
// equals
// ------------------------------------------------------------------------
assertTrue("equals", !fDomainInfo1.equals(fDomainInfo2));
assertTrue("equals", !fDomainInfo2.equals(fDomainInfo1));
}
-
+
public void testEqualsSymmetry() {
DomainInfo event1 = new DomainInfo((DomainInfo)fDomainInfo1);
DomainInfo event2 = new DomainInfo((DomainInfo)fDomainInfo2);
assertTrue("equals", event2.equals(fDomainInfo2));
assertTrue("equals", fDomainInfo2.equals(event2));
}
-
+
public void testEqualsTransivity() {
DomainInfo channel1 = new DomainInfo((DomainInfo)fDomainInfo1);
DomainInfo channel2 = new DomainInfo((DomainInfo)fDomainInfo1);
assertTrue("equals", channel2.equals(channel3));
assertTrue("equals", channel1.equals(channel3));
}
-
+
public void testEqualsNull() throws Exception {
assertTrue("equals", !fDomainInfo1.equals(null));
assertTrue("equals", !fDomainInfo2.equals(null));
}
-
+
// ------------------------------------------------------------------------
// hashCode
// ------------------------------------------------------------------------
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
/**
* The class <code>BaseEventInfoTest</code> contains test for the class <code>{@link BaseEventInfo}</code>.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class EventInfoTest extends TestCase {
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
private IEventInfo fEventInfo1 = null;
private IEventInfo fEventInfo2 = null;
-
+
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
public void testBaseEventInfo() {
EventInfo fixture = new EventInfo("event");
assertNotNull(fixture);
-
+
TraceEventType result = fixture.getEventType();
-
+
assertEquals("event", fixture.getName());
assertEquals("unknown", result.getInName());
assertEquals("UNKNOWN", result.name());
assertEquals("UNKNOWN", result.toString());
assertEquals(3, result.ordinal());
-
+
TraceEnablement state = fixture.getState();
assertEquals("disabled", state.getInName());
assertEquals("DISABLED", state.name());
*/
public void testEventInfoCopy() {
EventInfo info = new EventInfo((EventInfo)fEventInfo1);
-
+
assertEquals(fEventInfo1.getName(), info.getName());
assertEquals(fEventInfo1.getEventType(), info.getEventType());
assertEquals(fEventInfo1.getState(), info.getState());
// Success
}
}
-
+
/**
- * Getter/Setter tests
+ * Getter/Setter tests
*/
public void testGetAndSetter() {
EventInfo fixture = new EventInfo("event");
-
+
fixture.setEventType(TraceEventType.TRACEPOINT);
TraceEventType result = fixture.getEventType();
assertEquals("UNKNOWN", result.name());
assertEquals("UNKNOWN", result.toString());
assertEquals(3, result.ordinal());
-
+
// setEventType(String typeName)
String typeName = "";
fixture.setEventType(typeName);
result = fixture.getEventType();
-
+
assertEquals("unknown", result.getInName());
assertEquals("UNKNOWN", result.name());
assertEquals("UNKNOWN", result.toString());
fixture.setEventType(typeName);
result = fixture.getEventType();
-
+
assertEquals("unknown", result.getInName());
assertEquals("UNKNOWN", result.name());
assertEquals("UNKNOWN", result.toString());
assertEquals("DISABLED", state.name());
assertEquals("DISABLED", state.toString());
assertEquals(0, state.ordinal());
-
+
fixture.setState("enabled");
state = fixture.getState();
assertEquals("enabled", state.getInName());
assertEquals("ENABLED", state.name());
assertEquals("ENABLED", state.toString());
assertEquals(1, state.ordinal());
-
+
// setState(TraceEnablement state)
fixture.setState(TraceEnablement.DISABLED);
state = fixture.getState();
assertEquals("DISABLED", state.name());
assertEquals("DISABLED", state.toString());
assertEquals(0, state.ordinal());
-
+
fixture.setState(TraceEnablement.ENABLED);
state = fixture.getState();
assertEquals("enabled", state.getInName());
assertTrue("equals", !fEventInfo1.equals(fEventInfo2));
assertTrue("equals", !fEventInfo2.equals(fEventInfo1));
}
-
+
public void testEqualsSymmetry() {
EventInfo info1 = new EventInfo((EventInfo)fEventInfo1);
EventInfo info2 = new EventInfo((EventInfo)fEventInfo2);
assertTrue("equals", info2.equals(fEventInfo2));
assertTrue("equals", fEventInfo2.equals(info2));
}
-
+
public void testEqualsTransivity() {
EventInfo info1 = new EventInfo((EventInfo)fEventInfo1);
EventInfo info2 = new EventInfo((EventInfo)fEventInfo1);
assertTrue("equals", info2.equals(info3));
assertTrue("equals", info1.equals(info3));
}
-
+
public void testEqualsNull() {
assertTrue("equals", !fEventInfo1.equals(null));
assertTrue("equals", !fEventInfo2.equals(null));
}
-
+
// ------------------------------------------------------------------------
// hashCode
// ------------------------------------------------------------------------
/*******************************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.UstProviderInfo;
/**
- * Test facility to constants across test case
+ * Test facility to constants across test case
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class ModelImplFactory {
-
+
private ISessionInfo fSessionInfo1 = null;
private ISessionInfo fSessionInfo2 = null;
private IDomainInfo fDomainInfo1 = null;
private IUstProviderInfo fUstProviderInfo2 = null;
private IProbeEventInfo fProbeEventInfo1 = null;
private IProbeEventInfo fProbeEventInfo2 = null;
-
+
public ModelImplFactory() {
fBaseEventInfo1 = new BaseEventInfo("event1");
fBaseEventInfo1.setEventType(TraceEventType.UNKNOWN);
fBaseEventInfo2 = new BaseEventInfo("event2");
fBaseEventInfo2.setEventType(TraceEventType.TRACEPOINT);
fBaseEventInfo1.setLogLevel(TraceLogLevel.TRACE_DEBUG);
-
+
fEventInfo1 = new EventInfo("event1");
fEventInfo1.setEventType(TraceEventType.TRACEPOINT);
fEventInfo1.setState(TraceEnablement.ENABLED);
fEventInfo2 = new EventInfo("event2");
fEventInfo2.setEventType(TraceEventType.UNKNOWN);
fEventInfo2.setState(TraceEnablement.DISABLED);
-
+
fEventInfo3 = new EventInfo("event3");
fEventInfo3.setEventType(TraceEventType.TRACEPOINT);
fEventInfo3.setState(TraceEnablement.DISABLED);
fChannelInfo2.setSubBufferSize(4L);
fChannelInfo2.addEvent(fEventInfo2);
fChannelInfo2.addEvent(fEventInfo3);
-
+
fDomainInfo1 = new DomainInfo("test1");
fDomainInfo1.addChannel(fChannelInfo1);
fDomainInfo2 = new DomainInfo("test2");
fDomainInfo2.addChannel(fChannelInfo1);
fDomainInfo2.addChannel(fChannelInfo2);
-
+
fSessionInfo1 = new SessionInfo("session1");
fSessionInfo1.setSessionPath("/home/user");
fSessionInfo1.setSessionState(TraceSessionState.ACTIVE);
fProbeEventInfo2.setOffset("0x100");
fProbeEventInfo2.setSymbol("init_post");
}
-
+
public ISessionInfo getSessionInfo1() {
return fSessionInfo1;
}
public IEventInfo getEventInfo3() {
return fEventInfo3;
}
-
+
public IBaseEventInfo getBaseEventInfo1() {
return fBaseEventInfo1;
}
public IBaseEventInfo getBaseEventInfo2() {
return fBaseEventInfo2;
}
-
+
public IUstProviderInfo getUstProviderInfo1() {
return fUstProviderInfo1;
}
public IUstProviderInfo getUstProviderInfo2() {
return fUstProviderInfo2;
}
-
+
public IProbeEventInfo getProbeEventInfo1() {
return fProbeEventInfo1;
}
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
/**
* The class <code>BaseEventInfoTest</code> contains test for the class <code>{@link BaseEventInfo}</code>.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class ProbeEventInfoTest extends TestCase {
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
private IProbeEventInfo fEventInfo1 = null;
private IProbeEventInfo fEventInfo2 = null;
-
+
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
public void testBaseEventInfo() {
ProbeEventInfo fixture = new ProbeEventInfo("event");
assertNotNull(fixture);
-
+
TraceEventType result = fixture.getEventType();
-
+
assertEquals("event", fixture.getName());
assertEquals("unknown", result.getInName());
assertEquals("UNKNOWN", result.name());
assertEquals("UNKNOWN", result.toString());
assertEquals(3, result.ordinal());
-
+
TraceEnablement state = fixture.getState();
assertEquals("disabled", state.getInName());
assertEquals("DISABLED", state.name());
assertEquals("DISABLED", state.toString());
assertEquals(0, state.ordinal());
-
+
assertNull(fixture.getAddress());
assertNull(fixture.getOffset());
assertNull(fixture.getSymbol());
*/
public void testEventInfoCopy() {
ProbeEventInfo info = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
-
+
assertEquals(fEventInfo1.getName(), info.getName());
assertEquals(fEventInfo1.getEventType(), info.getEventType());
assertEquals(fEventInfo1.getState(), info.getState());
// Success
}
}
-
+
/**
- * Getter/Setter tests
+ * Getter/Setter tests
*/
public void testGetAndSetter() {
ProbeEventInfo fixture = new ProbeEventInfo("event");
-
+
fixture.setAddress("0xc12344321");
String result = fixture.getAddress();
assertTrue("equals", !fEventInfo1.equals(fEventInfo2));
assertTrue("equals", !fEventInfo2.equals(fEventInfo1));
}
-
+
public void testEqualsSymmetry() {
ProbeEventInfo info1 = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
ProbeEventInfo info2 = new ProbeEventInfo((ProbeEventInfo)fEventInfo2);
assertTrue("equals", info2.equals(fEventInfo2));
assertTrue("equals", fEventInfo2.equals(info2));
}
-
+
public void testEqualsTransivity() {
ProbeEventInfo info1 = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
ProbeEventInfo info2 = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
assertTrue("equals", info2.equals(info3));
assertTrue("equals", info1.equals(info3));
}
-
+
public void testEqualsNull() {
assertTrue("equals", !fEventInfo1.equals(null));
assertTrue("equals", !fEventInfo2.equals(null));
}
-
+
// ------------------------------------------------------------------------
// hashCode
// ------------------------------------------------------------------------
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
* The class <code>ChannelInfoTest</code> contains tests for the class <code>{@link SessionInfo}</code>.
*
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class SessionInfoTest extends TestCase {
// ------------------------------------------------------------------------
// Test data
// ------------------------------------------------------------------------
private ISessionInfo fSessionInfo1 = null;
private ISessionInfo fSessionInfo2 = null;
-
+
private IDomainInfo fDomainInfo1 = null;
private IDomainInfo fDomainInfo2 = null;
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
-
+
/**
* Perform pre-test initialization.
*
// ------------------------------------------------------------------------
// Tests
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public void testSessionInfo() {
ISessionInfo result = new SessionInfo("test");
assertNotNull(result);
-
+
assertEquals("test", result.getName());
assertEquals("", result.getSessionPath());
TraceSessionState state = result.getSessionState();
public void testSessionInfoCopy() {
SessionInfo sessionInfo = new SessionInfo((SessionInfo)fSessionInfo1);
-
+
assertEquals(sessionInfo.getName(), fSessionInfo1.getName());
assertEquals(sessionInfo.getSessionPath(), fSessionInfo1.getSessionPath());
assertEquals(sessionInfo.getSessionState(), fSessionInfo1.getSessionState());
*
*/
public void testGetAndSetters() {
-
+
// Note that addDomain() has been executed in setUp()
// check get method here
assertEquals(1, fSessionInfo1.getDomains().length);
assertNotNull(fSessionInfo1.getDomains()[0]);
assertEquals(fDomainInfo1, fSessionInfo1.getDomains()[0]);
-
+
ISessionInfo session = new SessionInfo("session");
List<IDomainInfo> list = new LinkedList<IDomainInfo>();
list.add(fDomainInfo1);
list.add(fDomainInfo2);
session.setDomains(list);
-
+
IDomainInfo[] result = session.getDomains();
assertEquals(2, result.length);
assertEquals(fDomainInfo1, result[0]);
assertEquals(fDomainInfo2, result[1]);
-
+
session.setSessionPath("/home/user");
assertEquals("/home/user", session.getSessionPath());
-
+
session.setSessionState("active");
TraceSessionState state = session.getSessionState();
state = session.getSessionState();
assertEquals("ACTIVE", state.name());
assertEquals("ACTIVE", state.toString());
assertEquals(1, state.ordinal());
-
+
session.setSessionState("inactive");
state = session.getSessionState();
assertEquals("inactive", state.getInName());
assertEquals("INACTIVE", state.name());
assertEquals("INACTIVE", state.toString());
assertEquals(0, state.ordinal());
-
+
session.setSessionState(TraceSessionState.ACTIVE);
state = session.getSessionState();
assertEquals("active", state.getInName());
// add additional test code here
assertEquals("[SessionInfo([TraceInfo(Name=session1)],State=ACTIVE,Domains=[DomainInfo([TraceInfo(Name=test1)],Channels=[ChannelInfo([TraceInfo(Name=channel1)],State=DISABLED,OverwriteMode=true,SubBuffersSize=13,NumberOfSubBuffers=12,SwitchTimer=10,ReadTimer=11,output=splice(),Events=[EventInfo([BaseEventInfo([TraceInfo(Name=event1)],type=TRACEPOINT,level=TRACE_DEBUG)],State=ENABLED)])],isKernel=false)])]", result);
}
-
+
// ------------------------------------------------------------------------
// equals
// ------------------------------------------------------------------------
assertTrue("equals", !fSessionInfo1.equals(fSessionInfo2));
assertTrue("equals", !fSessionInfo2.equals(fSessionInfo1));
}
-
+
public void testEqualsSymmetry() {
SessionInfo event1 = new SessionInfo((SessionInfo)fSessionInfo1);
SessionInfo event2 = new SessionInfo((SessionInfo)fSessionInfo2);
assertTrue("equals", event2.equals(fSessionInfo2));
assertTrue("equals", fSessionInfo2.equals(event2));
}
-
+
public void testEqualsTransivity() {
SessionInfo channel1 = new SessionInfo((SessionInfo)fSessionInfo1);
SessionInfo channel2 = new SessionInfo((SessionInfo)fSessionInfo1);
assertTrue("equals", channel2.equals(channel3));
assertTrue("equals", channel1.equals(channel3));
}
-
+
public void testEqualsNull() throws Exception {
assertTrue("equals", !fSessionInfo1.equals(null));
assertTrue("equals", !fSessionInfo2.equals(null));
}
-
+
// ------------------------------------------------------------------------
// hashCode
// ------------------------------------------------------------------------
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
/**
* The class <code>TraceInfoTest</code> contains test for the class <code>{@link TraceInfo}</code>.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class TraceInfoTest extends TestCase {
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
private ITraceInfo fTraceInfo1 = null;
private ITraceInfo fTraceInfo2 = null;
-
-
+
+
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
public void testTraceInfo() {
TraceInfo fixture = new TraceInfo("event");
assertNotNull(fixture);
-
+
assertEquals("event", fixture.getName());
}
// Success
}
}
-
+
/**
* Test Copy Constructor
*/
public void testTraceInfoCopy() {
TraceInfo info = new TraceInfo((TraceInfo)fTraceInfo1);
-
+
assertEquals(fTraceInfo1.getName(), info.getName());
}
// Success
}
}
-
+
/**
* Run the void setEventType(String) method test.
*
// add additional test code here
assertEquals("[TraceInfo(Name=event1)]", result);
}
-
+
// ------------------------------------------------------------------------
// equals
// ------------------------------------------------------------------------
assertTrue("equals", !fTraceInfo1.equals(fTraceInfo2));
assertTrue("equals", !fTraceInfo2.equals(fTraceInfo1));
}
-
+
public void testEqualsSymmetry() {
TraceInfo info1 = new TraceInfo((TraceInfo)fTraceInfo1);
TraceInfo info2 = new TraceInfo((TraceInfo)fTraceInfo2);
assertTrue("equals", info2.equals(fTraceInfo2));
assertTrue("equals", fTraceInfo2.equals(info2));
}
-
+
public void testEqualsTransivity() {
TraceInfo info1 = new TraceInfo((TraceInfo)fTraceInfo1);
TraceInfo info2 = new TraceInfo((TraceInfo)fTraceInfo1);
assertTrue("equals", info2.equals(info3));
assertTrue("equals", info1.equals(info3));
}
-
+
public void testEqualsNull() {
assertTrue("equals", !fTraceInfo1.equals(null));
assertTrue("equals", !fTraceInfo2.equals(null));
}
-
+
// ------------------------------------------------------------------------
// hashCode
// ------------------------------------------------------------------------
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
* The class <code>ChannelInfoTest</code> contains tests for the class <code>{@link UstProviderInfo}</code>.
*
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class UstProviderInfoTest extends TestCase {
// ------------------------------------------------------------------------
// Test data
// ------------------------------------------------------------------------
private IUstProviderInfo fUstProviderInfo1 = null;
private IUstProviderInfo fUstProviderInfo2 = null;
-
+
private IBaseEventInfo fEventInfo1 = null;
private IBaseEventInfo fEventInfo2 = null;
-
+
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
-
+
/**
* Perform pre-test initialization.
*
// ------------------------------------------------------------------------
// Tests
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public void testUstProviderInfo() {
IUstProviderInfo result = new UstProviderInfo("test");
assertNotNull(result);
-
+
assertEquals("test", result.getName());
assertEquals(0, result.getPid());
assertEquals(0, result.getEvents().length);
public void testUstProviderInfoCopy() {
IUstProviderInfo providerInf = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
-
+
assertEquals(fUstProviderInfo1.getName(), providerInf.getName());
assertEquals(fUstProviderInfo1.getPid(), providerInf.getPid());
assertEquals(fUstProviderInfo1.getEvents().length, providerInf.getEvents().length);
-
+
IBaseEventInfo[] orignalEvents = fUstProviderInfo1.getEvents();
IBaseEventInfo[] resultEvents = providerInf.getEvents();
for (int i = 0; i < orignalEvents.length; i++) {
public void testGetAndSetters() {
IUstProviderInfo fixture = new UstProviderInfo("test");
fixture.setPid(2468);
-
+
// add an event
IBaseEventInfo event = new BaseEventInfo("event");
fixture.addEvent(event);
assertEquals(1, result.length);
assertNotNull(result[0]);
assertTrue(event.equals(result[0]));
-
+
assertEquals(2468, fixture.getPid());
}
events.add(fEventInfo1);
events.add(fEventInfo2);
fixture.setEvents(events);
-
+
IBaseEventInfo[] infos = fixture.getEvents();
-
+
assertEquals(events.size(), infos.length);
-
+
for (int i = 0; i < infos.length; i++) {
assertEquals(events.get(i), infos[i]);
}
String result = fUstProviderInfo2.toString();
assertEquals("[EventInfo([TraceInfo(Name=myUST2)],PID=2345,Events=[BaseEventInfo([TraceInfo(Name=event1)],type=UNKNOWN,level=TRACE_DEBUG)][BaseEventInfo([TraceInfo(Name=event2)],type=TRACEPOINT,level=TRACE_DEBUG)])]", result);
}
-
+
// ------------------------------------------------------------------------
// equals
// ------------------------------------------------------------------------
assertTrue("equals", !fUstProviderInfo1.equals(fUstProviderInfo2));
assertTrue("equals", !fUstProviderInfo2.equals(fUstProviderInfo1));
}
-
+
public void testEqualsSymmetry() {
UstProviderInfo event1 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
UstProviderInfo event2 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo2);
assertTrue("equals", event2.equals(fUstProviderInfo2));
assertTrue("equals", fUstProviderInfo2.equals(event2));
}
-
+
public void testEqualsTransivity() {
UstProviderInfo UstProvider1 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
UstProviderInfo UstProvider2 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
assertTrue("equals", UstProvider2.equals(UstProvider3));
assertTrue("equals", UstProvider1.equals(UstProvider3));
}
-
+
public void testEqualsNull() throws Exception {
assertTrue("equals", !fUstProviderInfo1.equals(null));
assertTrue("equals", !fUstProviderInfo2.equals(null));
}
-
+
// ------------------------------------------------------------------------
// hashCode
// ------------------------------------------------------------------------
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model;
* <p>
* Interface for retrieval of trace session information.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public interface ISessionInfo extends ITraceInfo {
* @param state - state to set.
*/
public void setSessionState(TraceSessionState state);
-
+
/**
* Sets the event state to the value specified by the given name.
* @param stateName - state to set.
*/
public void setSessionState(String stateName);
-
+
/**
* @return path string where session is located.
*/
public String getSessionPath();
-
+
/**
* Sets the path string (where session is located) to the given value.
* @param path - session path to set.
*/
public void setSessionPath(String path);
-
+
/**
* @return all domain information as array.
*/
public IDomainInfo[] getDomains();
-
+
/**
* Sets all domain information specified by given list.
* @param domains - all domain information to set.
*/
public void setDomains(List<IDomainInfo> domains);
-
+
/**
* Adds a single domain information.
- * @param domain - domain information to add.
+ * @param domainInfo domain information to add.
*/
public void addDomain(IDomainInfo domainInfo);
}
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model;
* <p>
* Interface for retrieve trace comon information.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public interface ITraceInfo {
* @return the name of the information element.
*/
public String getName();
-
+
/**
* Sets the name of the information element.
+ *
* @param name
+ * The name to assign
*/
public void setName(String name);
-
+
}
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
*********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model;
* <p>
* Type of log Level enumeration.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public enum LogLevelType {
-
+
// ------------------------------------------------------------------------
// Enum definition
// ------------------------------------------------------------------------
- LOGLEVEL, // range of log levels [0,logLevel]
- LOGLEVEL_ONLY, // single log level
- LOGLEVEL_NONE; // no log level
-};
+ /** range of log levels [0,logLevel] */
+ LOGLEVEL,
+ /** single log level */
+ LOGLEVEL_ONLY,
+ /** no log level */
+ LOGLEVEL_NONE;
+}
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model;
/**
* <p>
- * Enumeration for the node connection state.
+ * Enumeration for the node connection state.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public enum TargetNodeState {
- DISCONNECTED,
- DISCONNECTING,
- CONNECTED,
- CONNECTING;
+ /** State when disconnected */
+ DISCONNECTED,
+ /** State while disconnecting */
+ DISCONNECTING,
+ /** State when connected */
+ CONNECTED,
+ /** State while connecting */
+ CONNECTING;
}
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model;
* <p>
* Enumeration for enabled/disabled states.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public enum TraceEnablement {
// ------------------------------------------------------------------------
// Enum definition
// ------------------------------------------------------------------------
+ /** Tracing is disabled */
DISABLED("disabled"), //$NON-NLS-1$
+ /** Tracing is enabled */
ENABLED("enabled"); //$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
/**
- * Name of enum
+ * Name of enum
*/
private final String fInName;
// ------------------------------------------------------------------------
// Constuctors
// ------------------------------------------------------------------------
-
+
/**
* Private constructor
* @param name the name of state
public String getInName() {
return fInName;
}
-};
-
+}
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model;
* <p>
* Trace event type enumeration.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
-public enum TraceEventType {
+public enum TraceEventType {
+ /** Event type: tracepoint */
TRACEPOINT("tracepoint"), //$NON-NLS-1$
+ /** Event type: syscall */
SYSCALL("syscall"), //$NON-NLS-1$
+ /** Event type: probe */
PROBE("probe"), //$NON-NLS-1$
+ /** Event type unknown */
UNKNOWN("unknown"); //$NON-NLS-1$
private final String fInName;
fInName = name;
}
+ /**
+ * Get the type's name
+ *
+ * @return The type's name
+ */
public String getInName() {
return fInName;
}
-};
+}
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
*********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model;
* <p>
* Log Level enumeration.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
@SuppressWarnings("nls")
public enum TraceLogLevel {
-
+
// ------------------------------------------------------------------------
// Enum definition
// ------------------------------------------------------------------------
- TRACE_EMERG("TRACE_EMERG"), // 0
- TRACE_ALERT("TRACE_ALERT"), // 1
- TRACE_CRIT("TRACE_CRIT"), // 2
- TRACE_ERR("TRACE_ERR"), // 3
- TRACE_WARNING("TRACE_WARNING"), // 4
- TRACE_NOTICE("TRACE_NOTICE"), // 5
- TRACE_INFO("TRACE_INFO"), // 6
- TRACE_DEBUG_SYSTEM("TRACE_DEBUG_SYSTEM"), // 7
- TRACE_DEBUG_PROGRAM("TRACE_DEBUG_PROGRAM"), // 8
- TRACE_DEBUG_PROCESS("TRACE_DEBUG_PROCESS"), // 9
- TRACE_DEBUG_MODULE("TRACE_DEBUG_MODULE"), // 10
- TRACE_DEBUG_UNIT("TRACE_DEBUG_UNIT"), // 11
- TRACE_DEBUG_FUNCTION("TRACE_DEBUG_FUNCTION"), //12
- TRACE_DEBUG_LINE("TRACE_DEBUG_LINE"), //13
- TRACE_DEBUG("TRACE_DEBUG"), // 14
- LEVEL_UNKNOWN("LEVEL_UNKNOWN"); // 15
+ /** Log level 0 */
+ TRACE_EMERG("TRACE_EMERG"),
+ /** Log level 1 */
+ TRACE_ALERT("TRACE_ALERT"),
+ /** Log level 2 */
+ TRACE_CRIT("TRACE_CRIT"),
+ /** Log level 3 */
+ TRACE_ERR("TRACE_ERR"),
+ /** Log level 4 */
+ TRACE_WARNING("TRACE_WARNING"),
+ /** Log level 5 */
+ TRACE_NOTICE("TRACE_NOTICE"),
+ /** Log level 6 */
+ TRACE_INFO("TRACE_INFO"),
+ /** Log level 7 */
+ TRACE_DEBUG_SYSTEM("TRACE_DEBUG_SYSTEM"),
+ /** Log level 8 */
+ TRACE_DEBUG_PROGRAM("TRACE_DEBUG_PROGRAM"),
+ /** Log level 9 */
+ TRACE_DEBUG_PROCESS("TRACE_DEBUG_PROCESS"),
+ /** Log level 10 */
+ TRACE_DEBUG_MODULE("TRACE_DEBUG_MODULE"),
+ /** Log level 11 */
+ TRACE_DEBUG_UNIT("TRACE_DEBUG_UNIT"),
+ /** Log level 12 */
+ TRACE_DEBUG_FUNCTION("TRACE_DEBUG_FUNCTION"),
+ /** Log level 13 */
+ TRACE_DEBUG_LINE("TRACE_DEBUG_LINE"),
+ /** Log level 14 */
+ TRACE_DEBUG("TRACE_DEBUG"),
+ /** Log level 15 */
+ LEVEL_UNKNOWN("LEVEL_UNKNOWN");
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
/**
- * Name of enum.
+ * Name of enum.
*/
private final String fInName;
// ------------------------------------------------------------------------
// Constuctors
// ------------------------------------------------------------------------
-
+
/**
* Private constructor
* @param name the name of state
public String getInName() {
return fInName;
}
-};
-
-
+}
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
*********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model;
* <p>
* Session state enumeration.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public enum TraceSessionState {
-
+
// ------------------------------------------------------------------------
// Enum definition
// ------------------------------------------------------------------------
+ /** Trace session inactive */
INACTIVE("inactive"), //$NON-NLS-1$
+ /** Trace session active */
ACTIVE("active"); //$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
/**
- * Name of enum.
+ * Name of enum.
*/
private final String fInName;
// ------------------------------------------------------------------------
// Constuctors
// ------------------------------------------------------------------------
-
+
/**
* Private constructor
* @param name the name of state
public String getInName() {
return fInName;
}
-};
-
+}
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
/**
* <p>
* Implementation of the trace channel interface (IChannelInfo) to store channel
- * related data.
+ * related data.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class ChannelInfo extends TraceInfo implements IChannelInfo {
/**
* The events information of the channel.
*/
- private List<IEventInfo> fEvents = new ArrayList<IEventInfo>();
+ private final List<IEventInfo> fEvents = new ArrayList<IEventInfo>();
+
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public void setState(TraceEnablement state) {
fState = state;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo#setState(java.lang.String)
fState = TraceEnablement.ENABLED;
}
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo#getEvents()
@Override
public void setEvents(List<IEventInfo> events) {
for (Iterator<IEventInfo> iterator = events.iterator(); iterator.hasNext();) {
- IEventInfo eventInfo = (IEventInfo) iterator.next();
+ IEventInfo eventInfo = iterator.next();
fEvents.add(eventInfo);
}
}
public void addEvent(IEventInfo channel) {
fEvents.add(channel);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#hashCode()
result = prime * result + (int) (fSubBufferSize ^ (fSubBufferSize >>> 32));
result = prime * result + (int) (fSwitchTimer ^ (fSwitchTimer >>> 32));
return result;
- }
+ }
/*
* (non-Javadoc)
}
return true;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#toString()
output.append("None");
} else {
for (Iterator<IEventInfo> iterator = fEvents.iterator(); iterator.hasNext();) {
- IEventInfo event = (IEventInfo) iterator.next();
+ IEventInfo event = iterator.next();
output.append(event.toString());
}
}
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
/**
* <p>
* Implementation of the trace domain interface (IDomainInfo) to store domain
- * related data.
+ * related data.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class DomainInfo extends TraceInfo implements IDomainInfo {
/**
* The channels information of the domain.
*/
- private List<IChannelInfo> fChannels = new ArrayList<IChannelInfo>();
+ private final List<IChannelInfo> fChannels = new ArrayList<IChannelInfo>();
private boolean fIsKernel = false;
// ------------------------------------------------------------------------
}
fIsKernel = other.fIsKernel;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IDomainInfo#isKernel()
public boolean isKernel() {
return fIsKernel;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IDomainInfo#setIsKernel(boolean)
@Override
public void setChannels(List<IChannelInfo> channels) {
for (Iterator<IChannelInfo> iterator = channels.iterator(); iterator.hasNext();) {
- IChannelInfo channelInfo = (IChannelInfo) iterator.next();
+ IChannelInfo channelInfo = iterator.next();
fChannels.add(channelInfo);
}
}
public void addChannel(IChannelInfo channel) {
fChannels.add(channel);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#hashCode()
output.append("None");
} else {
for (Iterator<IChannelInfo> iterator = fChannels.iterator(); iterator.hasNext();) {
- IChannelInfo channel = (IChannelInfo) iterator.next();
+ IChannelInfo channel = iterator.next();
output.append(channel.toString());
}
}
output.append(")]");
return output.toString();
}
-
+
}
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
/**
* <p>
* Implementation of the trace session interface (ISessionInfo) to store session
- * related data.
+ * related data.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class SessionInfo extends TraceInfo implements ISessionInfo {
* The trace session state.
*/
private TraceSessionState fState = TraceSessionState.INACTIVE;
- /**
+ /**
* The trace session path for storing traces.
*/
private String fSessionPath = ""; //$NON-NLS-1$
/**
* The domains information of this session.
*/
- private List<IDomainInfo> fDomains = new ArrayList<IDomainInfo>();
+ private final List<IDomainInfo> fDomains = new ArrayList<IDomainInfo>();
// ------------------------------------------------------------------------
// Constructors
super(other);
fState = other.fState;
fSessionPath = other.fSessionPath;
-
+
for (Iterator<IDomainInfo> iterator = other.fDomains.iterator(); iterator.hasNext();) {
IDomainInfo domain = iterator.next();
if (domain instanceof DomainInfo) {
}
}
}
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
fState = TraceSessionState.ACTIVE;
}
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ISessionInfo#getSessionPath()
@Override
public void setDomains(List<IDomainInfo> domains) {
for (Iterator<IDomainInfo> iterator = domains.iterator(); iterator.hasNext();) {
- IDomainInfo domainInfo = (IDomainInfo) iterator.next();
+ IDomainInfo domainInfo = iterator.next();
fDomains.add(domainInfo);
}
}
public void addDomain(IDomainInfo domainInfo) {
fDomains.add(domainInfo);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#hashCode()
output.append(fState);
output.append(",Domains=");
for (Iterator<IDomainInfo> iterator = fDomains.iterator(); iterator.hasNext();) {
- IDomainInfo domain = (IDomainInfo) iterator.next();
+ IDomainInfo domain = iterator.next();
output.append(domain.toString());
}
output.append(")]");
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
* Implementation of the base trace information interface (ITraceInfo) to
* store common data.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class TraceInfo implements ITraceInfo {
public TraceInfo(TraceInfo other) {
if (other == null) {
throw new IllegalArgumentException();
- } else {
- fName = String.valueOf(other.fName);
}
+ fName = String.valueOf(other.fName);
}
// ------------------------------------------------------------------------
public void setName(String name) {
fName = name;
}
-
+
/*
* (non-Javadoc)
* @see java.lang.Object#hashCode()
return false;
}
return true;
- }
+ }
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
/**
* <p>
- * Implementation of the Ust Provider interface (IUstProviderInfo) to store UST
- * provider related data.
+ * Implementation of the Ust Provider interface (IUstProviderInfo) to store UST
+ * provider related data.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class UstProviderInfo extends TraceInfo implements IUstProviderInfo {
/**
* List of event information.
*/
- private List<IBaseEventInfo> fEvents = new ArrayList<IBaseEventInfo>();
-
+ private final List<IBaseEventInfo> fEvents = new ArrayList<IBaseEventInfo>();
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
public UstProviderInfo(String name) {
super(name);
}
-
+
/**
* Copy constructor
* @param other - the instance to copy
}
}
}
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
@Override
public void setEvents(List<IBaseEventInfo> events) {
for (Iterator<IBaseEventInfo> iterator = events.iterator(); iterator.hasNext();) {
- IBaseEventInfo eventInfo = (IBaseEventInfo) iterator.next();
+ IBaseEventInfo eventInfo = iterator.next();
fEvents.add(eventInfo);
}
}
}
return true;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#toString()
output.append("None");
} else {
for (Iterator<IBaseEventInfo> iterator = fEvents.iterator(); iterator.hasNext();) {
- IBaseEventInfo event = (IBaseEventInfo) iterator.next();
+ IBaseEventInfo event = iterator.next();
output.append(event.toString());
}
}
return output.toString();
}
-
+
}