/*******************************************************************************
- * Copyright (c) 2014 Ericsson
+ * Copyright (c) 2014, 2015 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
*
* Contributors:
* Alexandre Montplaisir - Initial API and implementation
+ * Patrick Tasse - Enable StateSystemUtils tests
*******************************************************************************/
package org.eclipse.tracecompass.statesystem.core.tests;
@RunWith(Suite.class)
@Suite.SuiteClasses({
StateSystemPushPopTest.class,
+ StateSystemUtilsTest.class,
org.eclipse.tracecompass.statesystem.core.tests.backend.AllTests.class,
org.eclipse.tracecompass.statesystem.core.tests.statevalue.AllTests.class
})
/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2015 École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
private static final long START_TIME = 1000L;
private static final @NonNull String DUMMY_STRING = "test";
- private static final int INT_VAL = 10;
private ITmfStateSystemBuilder fStateSystem;
fStateSystem = StateSystemFactory.newStateSystem(DUMMY_STRING, backend);
int quark = fStateSystem.getQuarkAbsoluteAndAdd(DUMMY_STRING);
- fStateSystem.modifyAttribute(1200L, TmfStateValue.newValueInt(INT_VAL), quark);
+ fStateSystem.modifyAttribute(1200L, TmfStateValue.newValueInt(10), quark);
fStateSystem.modifyAttribute(1500L, TmfStateValue.newValueInt(20), quark);
fStateSystem.closeHistory(2000L);
} catch (StateValueTypeException | AttributeNotFoundException e) {
ITmfStateInterval interval = StateSystemUtils.queryUntilNonNullValue(ss, quark, 1000L, 1300L);
assertNotNull(interval);
assertEquals(ITmfStateValue.Type.INTEGER, interval.getStateValue().getType());
- assertEquals(INT_VAL, interval.getStateValue().unboxInt());
+ assertEquals(10, interval.getStateValue().unboxInt());
interval = StateSystemUtils.queryUntilNonNullValue(ss, quark, 800L, 2500L);
assertNotNull(interval);
assertEquals(ITmfStateValue.Type.INTEGER, interval.getStateValue().getType());
- assertEquals(INT_VAL, interval.getStateValue().unboxInt());
+ assertEquals(10, interval.getStateValue().unboxInt());
- interval = StateSystemUtils.queryUntilNonNullValue(ss, quark, 1500L, 2500L);
- assertNull(interval);
+ interval = StateSystemUtils.queryUntilNonNullValue(ss, quark, 1300L, 1800L);
+ assertNotNull(interval);
+ assertEquals(ITmfStateValue.Type.INTEGER, interval.getStateValue().getType());
+ assertEquals(10, interval.getStateValue().unboxInt());
+
+ interval = StateSystemUtils.queryUntilNonNullValue(ss, quark, 1500L, 1800L);
+ assertNotNull(interval);
+ assertEquals(ITmfStateValue.Type.INTEGER, interval.getStateValue().getType());
+ assertEquals(20, interval.getStateValue().unboxInt());
+
+ interval = StateSystemUtils.queryUntilNonNullValue(ss, quark, 1800L, 2500L);
+ assertNotNull(interval);
+ assertEquals(ITmfStateValue.Type.INTEGER, interval.getStateValue().getType());
+ assertEquals(20, interval.getStateValue().unboxInt());
} catch (AttributeNotFoundException e) {
fail(e.getMessage());